-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraphicsclass.h
166 lines (134 loc) · 3.14 KB
/
graphicsclass.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#pragma once
#include "d3dclass.h"
#include "cameraclass.h"
#include "modelclass.h"
#include "colorshaderclass.h"
#include "colors.h"
#include "textureshaderclass.h"
#include "light.h"
#include <chrono>
#include <fstream>
#include <list>
#include <vector>
#include <AntTweakBar.h>
#include <thread>
#include <noise/noise.h>
#include "noiseutils.h"
#include "face.h"
#include "planet.h"
#include "maths.h"
#include "mapping.h"
#include "Star.h"
using namespace noise;
const bool FULL_SCREEN = false;
const bool VSYNC_ENABLED = false; //evil
const float SCREEN_DEPTH = 20000.0f;
const float SCREEN_NEAR = 0.1f;
struct Transform
{
Transform() {};
Transform(XMFLOAT3 _pos, XMFLOAT3 _scale, XMFLOAT3 _rot, XMFLOAT4 _color):Transform()
{
pos = _pos;
scale = _scale;
rot = _rot;
color = _color;
}
XMFLOAT3 pos;
XMFLOAT3 scale;
XMFLOAT3 rot;
XMFLOAT4 color;
};
struct Parameters
{
float upperBound;
float lowerBound;
int segments;
int rings;
float startWidth;
float endWidth;
float segHeight;
float upperBoundX;
float lowerBoundX;
float upperBoundY;
float lowerBoundY;
float upperBoundZ;
float lowerBoundZ;
int recursion;
};
struct PlanetParam
{
float p_temperature;
XMFLOAT4 p_sky;
XMFLOAT3 p_seed;
XMFLOAT3 p_position;
float p_size;
float p_flat;
float m_waterHeight;
XMFLOAT3 m_seed;
};
class GraphicsClass
{
public:
GraphicsClass();
GraphicsClass(const GraphicsClass&);
~GraphicsClass();
bool Initialize(int, int, HWND, CameraClass*);
void Shutdown();
bool Frame(TwBar* bar);
void SetTweakBar(TwBar* bar);
//generation functions
//this is left over from a previous assignment
void CreateCube(Transform transform);
void CreateSphere(Transform transform, int divide);
void CreateTriangle(Transform transform);
void CreateLeaves(Transform transform, Parameters param);
void CreateMoreLeaves(Transform transform, Parameters param);
void CreateRose(Transform transform, Parameters param);
Transform CreateTrunk(Transform transform, Parameters param, int recursion);
void CreateBush(Transform transform, Parameters param);
void CreateTree(Transform transform, Parameters param);
void QueueRemake();
void RemakeSystem();
void QueueRemakePlanet();
void RemakePlanet();
void QueueRemakeStar();
void RemakeStar();
void PopModel(bool clearAll);
void ExportModel();
float GetSpeed(XMFLOAT3 position);
void RenderModel(ModelClass* model);
Transform new_transform;
Parameters trunk_param;
Parameters leaf_param;
Parameters rose_param;
TexParam tex_param;
TexParam leaf_tex_param;
TexParam trunk_tex_param;
TexParam rose_tex_param;
string export_path;
StarParam starParam;
bool randomStar = true;
bool randomPlanets = true;
int numPlanets = 10;
PlanetParam planetParam;
bool remakingPlanet = false;
bool remakingStar = false;
private:
bool Render(TwBar* bar);
private:
D3DClass* m_Direct3D;
ModelClass* m_Model;
std::vector<ModelClass*> m_objects;
std::vector<Planet*> m_planets;
Star* m_star;
ColorShaderClass* m_ColorShader;
TextureShaderClass* m_TextureShader;
CameraClass* m_Camera;
Light* m_light;
int triCount;
bool remaking = false;
Planet* builtPlanet;
Planet* m_remakingPlanet;
Mapping* m_hiresMap;
};