"const bool use_normal_map = true;\n"
"const bool use_shadow_map = true;\n"
"#pragma MSP stage(vertex)\n"
- "layout(location=7) in float ground_type;\n"
+ "layout(location=11) in float ground_type;\n"
+ "void custom_transform() override\n"
+ "{\n"
+ " passthrough;\n"
+ "}\n"
"#pragma MSP stage(fragment)\n"
- "vec4 get_diffuse_color()\n"
+ "vec4 get_diffuse_color() override\n"
"{\n"
" return mix(texture(texture1, texcoord.xy*3.0), texture(texture2, texcoord.xy), ground_type);\n"
"}\n"
- "vec4 get_fragment_normal()\n"
+ "vec3 get_fragment_normal() override\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"
- "layout(location=7) in vec3 sphere_coord;\n"
- "vec4 transform_position(vec4 pos)\n"
+ "layout(location=11) in vec3 sphere_coord;\n"
+ "vec4 transform_position(vec4 pos) override\n"
"{\n"
" return eye_obj_matrix*vec4(mix(vertex.xyz, sphere_coord, spherify), 1.0);\n"
"}\n"
- "vec3 transform_normal(vec3 pos)\n"
+ "vec3 transform_normal(vec3 pos) override\n"
"{\n"
" return eye_obj_normal_matrix*normalize(mix(normal, normalize(sphere_coord), spherify));\n"
"}\n";
/* No shadow pass here; the ground only receives shadows, but doesn't cast
them. */
- 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);
ground_data.mesh = new GL::Mesh(vfmt);
// Create a base grid
unsigned tan = vfmt.offset(GL::TANGENT3);
unsigned bin = vfmt.offset(GL::BINORMAL3);
unsigned tex = vfmt.offset(GL::TEXCOORD2);
- unsigned gt = vfmt.offset(GL::make_indexed_component(GL::ATTRIB1, 7));
+ unsigned gt = vfmt.offset(GL::GENERIC1);
for(unsigned i=0; i<n_vertices; ++i)
{
float *v = ground_data.mesh->modify_vertex(i);
pillar_material.set_receive_shadows(true);
GL::RenderPass *pass = &pillar_tech.add_pass(0);
- pass->set_material(&pillar_material);
+ pass->set_material(&pillar_material, &resources);
pass = &pillar_tech.add_pass("shadow");
pass->set_shader_program(&shadow_shprog, 0);
cube_material.set_reflectivity(0.5);
GL::RenderPass *pass = &cube_tech.add_pass(0);
- pass->set_material(&cube_material);
+ pass->set_material(&cube_material, &resources);
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());
l = sqrt(v.x*v.x+v.y*v.y+v.z*v.z);
l /= 1.732;
- bld.attrib(7, v.x/l, v.y/l, v.z/l);
+ bld.generic(0, v.x/l, v.y/l, v.z/l);
bld.vertex(v);
}