forked from jbikker/voxpopuli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrenderer.h
56 lines (44 loc) · 1.18 KB
/
renderer.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
#pragma once
#include "light.h"
#include "skydome/skydome.h"
#include "BVH/bvh.h"
namespace Tmpl8
{
class Renderer : public TheApp
{
public:
// game flow methods
void Init();
float3 Trace( Ray& ray );
void Tick( float deltaTime );
void UI();
void Shutdown();
// input handling
void MouseUp( int ) { /* implement if you want to detect mouse button presses */ }
void MouseDown( int )
{
if (ImGui::GetIO().WantCaptureMouse)
return;
Ray ray = camera.GetPrimaryRay(float(mousePos.x), float(mousePos.y));
bvh.intersect_bvh(voxel_objects, ray, 0);
}
void MouseMove( int x, int y ) { mousePos.x = x, mousePos.y = y; }
void MouseWheel( float ) { /* implement if you want to handle the mouse wheel */ }
void KeyUp( int ) { /* implement if you want to handle keys */ }
void KeyDown( int ) { /* implement if you want to handle keys */ }
// data members
int2 mousePos;
float4* accumulator;
Scene scene;
Camera camera;
private:
int frames = 0;
float3 sun_pos = float3(0.0f, 5.0f, 0.0f);
float time = 0.0f;
std::vector<Light> lights;
Skydome skydome;
VoxelVolume* voxel_objects = nullptr;
BVH bvh;
bool grid_view = false;
};
} // namespace Tmpl8