Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9869 in orxonox.OLD for trunk/src/world_entities/environments


Ignore:
Timestamp:
Oct 3, 2006, 12:19:30 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

Location:
trunk/src/world_entities/environments
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/environments/building.cc

    r9406 r9869  
    2323
    2424
    25 
    26 CREATE_FACTORY(Building, CL_BUILDING);
     25#include "class_id_DEPRECATED.h"
     26ObjectListDefinitionID(Building, CL_BUILDING);
     27CREATE_FACTORY(Building);
    2728
    2829/**
     
    3132Building::Building(const TiXmlElement* root)
    3233{
    33   this->setClassID(CL_BUILDING, "Building");
     34  this->registerObject(this, Building::_objectList);
    3435  this->toList(OM_ENVIRON_NOTICK);
    3536
  • trunk/src/world_entities/environments/building.h

    r7041 r9869  
    1515class Building : public WorldEntity
    1616{
    17  public:
     17  ObjectListDeclaration(Building);
     18  public:
    1819  Building(const TiXmlElement* root);
    1920
  • trunk/src/world_entities/environments/mapped_water.cc

    r9406 r9869  
    1717#include "util/loading/load_param.h"
    1818#include "util/loading/factory.h"
    19 #include "util/loading/resource_manager.h"
    2019#include "state.h"
    2120#include "t_animation.h"
     
    2524#include "script_class.h"
    2625
    27 CREATE_FACTORY(MappedWater, CL_MAPPED_WATER);
     26#include "resource_shader.h"
     27
     28#include "class_id_DEPRECATED.h"
     29ObjectListDefinitionID(MappedWater, CL_MAPPED_WATER);
     30CREATE_FACTORY(MappedWater);
    2831
    2932SHELL_COMMAND(gui, MappedWater, toggleGui);
    3033SHELL_COMMAND(output, MappedWater, saveParams);
    3134
    32 CREATE_SCRIPTABLE_CLASS(MappedWater, CL_MAPPED_WATER,
    33                         addMethod("waterUV", ExecutorLua2<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)));
     35CREATE_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)));
    4144
    4245
     
    4750MappedWater::MappedWater(const TiXmlElement* root)
    4851{
    49   this->setClassID(CL_MAPPED_WATER, "MappedWater");
     52  this->registerObject(this, MappedWater::_objectList);
    5053  this->toList(OM_ENVIRON);
    5154
     
    7578MappedWater::~MappedWater()
    7679{
    77   delete shader;
    7880  delete cam_uni;
    7981  delete color_uni;
     
    163165{
    164166  // 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();
    168170  // Set the variable "reflection" to correspond to the first texture unit
    169171  Shader::Uniform(shader, "reflection").set(0);
     
    197199  cam_uni = new Shader::Uniform(shader, "cameraPos");
    198200
    199   this->shader->deactivateShader();
     201  this->shader.deactivateShader();
    200202}
    201203
     
    223225void MappedWater::resetWaterColor(float r, float g, float b)
    224226{
    225   this->shader->activateShader();
     227  this->shader.activateShader();
    226228  this->waterColor = Vector(r, g, b);
    227229
     
    229231  color_uni->set(waterColor.x, waterColor.y, waterColor.z, 1.0f);
    230232
    231   this->shader->deactivateShader();
     233  this->shader.deactivateShader();
    232234}
    233235
     
    238240void MappedWater::resetShineSize(float shine)
    239241{
    240   this->shader->activateShader();
     242  this->shader.activateShader();
    241243  this->shineSize = shine;
    242244
     
    244246  shineSize_uni->set(this->shineSize);
    245247
    246   this->shader->deactivateShader();
     248  this->shader.deactivateShader();
    247249}
    248250
     
    253255void MappedWater::resetShineStrength(float strength)
    254256{
    255   this->shader->activateShader();
     257  this->shader.activateShader();
    256258  this->shineStrength = strength;
    257259
     
    259261  shineStrength_uni->set(this->shineStrength);
    260262
    261   this->shader->deactivateShader();
     263  this->shader.deactivateShader();
    262264}
    263265
     
    268270void MappedWater::resetReflStrength(float strength)
    269271{
    270   this->shader->activateShader();
     272  this->shader.activateShader();
    271273  this->reflStrength = strength;
    272274
     
    274276  reflStrength_uni->set(this->reflStrength);
    275277
    276   this->shader->deactivateShader();
     278  this->shader.deactivateShader();
    277279}
    278280
     
    283285void MappedWater::resetRefraction(float refraction)
    284286{
    285   this->shader->activateShader();
     287  this->shader.activateShader();
    286288  this->refraction = refraction;
    287289
     
    289291  refr_uni->set(this->refraction);
    290292
    291   this->shader->deactivateShader();
     293  this->shader.deactivateShader();
    292294}
    293295
     
    300302void MappedWater::resetLightPos(float x, float y, float z)
    301303{
    302   this->shader->activateShader();
     304  this->shader.activateShader();
    303305  this->lightPos = Vector(x, y, z);
    304306
     
    306308  light_uni->set(lightPos.x, lightPos.y, lightPos.z, 1.0f);
    307309
    308   this->shader->deactivateShader();
     310  this->shader.deactivateShader();
    309311}
    310312
     
    554556  mat.select();
    555557
    556   this->shader->activateShader();
     558  this->shader.activateShader();
    557559
    558560  // reset the camera uniform to the current cam position
     
    593595  glEnd();
    594596
    595   this->shader->deactivateShader();
     597  this->shader.deactivateShader();
    596598
    597599  mat.unselect();
  • trunk/src/world_entities/environments/mapped_water.h

    r9021 r9869  
    3535class MappedWater : public WorldEntity
    3636{
     37  ObjectListDeclaration(MappedWater);
    3738public:
    3839  MappedWater(const TiXmlElement* root = NULL);
     
    106107private:
    107108  Material                  mat;
    108   Shader*                   shader;
     109  Shader                    shader;
    109110  OrxGui::GLGuiBox*         box;
    110111
  • trunk/src/world_entities/environments/model_entity.cc

    r9656 r9869  
    2323
    2424
    25 
    26 CREATE_FACTORY(ModelEntity, CL_MODEL_ENTITY);
     25#include "class_id_DEPRECATED.h"
     26ObjectListDefinitionID(ModelEntity, CL_MODEL_ENTITY);
     27CREATE_FACTORY(ModelEntity);
    2728
    2829/**
     
    3132ModelEntity::ModelEntity(const TiXmlElement* root)
    3233{
    33   this->setClassID(CL_MODEL_ENTITY, "ModelEntity");
     34  this->registerObject(this, ModelEntity::_objectList);
    3435  this->toList(OM_ENVIRON);
    3536
  • trunk/src/world_entities/environments/model_entity.h

    r7048 r9869  
    1515class ModelEntity : public WorldEntity
    1616{
     17  ObjectListDeclaration(ModelEntity);
    1718 public:
    1819  ModelEntity(const TiXmlElement* root);
  • trunk/src/world_entities/environments/water.cc

    r9656 r9869  
    2323#include "material.h"
    2424
    25 #include "util/loading/resource_manager.h"
    26 #include "shader.h"
     25#include "resource_shader.h"
    2726
    2827#include "skybox.h"
     
    3332
    3433
    35 
    36 CREATE_FACTORY(Water, CL_WATER);
     34#include "class_id_DEPRECATED.h"
     35ObjectListDefinitionID(Water, CL_WATER);
     36CREATE_FACTORY(Water);
    3737
    3838
    3939Water::Water(const TiXmlElement* root)
    4040{
    41   this->setClassID(CL_WATER, "Water");
     41  this->registerObject(this, Water::_objectList);
    4242  this->toList(OM_ENVIRON);
    4343
     
    5555
    5656  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");
    5858
    5959  // To test the Wave equation
     
    217217void Water::tick(float dt)
    218218{
    219   ObjectManager::EntityList entityList = State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ);
     219  ObjectManager::EntityList entityList = State::getObjectManager()->getEntityList(OM_GROUP_01_PROJ);
    220220  ObjectManager::EntityList::iterator entity = entityList.begin();
    221221  while (entity != entityList.end())
  • trunk/src/world_entities/environments/water.h

    r7954 r9869  
    1313#include "world_entity.h"
    1414#include "material.h"
    15 
     15#include "shader.h"
    1616
    1717/* FORWARD DECLARATION */
    1818class Grid;
    19 class Shader;
    2019
    2120//! A Class to handle a WaterEffects
    2221class Water : public WorldEntity
    2322{
    24  public:
     23  ObjectListDeclaration(Water);
     24  public:
    2525   Water(const TiXmlElement* root = NULL);
    2626   virtual ~Water();
     
    3838   void draw() const;
    3939   void tick(float dt);
    40    
     40
    4141   virtual void varChangeHandler( std::list<int> & id );
    4242
     
    5151
    5252    Material        waterMaterial;
    53     Shader*         waterShader;
    54    
     53    Shader          waterShader;
     54
    5555    float           height;          //!< The hight of the Water
    5656    int             height_handle;   //!< Handle to notify about changes of height
Note: See TracChangeset for help on using the changeset viewer.