77 #if __cplusplus >= 201103L
114 void clearObject3d(
void);
124 void updateMatrix(
void);
129 void computeLocalMatrix(
void);
141 void unlinkChildren(
void);
146 void computeChildrenMatrices(
void);
155 m_attributes[name] = variable;
165 return m_attributes[name];
221 return m_matrix * vector;
228 void setPosition(
const Vector3& position);
241 m_position += (local ? (vec + getTransformedVector(vec)) : vec);
242 m_needToUpdate =
true;
257 addAxisAngleRotation((local) ? (getInverseRotatedVector(axis)) : axis,
283 void setEulerRotation(
const Vector3& euler);
295 void setAxisAngleRotation(
const Vector3& axis,
float angle);
307 void addAxisAngleRotation(
const Vector3& axis,
float angle);
345 void setScale(
const Vector3& scale);
398 inline bool hasParent(
void) {
return (m_parent != NULL); }
424 unsigned long getId() {
return m_id; }
430 void setId(
unsigned long id) { m_id = id; }
435 void updateBehaviors(
void);
440 void drawBehaviors(
void);
446 void deleteBehavior(
unsigned int id);
453 void invertBehavior(
unsigned int idA,
unsigned int idB);
460 void changeBehavior(
unsigned int id,
Behavior* behavior);
471 m_behaviors.push_back(behavior);
497 virtual void setActive(
bool active) { m_isActive = active; }
514 inline void setVisible(
bool visible) { m_isVisible = visible; }
537 void setName(
const char* name);
554 virtual void update(
void);
Definition: Object3d.h:100
Quaternion getRotation(void) const
Returns the rotation of the object.
Definition: Object3d.h:339
Vector3 getRotatedVector3(const Vector3 &vec) const
Definition: Matrix4x4.h:144
Object3d * m_parent
Definition: Object3d.h:93
Vector3 getTransformedScale(void) const
Returns the transformed scale of the object.
Definition: Object3d.h:351
unsigned int getBehaviorsNumber(void)
Returns the number of registered Behaviors.
Definition: Object3d.h:478
bool hasParent(void)
Checks if the object has a parent.
Definition: Object3d.h:398
String m_name
The name of the object.
Definition: Object3d.h:59
Quaternion m_rotation
The rotation.
Definition: Object3d.h:68
virtual void setActive(bool active)
Changes if the object is being active or inactive.
Definition: Object3d.h:497
Behavior * getBehavior(unsigned int id)
Returns the Behavior with the given ID.
Definition: Object3d.h:485
bool m_isActive
Definition: Object3d.h:86
Matrix4x4 * getMatrix(void)
Returns the current matrix.
Definition: Object3d.h:136
Vector3 getTransformedVector(const Vector3 &vector) const
Transforms the given vector using the internal matrix.
Definition: Object3d.h:219
Vector3 getTransformedRotation(void) const
Returns the transformed rotation.
Definition: Object3d.h:320
Matrix4x4 getInverse(void) const
Vector3 getPosition(void) const
Returns the position as a Vector3.
Definition: Object3d.h:275
virtual int getType(void)
Returns the type of the object.
Definition: Object3d.h:549
Vector3 getScale(void) const
vector< Object3d * > m_children
List of children.
Definition: Object3d.h:74
Vector3 getEulerRotation(void) const
Returns the Euler rotation in a Vector3 in degrees.
Definition: Object3d.h:329
Definition: Matrix4x4.h:31
Vector3 getScale(void) const
Returns the scale of the object.
Definition: Object3d.h:360
Matrix4x4 m_matrix
The matrix.
Definition: Object3d.h:71
Vector3 getInversePosition(const Vector3 &position) const
Multiplies the inverse matrix with the given vector and return the result.
Definition: Object3d.h:206
NeoVariable getAttribute(const char *name)
Returns the value of the attribute variable with the given name.
Definition: Object3d.h:163
Implements a framework for string manipulation that operates directly on C strings.
Definition: NeoString.h:35
void rotate(const Vector3 &axis, float angle, bool local=false)
Rotates the object.
Definition: Object3d.h:255
float entries[16]
Definition: Matrix4x4.h:35
void setVisible(bool visible)
Changes if the object is visible or not.
Definition: Object3d.h:514
void setAdditionalData(AdditionalData *d)
Definition: Object3d.h:119
void setParent(Object3d *object)
Sets the parent object.
Definition: Object3d.h:386
Object3d * getParent(void)
Returns the parent object.
Definition: Object3d.h:410
Definition: NeoEngine.h:44
Vector3 getRotatedVector(const Vector3 &vector) const
Rotates the given vector and returns the result.
Definition: Object3d.h:192
Vector3 getInverseRotatedVector(const Vector3 &vector) const
Calculates the inverse rotated vector.
Definition: Object3d.h:182
vector< Behavior * > m_behaviors
List of behaviors.
Definition: Object3d.h:96
Vector3 getEulerAngles(void) const
unsigned long m_id
Definition: Object3d.h:90
void setAttribute(const char *name, NeoVariable variable)
Sets the value of the attribute with the given name.
Definition: Object3d.h:153
The Object3d class represents a general object in a 3D scene.
Definition: Object3d.h:43
const char * getSafeString(void)
Returns the C string. This method is ensured to return a valid C string and never NULL...
Vector3 getEulerAngles(void) const
map< string, NeoVariable > m_attributes
Definition: Object3d.h:82
void addBehavior(Behavior *behavior)
Adds a new behavior to the list of behaviors.
Definition: Object3d.h:469
const char * getName(void)
Returns the object name.
Definition: Object3d.h:543
void addChild(Object3d *child)
Adds an Object3d to the list of children.
Definition: Object3d.h:392
Object3d * getChild(unsigned int id)
Returns the child with the given ID.
Definition: Object3d.h:418
unordered_map< string, NeoVariable > m_attributes
Definition: Object3d.h:79
void translate(const Vector3 &vec, bool local=false)
Translates the object.
Definition: Object3d.h:239
unsigned long getId()
Returns the ID of the object.
Definition: Object3d.h:424
Vector3 getInverseRotatedVector3(const Vector3 &vec) const
bool m_isVisible
Definition: Object3d.h:87
bool isActive(void)
Checks if the object is active.
Definition: Object3d.h:503
unordered_map< string, NeoVariable >::iterator AttributeIterator
Definition: Object3d.h:78
bool needToUpdate(void)
Checks if the object needs to be updated.
Definition: Object3d.h:491
Vector3 m_scale
The scale.
Definition: Object3d.h:65
Vector3 getTransformedPosition(void) const
Returns the transformed position directly from the internal matrix.
Definition: Object3d.h:265
void setId(unsigned long id)
Changes the ID of the object.
Definition: Object3d.h:430
unsigned int getChildrenNumber(void)
Returns the number of children.
Definition: Object3d.h:404
map< string, NeoVariable >::iterator AttributeIterator
Definition: Object3d.h:81
Vector3 m_position
The positopm.
Definition: Object3d.h:62
Definition: Quaternion.h:31
AdditionalData * getAdditionalData()
Definition: Object3d.h:118
The NeoVariable class defines a variable that can be of any type available in M_VARIABLE_TYPE.
Definition: PointerVariable.h:55
bool m_needToUpdate
Definition: Object3d.h:88
The Behavior class is an abstraction for creating behaviors.
Definition: Behavior.h:39
virtual void updateVisibility(OCamera *camera)
Recalculates visibility for the given camera.
Definition: Object3d.h:529
bool isVisible(void)
Checks if the object is visible.
Definition: Object3d.h:521