forked from noodlecollie/calliper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sceneobject.h
85 lines (64 loc) · 2.04 KB
/
sceneobject.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
#ifndef SCENEOBJECT_H
#define SCENEOBJECT_H
#include "hierarchicalobject.h"
#include <QScopedPointer>
#include "geometrydata.h"
#include <QMatrix4x4>
#include "eulerangle.h"
#include "boundingbox.h"
class BaseScene;
class ShaderStack;
class SceneObject : public HierarchicalObject
{
Q_OBJECT
friend class BaseScene;
public:
enum RenderFlag
{
NoRenderFlag = 0x0,
Translucent = 0x1,
};
Q_DECLARE_FLAGS(RenderFlags, RenderFlag)
Q_FLAG(RenderFlags)
explicit SceneObject(SceneObject *parent = 0);
explicit SceneObject(const QJsonObject &serialisedData, SceneObject* parent = 0);
virtual ~SceneObject();
// Object name is not cloned.
virtual SceneObject* clone() const;
SceneObject* parentObject() const;
QList<SceneObject*> children() const;
BaseScene* scene() const;
// The SceneObject owns its geometry.
// Any old geometry that is replaced will be deleted.
GeometryData* geometry() const;
void setGeometry(GeometryData* data);
// Empty => This object has no geometry
// (=> it's just for grouping children)
bool isEmpty() const;
virtual bool editable() const;
virtual void draw(ShaderStack* stack);
RenderFlags renderFlags() const;
void setRenderFlags(RenderFlags flags);
// Computes bounds in local space.
BoundingBox computeLocalBounds() const;
bool hidden() const;
void setHidden(bool hide);
virtual bool serialiseToJson(QJsonObject &obj) const;
virtual QString serialiseIdentifier() const;
// False by default.
bool shouldSerialiseGeometry() const;
void setShouldSerialiseGeometry(bool enabled);
signals:
public slots:
protected:
explicit SceneObject(const SceneObject &cloneFrom);
QScopedPointer<GeometryData> m_pGeometry;
BaseScene* m_pScene;
RenderFlags m_RenderFlags;
bool m_bHidden;
bool m_bSerialiseGeometry;
private:
void initDefaults(SceneObject* parent);
};
Q_DECLARE_OPERATORS_FOR_FLAGS(SceneObject::RenderFlags)
#endif // SCENEOBJECT_H