-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgraphics.h
80 lines (61 loc) · 1.54 KB
/
graphics.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
#ifndef GRAPHICS_H
#define GRAPHICS_H
#include <SDL.h>
#include <list>
class Point {
public:
float x, y, z;
int screenX, screenY;
//Initilize 3d point
Point(float inputX, float inputY, float inputZ);
//Initilize 2d point
Point(int inputX, int inputY);
};
class Triangle {
public:
int size;
std::list<Point> pointList;
float dist;
int color[3];
int alpha;
int solid;
void addPoint(int x, int y);
//Draw line to surface
void drawLineTriangle(SDL_Renderer* gRenderer);
};
class Vertex {
public:
std::list<Point> pointList;
//Triangle angle
float phi, theta;
//Initilize a vertex with three points
Vertex(std::initializer_list<float> pointA, std::initializer_list<float> pointB, std::initializer_list<float> pointC);
};
class Object {
public:
std::list<Vertex> vertexList;
int isVisible;
float x, y, z;
float phiAngle, thetaAngle;
int colorR, colorG, colorB, alpha;
int solid;
int visible;
int cX, cY, cZ;
float centerX, centerY, centerZ;
float maxRadius;
int objectPointCount;
Object();
//Retrieves three 3d points in form of array lists
void addVertex(std::initializer_list<float> pointA, std::initializer_list<float> pointB, std::initializer_list<float> pointC);
//Rotate an object
void rotateObject(float x, float y, float z, float thetaAdd, float phiAdd);
//Set object color
void setColor(int inputR, int inputG, int inputB);
//Set object alpha
void setAlpha(int inputA);
//Set object alpha
void setSolid(int inputVal);
//Set visibility
void setVisible(int inputVal);
};
#endif