Skip to content
Snippets Groups Projects
scene.hpp 2.44 KiB
Newer Older
Noé's avatar
Noé committed
#pragma once


#include "cgp/cgp.hpp"
#include "environment.hpp"
Noé's avatar
Noé committed
#include "key_positions_structure.hpp"
#include "ball.hpp"
#include "bird.hpp"
#include "chain.hpp"
#include "bats.hpp"
#include "projectiles.hpp"
Marie AUDOUARD's avatar
Marie AUDOUARD committed
#include "sapin.hpp"
Noé's avatar
Noé committed

// This definitions allow to use the structures: mesh, mesh_drawable, etc. without mentionning explicitly cgp::
using cgp::mesh;
using cgp::mesh_drawable;
using cgp::vec3;
using cgp::numarray;
using cgp::timer_basic;

Noé's avatar
Noé committed

// Variables associated to the GUI
Noé's avatar
Noé committed
struct gui_parameters {
	bool display_frame = true;
	bool display_wireframe = false;
Noé's avatar
Noé committed
	float k = 0.5f;
	bool fly = true;
	float speed = 1.0f;
Noé's avatar
Noé committed
};

// The structure of the custom scene
struct scene_structure : cgp::scene_inputs_generic {
	
	// ****************************** //
	// Elements and shapes of the scene
	// ****************************** //
	camera_controller_first_person_euler camera_control;
Noé's avatar
Noé committed
	camera_projection_perspective camera_projection;
	window_structure window;

	mesh_drawable global_frame;          // The standard global frame
	environment_structure environment;   // Standard environment controler
	input_devices inputs;                // Storage for inputs status (mouse, keyboard, window dimension)
	gui_parameters gui;                  // Standard GUI element storage
	
	// ****************************** //
	// Elements and shapes of the scene
	// ****************************** //
Noé's avatar
Noé committed
	
	cgp::skybox_drawable skybox;

Noé's avatar
Noé committed
	// Timer used for the animation
Noé's avatar
Noé committed
	timer_basic timer;

Noé's avatar
Noé committed
	cgp::mesh_drawable terrain;
	cgp::mesh_drawable cyl;
	cgp::mesh_drawable cone;
	cgp::mesh_drawable tree;
	cgp::mesh_drawable grass;
Noé's avatar
Noé committed

Noé's avatar
Noé committed
	// Timer used for the animation
	timer_basic timer_chain;

	ball bouncing;
	bird bird1;
	chain chain1;
	bats bats;
	projectiles projectiles;
Marie AUDOUARD's avatar
Marie AUDOUARD committed
	sapin sapin1;
Noé's avatar
Noé committed

	// ****************************** //
	// Functions
	// ****************************** //

	void initialize();    // Standard initialization to be called before the animation loop
	void display_frame(); // The frame display to be called within the animation loop
	void display_gui();   // The display of the GUI, also called within the animation loop
Noé's avatar
Noé committed
	void display_semiTransparent();
	void display_chain(vec3 end_pos);
	//void display_bird(vec3 p);
	void display_bats();
Noé's avatar
Noé committed

	void mouse_move_event();
	void mouse_click_event();
	void keyboard_event();
	void idle_frame();

Noé's avatar
Noé committed
	void draw_segment(vec3 const& a, vec3 const& b);
Noé's avatar
Noé committed

Noé's avatar
Noé committed
	void display_ball();
	bool scene_structure::test_dead(vec3 p);
	void display_projectiles();
Noé's avatar
Noé committed
};
Noé's avatar
Noé committed