Changeset 8119 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics
- Timestamp:
- Jun 2, 2006, 12:16:09 PM (19 years ago)
- Location:
- branches/atmospheric_engine/src/lib/graphics/effects
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.cc
r8084 r8119 57 57 bool CloudEffect::init() 58 58 { 59 59 PRINTF(1)("Initializing CloudEffect\n"); 60 60 61 62 61 this->sphereObj = gluNewQuadric(); 62 //this->setParentMode(PNODE_MOVEMENT); 63 63 64 65 64 gluQuadricTexture(this->sphereObj, GL_TRUE); 65 gluQuadricOrientation(this->sphereObj, GLU_INSIDE); 66 66 67 this->setRadius(1900.0); 67 68 68 this->setRadius(1900.0);69 mover = 0.0f; 69 70 70 mover = 0.0f; 71 72 // Initializing default values 73 this->cloudSpeed = 1.0f; 71 // Initializing default values 72 this->cloudSpeed = 1.0f; 74 73 this->cloudTexture = "pictures/sky/cloud1.jpg"; 75 74 } … … 90 89 91 90 this->cloudMaterial = new Material("Sky"); 92 93 94 91 this->cloudMaterial->setIllum(3); 92 this->cloudMaterial->setAmbient(1.0, 1.0, 1.0); 93 this->cloudMaterial->setDiffuseMap(this->cloudTexture); 95 94 } 96 95 … … 108 107 */ 109 108 110 111 109 glMatrixMode(GL_MODELVIEW); 110 glPushMatrix(); 112 111 113 114 115 112 // Move sphere along with the camera 113 Vector r = State::getCameraNode()->getAbsCoor(); 114 glTranslatef(r.x, r.y, r.z); 116 115 117 116 // Sky movement 118 117 glRotatef(mover, 0, 0, 1); 119 118 120 121 122 119 cloudMaterial->select(); 120 gluSphere(this->sphereObj, this->sphereRadius, 20, 20); 121 glPopMatrix(); 123 122 } 124 123 125 124 void CloudEffect::tick (float dt) 126 125 { 127 126 mover = mover + this->cloudSpeed * dt; 128 127 } 129 128 130 129 131 130 /** 132 133 131 * sets the Radius of the Sphere. 132 * @param radius The Radius of The Sphere 134 133 */ 135 134 void CloudEffect::setRadius(float radius) 136 135 { 137 136 this->sphereRadius = radius; 138 137 } 139 138 -
branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.h
r8079 r8119 40 40 void initialize(char* fileName); 41 41 42 GLUquadricObj* sphereObj; // A Placeholder for the SkySphere. 43 Material* cloudMaterial; // A Material for the SkySphere. 44 float sphereRadius; // Radius of the SkySphere. 45 float mover; 46 float cloudSpeed; 47 std::string cloudTexture; 42 GLUquadricObj* sphereObj; // A Placeholder for the Sphere. 43 Material* cloudMaterial; // A Material for the Sphere. 44 float sphereRadius; // Radius of the Sphere. 45 46 float mover; 47 float cloudSpeed; 48 std::string cloudTexture; 48 49 49 50 inline void setCloudTexture(const std::string& file) { this->cloudTexture = file; } -
branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc
r8074 r8119 1 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 4 Copyright (C) 2004 orx 5 5 6 7 8 9 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 10 11 11 ### File Specific: 12 12 main-programmer: hdavid, amaechler 13 13 */ 14 14 … … 31 31 SHELL_COMMAND(activate, RainEffect, activateRain); 32 32 SHELL_COMMAND(deactivate, RainEffect, deactivateRain); 33 34 SHELL_COMMAND(startRaining, RainEffect, startRaining); 33 35 34 36 using namespace std; … … 59 61 } 60 62 61 62 63 if(rainActivate) 64 this->activate(); 63 65 } 64 66 … … 84 86 LoadParam(root, "life", this, RainEffect, setRainLife); 85 87 LoadParam(root, "wind", this, RainEffect, setRainWind); 86 87 88 89 90 91 92 88 89 LOAD_PARAM_START_CYCLE(root, element); 90 { 91 LoadParam_CYCLE(element, "option", this, RainEffect, setRainOption); 92 } 93 LOAD_PARAM_END_CYCLE(element); 94 93 95 } 94 96 … … 97 99 { 98 100 //Default values 99 100 101 this->rainActivate = false; 102 this->rainMove = false; 101 103 this->rainCoord = Vector(500, 500, 500); 102 104 this->rainSize = Vector2D(1000, 1000); … … 108 110 109 111 this->emitter = new PlaneEmitter(this->rainSize); 110 111 112 113 lightMan = LightManager::getInstance(); 112 114 } 113 115 … … 145 147 if (this->rainWindForce > 0) 146 148 this->soundSource.loop(this->windBuffer, 0.5f); 147 148 149 150 lightMan->setAmbientColor(.1,.1,.1); 149 151 } 150 152 … … 156 158 157 159 this->soundSource.stop(); 158 159 160 161 lightMan->setAmbientColor(1,1,1); 160 162 } 161 163 … … 167 169 } 168 170 } 171 172 /** 173 * Slowly starts rain 174 * @param duration duration of the fade in process in seconds 175 */ 176 void RainEffect::startRaining(float duration) 177 { 178 // use alpha in color to fade in 179 // increase radius for more "heavy" rain 180 // increase sound volume 181 } -
branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.h
r8074 r8119 35 35 virtual bool deactivate(); 36 36 37 void activateRain() { this->activate(); } 38 void deactivateRain() { this->deactivate(); } 37 virtual void tick(float dt); 39 38 40 virtual void tick(float dt); 39 inline void activateRain() { this->activate(); } 40 inline void deactivateRain() { this->deactivate(); } 41 41 42 42 inline void setRainCoord(float x, float y, float z) { this->rainCoord = Vector(x, y, z); } … … 46 46 inline void setRainLife(float life) { this->rainLife = life; } 47 47 inline void setRainWind(int force) { this->rainWindForce = force; } 48 inline void setRainOption(const std::string& option) { if (option == "moverain") this->rainMove = true; 49 if (option == "activate") this->rainActivate = true; } 48 inline void setRainOption(const std::string& option) { 49 if (option == "moverain") this->rainMove = true; 50 if (option == "activate") this->rainActivate = true; 51 } 50 52 53 void startRaining(float duration); 51 54 52 55 private: 53 static SparkParticles* 54 ParticleEmitter* 56 static SparkParticles* rainParticles; 57 ParticleEmitter* emitter; 55 58 56 Vector 57 Vector2D 58 GLfloat 59 GLfloat 60 GLfloat 61 GLfloat 62 int 63 bool 64 boolrainActivate;59 Vector rainCoord; 60 Vector2D rainSize; 61 GLfloat rainRate; 62 GLfloat rainVelocity; 63 GLfloat rainLife; 64 GLfloat rainMaxParticles; 65 int rainWindForce; 66 bool rainMove; 67 bool rainActivate; 65 68 66 69 OrxSound::SoundSource soundSource; 67 70 OrxSound::SoundBuffer* rainBuffer; 68 71 OrxSound::SoundBuffer* windBuffer; 69 70 72 73 LightManager* lightMan; 71 74 }; 72 75 73 74 76 #endif /* _RAIN_EFFECT */
Note: See TracChangeset
for help on using the changeset viewer.