-
Notifications
You must be signed in to change notification settings - Fork 0
/
scene.h
107 lines (85 loc) · 1.55 KB
/
scene.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
#ifndef SCENE_H
#define SCENE_H
#include "film.h"
#include "camera.h"
#include "object.h"
#include <vector>
#define USE_KD_TREE
class Scene
{
public:
Scene();
~Scene();
void init();
void clear();
//
// Camera Gettor/Settor
//
//%%%
void setCamera(Camera *pCamera);
Camera * getCamera()
{
return _pCamera;
}
vect3d * getPreviousCameraCenter()
{
return &_previousCameraCenter;
}
vect3d* computeCameraCenter(Camera *pCamera);
void setPreviousCameraCenter(Camera *pCamera);
//%%%
//
// Ambient Light
//
void setAmbiColor(vect3d &pColor);
void getAmbiColor(vect3d &pColor);
void addObject(Object *pObj)
{
_vObjects.push_back(pObj);
}
unsigned getObjectNum() { return _vObjects.size(); }
Object *getObject(unsigned index) { return _vObjects[index]; }
void setDataDim(unsigned max_x, unsigned max_y, unsigned max_z)
{
_max_x = max_x;
_max_y = max_y;
_max_z = max_z;
}
void setElecData(float *elecData, int *idData)
{
_elecData = elecData;
_idData = idData;
}
//
// It is paralleled with render()
//
void compute();
//
// Render the scene
//
void render(const char *imgPath = NULL);
void setTFMode(int mode)
{
_tf_mode = mode;
}
private:
std::vector<Object *> _vObjects;
Film *_pFilm;
Camera *_pCamera;
//%%%
vect3d _previousCameraCenter;
//%%%
unsigned _nRdmNum;
float *_hostRdmData;
float *_deviceRdmData;
vect3d _ambientColor;
// Transfer Function mode
int _tf_mode;
// max dims for data
unsigned _max_x;
unsigned _max_y;
unsigned _max_z;
float *_elecData;
int *_idData;
};
#endif