forked from 15-466/15-466-f20-base5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ShowMeshesMode.hpp
47 lines (38 loc) · 1.34 KB
/
ShowMeshesMode.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
/*
*
* ShowMeshesMode exists to show the contents of MeshBuffers; this can be useful
* if, e.g., you aren't sure if things are being exported properly.
*
*/
#include "Mode.hpp"
#include "Scene.hpp"
#include "Mesh.hpp"
struct ShowMeshesMode : Mode {
ShowMeshesMode(MeshBuffer const &buffer);
virtual ~ShowMeshesMode();
virtual bool handle_event(SDL_Event const &, glm::uvec2 const &window_size) override;
virtual void draw(glm::uvec2 const &drawable_size) override;
//z-up trackball-style camera controls:
struct {
float radius = 2.0f;
float azimuth = 0.3f; //angle ccw of -y axis, in radians, [-pi,pi]
float elevation = 0.2f; //angle above ground, in radians, [-pi,pi]
glm::vec3 target = glm::vec3(0.0f);
bool flip_x = false; //flip x inputs when moving? (used to handle situations where camera is upside-down)
} camera;
//MeshBuffer being viewed:
MeshBuffer const &buffer;
//currently selected mesh:
std::string current_mesh_name = "";
glm::vec3 current_mesh_min = glm::vec3(0.0f);
glm::vec3 current_mesh_max = glm::vec3(0.0f);
void select_prev_mesh();
void select_next_mesh();
//Vertex array object used to bind mesh buffer for drawing:
GLuint vao = 0;
//mode uses a small Scene to arrange things for viewing:
Scene scene;
Scene::Camera *scene_camera = nullptr;
Scene::Drawable *scene_drawable = nullptr;
};