]> git.tdb.fi Git - libs/gl.git/blobdiff - demos/desertpillars.cpp
Add functions for setting arrays of 2x2 and 3x3 matrix uniforms
[libs/gl.git] / demos / desertpillars.cpp
index c0ba0c6cec34617242800392a3af6e960be2fe36..cb06cd000bc05f32f3cb446133c08a555362e4fb 100644 (file)
@@ -30,7 +30,7 @@
 #include <msp/input/keyboard.h>
 #include <msp/input/keys.h>
 #include <msp/time/timestamp.h>
-#include <msp/time/units.h>
+#include <msp/time/timedelta.h>
 #include <msp/time/utils.h>
 
 using namespace std;
@@ -234,7 +234,7 @@ const char DesertPillars::ground_variables[] =
        "uniform sampler2D texture2;\n"
        "uniform sampler2D normalmap2;\n"
        "attribute float ground_type;\n"
-       "fragment vec4 tex_sample = mix(texture2D(texture1, texture_coord*3.0), texture2D(texture2, texture_coord), ground_type);\n"
+       "fragment vec4 diffuse_sample = mix(texture2D(texture1, texture_coord*3.0), texture2D(texture2, texture_coord), ground_type);\n"
        "fragment vec3 normal_sample = mix(texture2D(normalmap1, texture_coord*3.0).rgb, texture2D(normalmap2, texture_coord).rgb, ground_type);\n";
 
 const char DesertPillars::cube_variables[] =
@@ -577,7 +577,7 @@ void DesertPillars::create_ground()
        features.lighting = true;
        features.shadow = true;
        features.texture = true;
-       features.normalmap = true;
+       features.normal_map = true;
        features.custom = ground_variables;
        GL::ProgramBuilder(features).add_shaders(ground_shprog);
        ground_shprog.bind_attribute(7, "ground_type");
@@ -746,7 +746,8 @@ void DesertPillars::create_cube()
        cube_material.set_diffuse(GL::Color(0.5, 0.5, 0.55));
        cube_material.set_ambient(GL::Color(0.5, 0.5, 0.55));
        cube_material.set_specular(GL::Color(1.0));
-       cube_material.set_shininess(150);
+       cube_material.set_shininess(120);
+       cube_material.set_reflectivity(0.5);
 
        // First create a simplified shader for rendering the shadow map
        GL::ProgramBuilder::StandardFeatures features;
@@ -919,9 +920,7 @@ DesertPillars::ObjectData::~ObjectData()
 
 DesertPillars::Cube::Cube(const GL::Object &obj):
        GL::AnimatedObject(obj)
-{
-       shdata.uniform("reflectivity", 0.5f);
-}
+{ }
 
 void DesertPillars::Cube::set_spherify(float s)
 {