TDME2  1.9.200
Lines.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 
5 #include <tdme/tdme.h>
6 #include <tdme/engine/fwd-tdme.h>
8 #include <tdme/engine/Color4.h>
13 #include <tdme/engine/Entity.h>
14 #include <tdme/engine/Transform.h>
15 #include <tdme/math/Matrix4x4.h>
16 #include <tdme/math/Quaternion.h>
17 #include <tdme/math/Vector3.h>
18 
19 using std::string;
20 
32 
33 /**
34  * Lines entity to be used with engine class
35  * @author Andreas Drewke
36  */
37 class tdme::engine::Lines final: public LinesInternal, public Entity
38 {
39 
40 private:
41  friend class Engine;
42 
43  Engine* engine { nullptr };
44  bool frustumCulling { true };
46 
47  // overridden methods
48  inline void setParentTransform(const Transform& parentTransform) override {
49  LinesInternal::setParentTransform(parentTransform);
50  }
51 
52 public:
53  // forbid class copy
55 
56  /**
57  * Public constructor
58  * @param id id
59  * @param lineWidth line width
60  * @param points points
61  * @param color color
62  * @param colors optional colors
63  * @param texture optional texture
64  */
65  Lines(const string& id, float lineWidth, const vector<Vector3>& points, const Color4& color, const vector<Color4>& colors = {}, Texture* texture = nullptr);
66 
67  // overridden methods
68  inline EntityType getEntityType() override {
69  return ENTITYTYPE_LINES;
70  }
71 
72  void setEngine(Engine* engine) override;
73 
74  inline void setRenderer(Renderer* renderer) override {
75  LinesInternal::setRenderer(renderer);
76  }
77 
78  inline void initialize() override {
79  LinesInternal::initialize();
80  }
81 
82  inline void dispose() override {
83  LinesInternal::dispose();
84  }
85 
86  inline bool isEnabled() override {
87  return LinesInternal::isEnabled();
88  }
89 
90  void setEnabled(bool enabled) override;
91 
92  inline bool isFrustumCulling() override {
93  return frustumCulling;
94  }
95 
96  void setFrustumCulling(bool frustumCulling) override;
97  void update() override;
98 
99  inline BoundingBox* getBoundingBox() override {
100  return LinesInternal::getBoundingBox();
101  }
102 
103  inline BoundingBox* getWorldBoundingBox() override {
104  return LinesInternal::getWorldBoundingBox();
105  }
106 
107  inline const Color4& getEffectColorAdd() const override {
108  return LinesInternal::getEffectColorAdd();
109  }
110 
111  inline void setEffectColorAdd(const Color4& effectColorAdd) override {
112  return LinesInternal::setEffectColorAdd(effectColorAdd);
113  }
114 
115  inline const Color4& getEffectColorMul() const override {
116  return LinesInternal::getEffectColorMul();
117  }
118 
119  inline void setEffectColorMul(const Color4& effectColorMul) override {
120  return LinesInternal::setEffectColorMul(effectColorMul);
121  }
122 
123  inline const string& getId() override {
124  return LinesInternal::getId();
125  }
126 
127  inline bool isContributesShadows() override {
128  return LinesInternal::isContributesShadows();
129  }
130 
131  inline void setContributesShadows(bool contributesShadows) override {
132  LinesInternal::setContributesShadows(contributesShadows);
133  }
134 
135  inline bool isReceivesShadows() override {
136  return LinesInternal::isReceivesShadows();
137  }
138 
139  inline void setReceivesShadows(bool receivesShadows) override {
140  LinesInternal::setReceivesShadows(receivesShadows);
141  }
142 
143  inline bool isPickable() override {
144  return LinesInternal::isPickable();
145  }
146 
147  inline void setPickable(bool pickable) override {
148  LinesInternal::setPickable(pickable);
149  }
150 
151  inline const Vector3& getTranslation() const override {
152  return Transform::getTranslation();
153  }
154 
155  inline void setTranslation(const Vector3& translation) override {
157  }
158 
159  inline const Vector3& getScale() const override {
160  return Transform::getScale();
161  }
162 
163  inline void setScale(const Vector3& scale) override {
165  }
166 
167  inline const int getRotationCount() const override {
169  }
170 
171  inline Rotation& getRotation(const int idx) override {
172  return Transform::getRotation(idx);
173  }
174 
175  inline void addRotation(const Vector3& axis, const float angle) override {
176  Transform::addRotation(axis, angle);
177  }
178 
179  inline void removeRotation(const int idx) override {
181  }
182 
183  inline const Vector3& getRotationAxis(const int idx) const override {
184  return Transform::getRotationAxis(idx);
185  }
186 
187  inline void setRotationAxis(const int idx, const Vector3& axis) override {
188  Transform::setRotationAxis(idx, axis);
189  }
190 
191  inline const float getRotationAngle(const int idx) const override {
192  return Transform::getRotationAngle(idx);
193  }
194 
195  inline void setRotationAngle(const int idx, const float angle) override {
196  Transform::setRotationAngle(idx, angle);
197  }
198 
199  inline const Quaternion& getRotationsQuaternion() const override {
201  }
202 
203  inline const Matrix4x4& getTransformMatrix() const override {
204  return entityTransformMatrix;
205  }
206 
207  inline const Transform& getParentTransform() const override {
208  return parentTransform;
209  }
210 
211  inline const Transform& getTransform() const override {
212  return *this;
213  }
214 
215  void setTransform(const Transform& transform) override;
216 
217  inline RenderPass getRenderPass() const override {
218  return renderPass;
219  }
220 
221  inline void setRenderPass(RenderPass renderPass) override {
222  this->renderPass = renderPass;
223  }
224 
225 };
Color 4 definition class.
Definition: Color4.h:18
Engine main class.
Definition: Engine.h:131
Engine entity.
Definition: Entity.h:30
Lines entity to be used with engine class.
Definition: Lines.h:38
BoundingBox * getBoundingBox() override
Definition: Lines.h:99
const Vector3 & getTranslation() const override
Definition: Lines.h:151
Engine * engine
Definition: Lines.h:43
const Transform & getTransform() const override
Definition: Lines.h:211
RenderPass getRenderPass() const override
Definition: Lines.h:217
void dispose() override
Dispose this entity.
Definition: Lines.h:82
void setTranslation(const Vector3 &translation) override
Set translation.
Definition: Lines.h:155
void removeRotation(const int idx) override
Remove rotation.
Definition: Lines.h:179
Rotation & getRotation(const int idx) override
Get rotation at given index.
Definition: Lines.h:171
RenderPass renderPass
Definition: Lines.h:45
const int getRotationCount() const override
Definition: Lines.h:167
const Vector3 & getRotationAxis(const int idx) const override
Definition: Lines.h:183
void initialize() override
Initiates this entity.
Definition: Lines.h:78
bool isReceivesShadows() override
Definition: Lines.h:135
void setRenderPass(RenderPass renderPass) override
Set render pass.
Definition: Lines.h:221
void setReceivesShadows(bool receivesShadows) override
Enable/disable receives shadows.
Definition: Lines.h:139
void addRotation(const Vector3 &axis, const float angle) override
Add rotation.
Definition: Lines.h:175
void update() override
Update transform.
Definition: Lines.cpp:43
void setPickable(bool pickable) override
Set this entity pickable.
Definition: Lines.h:147
void setEffectColorMul(const Color4 &effectColorMul) override
Set effect color that will be multiplied with fragment color.
Definition: Lines.h:119
bool isPickable() override
Definition: Lines.h:143
void setTransform(const Transform &transform) override
Set transform.
Definition: Lines.cpp:37
const Quaternion & getRotationsQuaternion() const override
Definition: Lines.h:199
void setScale(const Vector3 &scale) override
Set scale.
Definition: Lines.h:163
bool isContributesShadows() override
Definition: Lines.h:127
Lines(const string &id, float lineWidth, const vector< Vector3 > &points, const Color4 &color, const vector< Color4 > &colors={}, Texture *texture=nullptr)
Public constructor.
Definition: Lines.cpp:25
const Vector3 & getScale() const override
Definition: Lines.h:159
const float getRotationAngle(const int idx) const override
Definition: Lines.h:191
BoundingBox * getWorldBoundingBox() override
Definition: Lines.h:103
bool frustumCulling
Definition: Lines.h:44
const Color4 & getEffectColorMul() const override
The effect color will be multiplied with fragment color.
Definition: Lines.h:115
void setFrustumCulling(bool frustumCulling) override
Set frustum culling.
Definition: Lines.cpp:70
void setEngine(Engine *engine) override
Set up engine.
Definition: Lines.cpp:30
void setEnabled(bool enabled) override
Enable/disable rendering.
Definition: Lines.cpp:49
const Transform & getParentTransform() const override
Definition: Lines.h:207
const Matrix4x4 & getTransformMatrix() const override
Definition: Lines.h:203
const string & getId() override
Definition: Lines.h:123
EntityType getEntityType() override
Definition: Lines.h:68
void setContributesShadows(bool contributesShadows) override
Enable/disable contributes shadows.
Definition: Lines.h:131
void setRotationAxis(const int idx, const Vector3 &axis) override
Set rotation axis.
Definition: Lines.h:187
bool isFrustumCulling() override
Definition: Lines.h:92
bool isEnabled() override
Definition: Lines.h:86
void setEffectColorAdd(const Color4 &effectColorAdd) override
Set effect color that will be added to fragment color.
Definition: Lines.h:111
const Color4 & getEffectColorAdd() const override
The effect color will be added to fragment color.
Definition: Lines.h:107
void setParentTransform(const Transform &parentTransform) override
Set parent transform.
Definition: Lines.h:48
void setRenderer(Renderer *renderer) override
Set up renderer.
Definition: Lines.h:74
void setRotationAngle(const int idx, const float angle) override
Definition: Lines.h:195
Rotation representation.
Definition: Rotation.h:18
Texture entity.
Definition: Texture.h:24
Transform which contain scale, rotations and translation.
Definition: Transform.h:29
void setRotationAngle(const int idx, const float angle)
Definition: Transform.h:155
void setRotationAxis(const int idx, const Vector3 &axis)
Set rotation axis.
Definition: Transform.h:138
void setTranslation(const Vector3 &translation)
Set translation.
Definition: Transform.h:64
void removeRotation(const int idx)
Remove rotation.
Definition: Transform.h:121
const Vector3 & getScale() const
Definition: Transform.h:71
Rotation & getRotation(const int idx)
Get rotation at given index.
Definition: Transform.h:95
void setScale(const Vector3 &scale)
Set scale.
Definition: Transform.h:79
const int getRotationCount() const
Definition: Transform.h:86
const Vector3 & getRotationAxis(const int idx) const
Definition: Transform.h:129
const Quaternion & getRotationsQuaternion() const
Definition: Transform.h:162
const Vector3 & getTranslation() const
Definition: Transform.h:56
void addRotation(const Vector3 &axis, const float angle)
Add rotation.
Definition: Transform.h:113
const float getRotationAngle(const int idx) const
Definition: Transform.h:146
Representation of a 3D model.
Definition: Model.h:35
Axis aligned bounding box used for frustum, this is not directly connectable with physics engine.
Definition: BoundingBox.h:26
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Definition: Matrix4x4.h:23
Quaternion class representing quaternion mathematical structure and operations with x,...
Definition: Quaternion.h:24
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Definition: Vector3.h:20
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6