Changeset 9686 in orxonox.OLD for branches/new_class_id/src/lib/graphics
- Timestamp:
- Aug 22, 2006, 2:36:54 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib/graphics/effects
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/effects/cloud_effect.cc
r9406 r9686 29 29 #include "script_class.h" 30 30 31 #include " parser/tinyxml/tinyxml.h"31 #include "class_id.h" 32 32 33 33 Vector CloudEffect::cloudColor; … … 48 48 49 49 50 CREATE_SCRIPTABLE_CLASS(CloudEffect, C L_CLOUD_EFFECT,50 CREATE_SCRIPTABLE_CLASS(CloudEffect, CloudEffect::classID(), 51 51 addMethod("skyColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellSkyColor)) 52 52 ->addMethod("cloudColor", ExecutorLua4<CloudEffect,float,float,float,float>(&CloudEffect::shellCloudColor)) … … 57 57 58 58 CREATE_FACTORY(CloudEffect, CL_CLOUD_EFFECT); 59 NewObjectListDefinitionID(CloudEffect, CL_CLOUD_EFFECT); 59 60 60 61 CloudEffect::CloudEffect(const TiXmlElement* root) { 61 this->setClassID(CL_CLOUD_EFFECT, "CloudEffect");62 this->registerObject(this, CloudEffect::_objectList); 62 63 63 64 this->init(); -
branches/new_class_id/src/lib/graphics/effects/cloud_effect.h
r9112 r9686 37 37 38 38 class CloudEffect : public WeatherEffect { 39 NewObjectListDeclaration(CloudEffect); 39 40 40 41 public: -
branches/new_class_id/src/lib/graphics/effects/fog_effect.cc
r9406 r9686 28 28 SHELL_COMMAND(fadeout, FogEffect, fadeOutFog); 29 29 30 31 32 CREATE_SCRIPTABLE_CLASS(FogEffect, CL_FOG_EFFECT,30 #include "class_id.h" 31 32 CREATE_SCRIPTABLE_CLASS(FogEffect, FogEffect::classID(), 33 33 addMethod("fadeIn", ExecutorLua0<FogEffect>(&FogEffect::fadeInFog)) 34 34 ->addMethod("fadeOut", ExecutorLua0<FogEffect>(&FogEffect::fadeOutFog)) … … 38 38 39 39 CREATE_FACTORY(FogEffect, CL_FOG_EFFECT); 40 NewObjectListDefinition(FogEffect); 40 41 41 42 /** … … 43 44 */ 44 45 FogEffect::FogEffect(const TiXmlElement* root) { 45 this->setClassID(CL_FOG_EFFECT, "FogEffect"); 46 46 this->registerObject(this, FogEffect::_objectList); 47 47 // Initialize values 48 48 this->init(); … … 85 85 this->fogFadeInActivate = false; 86 86 this->fogFadeOutActivate = false; 87 87 88 88 this->cloudColor = Vector(0.2f, 0.3f, 0.3f); 89 89 this->skyColor = Vector(0.2f, 0.3f, 0.3f); … … 105 105 LoadParam(root, "cloudcolor", this, FogEffect, setCloudColor); 106 106 LoadParam(root, "skycolor", this, FogEffect, setSkyColor); 107 107 108 108 LOAD_PARAM_START_CYCLE(root, element); 109 109 { … … 131 131 132 132 glEnable(GL_FOG); 133 133 134 134 // Store cloud- and sky color before the snow 135 135 this->oldCloudColor = CloudEffect::cloudColor; 136 136 this->oldSkyColor = CloudEffect::skyColor; 137 137 138 138 // Change the colors 139 139 CloudEffect::changeCloudColor(this->cloudColor, this->fogFadeInDuration); … … 241 241 this->fogFadeInActivate = false; 242 242 243 243 244 244 // If Fog is off, turn it on first 245 245 if (!this->fogActivate) -
branches/new_class_id/src/lib/graphics/effects/fog_effect.h
r9235 r9686 15 15 class FogEffect : public WeatherEffect 16 16 { 17 NewObjectListDeclaration(FogEffect); 17 18 public: 18 19 FogEffect(const TiXmlElement* root = NULL); … … 75 76 this->fogActivate = true; 76 77 } 77 78 78 79 inline void setCloudColor(float colorX, float colorY, float colorZ) 79 80 { … … 119 120 120 121 Vector colorVector; 121 float localTimer; 122 122 float localTimer; 123 123 124 Vector oldSkyColor; 124 125 Vector oldCloudColor; -
branches/new_class_id/src/lib/graphics/effects/lense_flare.cc
r9406 r9686 33 33 #include "camera.h" 34 34 35 36 37 35 #include "class_id.h" 38 36 39 37 CREATE_FACTORY(LenseFlare, CL_LENSE_FLARE); 40 38 NewObjectListDefinitionID(LenseFlare, CL_LENSE_FLARE); 41 39 42 40 /** … … 45 43 */ 46 44 LenseFlare::LenseFlare(const TiXmlElement* root) { 47 this->setClassID(CL_LENSE_FLARE, "LenseFlare");45 this->registerObject(this, LenseFlare::_objectList); 48 46 49 47 /* length image scale */ -
branches/new_class_id/src/lib/graphics/effects/lense_flare.h
r8619 r9686 26 26 class LenseFlare : public GraphicsEffect 27 27 { 28 NewObjectListDeclaration(LenseFlare); 28 29 public: 29 30 LenseFlare(const TiXmlElement* root = NULL); -
branches/new_class_id/src/lib/graphics/effects/lightning_effect.cc
r9406 r9686 23 23 #include "effects/billboard.h" 24 24 25 #include "glincl.h"26 #include "parser/tinyxml/tinyxml.h"27 28 25 #include "shell_command.h" 29 26 #include "light.h" 30 27 #include "cloud_effect.h" 31 28 #include "script_class.h" 29 #include "class_id.h" 32 30 33 31 SHELL_COMMAND(activate, LightningEffect, activateLightning); 34 32 SHELL_COMMAND(deactivate, LightningEffect, deactivateLightning); 35 33 36 37 38 CREATE_SCRIPTABLE_CLASS(LightningEffect, CL_LIGHTNING_EFFECT, 34 CREATE_SCRIPTABLE_CLASS(LightningEffect, LightningEffect::classID(), 39 35 addMethod("activate", ExecutorLua0<LightningEffect>(&LightningEffect::activate)) 40 36 ->addMethod("deactivate", ExecutorLua0<LightningEffect>(&LightningEffect::deactivate)) … … 42 38 43 39 CREATE_FACTORY(LightningEffect, CL_LIGHTNING_EFFECT); 40 NewObjectListDefinitionID(LightningEffect, CL_LIGHTNING_EFFECT); 44 41 45 42 LightningEffect::LightningEffect(const TiXmlElement* root) { 46 this->setClassID(CL_LIGHTNING_EFFECT, "LightningEffect"); 47 43 this->registerObject(this, LightningEffect::_objectList); 48 44 this->init(); 49 45 -
branches/new_class_id/src/lib/graphics/effects/lightning_effect.h
r9006 r9686 17 17 class Light; 18 18 19 class LightningEffect : public WeatherEffect { 19 class LightningEffect : public WeatherEffect 20 { 21 NewObjectListDeclaration(LightningEffect); 20 22 public: 21 22 23 LightningEffect(const TiXmlElement* root = NULL); 24 virtual ~LightningEffect(); 23 25 24 26 virtual void loadParams(const TiXmlElement* root); 25 27 26 28 virtual void init(); 27 29 28 29 30 virtual void activate(); 31 virtual void deactivate(); 30 32 31 inline void activateLightning() { 32 this->activate(); 33 } 34 inline void deactivateLightning() { 35 this->deactivate(); 36 } 33 inline void activateLightning() 34 { 35 this->activate(); 36 } 37 inline void deactivateLightning() 38 { 39 this->deactivate(); 40 } 37 41 38 42 virtual void tick(float dt); 39 43 40 41 44 void coord(float x, float y, float z); 45 void setFlashSize(float width, float height, float seedWidth, float seedHeight); 42 46 43 inline void setLightningOption(const std::string& option) { 44 if (option == "activate") 45 this->lightningActivate = true; 46 if (option == "movelightning") 47 this->lightningMove = true; 48 } 47 inline void setLightningOption(const std::string& option) 48 { 49 if (option == "activate") 50 this->lightningActivate = true; 51 if (option == "movelightning") 52 this->lightningMove = true; 53 } 49 54 50 inline void setFlashFrequency(float baseFrequency, float seedTime) { 51 this->flashFrequencyBase = baseFrequency; 52 this->flashFrequency = baseFrequency; 53 this->flashFrequencySeed = seedTime; 54 } 55 inline void setFlashFrequency(float baseFrequency, float seedTime) 56 { 57 this->flashFrequencyBase = baseFrequency; 58 this->flashFrequency = baseFrequency; 59 this->flashFrequencySeed = seedTime; 60 } 55 61 56 inline void setFlashConstTime(float holdTime) { 57 this->flashHoldTime = holdTime; 58 } 62 inline void setFlashConstTime(float holdTime) 63 { 64 this->flashHoldTime = holdTime; 65 } 59 66 60 inline void setFlashRisingTime(float flashRisingTime) { 61 if(flashRisingTime > this->flashHoldTime) 62 this->flashRisingTime = this->flashHoldTime * 0.5; 63 else 64 this->flashRisingTime = flashRisingTime; 65 } 67 inline void setFlashRisingTime(float flashRisingTime) 68 { 69 if(flashRisingTime > this->flashHoldTime) 70 this->flashRisingTime = this->flashHoldTime * 0.5; 71 else 72 this->flashRisingTime = flashRisingTime; 73 } 66 74 67 inline void setFlashSeed(float seedX, float seedZ) { 68 this->seedX = seedX; 69 this->seedZ = seedZ; 70 } 75 inline void setFlashSeed(float seedX, float seedZ) 76 { 77 this->seedX = seedX; 78 this->seedZ = seedZ; 79 } 71 80 72 81 73 82 private: 74 83 75 76 77 84 void newCoordinates(); 85 void setTexture(); 86 void switchTexture(); 78 87 79 80 88 Billboard* thunderBolt[4]; 89 bool thunderTextureA; 81 90 82 83 91 bool lightningActivate; 92 bool lightningMove; 84 93 85 86 87 88 94 float flashFrequency; 95 float flashFrequencyBase; 96 float flashHoldTime; 97 float flashRisingTime; 89 98 90 99 float time; 91 100 92 93 94 95 101 float width; 102 float height; 103 float seedWidth; 104 float seedHeight; 96 105 97 98 99 106 float seedX; 107 float seedZ; 108 float flashFrequencySeed; 100 109 101 102 103 110 float mainPosX; 111 float mainPosY; 112 float mainPosZ; 104 113 105 106 114 Vector origSkyColor; 115 Vector cameraCoor; 107 116 108 117 Light* flashLight; 109 118 110 111 119 OrxSound::SoundSource soundSource; 120 OrxSound::SoundBuffer* thunderBuffer; 112 121 113 122 }; -
branches/new_class_id/src/lib/graphics/effects/rain_effect.cc
r9406 r9686 31 31 #include "script_class.h" 32 32 33 #include " parser/tinyxml/tinyxml.h"33 #include "class_id.h" 34 34 35 35 // Define shell commands … … 41 41 42 42 43 CREATE_SCRIPTABLE_CLASS(RainEffect, CL_RAIN_EFFECT,43 CREATE_SCRIPTABLE_CLASS(RainEffect, RainEffect::classID(), 44 44 addMethod("startRaining", ExecutorLua0<RainEffect>(&RainEffect::startRaining)) 45 45 ->addMethod("stopRaining", ExecutorLua0<RainEffect>(&RainEffect::stopRaining)) … … 49 49 50 50 CREATE_FACTORY(RainEffect, CL_RAIN_EFFECT); 51 NewObjectListDefinitionID(RainEffect, CL_RAIN_EFFECT); 51 52 52 53 /** … … 54 55 */ 55 56 RainEffect::RainEffect(const TiXmlElement* root) { 56 this->setClassID(CL_RAIN_EFFECT, "RainEffect"); 57 57 this->registerObject(this, RainEffect::_objectList); 58 58 this->init(); 59 59 -
branches/new_class_id/src/lib/graphics/effects/rain_effect.h
r9235 r9686 25 25 class RainEffect : public WeatherEffect 26 26 { 27 NewObjectListDeclaration(RainEffect); 27 28 public: 28 29 RainEffect(const TiXmlElement* root = NULL); … … 136 137 Vector skyColor; 137 138 Vector cloudColor; 138 139 139 140 LightManager* lightMan; 140 141 -
branches/new_class_id/src/lib/graphics/effects/snow_effect.cc
r9406 r9686 30 30 #include "cloud_effect.h" 31 31 32 #include " parser/tinyxml/tinyxml.h"32 #include "class_id.h" 33 33 34 34 SHELL_COMMAND(activate, SnowEffect, activateSnow); … … 36 36 37 37 38 CREATE_SCRIPTABLE_CLASS(SnowEffect, CL_SNOW_EFFECT,38 CREATE_SCRIPTABLE_CLASS(SnowEffect, SnowEffect::classID(), 39 39 addMethod("activate", ExecutorLua0<SnowEffect>(&SnowEffect::activate)) 40 40 ->addMethod("deactivate", ExecutorLua0<SnowEffect>(&SnowEffect::deactivate)) … … 42 42 43 43 CREATE_FACTORY(SnowEffect, CL_SNOW_EFFECT); 44 NewObjectListDefinitionID(SnowEffect, CL_SNOW_EFFECT); 44 45 45 46 SnowEffect::SnowEffect(const TiXmlElement* root) 46 47 { 47 this->setClassID(CL_SNOW_EFFECT, "SnowEffect");48 this->registerObject(this, SnowEffect::_objectList); 48 49 49 50 this->init(); -
branches/new_class_id/src/lib/graphics/effects/snow_effect.h
r9406 r9686 21 21 #include "sound_buffer.h" 22 22 23 class SnowEffect : public WeatherEffect { 23 class SnowEffect : public WeatherEffect 24 { 25 NewObjectListDeclaration(SnowEffect); 24 26 public: 25 26 27 SnowEffect(const TiXmlElement* root = NULL); 28 virtual ~SnowEffect(); 27 29 28 30 virtual void loadParams(const TiXmlElement* root); 29 31 30 32 virtual void init(); 31 33 32 33 34 virtual void activate(); 35 virtual void deactivate(); 34 36 35 inline void activateSnow() { 36 this->activate(); 37 } 38 inline void deactivateSnow() { 39 this->deactivate(); 40 } 37 inline void activateSnow() 38 { 39 this->activate(); 40 } 41 inline void deactivateSnow() 42 { 43 this->deactivate(); 44 } 41 45 42 43 46 virtual void draw() const; 47 virtual void tick(float dt); 44 48 45 49 46 inline void numParticles(int n) { 47 this->particles = n; 48 } 49 inline void materialTexture(const std::string& texture) { 50 this->texture = texture; 51 } 52 inline void lifeSpan(float lifeSpan, float randomLifeSpan) { 53 this->snowLife = lifeSpan; 54 this->randomLife = randomLifeSpan; 55 } 56 inline void radius(float radius, float randomRadius) { 57 this->snowRadius = radius; 58 this->randomRadius = randomRadius; 59 } 60 inline void mass(float mass, float randomMass) { 61 this->snowMass = mass; 62 this->randomMass = randomMass; 63 } 64 inline void emissionRate(float emissionRate) { 65 this->rate = emissionRate; 66 } 67 inline void emissionVelocity(float velocity, float randomVelocity) { 68 this->velocity = velocity; 69 this->randomVelocity = randomVelocity; 70 } 71 inline void size(float sizeX, float sizeY) { 72 this->snowSize = Vector2D(sizeX, sizeY); 73 } 74 inline void coord(float x, float y, float z) { 75 this->snowCoord = Vector(x, y, z); 76 } 77 inline void wind(int force) { 78 this->snowWindForce = force; 79 } 80 inline void setCloudColor(float colorX, float colorY, float colorZ) 81 { 82 this->cloudColor = Vector(colorX, colorY, colorZ); 83 } 84 inline void setSkyColor(float colorX, float colorY, float colorZ) 85 { 86 this->skyColor = Vector(colorX, colorY, colorZ); 87 } 88 inline void setFadeTime(float time) 89 { 90 this->fadeTime = time; 91 } 50 inline void numParticles(int n) 51 { 52 this->particles = n; 53 } 54 inline void materialTexture(const std::string& texture) 55 { 56 this->texture = texture; 57 } 58 inline void lifeSpan(float lifeSpan, float randomLifeSpan) 59 { 60 this->snowLife = lifeSpan; 61 this->randomLife = randomLifeSpan; 62 } 63 inline void radius(float radius, float randomRadius) 64 { 65 this->snowRadius = radius; 66 this->randomRadius = randomRadius; 67 } 68 inline void mass(float mass, float randomMass) 69 { 70 this->snowMass = mass; 71 this->randomMass = randomMass; 72 } 73 inline void emissionRate(float emissionRate) 74 { 75 this->rate = emissionRate; 76 } 77 inline void emissionVelocity(float velocity, float randomVelocity) 78 { 79 this->velocity = velocity; 80 this->randomVelocity = randomVelocity; 81 } 82 inline void size(float sizeX, float sizeY) 83 { 84 this->snowSize = Vector2D(sizeX, sizeY); 85 } 86 inline void coord(float x, float y, float z) 87 { 88 this->snowCoord = Vector(x, y, z); 89 } 90 inline void wind(int force) 91 { 92 this->snowWindForce = force; 93 } 94 inline void setCloudColor(float colorX, float colorY, float colorZ) 95 { 96 this->cloudColor = Vector(colorX, colorY, colorZ); 97 } 98 inline void setSkyColor(float colorX, float colorY, float colorZ) 99 { 100 this->skyColor = Vector(colorX, colorY, colorZ); 101 } 102 inline void setFadeTime(float time) 103 { 104 this->fadeTime = time; 105 } 92 106 93 inline void setSnowOption(const std::string& option) { 94 /*if (option == "fade") this->snowFade = true;*/ 95 if (option == "movesnow") 96 this->snowMove = true; 97 if (option == "activate") 98 this->snowActivate = true; 99 } 107 inline void setSnowOption(const std::string& option) 108 { 109 /*if (option == "fade") this->snowFade = true;*/ 110 if (option == "movesnow") 111 this->snowMove = true; 112 if (option == "activate") 113 this->snowActivate = true; 114 } 100 115 101 116 102 117 private: 103 104 105 106 107 108 109 110 111 112 113 114 115 118 int particles; 119 std::string texture; 120 float snowLife, randomLife; 121 float snowRadius, randomRadius; 122 float snowMass, randomMass; 123 float rate; 124 float velocity, randomVelocity; 125 float angle, randomAngle; 126 float alpha; 127 float fadeTime; 128 Vector snowCoord; 129 Vector2D snowSize; 130 int snowWindForce; 116 131 117 118 132 bool snowMove; 133 bool snowActivate; 119 134 120 135 PlaneEmitter* emitter; 121 136 122 123 124 137 static SpriteParticles* snowParticles; 138 OrxSound::SoundSource soundSource; 139 OrxSound::SoundBuffer* windBuffer; 125 140 126 127 128 129 141 Vector oldSkyColor; 142 Vector oldCloudColor; 143 Vector skyColor; 144 Vector cloudColor; 130 145 }; 131 146 -
branches/new_class_id/src/lib/graphics/effects/volfog_effect.cc
r9406 r9686 47 47 48 48 49 49 #include "class_id.h" 50 50 51 51 CREATE_FACTORY(VolFogEffect, CL_VOLFOG_EFFECT); 52 NewObjectListDefinitionID(VolFogEffect, CL_VOLFOG_EFFECT); 52 53 53 54 VolFogEffect::VolFogEffect(const TiXmlElement* root) { 54 this->setClassID(CL_VOLFOG_EFFECT, "VolFogEffect");55 this->registerObject(this, VolFogEffect::_objectList); 55 56 56 57 if (root != NULL) -
branches/new_class_id/src/lib/graphics/effects/volfog_effect.h
r8495 r9686 11 11 #include "glincl.h" 12 12 13 class VolFogEffect : public WeatherEffect { 13 class VolFogEffect : public WeatherEffect 14 { 15 NewObjectListDeclaration(VolFogEffect); 14 16 public: 15 16 17 VolFogEffect(const TiXmlElement* root = NULL); 18 virtual ~VolFogEffect(); 17 19 18 20 virtual void loadParams(const TiXmlElement* root); 19 21 20 22 virtual void init(); 21 23 22 23 24 virtual void activate(); 25 virtual void deactivate(); 24 26 25 26 27 virtual void draw() const; 28 virtual void tick(float dt); 27 29 28 30 private: 29 31 GLfloat fogColor[4]; 30 32 31 33 };
Note: See TracChangeset
for help on using the changeset viewer.