Changeset 8663 in orxonox.OLD for branches/atmospheric_engine/src/lib/graphics/effects
- Timestamp:
- Jun 21, 2006, 9:00:01 AM (18 years ago)
- Location:
- branches/atmospheric_engine/src/lib/graphics/effects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.cc
r8636 r8663 22 22 23 23 #include "material.h" 24 #include <math.h>25 24 #include "state.h" 26 25 #include "p_node.h" … … 41 40 { 42 41 this->setClassID(CL_CLOUD_EFFECT, "CloudEffect"); 43 // this->toList(OM_ENVIRON);44 42 45 43 this->init(); … … 48 46 this->loadParams(root); 49 47 50 //if(cloudActivate)51 this->activate();48 if(cloudActivate) 49 this->activate(); 52 50 } 53 51 … … 61 59 { 62 60 PRINTF(0)("Initializing CloudEffect\n"); 61 62 this->offsetZ = 0; 63 this->animationSpeed = 2; 63 64 64 65 noise3DTexSize = 64; … … 79 80 noise3DTexSize, noise3DTexSize, noise3DTexSize, 80 81 0, GL_RGBA, GL_UNSIGNED_BYTE, noise3DTexPtr); 81 82 83 //cloudMaterial.setDiffuseMap("pictures/sky/cloud1.jpg", GL_TEXTURE_2D, 0);84 85 coor = 0;86 82 87 83 shader = new Shader(ResourceManager::getInstance()->getDataDir() + "/shaders/cloud.vert", … … 106 102 WeatherEffect::loadParams(root); 107 103 108 // LoadParam(root, "speed", this, CloudEffect, setCloudAnimation); 109 // LoadParam(root, "texture", this, CloudEffect, setCloudTexture); 110 /* 104 LoadParam(root, "speed", this, CloudEffect, setAnimationSpeed); 105 111 106 LOAD_PARAM_START_CYCLE(root, element); 112 107 { 113 LoadParam_CYCLE(element, "option", this, CloudEffect, setCloudOption);114 } 115 LOAD_PARAM_END_CYCLE(element); */108 LoadParam_CYCLE(element, "option", this, CloudEffect, setCloudOption); 109 } 110 LOAD_PARAM_END_CYCLE(element); 116 111 } 117 112 … … 121 116 PRINTF(0)( "Activating\n"); 122 117 123 //this->cloudActivate = true;118 this->cloudActivate = true; 124 119 } 125 120 … … 128 123 PRINTF(0)("Deactivating CloudEffect\n"); 129 124 130 //this->cloudActivate = false;125 this->cloudActivate = false; 131 126 } 132 127 133 128 void CloudEffect::draw() const 134 129 { 135 //if (!this->cloudActivate) 136 // return; 130 if (!this->cloudActivate) 131 return; 132 137 133 glPushAttrib(GL_ENABLE_BIT); 138 134 … … 143 139 glBindTexture(GL_TEXTURE_3D, noise3DTexName); 144 140 145 146 //this->shader->activateShader();147 148 //glMatrixMode(GL_MODELVIEW);149 //glColor4f(1,1,1,1);150 141 glPushMatrix(); 151 //glTranslatef(0,this->waterHeight,0);152 153 //cloudMaterial.unselect();154 //cloudMaterial.select();155 142 156 143 this->shader->activateShader(); 157 //PRINTF(0)("coor: %f\n", coor); 158 offset->set(coor, coor, coor); 159 160 //glutSolidTeapot(1); 144 offset->set(0.0f, 0.0f, offsetZ); 161 145 162 146 … … 173 157 this->shader->deactivateShader(); 174 158 175 //cloudMaterial.unselect();176 177 159 glPopMatrix(); 178 179 160 glPopAttrib(); 180 161 … … 183 164 void CloudEffect::tick (float dt) 184 165 { 185 //if (!this->cloudActivate)186 //return;187 coor += 10;166 if (!this->cloudActivate) 167 return; 168 this->offsetZ += 0.05 * dt * this->animationSpeed; 188 169 } 189 170 -
branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.h
r8636 r8663 52 52 this->deactivate(); 53 53 } 54 inline void setCloudOption(const std::string& option) 55 { 56 if (option == "activate") 57 this->cloudActivate = true; 58 } 59 inline void setAnimationSpeed(float speed) 60 { 61 this->animationSpeed = speed; 62 } 54 63 55 64 virtual void draw() const; … … 63 72 void normalize3(double v[3]); 64 73 65 /*inline void setCloudOption(const std::string& option) { 66 if (option == "activate") 67 this->cloudActivate = true; 68 }*/ 74 private: 69 75 70 71 private: 72 //void initialize(char* fileName); 73 74 //bool cloudActivate; 76 bool cloudActivate; 77 float animationSpeed; 75 78 76 79 // Material cloudMaterial; 77 80 Shader* shader; 78 81 Shader::Uniform* offset; 79 80 float coor;82 83 float offsetZ; 81 84 82 85 int noise3DTexSize;
Note: See TracChangeset
for help on using the changeset viewer.