- Timestamp:
- Mar 21, 2005, 1:14:14 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/story_entities/world.cc
r3608 r3612 238 238 Vector* es = new Vector (10, 5, 0); 239 239 Quaternion* qs = new Quaternion (); 240 WorldEntity* pr = new Primitive(P SPHERE);240 WorldEntity* pr = new Primitive(P_CUBE); 241 241 pr->setName("primitive"); 242 242 this->spawn(pr, this->localPlayer, es, qs, PNODE_MOVEMENT); … … 290 290 Vector* es = new Vector (20, 0, 0); 291 291 Quaternion* qs = new Quaternion (); 292 WorldEntity* pr = new Primitive(P SPHERE);292 WorldEntity* pr = new Primitive(P_SPHERE); 293 293 pr->setName("primitive"); 294 294 this->spawn(pr, this->localPlayer, es, qs, PNODE_ROTATE_AND_MOVE); -
orxonox/trunk/src/world_entities/primitive.cc
r3608 r3612 31 31 \brief standard constructor 32 32 */ 33 Primitive::Primitive ( PRIMITIVE_FORMform) : WorldEntity()33 Primitive::Primitive (pForm form) : WorldEntity() 34 34 { 35 //this->model = new OBJModel("../data/models/fighter.obj"); 36 //this->model = new OBJModel(""); 35 this->form = form; 37 36 this->object = gluNewQuadric(); 38 37 38 gluQuadricNormals(this->object, GLU_SMOOTH); 39 39 gluQuadricTexture(this->object, GL_TRUE); 40 40 41 41 this->material = new Material("Sphere"); 42 42 //this->material->setDiffuseMap("../data/pictures/load_screen.jpg"); 43 43 this->material->setIllum(3); 44 44 this->material->setAmbient(1, .5, 1); 45 Vector* v = new Vector();46 47 45 } 48 46 … … 96 94 //glMultMatrixf((float*)matrix); 97 95 this->material->select(); 98 gluSphere(this->object, 1, 6, 6); 99 //gluCylinder(this->object, 1, 1, 2, 6, 6); 100 //gluDisk(this->object, 1, 2, 6, 6); 96 97 switch( this->form) 98 { 99 case P_SPHERE: 100 gluSphere(this->object, 1, 6, 6); 101 break; 102 case P_CUBE: 103 this->glDrawCube(); 104 break; 105 case P_CYLINDER: 106 gluCylinder(this->object, 1, 1, 2, 6, 6); 107 break; 108 case P_DISK: 109 gluDisk(this->object, 1, 2, 6, 6); 110 break; 111 default: 112 break; 113 } 101 114 102 115 glPopMatrix(); 103 116 } 104 117 118 119 void Primitive::glDrawCube() 120 { 121 glBegin(GL_QUADS); 122 glNormal3f( 0.0f, 0.0f, 1.0f); 123 glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); 124 glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); 125 glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); 126 glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); 127 128 glNormal3f( 0.0f, 0.0f,-1.0f); 129 glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); 130 glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); 131 glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); 132 glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f); 133 134 glNormal3f( 0.0f, 1.0f, 0.0f); 135 glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); 136 glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f); 137 glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f); 138 glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); 139 140 glNormal3f( 0.0f,-1.0f, 0.0f); 141 glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f); 142 glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f); 143 glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); 144 glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); 145 146 glNormal3f( 1.0f, 0.0f, 0.0f); 147 glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f); 148 glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f); 149 glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); 150 glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f); 151 152 glNormal3f(-1.0f, 0.0f, 0.0f); 153 glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f); 154 glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); 155 glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); 156 glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f); 157 glEnd(); 158 } -
orxonox/trunk/src/world_entities/primitive.h
r3608 r3612 5 5 #include "glincl.h" 6 6 7 typedef enum PRIMITIVE_FORM {PSPHERE = 0, PCUBE, PSQUARE};7 typedef enum pForm {P_SPHERE = 0, P_CUBE, P_CYLINDER, P_DISK}; 8 8 9 9 class Material; 10 11 10 12 11 class Primitive : public WorldEntity … … 15 14 16 15 public: 17 Primitive ( PRIMITIVE_FORMform);16 Primitive (pForm form); 18 17 virtual ~Primitive (); 19 18 … … 21 20 virtual void hit (WorldEntity* weapon, Vector* loc); 22 21 virtual void collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags); 22 23 23 virtual void draw (); 24 void glDrawCube(); 25 24 26 25 27 private: 26 28 GLUquadricObj *object; //!< the object to be rendered 27 29 Material *material; //!< A Material for the SkySphere. 30 pForm form; 28 31 29 32 };
Note: See TracChangeset
for help on using the changeset viewer.