Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9818 in orxonox.OLD for branches/new_class_id/src/world_entities


Ignore:
Timestamp:
Sep 25, 2006, 12:10:07 PM (18 years ago)
Author:
bensch
Message:

Switching to new Shader layout, with Shader and ShaderData. Shaders do not render for the time being

Location:
branches/new_class_id/src/world_entities
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/world_entities/environments/mapped_water.cc

    r9757 r9818  
    7777MappedWater::~MappedWater()
    7878{
    79   delete shader;
    8079  delete cam_uni;
    8180  delete color_uni;
     
    165164{
    166165  // load shader files
    167   shader = new Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/mapped_water.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag");
    168 
    169   this->shader->activateShader();
     166  shader = Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/mapped_water.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag");
     167
     168  this->shader.activateShader();
    170169  // Set the variable "reflection" to correspond to the first texture unit
    171170  Shader::Uniform(shader, "reflection").set(0);
     
    199198  cam_uni = new Shader::Uniform(shader, "cameraPos");
    200199
    201   this->shader->deactivateShader();
     200  this->shader.deactivateShader();
    202201}
    203202
     
    225224void MappedWater::resetWaterColor(float r, float g, float b)
    226225{
    227   this->shader->activateShader();
     226  this->shader.activateShader();
    228227  this->waterColor = Vector(r, g, b);
    229228
     
    231230  color_uni->set(waterColor.x, waterColor.y, waterColor.z, 1.0f);
    232231
    233   this->shader->deactivateShader();
     232  this->shader.deactivateShader();
    234233}
    235234
     
    240239void MappedWater::resetShineSize(float shine)
    241240{
    242   this->shader->activateShader();
     241  this->shader.activateShader();
    243242  this->shineSize = shine;
    244243
     
    246245  shineSize_uni->set(this->shineSize);
    247246
    248   this->shader->deactivateShader();
     247  this->shader.deactivateShader();
    249248}
    250249
     
    255254void MappedWater::resetShineStrength(float strength)
    256255{
    257   this->shader->activateShader();
     256  this->shader.activateShader();
    258257  this->shineStrength = strength;
    259258
     
    261260  shineStrength_uni->set(this->shineStrength);
    262261
    263   this->shader->deactivateShader();
     262  this->shader.deactivateShader();
    264263}
    265264
     
    270269void MappedWater::resetReflStrength(float strength)
    271270{
    272   this->shader->activateShader();
     271  this->shader.activateShader();
    273272  this->reflStrength = strength;
    274273
     
    276275  reflStrength_uni->set(this->reflStrength);
    277276
    278   this->shader->deactivateShader();
     277  this->shader.deactivateShader();
    279278}
    280279
     
    285284void MappedWater::resetRefraction(float refraction)
    286285{
    287   this->shader->activateShader();
     286  this->shader.activateShader();
    288287  this->refraction = refraction;
    289288
     
    291290  refr_uni->set(this->refraction);
    292291
    293   this->shader->deactivateShader();
     292  this->shader.deactivateShader();
    294293}
    295294
     
    302301void MappedWater::resetLightPos(float x, float y, float z)
    303302{
    304   this->shader->activateShader();
     303  this->shader.activateShader();
    305304  this->lightPos = Vector(x, y, z);
    306305
     
    308307  light_uni->set(lightPos.x, lightPos.y, lightPos.z, 1.0f);
    309308
    310   this->shader->deactivateShader();
     309  this->shader.deactivateShader();
    311310}
    312311
     
    556555  mat.select();
    557556
    558   this->shader->activateShader();
     557  this->shader.activateShader();
    559558
    560559  // reset the camera uniform to the current cam position
     
    595594  glEnd();
    596595
    597   this->shader->deactivateShader();
     596  this->shader.deactivateShader();
    598597
    599598  mat.unselect();
  • branches/new_class_id/src/world_entities/environments/mapped_water.h

    r9715 r9818  
    107107private:
    108108  Material                  mat;
    109   Shader*                   shader;
     109  Shader                    shader;
    110110  OrxGui::GLGuiBox*         box;
    111111
  • branches/new_class_id/src/world_entities/weather_effects/cloud_effect.cc

    r9760 r9818  
    7676    if (glIsTexture(noise3DTexName))
    7777        glDeleteTextures(1, &noise3DTexName);
    78 
    79     delete shader;
    8078}
    8179
     
    122120    this->skydome->setTexture(noise3DTexName);
    123121
    124     this->shader = new Shader(ResourceManager::getInstance()->getDataDir() + "/shaders/cloud.vert",
     122    this->shader = Shader(ResourceManager::getInstance()->getDataDir() + "/shaders/cloud.vert",
    125123                              ResourceManager::getInstance()->getDataDir() + "/shaders/cloud.frag");
    126124
    127     this->shader->activateShader();
     125    this->shader.activateShader();
    128126
    129127    Shader::Uniform(shader, "Noise").set(0);
     
    133131    this->cloudcolor = new Shader::Uniform(shader, "CloudColor");
    134132
    135     this->shader->deactivateShader();
    136 
    137     this->skydome->setShader(shader);
     133    this->shader.deactivateShader();
     134
     135    this->skydome->setShader(&shader);
    138136}
    139137
     
    163161
    164162    // Can only be set after the loadParams call
    165     this->shader->activateShader();
     163    this->shader.activateShader();
    166164    Shader::Uniform(shader, "Scale").set(this->scale);
    167165    this->skycolor->set
     
    169167    this->cloudcolor->set
    170168    (cloudColor.x, cloudColor.y, cloudColor.z);
    171     this->shader->deactivateShader();
     169    this->shader.deactivateShader();
    172170
    173171    this->skydome->generateSkyPlane(this->divs, this->planetRadius, this->atmosphericRadius, 1, 1);
     
    192190        this->offsetZ += 0.05 * dt * this->animationSpeed;
    193191
    194         this->shader->activateShader();
     192        this->shader.activateShader();
    195193        this->offset->set
    196194        (0.0f, 0.0f, offsetZ);
     
    258256        }
    259257
    260         this->shader->deactivateShader();
     258        this->shader.deactivateShader();
    261259    }
    262260}
  • branches/new_class_id/src/world_entities/weather_effects/cloud_effect.h

    r9760 r9818  
    143143
    144144    // SHADER STUFF
    145     Shader*          shader;
     145    Shader           shader;
    146146    Shader::Uniform* offset;
    147147    Shader::Uniform* skycolor;
Note: See TracChangeset for help on using the changeset viewer.