-
Notifications
You must be signed in to change notification settings - Fork 2
/
scene_object.h
72 lines (52 loc) · 1.54 KB
/
scene_object.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
#ifndef SCENE_OBJECT_
#define SCENE_OBJECT_
#define SCENE_NAME std::string("bowling")
#include <optixu/optixpp_namespace.h>
#include <optixu/optixu_math_namespace.h>
#include <optixu/optixu_matrix_namespace.h>
#include "common_structs.h"
using namespace optix;
class Collider;
class SceneObject {
public:
SceneObject();
/**
* parse a .mtl file and get modify the Material created in initGraphics
* tex_dir refers to the directory where the textures are located
*/
void parseMtlFile(Material mat, std::string mtl_path, std::string tex_dir);
virtual void initGraphics(std::string obj_path, std::string mtl_path, std::string tex_dir);
RectangleLight createAreaLight();
inline Transform getTransform() const { return m_transform; };
inline void setTransformMatrix(float m[]) { m_transform->setMatrix(false, m, NULL); };
void attachCollider(Collider* c);
inline Collider* getCollider() const { return m_collider; };
std::string m_renderObjFilename;
std::string m_diffuseMapFilename;
std::string m_normalMapFilename;
std::string m_specularMapFilename;
bool m_emissive;
float3 m_ke;
float3 m_ka;
float3 m_kd;
float3 m_ks;
float3 m_krefl;
float3 m_alpha;
float3 m_ss;
float m_ss_att;
float m_glossiness;
float m_intensity;
float m_attenuation_coeff;
bool m_anisotropic;
static Context context;
static Program mesh_intersect;
static Program mesh_bounds;
static Program closest_hit;
static Program any_hit;
protected:
Transform m_transform;
float* m_initialTransformMtx;
std::string m_objPath;
Collider* m_collider;
};
#endif