Render two grass instances
@@ -19,7 +19,8 @@ impl Grass
{
let mesh = gust::models::create_cube().unwrap();
let program = program::Program::from_resource(gl, "examples/assets/shaders/grass")?;
- let model = surface::TriangleSurface::create(gl, &mesh, &program)?;
+ let mut model = surface::TriangleSurface::create_without_adding_attributes(gl, &mesh)?;
+ model.add_attributes(&[&mesh.positions].to_vec(), &program)?;
Ok(Grass { program, model })
}
@@ -30,12 +31,10 @@ impl Grass
self.program.cull(state::CullType::NONE);
- self.program.add_uniform_mat4("modelMatrix", &transformation)?;
self.program.add_uniform_mat4("viewMatrix", &camera.get_view())?;
self.program.add_uniform_mat4("projectionMatrix", &camera.get_projection())?;
- self.program.add_uniform_mat4("normalMatrix", &transpose(&inverse(&transformation)))?;
- self.model.render()?;
+ self.model.render_instances(2)?;
Ok(())
}
}
