-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcat.h
130 lines (116 loc) · 3.7 KB
/
cat.h
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//----------------------------------------------------------------------------//
// viewer.h //
// Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger //
//----------------------------------------------------------------------------//
// This program is free software; you can redistribute it and/or modify it //
// under the terms of the GNU General Public License as published by the Free //
// Software Foundation; either version 2 of the License, or (at your option) //
// any later version. //
//----------------------------------------------------------------------------//
#ifndef VIEWER_H
#define VIEWER_H
//----------------------------------------------------------------------------//
// Includes //
//----------------------------------------------------------------------------//
#include "global.h"
#include <string>
#include "glm/glm.hpp"
#include "glm/gtc/matrix_transform.hpp"
#include "glm/gtc/type_ptr.hpp"
#include <vector>
#include "sh_matrix.h"
#include <cstring>
#include "shader.h"
//----------------------------------------------------------------------------//
// Class declaration //
//----------------------------------------------------------------------------//
class CalCoreModel;
class CalModel;
#define NUM_BUFFERS 5
#define VALS_PER_VERT 3
#define VALS_PER_COLOUR 4
#define NUM_VERTS 3 // Total number of vertices to load/render
#define NUM_AVERAGES 20
class Cat
{
protected:
unsigned int m_lastTick;
bool m_bPaused;
//static const std::string model_name;
CalCoreModel * m_calCoreModel;
CalModel * m_calModel;
//CalCoreModel m_calCoreModel;
//CalModel m_calModel;
float m_scale;
int m_currentAnimationId;
float m_leftAnimationTime;
float m_blendTime;
float m_lodLevel;
int m_vertexCount;
int m_faceCount;
float near_clip;
float far_clip;
float camera_h_fov;
float onEmission;
float onPoint;
float onDirectional;
float wireframeToggle;
GLuint vertexVaoShapeArray;
GLuint buffer[NUM_BUFFERS];
GLuint arrayVboArray;
GLuint vertexVaoGnomonArray;
GLuint gnomonVao;
GLuint bufferGnomon[NUM_BUFFERS];
GLuint arrayGnomonVboArray;
GLuint id; // Vertex Shader ID
// constructors/destructor
public:
Cat( const char* in_skeleton,
const char* in_mesh,
const char* in_walk_F_anim,
const char* in_walk_L_anim,
const char* in_walk_R_anim,
const char* in_material,
const char* in_tex_albedo,
float in_cycle_duration,
float in_scale,
glm::mat4 in_location);
virtual ~Cat();
// member functions
public:
void renderModel();
void onIdle();
glm::mat4 viewMatrix;
glm::mat4 projectionMatrix;
glm::mat4 modelMatrix;
glm::mat4 location;
float direction;
protected:
GLuint loadTexture(const std::string& strFilename);
bool createShaders(const char* vert, const char* frag);
bool onInitModel();
bool onInitShading();
bool onCreate();
bool initModel();
bool initProgram();
bool initMaterialLight();
private:
std::string skeleton;
std::string mesh;
std::string walk_anim_F;
std::string walk_anim_L;
std::string walk_anim_R;
std::string tex_albedo;
std::string material;
float cycle_duration;
int id_anim_F;
int id_anim_L;
int id_anim_R;
std::string tex_map;
float scale;
GLuint tex_cube;
float direction_average[NUM_AVERAGES];
float change;
};
#endif
//----------------------------------------------------------------------------//