Changeset 10403 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Jan 27, 2007, 12:21:10 AM (18 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/blackscreen.cc
r10400 r10403 23 23 #include "material.h" 24 24 #include "state.h" 25 #include "camera.h" 26 #include "static_model.h" 25 27 26 28 ObjectListDefinition(BlackScreen); … … 71 73 this->material->setDiffuse(0,0,0); 72 74 this->material->setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 75 76 this->build(); 73 77 74 78 i=0; … … 106 110 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 107 111 108 this->material->setTransparency(i); 109 this->material->select(); 110 111 glBegin(GL_QUADS); 112 glVertex3f(0.,-100.0f,-100.0f); 113 glVertex3f(0., -100.0f,100.0f); 114 glVertex3f(0., 100.0f,100.0f); 115 glVertex3f(0., 100.0f,-100.0f); 116 117 glEnd(); 112 this->material->select(); 113 114 115 WorldEntity::draw(this->getModel( )); 116 117 // glBegin(GL_QUADS); 118 119 // glVertex3f(0.,-100.0f,-100.0f); 120 // glVertex3f(0., -100.0f,100.0f); 121 // glVertex3f(0., 100.0f,100.0f); 122 // glVertex3f(0., 100.0f,-100.0f); 123 124 // glEnd(); 118 125 119 126 glPopMatrix(); … … 130 137 else 131 138 fadeIn(); 139 140 this->material->setTransparency(i); 141 Camera* cam = State::getCamera(); 142 if( cam != NULL) 143 this->setParent(cam); 132 144 } 133 145 … … 176 188 return 0; 177 189 } 190 191 192 void BlackScreen::build() 193 { 194 StaticModel* model = new StaticModel(); 195 196 float size = 10.; 197 198 model->addVertex (-size, -size, size); 199 model->addVertex (size, -size, size); 200 model->addVertex (-size, size, size); 201 model->addVertex (size, size, size); 202 model->addVertex (-size, size, -size); 203 model->addVertex (size, size, -size); 204 model->addVertex (-size, -size, -size); 205 model->addVertex (size, -size, -size); 206 207 208 model->addVertexNormal (0.0, 0.0, 1.0); 209 model->addVertexNormal (0.0, 1.0, 0.0); 210 model->addVertexNormal (0.0, 0.0, -1.0); 211 model->addVertexNormal (0.0, -1.0, 0.0); 212 model->addVertexNormal (1.0, 0.0, 0.0); 213 model->addVertexNormal (-1.0, 0.0, 0.0); 214 215 model->addVertexTexture (0.0, 1.0); 216 model->addVertexTexture (1.0, 1.0); 217 model->addVertexTexture (1.0, 0.0); 218 model->addVertexTexture (0.0, 0.0); 219 220 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,4, 0,1,4, 2,2,4, 4,3,4); // back 221 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,5); // front 222 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,1, 7,1,1, 1,2,1, 0,3,1); // bottom 223 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,0,3, 3,1,3, 5,2,3, 4,3,3); // top 224 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,2,2, 5,3,2, 7,0,2, 6,1,2); // left 225 model->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,0, 1,1,0, 3,2,0, 2,3,0); // right 226 227 model->finalize(); 228 229 this->setModel(model); 230 } -
trunk/src/world_entities/blackscreen.h
r10379 r10403 36 36 virtual void draw() const; 37 37 38 private: 39 void build(); 40 38 41 }; 39 42 -
trunk/src/world_entities/camera.cc
r10396 r10403 258 258 Vector cameraPosition = this->getAbsCoor(); 259 259 Vector targetPosition = this->target->getAbsCoor(); 260 260 261 261 262 //Setting the Camera Eye, lookAt and up Vectors … … 497 498 if (fabs(translateTo.len() - (target->getAbsCoor()).len()) >= 11 ) 498 499 { 499 printf("translate\n");500 500 Vector tmpVec= iterate(dt, &translateTo, &(masta->getAbsCoor())); 501 501 target->shiftCoor(speed*tmpVec.x, speed*tmpVec.y, speed*tmpVec.z); -
trunk/src/world_entities/cameraman.cc
r10400 r10403 29 29 addMethod("changeCurrTarget", Executor2<CameraMan, lua_State*,const std::string&,const std::string&>(&CameraMan::changeCurrTarget)) 30 30 ->addMethod("changeTarget", Executor3<CameraMan, lua_State*, const std::string&, const std::string&,const std::string&>(&CameraMan::changeTarget)) 31 ->addMethod("setCam", Executor1<CameraMan, lua_State*, const std::string&>(&CameraMan::setCam)) 31 ->addMethod("setCam", Executor1<CameraMan, lua_State*, const std::string&>(&CameraMan::setCam)) 32 32 ->addMethod("togglFade", Executor0<CameraMan, lua_State*>(&CameraMan::togglFade)) 33 33 ->addMethod("getCurrCameraCoorX", Executor0ret<CameraMan, lua_State*,float>(&CameraMan::getCurrCameraCoorX)) … … 44 44 this->farClip = 1000.0; 45 45 46 currentCam=State::getCamera();47 this->cameras.push_back(currentCam);48 49 State::setCamera(currentCam, currentCam->getTarget());50 46 this->fadeToBlack=new BlackScreen(); 51 this->fadeToBlack->setParent(this->currentCam); 52 this-> fadeToBlack->setRelCoor(3., 0., 0.);53 47 48 this->setCam( State::getCamera()); 49 54 50 if (root != NULL) 55 51 this->loadParams(root); … … 60 56 { 61 57 BaseObject::loadParams(root); 62 58 63 59 LOAD_PARAM_START_CYCLE(root, object); 64 60 { … … 83 79 if (cameraNo<cameras.size()) 84 80 { 85 currentCam=cameras[cameraNo]; 81 this->setCam( cameras[cameraNo]); 82 } 83 } 84 85 void CameraMan::setCam(const std::string& camName) 86 { 87 BaseObject* object = ObjectListBase::getBaseObject("Camera", camName); 88 89 if(object != NULL) 90 { 91 Camera* currentCam = dynamic_cast<Camera*>(object) ; 92 93 this->setCam(currentCam); 94 return; 95 } 96 printf("ERROR CAMERAMANAGER: Couldn't set camera : %s \n", camName.c_str()); 97 } 98 99 100 void CameraMan::setCam(Camera* camera) 101 { 102 if( camera == NULL) 103 { 104 PRINTF(0)("trying to add a zero camera! uiuiui!\n"); 105 } 106 this->currentCam = camera; 107 86 108 State::setCamera(currentCam, currentCam->getTarget()); 87 109 OrxSound::SoundEngine::getInstance()->setListener(currentCam); 88 110 111 // check if it is already added 112 if( ! this->cameraIsInVector(currentCam) ) 113 this->cameras.push_back(currentCam); 114 115 this->fadeToBlack->setRelCoor(0., 0., 0.); 89 116 this->fadeToBlack->setParent(this->currentCam); 90 this->fadeToBlack->setRelCoor(3., 0., 0.); 91 } 92 93 } 94 95 void CameraMan::setCam(const std::string& camName) 96 { 97 BaseObject* object = ObjectListBase::getBaseObject("Camera", camName); 98 99 if(object != NULL) 100 { 101 102 currentCam = dynamic_cast<Camera*>(object) ; 103 104 if( ! this->cameraIsInVector(currentCam) ) 105 this->cameras.push_back(currentCam); 106 107 State::setCamera(currentCam, currentCam->getTarget()); 108 OrxSound::SoundEngine::getInstance()->setListener(currentCam); 109 this->fadeToBlack->setParent(this->currentCam); 110 this->fadeToBlack->setRelCoor(3., 0., 0.); 111 return; 112 } 113 printf("ERROR CAMERAMANAGER: Couldn't set camera : %s \n", camName.c_str()); 114 115 } 117 } 118 116 119 117 120 void CameraMan::moveCurrCam(int x, int y, int z) 118 121 { 119 currentCam->target->trans(x,y,z);122 currentCam->target->trans(x,y,z); 120 123 } 121 124 … … 123 126 void CameraMan::moveCam(int x, int y, int z, int camNo) 124 127 { 125 cameras[camNo]->target->trans(x,y,z);128 cameras[camNo]->target->trans(x,y,z); 126 129 } 127 130 -
trunk/src/world_entities/cameraman.h
r10394 r10403 22 22 void setCam(int CameraNo); 23 23 void setCam(const std::string& camName); 24 void setCam(Camera* camera); 25 24 26 void createCam(const TiXmlElement* root); 25 27 void moveCam(int x, int y, int z, int camNo); … … 34 36 void setClipRegion(float nearClip, float farClip); 35 37 void togglFade(); 36 38 37 39 /// LOADING 38 40 virtual void loadParams(const TiXmlElement* root); 39 41 40 42 /// POLLING 41 43 float getCurrCameraCoorX(){ return this->currentCam->getAbsCoorX(); } -
trunk/src/world_entities/sound_entity.cc
r10368 r10403 41 41 this->soundSource.setSourceNode(this); 42 42 43 this->bInit = false; 44 43 45 if( root != NULL) 44 46 this->loadParams(root); … … 75 77 { 76 78 this->soundBuffer = OrxSound::ResourceSoundBuffer(fileName); 79 this->bInit = true; 77 80 } 78 81 … … 80 83 void SoundEntity::activate() 81 84 { 85 this->soundSource.play(); 82 86 } 83 87 -
trunk/src/world_entities/sound_entity.h
r10368 r10403 37 37 private: 38 38 39 bool bInit; 39 40 OrxSound::SoundSource soundSource; 40 41 OrxSound::SoundBuffer soundBuffer;
Note: See TracChangeset
for help on using the changeset viewer.