- Timestamp:
- Jan 16, 2006, 12:23:49 AM (19 years ago)
- Location:
- branches/avi_play/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/avi_play/src/world_entities/movie_entity.cc
r6507 r6508 35 35 this->setClassID(CL_MOVIE_ENTITY, "MovieEntity"); 36 36 37 media_container = new MediaContainer( "/home/david/Desktop/Crash.mpg");37 media_container = new MediaContainer(); 38 38 39 39 this->material = new Material; 40 40 this->material->setDiffuseMap("maps/radialTransparency.png"); 41 42 axis = 0; 43 rotation = 0; 44 height = 20; 45 width = 20; 41 46 42 47 this->toList(OM_COMMON); … … 61 66 { 62 67 static_cast<WorldEntity*>(this)->loadParams(root); 68 69 LoadParam(root, "name", this, MovieEntity, loadMovie); 70 LoadParam(root, "axis", this, MovieEntity, setAxis); 71 LoadParam(root, "rotation", this, MovieEntity, setRotation); 72 LoadParam(root, "size", this, MovieEntity, setSize); 63 73 } 64 74 65 75 void MovieEntity::loadMovie(const char* filename) 66 76 { 77 media_container->loadMedia(filename); 78 } 67 79 80 void MovieEntity::setAxis(float axis) 81 { 82 this->axis = axis; 83 } 84 85 // Seconds for one loop 86 void MovieEntity::setRotation(float rotation) 87 { 88 this->rotation = rotation; 89 } 90 91 void MovieEntity::setSize(float width, float height) 92 { 93 this->width = width; 94 this->height = height; 68 95 } 69 96 … … 88 115 } 89 116 } 117 118 if(rotation != 0) 119 axis = (int)(axis + (time * 360/rotation))%360; 90 120 } 91 121 … … 103 133 this->getAbsCoor ().y, 104 134 this->getAbsCoor ().z); 105 135 glRotatef(axis, 0.0f, 1.0f, 0.0f); 136 //PRINTF(0)("axis: %f\n", axis); 106 137 this->material->select(); 107 138 glBindTexture(GL_TEXTURE_2D, media_container->getFrameTexture(counter)); 108 139 109 140 glBegin(GL_QUADS); 110 // Front Face 111 glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom Left Of The Texture and Quad 112 glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, 1.0f); // Bottom Right Of The Texture and Quad 113 glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f); // Top Right Of The Texture and Quad 114 glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f); // Top Left Of The Texture and Quad 141 glTexCoord2f(1.0f, 1.0f); glVertex3f(-width/2, -height/2, 0.0f); 142 glTexCoord2f(0.0f, 1.0f); glVertex3f( width/2, -height/2, 0.0f); 143 glTexCoord2f(0.0f, 0.0f); glVertex3f( width/2, height/2, 0.0f); 144 glTexCoord2f(1.0f, 0.0f); glVertex3f(-width/2, height/2, 0.0f); 115 145 glEnd(); 116 146 -
branches/avi_play/src/world_entities/movie_entity.h
r6507 r6508 23 23 float fps; 24 24 25 float axis; 26 float rotation; 27 float height; 28 float width; 29 25 30 public: 26 31 MovieEntity (const TiXmlElement* root = NULL); … … 29 34 virtual void draw () const; 30 35 virtual void tick (float time); 36 31 37 void loadParams(const TiXmlElement* root); 38 32 39 void loadMovie(const char* filename); 40 void setAxis(float axis); 41 void setRotation(float rotation); 42 void setSize(float width, float height); 33 43 34 44 };
Note: See TracChangeset
for help on using the changeset viewer.