-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathobject3d.h
More file actions
70 lines (45 loc) · 1.52 KB
/
object3d.h
File metadata and controls
70 lines (45 loc) · 1.52 KB
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
#ifndef OBJECT3D_H
#define OBJECT3D_H
#include <vector>
#include <map>
#include "Config.h"
#include "bspmodel.h"
#include "RenderDevice.h"
namespace P3D
{
class Object3d
{
public:
Object3d();
bool Setup(unsigned int screenWidth, unsigned int screenHeight, fp hFov = 54, fp zNear = 5, fp zFar = 1024, pixel *framebuffer = nullptr);
V3<fp>& CameraPos();
V3<fp>& CameraAngle();
void DoCollisions();
bool CheckCollision(const BspModelTriangle* tri, V3<fp>& point, const fp radius);
void RenderScene();
void SetModel(const BspModel* model);
void SetBackgroundColor(pixel color);
void SetFrameBuffer(pixel* buffer);
#ifdef RENDER_STATS
const RenderStats& GetRenderStats();
#endif
bool update_frustrum_bb = true;
bool do_collisions = true;
fp light_level = 1.0;
private:
void RenderBsp();
void UpdateFrustrumAABB();
RenderDevice* render_device = nullptr;
RenderTarget* render_target = nullptr;
const BspModel* model;
AABB<fp> viewFrustrumBB;
V3<fp> eyePos;
//V3<fp> cameraPos = V3<fp>(0,50,0);
V3<fp> cameraPos = V3<fp>(8508,13,8563);
V3<fp> cameraAngle = V3<fp>(0,-236,0);
pixel backgroundColor = 0x799ED7;
V3<fp> frustrumPoints[4]; //Top left and bottom-right frustrum points.
Plane<fp> frustrumPlanes[6];
};
}
#endif // OBJECT3D_H