Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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();
Note: See TracChangeset for help on using the changeset viewer.