Changeset 4338 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- May 27, 2005, 9:16:53 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 23 edited
- 27 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/Makefile.am
r4326 r4338 15 15 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/math 16 16 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/tinyxml 17 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/physics 18 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/physics/fields 17 19 AM_CXXFLAGS+=-I$(MAINSRCDIR)/defs 18 20 AM_CXXFLAGS+=-I$(MAINSRCDIR)/font … … 35 37 36 38 orxonox_DEPENDENCIES = lib/gui/gui/libORXgui.a \ 37 lib/tinyxml/libtinyxml.a 39 lib/physics/libORXphysics.a \ 40 lib/tinyxml/libtinyxml.a 41 38 42 orxonox_LDADD = lib/gui/gui/libORXgui.a \ 43 lib/physics/libORXphysics.a \ 39 44 lib/tinyxml/libtinyxml.a \ 40 45 $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS) 46 41 47 42 48 orxonox_SOURCES= orxonox.cc \ … … 55 61 util/loading/factory.cc \ 56 62 util/loading/load_param.cc \ 63 util/state.cc \ 57 64 story_entities/story_entity.cc \ 58 65 story_entities/campaign.cc \ … … 112 119 util/object_manager.h \ 113 120 util/garbage_collector.h \ 121 util/state.h \ 114 122 story_entities/story_entity.h \ 115 123 story_entities/story_def.h \ -
orxonox/trunk/src/Makefile.in
r4326 r4338 60 60 garbage_collector.$(OBJEXT) list.$(OBJEXT) \ 61 61 resource_manager.$(OBJEXT) factory.$(OBJEXT) \ 62 load_param.$(OBJEXT) st ory_entity.$(OBJEXT) campaign.$(OBJEXT) \63 world.$(OBJEXT) world_entity.$(OBJEXT) camera.$(OBJEXT) \64 player.$(OBJEXT) environment.$(OBJEXT) skysphere.$(OBJEXT) \65 sky box.$(OBJEXT) terrain.$(OBJEXT) weapon.$(OBJEXT) \66 projectile.$(OBJEXT) satellite.$(OBJEXT) \62 load_param.$(OBJEXT) state.$(OBJEXT) story_entity.$(OBJEXT) \ 63 campaign.$(OBJEXT) world.$(OBJEXT) world_entity.$(OBJEXT) \ 64 camera.$(OBJEXT) player.$(OBJEXT) environment.$(OBJEXT) \ 65 skysphere.$(OBJEXT) skybox.$(OBJEXT) terrain.$(OBJEXT) \ 66 weapon.$(OBJEXT) projectile.$(OBJEXT) satellite.$(OBJEXT) \ 67 67 character_attributes.$(OBJEXT) test_gun.$(OBJEXT) \ 68 68 test_bullet.$(OBJEXT) test_entity.$(OBJEXT) p_node.$(OBJEXT) \ … … 110 110 @AMDEP_TRUE@ ./$(DEPDIR)/resource_manager.Po \ 111 111 @AMDEP_TRUE@ ./$(DEPDIR)/satellite.Po ./$(DEPDIR)/skybox.Po \ 112 @AMDEP_TRUE@ ./$(DEPDIR)/skysphere.Po \112 @AMDEP_TRUE@ ./$(DEPDIR)/skysphere.Po ./$(DEPDIR)/state.Po \ 113 113 @AMDEP_TRUE@ ./$(DEPDIR)/story_entity.Po \ 114 114 @AMDEP_TRUE@ ./$(DEPDIR)/substring.Po ./$(DEPDIR)/terrain.Po \ … … 247 247 target_vendor = @target_vendor@ 248 248 MAINSRCDIR = . 249 AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/graphics/particles -I$(MAINSRCDIR)/lib/gui -I$(MAINSRCDIR)/lib/gui/gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/lib/tinyxml -I$(MAINSRCDIR)/ defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai -I$(MAINSRCDIR)/util -I$(MAINSRCDIR)/util/animation -I$(MAINSRCDIR)/util/common -I$(MAINSRCDIR)/util/loading -I$(MAINSRCDIR)/util/track -I$(MAINSRCDIR)/subprojects249 AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/graphics/particles -I$(MAINSRCDIR)/lib/gui -I$(MAINSRCDIR)/lib/gui/gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/lib/tinyxml -I$(MAINSRCDIR)/lib/physics -I$(MAINSRCDIR)/lib/physics/fields -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai -I$(MAINSRCDIR)/util -I$(MAINSRCDIR)/util/animation -I$(MAINSRCDIR)/util/common -I$(MAINSRCDIR)/util/loading -I$(MAINSRCDIR)/util/track -I$(MAINSRCDIR)/subprojects 250 250 orxonox_DEPENDENCIES = lib/gui/gui/libORXgui.a \ 251 lib/tinyxml/libtinyxml.a 251 lib/physics/libORXphysics.a \ 252 lib/tinyxml/libtinyxml.a 252 253 253 254 orxonox_LDADD = lib/gui/gui/libORXgui.a \ 255 lib/physics/libORXphysics.a \ 254 256 lib/tinyxml/libtinyxml.a \ 255 257 $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS) … … 270 272 util/loading/factory.cc \ 271 273 util/loading/load_param.cc \ 274 util/state.cc \ 272 275 story_entities/story_entity.cc \ 273 276 story_entities/campaign.cc \ … … 327 330 util/object_manager.h \ 328 331 util/garbage_collector.h \ 332 util/state.h \ 329 333 story_entities/story_entity.h \ 330 334 story_entities/story_def.h \ … … 509 513 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skybox.Po@am__quote@ 510 514 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skysphere.Po@am__quote@ 515 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/state.Po@am__quote@ 511 516 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/story_entity.Po@am__quote@ 512 517 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/substring.Po@am__quote@ … … 747 752 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 748 753 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o load_param.obj `if test -f 'util/loading/load_param.cc'; then $(CYGPATH_W) 'util/loading/load_param.cc'; else $(CYGPATH_W) '$(srcdir)/util/loading/load_param.cc'; fi` 754 755 state.o: util/state.cc 756 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT state.o -MD -MP -MF "$(DEPDIR)/state.Tpo" -c -o state.o `test -f 'util/state.cc' || echo '$(srcdir)/'`util/state.cc; \ 757 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/state.Tpo" "$(DEPDIR)/state.Po"; else rm -f "$(DEPDIR)/state.Tpo"; exit 1; fi 758 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/state.cc' object='state.o' libtool=no @AMDEPBACKSLASH@ 759 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/state.Po' tmpdepfile='$(DEPDIR)/state.TPo' @AMDEPBACKSLASH@ 760 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 761 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o state.o `test -f 'util/state.cc' || echo '$(srcdir)/'`util/state.cc 762 763 state.obj: util/state.cc 764 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT state.obj -MD -MP -MF "$(DEPDIR)/state.Tpo" -c -o state.obj `if test -f 'util/state.cc'; then $(CYGPATH_W) 'util/state.cc'; else $(CYGPATH_W) '$(srcdir)/util/state.cc'; fi`; \ 765 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/state.Tpo" "$(DEPDIR)/state.Po"; else rm -f "$(DEPDIR)/state.Tpo"; exit 1; fi 766 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='util/state.cc' object='state.obj' libtool=no @AMDEPBACKSLASH@ 767 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/state.Po' tmpdepfile='$(DEPDIR)/state.TPo' @AMDEPBACKSLASH@ 768 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 769 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o state.obj `if test -f 'util/state.cc'; then $(CYGPATH_W) 'util/state.cc'; else $(CYGPATH_W) '$(srcdir)/util/state.cc'; fi` 749 770 750 771 story_entity.o: story_entities/story_entity.cc -
orxonox/trunk/src/lib/Makefile.am
r4265 r4338 3 3 4 4 SUBDIRS = graphics \ 5 physics \ 5 6 tinyxml \ 6 7 $(GTK_PROGS) -
orxonox/trunk/src/lib/Makefile.in
r4276 r4338 168 168 GTK_PROGS = gui 169 169 SUBDIRS = graphics \ 170 physics \ 170 171 tinyxml \ 171 172 $(GTK_PROGS) -
orxonox/trunk/src/lib/coord/p_node.h
r4326 r4338 73 73 /** \returns the Velocity of the Node */ 74 74 inline const Vector& getVelocity() const {return this->velocity;} 75 /** \returns the last calculated coordinate */ 76 inline Vector getLastAbsCoor(void) {return this->lastAbsCoordinate;} 75 77 76 78 void addChild (PNode* pNode, int parentingMode = DEFAULT_MODE); -
orxonox/trunk/src/lib/graphics/light.h
r3603 r4338 11 11 #define _LIGHT_H 12 12 13 #include " world_entity.h"13 #include "p_node.h" 14 14 #include "glincl.h" 15 15 … … 21 21 22 22 //! A class that handles Lights. The LightManager operates on this. 23 class Light : public WorldEntity23 class Light : public PNode 24 24 { 25 25 public: -
orxonox/trunk/src/lib/graphics/particles/particle_emitter.cc
r4320 r4338 31 31 { 32 32 this->setClassID(CL_PARTICLE_EMITTER, "ParticleEmitter"); 33 34 this->type = EMITTER_DOT; 35 this->emitterSize = 1.0; 33 36 this->direction = direction; 34 37 this->setSpread(angle); 35 38 this->setEmissionRate(emissionRate); 36 this->set Velocity(velocity);39 this->setEmissionVelocity(velocity); 37 40 38 41 this->saveTime = 0.0; … … 50 53 { 51 54 ParticleEngine::getInstance()->removeEmitter(this); 52 53 55 } 54 56 … … 71 73 72 74 /** 75 \param type the new Type of this emitter 76 */ 77 void ParticleEmitter::setType(EMITTER_TYPE type) 78 { 79 this->type = type; 80 } 81 82 void ParticleEmitter::setSize(float emitterSize) 83 { 84 if (emitterSize > 0.0) 85 this->emitterSize = emitterSize; 86 else 87 emitterSize = 0.0; 88 } 89 90 /** 73 91 \brief set the emission rate 74 92 \param sets the number of particles emitted per second … … 79 97 void ParticleEmitter::setEmissionRate(float emissionRate) 80 98 { 81 this->emissionRate = emissionRate; 99 if (emissionRate > 0.0) 100 this->emissionRate = emissionRate; 101 else 102 this->emissionRate = 0.0; 82 103 } 83 104 … … 104 125 you may want to use the animation class 105 126 */ 106 void ParticleEmitter::set Velocity(float velocity, float randomVelocity)127 void ParticleEmitter::setEmissionVelocity(float velocity, float randomVelocity) 107 128 { 108 129 this->velocity = velocity; … … 139 160 140 161 // this should spread the Particles evenly. if the Emitter is moved around quickly 141 Vector equalSpread = this->getVelocity() * random()/RAND_MAX * dt; 162 Vector equalSpread = this->getVelocity() * rand()/RAND_MAX * dt; 163 Vector extension; // the Vector for different fields. 142 164 143 system->addParticle(this->getAbsCoor() - equalSpread, velocityV); 165 if (this->type & 2) 166 { 167 extension = Vector(this->emitterSize * ((float)rand()/RAND_MAX -.5), 0, this->emitterSize * ((float)rand()/RAND_MAX - .5)); 168 extension = this->getAbsDir().apply(extension); 169 } 170 else if (this->type & 8) 171 { 172 extension = Vector((float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5) * this->emitterSize; 173 } 174 175 system->addParticle(this->getAbsCoor() + extension - equalSpread, velocityV); 176 144 177 } 145 178 } -
orxonox/trunk/src/lib/graphics/particles/particle_emitter.h
r4176 r4338 13 13 class ParticleSystem; 14 14 15 typedef enum EMITTER_TYPE {EMITTER_DOT, 16 EMITTER_PLANE, 17 EMITTER_SPHERE, 18 EMITTER_CUBE}; 15 //! The form of the Emitter to emit from 16 typedef enum EMITTER_TYPE {EMITTER_DOT = 1, 17 EMITTER_PLANE = 2, 18 EMITTER_SPHERE= 4, 19 EMITTER_CUBE = 8}; 19 20 20 21 //! A default singleton class. … … 32 33 33 34 /* controlling the behavour: these can be used as Animation interfaces */ 35 void setType(EMITTER_TYPE type); 36 void setSize(float emitterSize); 34 37 void setEmissionRate(float emissionRate); 35 38 void setSpread(float angle, float randomAngle = 0.0); 36 void setVelocity(float velocity, float randomVelocity = 0.0); 39 void setEmissionVelocity(float velocity, float randomVelocity = 0.0); 40 41 /** \returns the type of the emitter */ 42 inline EMITTER_TYPE getType(void) const { return this->type; }; 43 /** \returns the Size of the emitter */ 44 inline float getSize(void) const { return this->emitterSize; }; 45 /** \returns the emissionRate */ 46 inline float getEmissionRate(void) const { return this->emissionRate; }; 47 /** \returns the SpreadAngle of the emitter */ 48 inline float getSpread(void) { return this->angle; }; 49 /** \returns the EmissionVelocity of the emitter */ 50 inline float getEmissionVelocity(void) { return this->velocity; }; 37 51 38 52 void debug(void); 39 53 40 54 private: 55 EMITTER_TYPE type; //!< The type of emitter this is 56 float emitterSize; //!< The size of the emitter (not for EMITTER_DOT) 41 57 Vector direction; //!< emition direction 42 58 float angle; //!< max angle from the direction of the emitter -
orxonox/trunk/src/lib/graphics/particles/particle_engine.cc
r4320 r4338 267 267 268 268 /** 269 \param systemName the name of the system to search for 270 \returns the system called by systemName or NULL if not found 271 */ 272 ParticleSystem* ParticleEngine::getSystemByName(const char* systemName) const 273 { 274 tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); 275 ParticleSystem* tmpSys = tmpIt->nextElement(); 276 while(tmpSys) 277 { 278 if (!strcmp(systemName, tmpSys->getName())) 279 { 280 delete tmpIt; 281 return tmpSys; 282 } 283 tmpSys = tmpIt->nextElement(); 284 } 285 delete tmpIt; 286 return NULL; 287 } 288 289 /** 290 \param number the n-th system to return 291 \returns the system called by number or NULL if not found 292 */ 293 ParticleSystem* ParticleEngine::getSystemByNumber(unsigned int number) const 294 { 295 int count = 0; 296 tIterator<ParticleSystem>* tmpIt = systemList->getIterator(); 297 ParticleSystem* tmpSys = tmpIt->nextElement(); 298 while(tmpSys) 299 { 300 count++; 301 if ( count == number) 302 { 303 delete tmpIt; 304 return tmpSys; 305 } 306 tmpSys = tmpIt->nextElement(); 307 } 308 delete tmpIt; 309 return NULL; 310 } 311 312 /** 313 \param emitterName the name of the emitter to search for 314 \returns the emitter called by emitterName or NULL if not found 315 */ 316 ParticleEmitter* ParticleEngine::getEmitterByName(const char* emitterName) const 317 { 318 tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator(); 319 ParticleEmitter* tmpEmit = tmpIt->nextElement(); 320 while(tmpEmit) 321 { 322 if (!strcmp(emitterName, tmpEmit->getName())) 323 { 324 delete tmpIt; 325 return tmpEmit; 326 } 327 tmpEmit = tmpIt->nextElement(); 328 } 329 delete tmpIt; 330 return NULL; 331 } 332 333 334 /** 335 \param number the n-th emitter to return 336 \returns the emitter called by number or NULL if not found 337 */ 338 ParticleEmitter* ParticleEngine::getEmitterByNumber(unsigned int number) const 339 { 340 int count = 0; 341 tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator(); 342 ParticleEmitter* tmpEmit = tmpIt->nextElement(); 343 while(tmpEmit) 344 { 345 count++; 346 if ( count == number) 347 { 348 delete tmpIt; 349 return tmpEmit; 350 } 351 tmpEmit = tmpIt->nextElement(); 352 } 353 delete tmpIt; 354 return NULL; 355 } 356 357 /** 269 358 \brief outputs some nice debug information 270 359 */ -
orxonox/trunk/src/lib/graphics/particles/particle_engine.h
r4176 r4338 13 13 // FORWARD DEFINITION 14 14 template<class T> class tList; 15 class ParticleSystem;16 class ParticleEmitter;17 15 18 16 struct ParticleConnection … … 41 39 bool breakConnection(ParticleConnection* connection); 42 40 41 ParticleSystem* getSystemByName(const char* systemName) const; 42 ParticleSystem* getSystemByNumber(unsigned int number) const; 43 ParticleEmitter* getEmitterByName(const char* emitterName) const; 44 ParticleEmitter* getEmitterByNumber(unsigned int number) const; 45 43 46 void debug(); 44 47 -
orxonox/trunk/src/lib/graphics/particles/particle_system.cc
r4320 r4338 20 20 #include "particle_emitter.h" 21 21 #include "particle_engine.h" 22 23 #include "field.h" 24 22 25 #include "compiler.h" 23 26 #include "material.h" 27 #include "state.h" 28 29 30 // needed to find the Position of the Camera 31 #include "world.h" 24 32 25 33 using namespace std; … … 34 42 ParticleSystem::ParticleSystem (unsigned int maxCount, PARTICLE_TYPE type) 35 43 { 36 this->setClassID(CL_PARTICLE_SYSTEM, "ParticleSystem"); 37 this->material = NULL; 38 this->name = NULL; 39 this->maxCount = maxCount; 40 this->count = 0; 41 this->particles = NULL; 42 this->deadList = NULL; 43 this->setConserve(1); 44 this->setLifeSpan(1); 45 this->setInheritSpeed(0); 46 this->glID = NULL; 47 this->setRadius(1.0, 1.0, 0.0); 48 this->setType(type, 1); 49 ParticleEngine::getInstance()->addSystem(this); 44 this->setClassID(CL_PARTICLE_SYSTEM, "ParticleSystem"); 45 this->material = NULL; 46 this->name = NULL; 47 this->maxCount = maxCount; 48 this->count = 0; 49 this->particles = NULL; 50 this->deadList = NULL; 51 this->setConserve(1); 52 this->setLifeSpan(1); 53 this->setInheritSpeed(0); 54 this->glID = NULL; 55 this->setRadius(1.0, 1.0, 0.0); 56 this->setType(type, 1); 57 this->setColor(1.0,1.0,1.0,1.0, .5,.5,.5,.5, .0,.0,.0,.0); 58 ParticleEngine::getInstance()->addSystem(this); 50 59 } 51 60 … … 106 115 this->particleType = particleType; 107 116 this->dialectCount = count; 108 if (glID != NULL) 109 delete glID; 110 111 glID = new GLuint[count]; 112 for (int i = 0; i< count; i++) 113 glID[i] = 0; 114 115 glID[0] = glGenLists(count); 116 117 material = new Material("transperencyMap"); 118 material->setDiffuseMap("pictures/radialTransparency.png"); 119 // material->setTransparency(.5); 120 121 glNewList(glID[0], GL_COMPILE); 122 glBegin(GL_TRIANGLE_STRIP); 123 glTexCoord2f(1, 1); 124 glVertex3f(0.0, .5, .5); 125 glTexCoord2f(1, 0); 126 glVertex3f(0.0, -.5, .5); 127 glTexCoord2f(0, 1); 128 glVertex3f(0.0, .5, -.5); 129 glTexCoord2f(0, 0); 130 glVertex3f(0.0, -.5, -.5); 131 glEnd(); 132 glEndList(); 117 // if (glID != NULL) 118 // delete glID; 119 120 // glID = new GLuint[count]; 121 // for (int i = 0; i< count; i++) 122 // glID[i] = 0; 123 124 // glID[0] = glGenLists(count); 125 if (this->material) 126 delete this->material; 127 this->material = NULL; 128 129 if (this->particleType == PARTICLE_SPRITE) 130 { 131 this->material = new Material("transperencyMap"); 132 this->material->setDiffuseMap("pictures/radialTransparency.png"); 133 // material->setTransparency(.5); 134 } 133 135 } 134 136 … … 192 194 } 193 195 196 197 /** 198 \brief Tells the ParticleSystem how it should iterate the color over time 199 \param .... 200 */ 201 void ParticleSystem::setColor(GLfloat br, GLfloat bg, GLfloat bb, GLfloat ba, 202 GLfloat mr, GLfloat mg, GLfloat mb, GLfloat ma, 203 GLfloat er, GLfloat eg, GLfloat eb, GLfloat ea) 204 { 205 this->startColor[0] = br; 206 this->startColor[1] = bg; 207 this->startColor[2] = bb; 208 this->startColor[3] = ba; 209 210 this->midColor[0] = mr; 211 this->midColor[1] = mg; 212 this->midColor[2] = mb; 213 this->midColor[3] = ma; 214 215 this->endColor[0] = er; 216 this->endColor[1] = eg; 217 this->endColor[2] = eb; 218 this->endColor[3] = ea; 219 } 220 194 221 /** 195 222 \brief ticks the system. … … 207 234 tickPart->radius += tickPart->radiusIt * dt; 208 235 236 // applying force to the System. 237 tickPart->velocity += tickPart->extForce * tickPart->mass; 238 tickPart->extForce = Vector(0,0,0); 239 240 // applying Color 241 //! \todo better algorithm to do this \todo also implement the midColor 242 if (tickPart->lifeCycle < .5) 243 { 244 tickPart->color[0] = this->startColor[0] *(1.0-tickPart->lifeCycle*2.0) + this->midColor[0] *(tickPart->lifeCycle*2); 245 tickPart->color[1] = this->startColor[1] *(1.0-tickPart->lifeCycle*2.0) + this->midColor[1] *(tickPart->lifeCycle*2); 246 tickPart->color[2] = this->startColor[2] *(1.0-tickPart->lifeCycle*2.0) + this->midColor[2] *(tickPart->lifeCycle*2); 247 tickPart->color[3] = this->startColor[3] *(1.0-tickPart->lifeCycle*2.0) + this->midColor[3] *(tickPart->lifeCycle*2); 248 } 249 else 250 { 251 tickPart->color[0] = this->midColor[0] *(2.0-tickPart->lifeCycle*2.0) + this->endColor[0] *(tickPart->lifeCycle*2); 252 tickPart->color[1] = this->midColor[1] *(2.0-tickPart->lifeCycle*2.0) + this->endColor[1] *(tickPart->lifeCycle*2); 253 tickPart->color[2] = this->midColor[2] *(2.0-tickPart->lifeCycle*2.0) + this->endColor[2] *(tickPart->lifeCycle*2); 254 tickPart->color[3] = this->midColor[3] *(2.0-tickPart->lifeCycle*2.0) + this->endColor[3] *(tickPart->lifeCycle*2); 255 } 209 256 // many more to come 210 211 257 212 258 if (this->conserve < 1.0) 213 259 tickPart->velocity = tickPart->velocity * this->conserve; 214 260 // find out if we have to delete tickPart 215 if ((tickPart-> timeToLive -= dt) <=0)261 if ((tickPart->lifeCycle += dt/tickPart->lifeTime) >= 1.0) 216 262 { 217 263 // remove the particle from the list … … 241 287 } 242 288 289 /** 290 \brief applies some force to a Particle. 291 */ 292 void ParticleSystem::applyField(float dt, Field* field) 293 { 294 Particle* tickPart = particles; 295 while (tickPart) 296 { 297 tickPart->extForce += field->calcForce(dt, tickPart->position); 298 tickPart = tickPart->next; 299 } 300 } 301 302 243 303 /** 244 304 \brief draws all the Particles of this System 245 305 \param the time passed in seconds (since the last draw) 306 307 The Cases in this Function all do the same: 308 Drawing all the particles with the appropriate Type. 309 This is just the fastest Way to do this, but will most likely be changed in the future. 246 310 */ 247 311 void ParticleSystem::draw(float dt) 248 312 { 249 313 glPushAttrib(GL_ENABLE_BIT); 250 // material->select(); 314 glDisable(GL_LIGHTING); 315 251 316 Particle* drawPart = particles; 252 317 253 318 switch (this->particleType) 254 319 { 320 default: 255 321 case PARTICLE_SPRITE: 256 322 glMatrixMode(GL_MODELVIEW); 257 // glDisable(GL_LIGHTING); 323 glDisable(GL_DEPTH_TEST); 324 258 325 material->select(); 259 glDisable(GL_DEPTH_TEST); 326 // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE); 327 328 260 329 while (likely(drawPart != NULL)) 261 330 { 262 glPushMatrix(); 263 glTranslatef(drawPart->position.x, drawPart->position.y, drawPart->position.z); 264 glScalef(drawPart->radius, drawPart->radius, drawPart->radius); 265 glCallList(*this->glID); 266 267 //glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z); 331 glColor4fv(drawPart->color); 332 //! \todo implement a faster code for the look-at Camera algorithm. 333 334 const PNode* camera = State::getInstance()->getCamera(); //!< \todo MUST be different 335 Vector cameraPos = camera->getAbsCoor(); 336 Vector cameraTargetPos = State::getInstance()->getCameraTarget()->getAbsCoor(); 337 Vector view = cameraTargetPos - cameraPos; 338 Vector up = Vector(0, 1, 0); 339 up = camera->getAbsDir().apply(up); 340 Vector h = up.cross(view); 341 Vector v = h.cross(view); 342 h.normalize(); 343 v.normalize(); 344 v *= .5 * drawPart->radius; 345 h *= .5 * drawPart->radius; 346 347 glBegin(GL_TRIANGLE_STRIP); 348 glTexCoord2i(1, 1); 349 glVertex3f(drawPart->position.x - h.x - v.x, 350 drawPart->position.y - h.y - v.y, 351 drawPart->position.z - h.z - v.z); 352 glTexCoord2i(0, 1); 353 glVertex3f(drawPart->position.x - h.x + v.x, 354 drawPart->position.y - h.y + v.y, 355 drawPart->position.z - h.z + v.z); 356 glTexCoord2i(1, 0); 357 glVertex3f(drawPart->position.x + h.x - v.x, 358 drawPart->position.y + h.y - v.y, 359 drawPart->position.z + h.z - v.z); 360 glTexCoord2i(0, 0); 361 glVertex3f(drawPart->position.x + h.x + v.x, 362 drawPart->position.y + h.y + v.y, 363 drawPart->position.z + h.z + v.z); 364 365 glEnd(); 366 268 367 drawPart = drawPart->next; 269 glPopMatrix(); 270 } 271 // glEnd(); 272 273 // glEnable(GL_LIGHTING); 274 275 glEnable(GL_DEPTH_TEST); 368 } 369 370 276 371 break; 277 default:278 372 279 373 case PARTICLE_SPARK: … … 282 376 while (likely(drawPart != NULL)) 283 377 { 378 glColor4fv(drawPart->color); 284 379 glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z); 285 380 glVertex3f(drawPart->position.x - drawPart->velocity.x, … … 295 390 while (likely(drawPart != NULL)) 296 391 { 392 glColor4fv(drawPart->color); 393 297 394 glLineWidth(drawPart->radius); 298 395 … … 349 446 } 350 447 351 particles->timeToLive = this->lifeSpan + (float)(rand()/RAND_MAX)* this->randomLifeSpan; 448 particles->lifeTime = this->lifeSpan + (float)(rand()/RAND_MAX)* this->randomLifeSpan; 449 particles->lifeCycle = 0.0; 352 450 particles->position = position; 353 451 particles->velocity = velocity; … … 357 455 particles->radius = this->startRadius + (rand()/RAND_MAX-.5)*this->randomStartRadius; 358 456 359 particles->radiusIt = (this->endRadius + (rand()/RAND_MAX-.5)*this->randomEndRadius - particles->radius) / particles-> timeToLive;457 particles->radiusIt = (this->endRadius + (rand()/RAND_MAX-.5)*this->randomEndRadius - particles->radius) / particles->lifeTime; 360 458 361 459 ++this->count; -
orxonox/trunk/src/lib/graphics/particles/particle_system.h
r4176 r4338 31 31 class Material; 32 32 class ParticleEmitter; 33 33 class Field; 34 34 35 35 //! A struct for one Particle 36 36 typedef struct Particle 37 37 { 38 float timeToLive; //!< The time this particle lives from NOW on. 38 float lifeTime; //!< The time this particle has to live. 39 float lifeCycle; //!< The fraction of time passed. (in percentage of its lifeTime) 40 39 41 Vector position; //!< The current position of this particle. 40 42 Vector velocity; //!< The current velocity of this particle. 43 Vector extForce; //!< The external Force that influences this Particle. 41 44 Quaternion rotation; //!< The current rotation of this particle. 42 45 float mass; //!< The mass of this particle. 43 46 float radius; //!< The current size of this particle. 44 47 float radiusIt; //!< The difference of the Size per second. 48 49 GLfloat color [4]; //!< A Color for the particles. 45 50 46 51 PARTICLE_TYPE type; … … 69 74 void setMass(float mass, float randomMass); 70 75 76 void setColor(GLfloat br, GLfloat bg, GLfloat bb, GLfloat ba, 77 GLfloat mr, GLfloat mg, GLfloat mb, GLfloat ma, 78 GLfloat er, GLfloat eg, GLfloat eb, GLfloat ea); 79 80 /** \returns the Type of the particles */ 81 inline PARTICLE_TYPE getType(void) const { return this->particleType; }; 82 /** \returns the Material that lies on this particles */ 83 inline const Material* getMaterial(void) const { return this->material; }; 84 /** \returns the inherit-speed-factor */ 85 inline float getInheritSpeed(void) const { return this->inheritSpeed; }; 86 /** \returns the lifespan of the particles */ 87 inline float getLifeSpan(void) const { return this->lifeSpan; }; 88 /** \returns the starting-radius of the particles */ 89 inline float getStartRadius(void) const { return this->startRadius; }; 90 /** \returns the end-radius of the particles */ 91 inline float getEndRadius(void) const { return this->endRadius; }; 92 /** \returns the conserve-factor of the particles */ 93 inline float getConserve(void) const { return this->conserve; }; 94 /** \returns the initial mass of the particles */ 95 inline float getMass(void) const { return this->initialMass; }; 96 97 void applyField(float dt, Field* field); 98 71 99 void tick(float dt); 72 100 void draw(float dt); … … 79 107 float conserve; //!< How much energy gets conserved to the next Tick. 80 108 float lifeSpan; //!< Initial lifetime of a Particle. 81 float randomLifeSpan; 82 float startRadius; 83 float endRadius; 84 float randomStartRadius; 85 float randomEndRadius; 86 float initialMass; 87 float randomInitialMass; 88 float inheritSpeed; 109 float randomLifeSpan; //!< A random value for the Lifespan (around the initial lifetime) 110 float startRadius; //!< The beginning Radius of the Particle 111 float endRadius; //!< The end Radius of the Particle 112 float randomStartRadius; //!< The Random start Radius (begin + rand*randomValue) 113 float randomEndRadius; //!< Random end value 114 float initialMass; //!< The initial Mass of the Particle 115 float randomInitialMass; //!< The random initial Mass of the Particle 116 float inheritSpeed; //!< How much speed the particle inherits from the Emitters speed \todo move this to the emitter 117 118 GLfloat startColor[4]; //!< Color of the Particle at the beginning 119 GLfloat midColor[4]; //!< Color of the Particle at the middle of its lifeSpan 120 GLfloat endColor[4]; //!< Color of the Particle at the end of its lifeSpan 89 121 90 122 // particles -
orxonox/trunk/src/lib/gui/gui/Makefile.am
r4266 r4338 25 25 noinst_LIBRARIES = libORXgui.a 26 26 27 libORXgui_a_CPPFLAGS=$(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS) 27 libORXgui_a_CPPFLAGS = -DBUILD_ORXONOX \ 28 $(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS) 28 29 29 30 libORXgui_a_SOURCES = gui.cc \ -
orxonox/trunk/src/lib/gui/gui/Makefile.in
r4276 r4338 200 200 AM_LDFLAGS = $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS) 201 201 noinst_LIBRARIES = libORXgui.a 202 libORXgui_a_CPPFLAGS = $(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS) 202 libORXgui_a_CPPFLAGS = -DBUILD_ORXONOX \ 203 $(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS) 204 203 205 libORXgui_a_SOURCES = gui.cc \ 204 206 gui_gtk.cc \ -
orxonox/trunk/src/lib/gui/gui/gui_gtk.cc
r4134 r4338 47 47 bool initGUI(int argc, char *argv[]) 48 48 { 49 executable = new char[strlen(argv[0])+1]; 50 strcpy(executable, argv[0]); 49 if (argv) 50 { 51 executable = new char[strlen(argv[0])+1]; 52 strcpy(executable, argv[0]); 53 } 54 else 55 executable = NULL; 51 56 52 57 #ifdef HAVE_GTK2 … … 1073 1078 #ifdef HAVE_GTK2 1074 1079 /** 1075 \brief Signal OptionChange writes the Value from the Sliderto its Object-Database.1076 \param widget The widget( Slider) that has a changed Value1077 \param slider the Slider-Object that should receive the change.1080 \brief Signal OptionChange writes the Value from the Option to its Object-Database. 1081 \param widget The widget(Option) that has a changed Value 1082 \param option the Option-Object that should receive the change. 1078 1083 */ 1079 1084 gint Option::OptionChange(GtkWidget *widget, Widget* option) 1080 1085 { 1081 1086 static_cast<Option*>(option)->changeOption(); 1082 flags->setTextFromFlags(Window::mainWindow); //// must be different !!! 1087 #ifdef BUILD_ORXONOX 1088 flags->setTextFromFlags(Window::mainWindow); 1089 #endif 1083 1090 } 1084 1091 #endif /* HAVE_GTK2 */ … … 1242 1249 \param end The maximal Value of the slider. 1243 1250 */ 1244 Slider::Slider(const char* slidername, int start, int end)1245 { 1246 this->optionType = GUI_ INT;1251 Slider::Slider(const char* slidername, float start, float end) 1252 { 1253 this->optionType = GUI_FLOAT; 1247 1254 1248 1255 this->start = start; … … 1268 1275 1269 1276 /** 1277 \brief sets the exactness of the widget 1278 \param exactness count of digits after the dot 1279 */ 1280 void Slider::setExactness(int exactness) 1281 { 1282 #ifdef HAVE_GTK2 1283 gtk_scale_set_digits(GTK_SCALE(this->widget), exactness); 1284 #endif /* HAVE_GTK2 */ 1285 } 1286 1287 /** 1270 1288 \brief Setting a new value to the Slider. 1271 1289 Maybe you also require a Slider::redraw() for this to display 1272 1290 */ 1273 void Slider::setValue( int value)1274 { 1275 this-> value = value;1291 void Slider::setValue(float value) 1292 { 1293 this->fValue = value; 1276 1294 } 1277 1295 … … 1283 1301 { 1284 1302 #ifdef HAVE_GTK2 1285 gtk_range_set_value(GTK_RANGE(this->widget), this-> value);1303 gtk_range_set_value(GTK_RANGE(this->widget), this->fValue); 1286 1304 #endif /* HAVE_GTK2 */ 1287 1305 } … … 1293 1311 { 1294 1312 #ifdef HAVE_GTK2 1295 this-> value =(int)gtk_range_get_value(GTK_RANGE(this->widget));1313 this->fValue = gtk_range_get_value(GTK_RANGE(this->widget)); 1296 1314 #else /* HAVE_GTK2 */ 1297 1315 char tmpChar[20]; … … 1299 1317 scanf("%s", tmpChar); 1300 1318 1301 if ((this->value = atoi(tmpChar))> this->end) 1302 this->value = this->end; 1303 if (this->value <= this->start) 1304 this->value = this->start; 1305 1306 PRINT(0)("%s set to: %d\n",this->title, this->value); 1307 #endif /* HAVE_GTK2 */ 1308 } 1319 if ((this->fValue = atof(tmpChar))> this->end) 1320 this->fValue = this->end; 1321 if (this->fValue <= this->start) 1322 this->fValue = this->start; 1323 1324 PRINT(0)("%s set to: %d\n",this->title, this->fValue); 1325 #endif /* HAVE_GTK2 */ 1326 } 1327 1328 char* Slider::save(void) 1329 { 1330 char* value = new char [30]; 1331 sprintf (value, "%f", this->fValue); 1332 return value; 1333 } 1334 void Slider::load(char* loadString) 1335 { 1336 this->fValue = atof(loadString); 1337 PRINT(5)("Loading %s: %s %f\n", this->title, loadString, fValue); 1338 this->redraw(); 1339 } 1340 1309 1341 1310 1342 ////////// … … 1387 1419 { 1388 1420 MenuItem* tmpItem = this->firstItem; 1389 for (int i = 0; i<this->value; i++) 1390 tmpItem = tmpItem->next; 1391 1392 return tmpItem->name; 1421 for (int i = 0; i < this->value; i++) 1422 if (tmpItem) 1423 tmpItem = tmpItem->next; 1424 else 1425 break; 1426 if (tmpItem) 1427 { 1428 char* tmpName = new char[strlen(tmpItem->name)+1]; 1429 strcpy(tmpName, tmpItem->name); 1430 return tmpName; 1431 } 1432 else 1433 return NULL; 1393 1434 } 1394 1435 … … 1471 1512 1472 1513 #endif /* HAVE_GTK2 */ 1473 PRINT( 5)("%s set to: %d\n", this->title, this->value);1514 PRINT(1)("%s set to: %d\n", this->title, this->value); 1474 1515 } 1475 1516 -
orxonox/trunk/src/lib/gui/gui/gui_gtk.h
r4132 r4338 61 61 62 62 virtual void setTitle(const char* title); //!< An abstract Function, that sets the title of Widgets. 63 virtual const char* getTitle(void) const { return this->title; }; 63 64 64 65 Widget* findWidgetByName(char* name, unsigned int depth); … … 296 297 { 297 298 private: 298 int start; //!< The beginning of the Slider-range. 299 int end; //!< The end of the Slider-range. 300 public: 301 Slider(const char* slidername, int start, int end); 299 float start; //!< The beginning of the Slider-range. 300 float end; //!< The end of the Slider-range. 301 float fValue; //!< a value for the slider 302 public: 303 Slider(const char* slidername, float start, float end); 302 304 virtual ~Slider(void); 303 305 304 void setValue(int value); 305 virtual void redraw(void); 306 virtual void changeOption(void); 306 void setExactness(int exactness); 307 void setValue(float value); 308 virtual void redraw(void); 309 virtual void changeOption(void); 310 311 virtual char* save(void); 312 virtual void load(char* loadString); 307 313 }; 308 314 -
orxonox/trunk/src/story_entities/world.cc
r4326 r4338 45 45 #include "particle_engine.h" 46 46 #include "graphics_engine.h" 47 #include "physics_engine.h" 47 48 48 49 #include "command_node.h" … … 279 280 280 281 AnimationPlayer::getInstance(); // initializes the animationPlayer 282 PhysicsEngine::getInstance(); 281 283 282 284 this->localCamera = new Camera(); … … 453 455 454 456 455 456 ParticleSystem* system = new ParticleSystem(1000, PARTICLE_SPRITE);457 system->setLifeSpan(.5);458 system->setConserve(.99);459 system->setRadius(2, 0, 2, 0);460 461 ParticleEmitter* emitter = new ParticleEmitter(Vector(-1, 0, 0), M_PI_4, 100, .05);462 emitter->setParent(this->localPlayer);463 464 particleEngine->addConnection(emitter, system);465 457 /* 458 ParticleSystem* system = new ParticleSystem(1000, PARTICLE_SPRITE); 459 system->setLifeSpan(.5); 460 system->setConserve(.99); 461 system->setRadius(2, 0, 2, 0); 462 463 ParticleEmitter* emitter = new ParticleEmitter(Vector(-1, 0, 0), M_PI_4, 100, .05); 464 emitter->setParent(this->localPlayer); 465 466 particleEngine->addConnection(emitter, system); 467 */ 466 468 WorldEntity* testEntity = new TestEntity(); 467 469 //testEntity->setRelCoor(Vector(570, 10, -15)); -
orxonox/trunk/src/story_entities/world.h
r4326 r4338 37 37 static WorldInterface* getInstance(); 38 38 void init(World* world); 39 inline World* getCurrentWorld(void) {return this->worldReference;} 39 40 tList<WorldEntity>* getEntityList(); 40 41 … … 93 94 void setPath( const char* name); 94 95 96 inline Camera* getLocalCamera(void) {return this->localCamera;} 97 95 98 private: 96 99 void constuctorInit(char* name, int worldID); -
orxonox/trunk/src/subprojects/Makefile.am
r4266 r4338 1 1 SUBDIRS = importer \ 2 particles \ 2 3 gui \ 3 4 testmain 5 6 noinst_HEADERS = framework.h 7 8 9 EXTRA_DIST = framework.cc 10 -
orxonox/trunk/src/subprojects/Makefile.in
r4276 r4338 14 14 15 15 @SET_MAKE@ 16 16 17 srcdir = @srcdir@ 17 18 top_srcdir = @top_srcdir@ … … 36 37 host_triplet = @host@ 37 38 subdir = src/subprojects 38 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 39 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ 40 $(srcdir)/Makefile.in 39 41 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 40 42 am__aclocal_m4_deps = $(top_srcdir)/configure.ac … … 52 54 pdf-recursive ps-recursive uninstall-info-recursive \ 53 55 uninstall-recursive 56 HEADERS = $(noinst_HEADERS) 54 57 ETAGS = etags 55 58 CTAGS = ctags … … 165 168 target_vendor = @target_vendor@ 166 169 SUBDIRS = importer \ 170 particles \ 167 171 gui \ 168 172 testmain 169 173 174 noinst_HEADERS = framework.h 175 EXTRA_DIST = framework.cc 170 176 all: all-recursive 171 177 … … 364 370 check-am: all-am 365 371 check: check-recursive 366 all-am: Makefile 372 all-am: Makefile $(HEADERS) 367 373 installdirs: installdirs-recursive 368 374 installdirs-am: -
orxonox/trunk/src/subprojects/importer/Makefile.am
r4272 r4338 48 48 $(MAINSRCDIR)/lib/coord/null_parent.cc 49 49 50 noinst_HEADERS = framework.h \51 windowHandler.h 50 noinst_HEADERS = framework.h 51 -
orxonox/trunk/src/subprojects/importer/Makefile.in
r4276 r4338 212 212 $(MAINSRCDIR)/lib/coord/null_parent.cc 213 213 214 noinst_HEADERS = framework.h \ 215 windowHandler.h 216 214 noinst_HEADERS = framework.h 217 215 all: all-am 218 216 -
orxonox/trunk/src/world_entities/camera.h
r3869 r4338 19 19 This class controls the viewpoint from which the World is rendered. 20 20 */ 21 class Camera : public PNode 21 class Camera : public PNode 22 22 { 23 23 private:
Note: See TracChangeset
for help on using the changeset viewer.