-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.hpp
More file actions
69 lines (53 loc) · 1.4 KB
/
node.hpp
File metadata and controls
69 lines (53 loc) · 1.4 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
#ifndef NODE_H
#define NODE_H
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp>
#include <mesh/object.hpp>
#include <mesh/cube.hpp>
#include <mesh/cylinder.hpp>
#include <mesh/sphere.hpp>
#include <shader.hpp>
#include <conf.hpp>
#include <texture.hpp>
#include <string>
#include <iostream>
#include <deque>
#include <set>
class Scene;
class Node {
public:
Node(std::string name);
Node(std::string name, Object *m);
Node(const NodeConf& conf);
Node(const NodeConf& conf, Object *m);
~Node();
void addChild(Node *n);
void delChild(Node *n);
void addShader(Shader *s);
void delShader(Shader *s);
void bindTexture(Texture *tex);
void unbindTexture();
void bindMaterial(MatConf *mat);
void draw(Shader *shader);
void buildPreOrder(std::deque<std::string>& vec);
void translate(glm::vec3 dv);
void rotate(glm::vec3 dv);
void scale(glm::vec3 dv);
void center(const glm::vec3& v);
Intersection raytrace(const Ray& ray);
void sample(Intersection& ix) const;
protected:
glm::mat4 getLocalModel() const;
bool raytrace(const Ray& ray, Intersection& ix);
void updateLocalModel();
Node *parent;
std::vector<Node*> children;
Object *geometry;
glm::vec3 tx,rot,sc,ctr;
std::string name;
std::set<Shader*> shaders;
Texture *tex;
MatConf *mat;
glm::mat4 localModel, localModelInv;
};
#endif /* NODE_H */