Пример #1
0
void Engine::make_litcube(std::string name, glm::vec4 color,
                          glm::vec3 scale, float mass,
                          glm::vec3 position, glm::quat orientation) {
    Shader* shader = shaders["light1"];
    Node* node = nodes[name] =
            new Node(nodes["scene"], position, orientation);
    VAO* vao = parse_obj_file("data/cube.obj", scale);
    std::vector<Uniform*> material;

    StoredUniform<glm::vec4>* mycolor =
            new StoredUniform<glm::vec4>(shader, "mycolor", color);
    material.push_back(mycolor);

    Renderable* renderable =
            new LitRenderObject(shader, node, vao, material);
    renderables.push_back(renderable);

    // mem
    vaos.push_back(vao);
    uniforms.push_back(mycolor);

    if (mass >= 0.f) {
        // physics
        btCollisionShape* cube_shape = new btBoxShape(from_vec3(scale/2.f));

        physics->add_rigid_body(
                create_rigid_body(mass, node, cube_shape));

        // mem
        collision_shapes.push_back(cube_shape);
    }
}
Пример #2
0
static int	remind_options_to_user(t_rtc *rtc)
{
  if (rtc->height == 1080)
    my_putstr("Default height selected : 1080\n");
  else
    {
      my_putstr("Your selected height : ");
      my_put_nbr(rtc->height);
      my_putstr("\n");
    }
  if (rtc->width == 1920)
    my_putstr("Default width selected : 1920\n");
  else
    {
      my_putstr("Your selected width : ");
      my_put_nbr(rtc->width);
      my_putstr("\n");
    }
  (rtc->fullscreen == 1) ? (my_putstr("Fullscreen : YES\n")) :
    (my_putstr("Fullscreen : NO\n"));
  if (rtc->scene_file == NULL)
    return (my_puterr("Error : No scene file given. Aborting.\n"));
  else
    return (parse_obj_file(rtc));
}