Beispiel #1
0
GameObject::GameObject(
      const GroundPlane& ground_plane,
      const Mesh& mesh,
      Shaders& shaders) :
   should_move_(true),
   should_blue_(false),
   center_(
         ground_plane.x_bounds().shrink(2*kRadius).randomInclusive(),
         kRadius,
         ground_plane.z_bounds().shrink(2*kRadius).randomInclusive()),
   velocity_(0.005f * cos(rand()), 0, 0.005f * sin(rand())),
   blue_uniform_(shaders.getUniforms(Uniform::BLUE)),
   mesh_(mesh),
   model_matrix_(shaders, glm::mat4()) {}
Beispiel #2
0
GroundPlane::GroundPlane(Shaders& shaders) :
   mesh_{
      createIndexBufferObject(ground_indices),
      {
         createArrayBufferObject(
            ground_vertices,
            shaders.getAttributes(Attribute::VERTEX),
            3),
         createArrayBufferObject(
            ground_normals,
            shaders.getAttributes(Attribute::NORMAL),
            3),
      }
   },
   model_matrix_(shaders,
         glm::rotate(glm::scale(glm::mat4(), glm::vec3(20.0f)), 90.0f, glm::vec3(1, 0, 0))),
   blue_uniform_(shaders.getUniforms(Uniform::BLUE))
{
}