Changeset 3614 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Mar 21, 2005, 2:25:10 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/story_entities/world.cc
r3612 r3614 238 238 Vector* es = new Vector (10, 5, 0); 239 239 Quaternion* qs = new Quaternion (); 240 WorldEntity* pr = new Primitive(P_C UBE);240 WorldEntity* pr = new Primitive(P_CYLINDER); 241 241 pr->setName("primitive"); 242 242 this->spawn(pr, this->localPlayer, es, qs, PNODE_MOVEMENT); -
orxonox/trunk/src/world_entities/primitive.cc
r3612 r3614 40 40 41 41 this->material = new Material("Sphere"); 42 //this->material->setDiffuseMap("../data/pictures/load_screen.jpg");43 42 this->material->setIllum(3); 44 43 this->material->setAmbient(1, .5, 1); … … 54 53 free(this->object); 55 54 } 55 56 57 /** 58 \brief sets the form of the primitive body 59 \param form (enumeration) from pForm 60 */ 61 void Primitive::setForm(pForm form) 62 { 63 this->form = form; 64 } 65 66 67 /** 68 \brief sets the size of the body 69 \param size from [0..1] 70 */ 71 void Primitive::setSize(float size) 72 { 73 if( size < 0 || size > 1) 74 { 75 PRINTF(1)("size must be value between 0 and 1 [0..1]. resetting it to 1\n"); 76 size = 1.0; 77 } 78 this->size = size; 79 } 80 81 82 /** 83 \brief stets the material 84 \param material to be set 85 */ 86 void Primitive::setMaterial(Material* material) 87 { 88 if( material == NULL) 89 { 90 PRINTF(1)("material reference is NULL, returning without modifications\n"); 91 return; 92 } 93 this->material = material; 94 } 95 96 97 /** 98 \brief sets the texture name 99 \param path to the texture 100 101 eg: name could have following value: "../data/pictures/load_screen.jpg" 102 */ 103 void Primitive::setTexture(char* name) 104 { 105 if( name == NULL ) 106 { 107 PRINTF(1)("texture char reference is NULL, returning without modifications\n"); 108 return; 109 } 110 this->textureName = name; 111 this->material->setDiffuseMap( name); 112 } 113 56 114 57 115 /** … … 98 156 { 99 157 case P_SPHERE: 100 gluSphere(this->object, 1, 6, 6);158 gluSphere(this->object, 0.2, 6, 6); 101 159 break; 102 160 case P_CUBE: -
orxonox/trunk/src/world_entities/primitive.h
r3612 r3614 17 17 virtual ~Primitive (); 18 18 19 void setForm(pForm form); 20 void setSize(float size); 21 void setMaterial(Material* material); 22 void setTexture(char* name); 23 24 19 25 virtual void tick (float time); 20 26 virtual void hit (WorldEntity* weapon, Vector* loc); 21 27 virtual void collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags); 28 virtual void draw (); 22 29 23 virtual void draw ();24 void glDrawCube();25 30 26 31 27 32 private: 28 GLUquadricObj *object; //!< the object to be rendered29 Material *material; //!< A Material for the SkySphere.33 GLUquadricObj* object; //!< the object to be rendered 34 Material* material; //!< A Material for the SkySphere. 30 35 pForm form; 36 char* textureName; 37 float size; 31 38 39 void glDrawCube(); 32 40 }; 33 41
Note: See TracChangeset
for help on using the changeset viewer.