-
Notifications
You must be signed in to change notification settings - Fork 0
/
SceneNode.hpp
61 lines (40 loc) · 1.17 KB
/
SceneNode.hpp
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
#pragma once
#include "Material.hpp"
#include <glm/glm.hpp>
#include <list>
#include <string>
#include <iostream>
#include "Ray.hpp"
enum class NodeType {
SceneNode,
GeometryNode,
JointNode
};
class SceneNode {
public:
SceneNode(const std::string & name);
SceneNode(const SceneNode & other);
virtual ~SceneNode();
int totalSceneNodes() const;
const glm::mat4& get_transform() const;
const glm::mat4& get_inverse() const;
void set_transform(const glm::mat4& m);
void add_child(SceneNode* child);
void remove_child(SceneNode* child);
//-- Transformations:
void rotate(char axis, float angle);
void scale(const glm::vec3& amount);
void translate(const glm::vec3& amount);
friend std::ostream & operator << (std::ostream & os, const SceneNode & node);
// Transformations
glm::mat4 trans;
glm::mat4 invtrans;
std::list<SceneNode*> children;
NodeType m_nodeType;
std::string m_name;
unsigned int m_nodeId;
virtual bool intersect(Ray &ray, float closet, float fart, Intersection &intersection);
private:
// The number of SceneNode instances.
static unsigned int nodeInstanceCount;
};