Changeset 9869 in orxonox.OLD for trunk/src/world_entities/environments
- Timestamp:
- Oct 3, 2006, 12:19:30 AM (18 years ago)
- Location:
- trunk/src/world_entities/environments
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/environments/building.cc
r9406 r9869 23 23 24 24 25 26 CREATE_FACTORY(Building, CL_BUILDING); 25 #include "class_id_DEPRECATED.h" 26 ObjectListDefinitionID(Building, CL_BUILDING); 27 CREATE_FACTORY(Building); 27 28 28 29 /** … … 31 32 Building::Building(const TiXmlElement* root) 32 33 { 33 this-> setClassID(CL_BUILDING, "Building");34 this->registerObject(this, Building::_objectList); 34 35 this->toList(OM_ENVIRON_NOTICK); 35 36 -
trunk/src/world_entities/environments/building.h
r7041 r9869 15 15 class Building : public WorldEntity 16 16 { 17 public: 17 ObjectListDeclaration(Building); 18 public: 18 19 Building(const TiXmlElement* root); 19 20 -
trunk/src/world_entities/environments/mapped_water.cc
r9406 r9869 17 17 #include "util/loading/load_param.h" 18 18 #include "util/loading/factory.h" 19 #include "util/loading/resource_manager.h"20 19 #include "state.h" 21 20 #include "t_animation.h" … … 25 24 #include "script_class.h" 26 25 27 CREATE_FACTORY(MappedWater, CL_MAPPED_WATER); 26 #include "resource_shader.h" 27 28 #include "class_id_DEPRECATED.h" 29 ObjectListDefinitionID(MappedWater, CL_MAPPED_WATER); 30 CREATE_FACTORY(MappedWater); 28 31 29 32 SHELL_COMMAND(gui, MappedWater, toggleGui); 30 33 SHELL_COMMAND(output, MappedWater, saveParams); 31 34 32 CREATE_SCRIPTABLE_CLASS(MappedWater, CL_MAPPED_WATER,33 addMethod("waterUV", Executor Lua2<MappedWater, float, float>(&MappedWater::fadeWaterUV))34 ->addMethod("waterFlow", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterFlow))35 ->addMethod("shineSize", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeShineSize))36 ->addMethod("shineStrength", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeShineStrength))37 ->addMethod("reflStrength", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeReflStrength))38 ->addMethod("refraction", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeRefraction))39 ->addMethod("waterHeight", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterHeight))40 ->addMethod("waterColor", ExecutorLua4<MappedWater, float, float, float, float>(&MappedWater::fadeWaterColor)));35 CREATE_SCRIPTABLE_CLASS(MappedWater, 36 addMethod("waterUV", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeWaterUV)) 37 ->addMethod("waterFlow", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeWaterFlow)) 38 ->addMethod("shineSize", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeShineSize)) 39 ->addMethod("shineStrength", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeShineStrength)) 40 ->addMethod("reflStrength", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeReflStrength)) 41 ->addMethod("refraction", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeRefraction)) 42 ->addMethod("waterHeight", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeWaterHeight)) 43 ->addMethod("waterColor", Executor4<MappedWater, lua_State*, float, float, float, float>(&MappedWater::fadeWaterColor))); 41 44 42 45 … … 47 50 MappedWater::MappedWater(const TiXmlElement* root) 48 51 { 49 this-> setClassID(CL_MAPPED_WATER, "MappedWater");52 this->registerObject(this, MappedWater::_objectList); 50 53 this->toList(OM_ENVIRON); 51 54 … … 75 78 MappedWater::~MappedWater() 76 79 { 77 delete shader;78 80 delete cam_uni; 79 81 delete color_uni; … … 163 165 { 164 166 // load shader files 165 shader = new Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/mapped_water.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag");166 167 this->shader ->activateShader();167 shader = ResourceShader( "/shaders/mapped_water.vert", "/shaders/mapped_water.frag"); 168 169 this->shader.activateShader(); 168 170 // Set the variable "reflection" to correspond to the first texture unit 169 171 Shader::Uniform(shader, "reflection").set(0); … … 197 199 cam_uni = new Shader::Uniform(shader, "cameraPos"); 198 200 199 this->shader ->deactivateShader();201 this->shader.deactivateShader(); 200 202 } 201 203 … … 223 225 void MappedWater::resetWaterColor(float r, float g, float b) 224 226 { 225 this->shader ->activateShader();227 this->shader.activateShader(); 226 228 this->waterColor = Vector(r, g, b); 227 229 … … 229 231 color_uni->set(waterColor.x, waterColor.y, waterColor.z, 1.0f); 230 232 231 this->shader ->deactivateShader();233 this->shader.deactivateShader(); 232 234 } 233 235 … … 238 240 void MappedWater::resetShineSize(float shine) 239 241 { 240 this->shader ->activateShader();242 this->shader.activateShader(); 241 243 this->shineSize = shine; 242 244 … … 244 246 shineSize_uni->set(this->shineSize); 245 247 246 this->shader ->deactivateShader();248 this->shader.deactivateShader(); 247 249 } 248 250 … … 253 255 void MappedWater::resetShineStrength(float strength) 254 256 { 255 this->shader ->activateShader();257 this->shader.activateShader(); 256 258 this->shineStrength = strength; 257 259 … … 259 261 shineStrength_uni->set(this->shineStrength); 260 262 261 this->shader ->deactivateShader();263 this->shader.deactivateShader(); 262 264 } 263 265 … … 268 270 void MappedWater::resetReflStrength(float strength) 269 271 { 270 this->shader ->activateShader();272 this->shader.activateShader(); 271 273 this->reflStrength = strength; 272 274 … … 274 276 reflStrength_uni->set(this->reflStrength); 275 277 276 this->shader ->deactivateShader();278 this->shader.deactivateShader(); 277 279 } 278 280 … … 283 285 void MappedWater::resetRefraction(float refraction) 284 286 { 285 this->shader ->activateShader();287 this->shader.activateShader(); 286 288 this->refraction = refraction; 287 289 … … 289 291 refr_uni->set(this->refraction); 290 292 291 this->shader ->deactivateShader();293 this->shader.deactivateShader(); 292 294 } 293 295 … … 300 302 void MappedWater::resetLightPos(float x, float y, float z) 301 303 { 302 this->shader ->activateShader();304 this->shader.activateShader(); 303 305 this->lightPos = Vector(x, y, z); 304 306 … … 306 308 light_uni->set(lightPos.x, lightPos.y, lightPos.z, 1.0f); 307 309 308 this->shader ->deactivateShader();310 this->shader.deactivateShader(); 309 311 } 310 312 … … 554 556 mat.select(); 555 557 556 this->shader ->activateShader();558 this->shader.activateShader(); 557 559 558 560 // reset the camera uniform to the current cam position … … 593 595 glEnd(); 594 596 595 this->shader ->deactivateShader();597 this->shader.deactivateShader(); 596 598 597 599 mat.unselect(); -
trunk/src/world_entities/environments/mapped_water.h
r9021 r9869 35 35 class MappedWater : public WorldEntity 36 36 { 37 ObjectListDeclaration(MappedWater); 37 38 public: 38 39 MappedWater(const TiXmlElement* root = NULL); … … 106 107 private: 107 108 Material mat; 108 Shader *shader;109 Shader shader; 109 110 OrxGui::GLGuiBox* box; 110 111 -
trunk/src/world_entities/environments/model_entity.cc
r9656 r9869 23 23 24 24 25 26 CREATE_FACTORY(ModelEntity, CL_MODEL_ENTITY); 25 #include "class_id_DEPRECATED.h" 26 ObjectListDefinitionID(ModelEntity, CL_MODEL_ENTITY); 27 CREATE_FACTORY(ModelEntity); 27 28 28 29 /** … … 31 32 ModelEntity::ModelEntity(const TiXmlElement* root) 32 33 { 33 this-> setClassID(CL_MODEL_ENTITY, "ModelEntity");34 this->registerObject(this, ModelEntity::_objectList); 34 35 this->toList(OM_ENVIRON); 35 36 -
trunk/src/world_entities/environments/model_entity.h
r7048 r9869 15 15 class ModelEntity : public WorldEntity 16 16 { 17 ObjectListDeclaration(ModelEntity); 17 18 public: 18 19 ModelEntity(const TiXmlElement* root); -
trunk/src/world_entities/environments/water.cc
r9656 r9869 23 23 #include "material.h" 24 24 25 #include "util/loading/resource_manager.h" 26 #include "shader.h" 25 #include "resource_shader.h" 27 26 28 27 #include "skybox.h" … … 33 32 34 33 35 36 CREATE_FACTORY(Water, CL_WATER); 34 #include "class_id_DEPRECATED.h" 35 ObjectListDefinitionID(Water, CL_WATER); 36 CREATE_FACTORY(Water); 37 37 38 38 39 39 Water::Water(const TiXmlElement* root) 40 40 { 41 this-> setClassID(CL_WATER, "Water");41 this->registerObject(this, Water::_objectList); 42 42 this->toList(OM_ENVIRON); 43 43 … … 55 55 56 56 this->rebuildGrid(); 57 this->waterShader = (Shader*)ResourceManager::getInstance()->load("shaders/water.vert", SHADER, RP_GAME, "shaders/water.frag");57 this->waterShader = ResourceShader("shaders/water.vert", "shaders/water.frag"); 58 58 59 59 // To test the Wave equation … … 217 217 void Water::tick(float dt) 218 218 { 219 ObjectManager::EntityList entityList = State::getObjectManager()->get ObjectList(OM_GROUP_01_PROJ);219 ObjectManager::EntityList entityList = State::getObjectManager()->getEntityList(OM_GROUP_01_PROJ); 220 220 ObjectManager::EntityList::iterator entity = entityList.begin(); 221 221 while (entity != entityList.end()) -
trunk/src/world_entities/environments/water.h
r7954 r9869 13 13 #include "world_entity.h" 14 14 #include "material.h" 15 15 #include "shader.h" 16 16 17 17 /* FORWARD DECLARATION */ 18 18 class Grid; 19 class Shader;20 19 21 20 //! A Class to handle a WaterEffects 22 21 class Water : public WorldEntity 23 22 { 24 public: 23 ObjectListDeclaration(Water); 24 public: 25 25 Water(const TiXmlElement* root = NULL); 26 26 virtual ~Water(); … … 38 38 void draw() const; 39 39 void tick(float dt); 40 40 41 41 virtual void varChangeHandler( std::list<int> & id ); 42 42 … … 51 51 52 52 Material waterMaterial; 53 Shader *waterShader;54 53 Shader waterShader; 54 55 55 float height; //!< The hight of the Water 56 56 int height_handle; //!< Handle to notify about changes of height
Note: See TracChangeset
for help on using the changeset viewer.