Changeset 10391 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Jan 26, 2007, 7:12:37 PM (18 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/camera.cc
r10389 r10391 41 41 { 42 42 this->registerObject(this, Camera::_objectList); 43 43 44 this->init(); 44 45 } 45 46 46 /* 47 47 48 Camera::Camera(const TiXmlElement* root) 48 49 { 49 50 this->registerObject(this, Camera::_objectList); 51 52 if( root != NULL) 53 this->loadParams(root); 54 50 55 this->init(); 51 this->loadParams(root); 52 } 53 */ 56 57 } 58 54 59 55 60 /** … … 87 92 this->viewLeftDistance = 10; 88 93 89 //this->loadParams(doc.RootElement());90 91 94 this->setViewMode(Camera::ViewNormal); 92 95 93 96 this->setParentMode(PNODE_ALL); 94 97 this->eventHandling = true; 95 98 96 99 //add to track 97 100 if(this->entityTrack) … … 213 216 if (fabsf(tmpFovy) > 0.01) 214 217 this->fovy += tmpFovy * fabsf(dt); 215 218 216 219 if(this->entityTrack) 217 220 this->entityTrack->tick(dt); … … 302 305 { 303 306 // Do the PNode loading stuff 304 PNode::loadParams(root);307 WorldEntity::loadParams(root); 305 308 306 309 LoadParam(root, "viewTopFovy", this, Camera, setViewTopFovy); -
trunk/src/world_entities/planet.cc
r10387 r10391 45 45 this->toList(OM_GROUP_01); 46 46 47 this->rotSpeedPlanet = 0.0; 48 this->rotSpeedCloud = 0.0; 49 47 50 //this->materialPlanet->setIllum(20); 48 51 //this->materialPlanet->setAmbient(0.1, 0.1, 0.1); … … 54 57 this->setModel(model); 55 58 56 57 59 this->cloudModel = new PrimitiveModel(PRIM_SPHERE, this->size + 10, 50); 58 60 } 59 61 … … 77 79 LoadParam(root, "cloud-texture", this, Planet, setCloudTexture) 78 80 .describe("Sets the cloud texture of the planet"); 81 82 LoadParam(root, "cloud-rotation", this, Planet, setCloudRotation) 83 .describe("Sets the cloud rotation speed"); 79 84 80 85 LoadParam(root, "size", this, Planet, setSize) … … 103 108 104 109 110 void Planet::setCloudRotation(float rotationSpeed) 111 { 112 this->rotSpeedCloud = rotationSpeed; 113 } 114 105 115 /** 106 116 * @param size The new size of the Planet … … 114 124 115 125 126 void Planet::tick( float dt) 127 { 128 if( dt != 0.) 129 this->shiftDir( Quaternion( this->rotSpeedPlanet * dt, Vector(1,0,0))); 130 } 116 131 132 133 /** 134 * draws the planet 135 */ 117 136 void Planet::draw() const 118 137 { 138 // draw the clouds 119 139 this->materialPlanet.select(); 140 WorldEntity::draw(); 120 141 121 WorldEntity::draw(); 142 this->materialCloud.select(); 143 WorldEntity::draw(this->cloudModel); 144 122 145 } 123 146 -
trunk/src/world_entities/planet.h
r10387 r10391 29 29 void setTexture(const std::string& textureName); 30 30 void setCloudTexture(const std::string& textureName); 31 void setCloudRotation(float rotationSpeed); 31 32 32 33 33 34 35 virtual void tick( float dt); 34 36 virtual void draw() const; 35 37 … … 42 44 Model* cloudModel; //!< the model for the cloud 43 45 44 46 float rotSpeedCloud; //! cloud rotation speed 47 float rotSpeedPlanet; //! planet rotation speed 45 48 float size; //!< Size of the Planet. This should match the frustum maximum range. 46 49 float textureSize; //!< this is the length of a texture (assumes a square texture) -
trunk/src/world_entities/world_entity.cc
r10368 r10391 68 68 */ 69 69 WorldEntity::WorldEntity() 70 : Synchronizeable(), _collisionFilter(this)70 : Synchronizeable(), _collisionFilter(this) 71 71 { 72 72 this->registerObject(this, WorldEntity::_objectList); … … 171 171 // Track 172 172 LoadParamXML(root, "Track", this, WorldEntity, addTrack) 173 173 .describe("creates and adds a track to this WorldEntity"); 174 174 } 175 175 … … 191 191 } 192 192 LOAD_PARAM_END_CYCLE(element);*/ 193 193 194 194 195 195 } … … 252 252 this->setModel(model, modelNumber); 253 253 254 254 if( modelNumber == 0) 255 255 { 256 256 this->buildObbTree(obbTreeDepth); 257 257 } 258 258 } … … 275 275 { 276 276 PRINTF(4)("fetching MD3 file: %s\n", fileName.c_str()); 277 // Model* m = new md3::MD3Model(fileName, this->scaling);278 // this->setModel(m, 0);277 // Model* m = new md3::MD3Model(fileName, this->scaling); 278 // this->setModel(m, 0); 279 279 280 280 // if( m != NULL) … … 448 448 void WorldEntity::unmount(int slot) 449 449 { 450 450 if( this->mountPoints[slot] == NULL) 451 451 { 452 452 PRINTF(0)("you tried to remove an entity from a mount point that doesn't exist (slot %i)\n", slot); … … 649 649 */ 650 650 void WorldEntity::tick(float time) 651 { 652 } 651 {} 653 652 654 653 … … 689 688 this->models[0]->draw(); 690 689 } 691 690 692 691 //if (this->entityTrack) 693 692 //this->entityTrack->drawGraph(0.02); 694 693 695 694 // if( this->aabbNode != NULL) … … 699 698 } 700 699 } 700 701 702 /** 703 * the entity is drawn onto the screen with this function 704 * 705 * This is a central function of an entity: call it to let the entity painted to the screen. 706 * Just override this function with whatever you want to be drawn. 707 */ 708 void WorldEntity::draw(const Model* model) const 709 { 710 glMatrixMode(GL_MODELVIEW); 711 glPushMatrix(); 712 713 /* translate */ 714 glTranslatef (this->getAbsCoor ().x, 715 this->getAbsCoor ().y, 716 this->getAbsCoor ().z); 717 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 718 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 719 720 721 // This Draws the LOD's 722 if( model != NULL) 723 model->draw(); 724 725 glPopMatrix(); 726 } 727 701 728 702 729 /** -
trunk/src/world_entities/world_entity.h
r10368 r10391 75 75 virtual void tick (float time); 76 76 virtual void draw () const; 77 void draw(const Model* model) const; 77 78 void debugDrawMountPoints() const; 78 79
Note: See TracChangeset
for help on using the changeset viewer.