/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: Patrick Boenzli co-programmer: ... */ #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY #include "planet.h" #include "util/loading/load_param.h" #include "util/loading/factory.h" #include "static_model.h" #include "material.h" #include "texture.h" #include "network_game_manager.h" #include "converter.h" #include "vertex_array_model.h" #include "primitive_model.h" #include "debug.h" #include "class_id_DEPRECATED.h" ObjectListDefinitionID(Planet, CL_PLANET); CREATE_FACTORY(Planet); /** * initializes a skybox from a XmlElement */ Planet::Planet(const TiXmlElement* root) { this->registerObject(this, Planet::_objectList); this->toList(OM_GROUP_01); //this->material->setIllum(20); //this->material->setAmbient(0.1, 0.1, 0.1); //st float radius, const unsigned int loops, const unsigned int segmentsPerLoop this->loadParams(root); // VertexArrayModel* model = new VertexArrayModel(); // model->spiralSphere(this->size, 10, 10); // this->setModel(model); // model->debug(); // PrimitiveModel* model = new PrimitiveModel(PRIM_SPHERE, this->size, 50); this->setModel(model); } /** * default destructor */ Planet::~Planet() { PRINTF(5)("Deleting Planet\n"); } void Planet::loadParams(const TiXmlElement* root) { WorldEntity::loadParams(root); LoadParam(root, "texture", this, Planet, setTexture) .describe("Sets the material on the Planet. The string must be the path relative to the data-dir, and without a trailing .jpg"); LoadParam(root, "size", this, Planet, setSize) .describe("Sets the Size of the Planet (normally this should be 90% of the maximal viewing Distance)."); } /** * Defines which textures should be loaded onto the Planet. * @param textureName the top texture. */ void Planet::setTexture(const std::string& textureName) { this->material.setDiffuseMap(textureName); } /** * @param size The new size of the Planet * do not forget to rebuild the Planet after this. */ void Planet::setSize(float size) { this->size = size; } void Planet::draw() const { this->material.select(); WorldEntity::draw(); }