#include <msp/gl/program.h>
#include <msp/gl/renderer.h>
#include <msp/gl/resources.h>
#include <msp/gl/program.h>
#include <msp/gl/renderer.h>
#include <msp/gl/resources.h>
void create_skybox();
static void create_skybox_face(GL::TextureCube &, GL::TextureCubeFace);
void create_tiles_texture();
void create_skybox();
static void create_skybox_face(GL::TextureCube &, GL::TextureCubeFace);
void create_tiles_texture();
"const bool use_normal_map = true;\n"
"const bool use_shadow_map = true;\n"
"#pragma MSP stage(vertex)\n"
"const bool use_normal_map = true;\n"
"const bool use_shadow_map = true;\n"
"#pragma MSP stage(vertex)\n"
"{\n"
" return mix(texture(texture1, texcoord.xy*3.0), texture(texture2, texcoord.xy), ground_type);\n"
"}\n"
"{\n"
" return mix(texture(texture1, texcoord.xy*3.0), texture(texture2, texcoord.xy), ground_type);\n"
"}\n"
"{\n"
" return mix(texture(normalmap1, texcoord.xy*3.0).rgb, texture(normalmap2, texcoord.xy).rgb, ground_type);\n"
"}\n";
"{\n"
" return mix(texture(normalmap1, texcoord.xy*3.0).rgb, texture(normalmap2, texcoord.xy).rgb, ground_type);\n"
"}\n";
"const bool use_reflectivity = true;\n"
"uniform float spherify;\n"
"#pragma MSP stage(vertex)\n"
"const bool use_reflectivity = true;\n"
"uniform float spherify;\n"
"#pragma MSP stage(vertex)\n"
"{\n"
" return eye_obj_matrix*vec4(mix(vertex.xyz, sphere_coord, spherify), 1.0);\n"
"}\n"
"{\n"
" return eye_obj_matrix*vec4(mix(vertex.xyz, sphere_coord, spherify), 1.0);\n"
"}\n"
cube_shprog(cube_src),
cube_shadow_shprog(string(cube_src)+cube_shadow_src_tail),
view(window, gl_context),
cube_shprog(cube_src),
cube_shadow_shprog(string(cube_src)+cube_shadow_src_tail),
view(window, gl_context),
shadow_scene(resources, 2048, scene, light),
bloom(resources, window.get_width(), window.get_height()),
colorcurve(resources),
shadow_scene(resources, 2048, scene, light),
bloom(resources, window.get_width(), window.get_height()),
colorcurve(resources),
keyboard.signal_button_press.connect(sigc::bind_return(sigc::mem_fun(this, &DesertPillars::key_press), false));
setup_view();
keyboard.signal_button_press.connect(sigc::bind_return(sigc::mem_fun(this, &DesertPillars::key_press), false));
setup_view();
camera.set_up_direction(GL::Vector3(0, 0, 1));
camera.set_depth_clip(1, 50);
view.set_camera(&camera);
camera.set_up_direction(GL::Vector3(0, 0, 1));
camera.set_depth_clip(1, 50);
view.set_camera(&camera);
/* The shadow map is focused on the part of the scene that contains the
pillars and the cube. Making the ground cast shadows as well would result
/* The shadow map is focused on the part of the scene that contains the
pillars and the cube. Making the ground cast shadows as well would result
pass->set_lighting(&lighting);
pass->set_depth_test(&GL::DepthTest::lequal());
/* A bloom filter enhances the realism of bright surfaces, even if there
isn't anything really glowy in the scene. */
bloom.set_strength(0.3);
pass->set_lighting(&lighting);
pass->set_depth_test(&GL::DepthTest::lequal());
/* A bloom filter enhances the realism of bright surfaces, even if there
isn't anything really glowy in the scene. */
bloom.set_strength(0.3);
/* Lighting calculations are best done in linear color space, so the final
image must be converted to srgb for display. */
colorcurve.set_srgb();
/* Lighting calculations are best done in linear color space, so the final
image must be converted to srgb for display. */
colorcurve.set_srgb();
- env_pipeline.add_pass(0, sky_scene);
- pass = &env_pipeline.add_pass(0, shadow_scene);
+ env_sequence.add_pass(0, sky_scene);
+ pass = &env_sequence.add_pass(0, shadow_scene);
- GL::VertexFormat vfmt = (GL::VERTEX3, GL::NORMAL3, GL::TANGENT3, GL::BINORMAL3, GL::TEXCOORD2, GL::ATTRIB1,7);
+ GL::VertexFormat vfmt = (GL::VERTEX3, GL::NORMAL3, GL::TANGENT3, GL::BINORMAL3, GL::TEXCOORD2, GL::GENERIC1);
unsigned tan = vfmt.offset(GL::TANGENT3);
unsigned bin = vfmt.offset(GL::BINORMAL3);
unsigned tex = vfmt.offset(GL::TEXCOORD2);
unsigned tan = vfmt.offset(GL::TANGENT3);
unsigned bin = vfmt.offset(GL::BINORMAL3);
unsigned tex = vfmt.offset(GL::TEXCOORD2);
pass = &pillar_tech.add_pass("shadow");
pass->set_shader_program(&shadow_shprog, 0);
pass = &pillar_tech.add_pass("shadow");
pass->set_shader_program(&shadow_shprog, 0);
pass->set_shader_program(&cube_shprog, 0);
pass = &cube_tech.add_pass("shadow");
pass->set_shader_program(&cube_shadow_shprog, 0);
pass->set_shader_program(&cube_shprog, 0);
pass = &cube_tech.add_pass("shadow");
pass->set_shader_program(&cube_shadow_shprog, 0);
- cube_data.mesh = new GL::Mesh((GL::VERTEX3, GL::NORMAL3, GL::ATTRIB3,7));
+ cube_data.mesh = new GL::Mesh((GL::VERTEX3, GL::NORMAL3, GL::GENERIC3));
GL::MeshBuilder bld(*cube_data.mesh);
create_cube_face(bld, GL::Vector3(-1, -1, -1), GL::Vector3(2, 0, 0), GL::Vector3(0, 2, 0), 16);
bld.offset(cube_data.mesh->get_n_vertices());
GL::MeshBuilder bld(*cube_data.mesh);
create_cube_face(bld, GL::Vector3(-1, -1, -1), GL::Vector3(2, 0, 0), GL::Vector3(0, 2, 0), 16);
bld.offset(cube_data.mesh->get_n_vertices());
cube_data.object = new GL::Object(cube_data.mesh, &cube_tech);
cube = new Cube(*cube_data.object);
cube_data.object = new GL::Object(cube_data.mesh, &cube_tech);
cube = new Cube(*cube_data.object);
- env_cube = new GL::EnvironmentMap(resources, 512, *cube, env_pipeline);
+ env_cube = new GL::EnvironmentMap(resources, 512, *cube, env_sequence);
- bld.attrib(7, v.x/l, v.y/l, v.z/l);
+ bld.generic(0, v.x/l, v.y/l, v.z/l);