Jopnal Engine  alpha 0.4
Simple Component Based 2D/3D Game Engine
Public Types | Public Member Functions | Friends | List of all members
jop::Object Class Reference

#include <Object.hpp>

Inheritance diagram for jop::Object:
jop::SafeReferenceable< Object > jop::SerializeInfo jop::Scene

Public Types

enum  TransformRestriction : uint32 {
  TranslationX = 1 << 10, TranslationY = 1 << 11, TranslationZ = 1 << 12, Translation = TranslationX | TranslationY | TranslationZ,
  ScaleX = 1 << 13, ScaleY = 1 << 14, ScaleZ = 1 << 15, Scale = ScaleX | ScaleY | ScaleZ,
  Rotation = 1 << 16, IgnoreParent = Translation | Scale | Rotation
}
 

Public Member Functions

 Object (const std::string &ID)
 Constructor. More...
 
 Object (const Object &other, const std::string &newID, const Transform::Variables &newTransform)
 Copy constructor. More...
 
 Object (Object &&other)
 Move constructor. More...
 
Objectoperator= (Object &&other)
 Move assignment operator. More...
 
 ~Object ()
 Destructor. More...
 
std::vector< std::unique_ptr< Component > > & getComponents ()
 Get all components. More...
 
const std::vector< std::unique_ptr< Component > > & getComponents () const
 Get all components. More...
 
template<typename T >
T * getComponent ()
 Get a component using type info. More...
 
template<typename T >
const T * getComponent () const
 Get a component using type info. More...
 
template<typename T >
T * getComponent (const uint32 ID)
 Get a component using component ID and type info. More...
 
template<typename T >
const T * getComponent (const uint32 ID) const
 Get a component using component ID and type info. More...
 
template<typename T , typename... Args>
T & createComponent (Args &&...args)
 Create a component. More...
 
template<typename T >
T * cloneComponent (Object &object, const uint32 ID=0) const
 Clone a component. More...
 
ObjectremoveComponents (const uint32 ID)
 Remove components. More...
 
template<typename T >
ObjectremoveComponent (const uint32 ID=0)
 Remove a component. More...
 
ObjectclearComponents ()
 Remove all components. More...
 
unsigned int componentCount () const
 Get amount of components. More...
 
WeakReference< ObjectcreateChild (const std::string &ID)
 Create a new child. More...
 
WeakReference< ObjectadoptChild (Object &child)
 Adopt a child. More...
 
std::vector< Object > & getChildren ()
 Get all children. More...
 
const std::vector< Object > & getChildren () const
 Get all children. More...
 
WeakReference< ObjectcloneChild (const std::string &ID, const std::string &clonedID)
 Clone a child with the given id. More...
 
WeakReference< ObjectcloneChild (const std::string &ID, const std::string &clonedID, const Transform::Variables &newTransform)
 Clone a child with the given id. More...
 
ObjectremoveChildren (const std::string &ID)
 Remove children with the given identifier. More...
 
ObjectremoveChildrenWithTag (const std::string &tag, const bool recursive)
 Remove all children with the given tag. More...
 
ObjectreserveChildren (const uint32 size)
 Reserve memory for children. More...
 
ObjectclearChildren ()
 Remove all children. More...
 
void removeSelf ()
 Mark this to be removed. More...
 
WeakReference< ObjectcloneSelf ()
 Clone/instantiate this object. More...
 
WeakReference< ObjectcloneSelf (const std::string &newID)
 Clone/instantiate this object. More...
 
WeakReference< ObjectcloneSelf (const std::string &newID, const Transform::Variables &newTransform)
 Clone/instantiate this object. More...
 
bool isRemoved () const
 Check if this object has been marked to be removed. More...
 
unsigned int childCount () const
 Get amount of children. More...
 
unsigned int childCountRecursive () const
 Get amount of children recursively. More...
 
WeakReference< ObjectgetParent () const
 Get this object's parent. More...
 
WeakReference< ObjectsetParent (Object &newParent)
 Set a new parent. More...
 
ScenegetScene ()
 Get the scene this objects is bound to. More...
 
const ScenegetScene () const
 Get the scene this objects is bound to. More...
 
Message::Result sendMessage (const Message &message)
 Send a message. More...
 
WeakReference< ObjectfindChild (const std::string &ID, const bool recursive=false, const bool strict=true) const
 Find a child. More...
 
std::vector< WeakReference< Object > > findChildren (const std::string &ID, const bool recursive, const bool strict) const
 Find all children matching the criteria. More...
 
std::vector< WeakReference< Object > > findChildrenWithTag (const std::string &tag, const bool recursive) const
 Find children with a tag. More...
 
WeakReference< ObjectfindChildWithPath (const std::string &path) const
 Find child with a search path. More...
 
std::string makeSearchPath () const
 Make a string path through this object's parents. More...
 
ObjectsetActive (const bool active)
 Set this object active/inactive. More...
 
bool isActive () const
 Check if this object is active. More...
 
const std::string & getID () const
 Get this object's identifier. More...
 
ObjectsetID (const std::string &ID)
 Set the identifier. More...
 
ObjectaddTag (const std::string &tag)
 Add a tag. More...
 
ObjectremoveTag (const std::string &tag)
 Remove a tag. More...
 
ObjectclearTags ()
 Clear tags. More...
 
bool hasTag (const std::string &tag) const
 Check if this object has a tag. More...
 
void update (const float deltaTime)
 Update. More...
 
void printDebugTree () const
 Print the tree of objects into the console, this object as root. More...
 
const TransformgetTransform () const
 Get the transform. More...
 
const TransformgetInverseTransform () const
 Get the inverse transform. More...
 
const Transform::VariablesgetLocalTransformVars () const
 Get the local transformation variables. More...
 
const Transform::VariablesgetGlobalTransformVars () const
 Get the global transformation variables. More...
 
ObjectsetRotation (const float x, const float y, const float z)
 Set the rotation. More...
 
ObjectsetRotation (const glm::vec3 &rotation)
 Set the rotation. More...
 
ObjectsetRotation (const float angle, const glm::vec3 &axis)
 Set the rotation using angle-axis. More...
 
ObjectsetRotation (const glm::quat &rotation)
 Set the rotation. More...
 
const glm::quat & getLocalRotation () const
 Get the local rotation. More...
 
const glm::quat & getGlobalRotation () const
 Get the global rotation. More...
 
glm::vec3 getGlobalFront () const
 Get the global front vector. More...
 
glm::vec3 getGlobalRight () const
 Get the global right vector. More...
 
glm::vec3 getGlobalUp () const
 Get the global up vector. More...
 
glm::vec3 getLocalFront () const
 Get the local front vector. More...
 
glm::vec3 getLocalRight () const
 Get the local right vector. More...
 
glm::vec3 getLocalUp () const
 Get the local up vector. More...
 
ObjectsetScale (const float x, const float y, const float z)
 Set the scale. More...
 
ObjectsetScale (const glm::vec3 &scale)
 Set the scale. More...
 
ObjectsetScale (const float delta)
 Set the scale. More...
 
const glm::vec3 & getLocalScale () const
 Get the local scale. More...
 
const glm::vec3 & getGlobalScale () const
 Get the global scale. More...
 
ObjectsetPosition (const float x, const float y, const float z)
 Set the position. More...
 
ObjectsetPosition (const glm::vec3 &position)
 Set the position. More...
 
const glm::vec3 & getLocalPosition () const
 Get the local position. More...
 
const glm::vec3 & getGlobalPosition () const
 Get the global position. More...
 
ObjectlookAt (const glm::vec3 &point)
 Set this transform to look at a certain point. More...
 
ObjectlookAt (const glm::vec3 &point, const glm::vec3 &up)
 Set this transform to look at a certain point. More...
 
ObjectlookAt (const float x, const float y, const float z)
 Set this transform to look at a certain point. More...
 
Objectmove (const float x, const float y, const float z)
 Move this object. More...
 
Objectmove (const glm::vec3 &offset)
 Move this object. More...
 
Objectrotate (const float x, const float y, const float z)
 Rotate this object. More...
 
Objectrotate (const glm::quat &rotation)
 Rotate this object. More...
 
Objectrotate (const glm::vec3 &rotation)
 Rotate this object. More...
 
Objectrotate (const float angle, const glm::vec3 &axis)
 Rotate this object using an axis-angle. More...
 
Objectscale (const float x, const float y, const float z)
 Scale this object. More...
 
Objectscale (const glm::vec3 &scale)
 Scale this object. More...
 
Objectscale (const float delta)
 Scale this object. More...
 
ObjectsetIgnoreParent (const bool ignore)
 Set this node to ignore its parent. More...
 
bool ignoresParent () const
 Check if this node ignores its parent. More...
 
ObjectsetIgnoreTransform (const uint32 flags)
 Set transform restriction flags. More...
 
bool ignoresTransform (const uint32 flag) const
 Check if a transform restriction has been set. More...
 
- Public Member Functions inherited from jop::SafeReferenceable< Object >
WeakReference< ObjectgetReference () const
 Get a weak reference to the bound object. More...
 
- Public Member Functions inherited from jop::SerializeInfo
 SerializeInfo ()
 
void setSerializePackage (const uint16 package)
 
uint16 getSerializePackage () const
 
void setShouldSerialize (const bool set)
 
bool shouldSerialize () const
 
void setLightSerializeable (const bool set)
 
bool isLightSerializeable () const
 

Friends

class SceneLoader
 
class Component
 

Additional Inherited Members

- Protected Member Functions inherited from jop::SafeReferenceable< Object >
 SafeReferenceable (Object *ref)
 Constructor. More...
 
 SafeReferenceable (SafeReferenceable< Object > &&other)
 Move constructor. More...
 
SafeReferenceableoperator= (SafeReferenceable< Object > &&other)
 Move assignment operator. More...
 
 ~SafeReferenceable ()
 Protected destructor. More...
 

Detailed Description

Definition at line 43 of file Object.hpp.

Member Enumeration Documentation

Transformation restrictions

Enumerator
TranslationX 

Translation on the X axis.

TranslationY 

Translation on the Y axis.

TranslationZ 

Translation on the Z axis.

Translation 

Translation on all axes.

ScaleX 

Scale on the X axis.

ScaleY 

Scale on the Y axis.

ScaleZ 

Scale on the Z axis.

Scale 

Scale on all axes.

Rotation 

Rotation on all axes.

IgnoreParent 

Ignore parent transform completely.

Definition at line 73 of file Object.hpp.

Constructor & Destructor Documentation

jop::Object::Object ( const std::string &  ID)

Constructor.

Parameters
IDObject identifier
jop::Object::Object ( const Object other,
const std::string &  newID,
const Transform::Variables newTransform 
)

Copy constructor.

Parameters
otherThe other object to copy
newIDThe ID of the new object
newTransformThe transform values of the new object
jop::Object::Object ( Object &&  other)

Move constructor.

jop::Object::~Object ( )

Destructor.

Member Function Documentation

Object& jop::Object::addTag ( const std::string &  tag)

Add a tag.

Parameters
tagThe tag to add
Returns
Reference to self
This method is exposed as command named addTag
WeakReference<Object> jop::Object::adoptChild ( Object child)

Adopt a child.

This will move the child onto this object and remove it from its old parent. If the child's parent is equal to this, this function does nothing.

Parameters
childThe child to adopt
Returns
Reference to the adopted child. The old reference will become invalid
This method is exposed as command named adoptChild
unsigned int jop::Object::childCount ( ) const

Get amount of children.

Returns
Amount of children
unsigned int jop::Object::childCountRecursive ( ) const

Get amount of children recursively.

Returns
Amount of children, summed recursively
Object& jop::Object::clearChildren ( )

Remove all children.

The children will be removed immediately.

Returns
Reference to self
This method is exposed as command named clearChildren
Object& jop::Object::clearComponents ( )

Remove all components.

Returns
Reference to self
This method is exposed as command named clearComponents
Object& jop::Object::clearTags ( )

Clear tags.

Returns
Reference to self
This method is exposed as command named clearTags
WeakReference<Object> jop::Object::cloneChild ( const std::string &  ID,
const std::string &  clonedID 
)

Clone a child with the given id.

The child object, if successfully cloned, will be added to the internal array and then returned.

Parameters
IDThe ID to search with
clonedIDThe ID of the cloned object
Returns
Reference to the newly cloned child object if the object was found, empty otherwise
This method is exposed as command named cloneChild
WeakReference<Object> jop::Object::cloneChild ( const std::string &  ID,
const std::string &  clonedID,
const Transform::Variables newTransform 
)

Clone a child with the given id.

The child object, if successfully cloned, will be added to the internal array and then returned.

Parameters
IDThe ID to search with
clonedIDThe ID of the cloned object
Returns
Reference to the newly cloned child object if the object was found, empty otherwise
This method is exposed as command named cloneChild
Parameters
newTransformNew transform for the cloned child
template<typename T >
T* jop::Object::cloneComponent ( Object object,
const uint32  ID = 0 
) const

Clone a component.

Parameters
objectNew object for the cloned component
IDIdentifier of the component to clone
Returns
Pointer to the cloned component. nullptr if not found
WeakReference<Object> jop::Object::cloneSelf ( )

Clone/instantiate this object.

The same ID and transform will be used.

Returns
Reference to the cloned object
WeakReference<Object> jop::Object::cloneSelf ( const std::string &  newID)

Clone/instantiate this object.

The same transform will be used.

Parameters
newIDThe ID of the cloned object
Returns
Reference to the cloned object
WeakReference<Object> jop::Object::cloneSelf ( const std::string &  newID,
const Transform::Variables newTransform 
)

Clone/instantiate this object.

Parameters
newIDThe ID of the cloned object
newTransformThe transform of the cloned object
Returns
Reference to the cloned object
unsigned int jop::Object::componentCount ( ) const

Get amount of components.

Returns
Amount of components
WeakReference<Object> jop::Object::createChild ( const std::string &  ID)

Create a new child.

Parameters
IDId for the new child object
Returns
Reference to the newly created child
This method is exposed as command named createChild
template<typename T , typename... Args>
T& jop::Object::createComponent ( Args &&...  args)

Create a component.

Parameters
argsArguments to use with construction
Returns
Reference to the newly created component
WeakReference<Object> jop::Object::findChild ( const std::string &  ID,
const bool  recursive = false,
const bool  strict = true 
) const

Find a child.

Parameters
IDObject identifier
recursiveSearch recursively?
strictDoes the ID have to match exactly?
Returns
Reference to the child, empty if not found
std::vector<WeakReference<Object> > jop::Object::findChildren ( const std::string &  ID,
const bool  recursive,
const bool  strict 
) const

Find all children matching the criteria.

When ID is empty and strict is false, all children will be returned.

Parameters
IDObject identifier
recursiveSearch recursively?
strictDoes the ID have to match exactly?
Returns
Vector with all the found children, empty if none were found
std::vector<WeakReference<Object> > jop::Object::findChildrenWithTag ( const std::string &  tag,
const bool  recursive 
) const

Find children with a tag.

Parameters
tagObject identifier
recursiveSearch recursively?
Returns
Vector with all the found children, empty if none were found
WeakReference<Object> jop::Object::findChildWithPath ( const std::string &  path) const

Find child with a search path.

Parameters
pathSearch path
Returns
Reference to the child, empty if not found
See also
makeSearchPath()
std::vector<Object>& jop::Object::getChildren ( )

Get all children.

Returns
Reference to the internal vector with the children
const std::vector<Object>& jop::Object::getChildren ( ) const

Get all children.

Returns
Reference to the internal vector with the children
template<typename T >
T* jop::Object::getComponent ( )

Get a component using type info.

Returns
Pointer to the component. nullptr if not found
template<typename T >
const T* jop::Object::getComponent ( ) const

Get a component using type info.

Returns
Pointer to the component. nullptr if not found
template<typename T >
T* jop::Object::getComponent ( const uint32  ID)

Get a component using component ID and type info.

Parameters
IDThe identifier to search with
Returns
Pointer to the component. nullptr if not found
template<typename T >
const T* jop::Object::getComponent ( const uint32  ID) const

Get a component using component ID and type info.

Parameters
IDThe identifier to search with
Returns
Pointer to the component. nullptr if not found
std::vector<std::unique_ptr<Component> >& jop::Object::getComponents ( )

Get all components.

Returns
Reference to the internal vector with the components
const std::vector<std::unique_ptr<Component> >& jop::Object::getComponents ( ) const

Get all components.

Returns
Reference to the internal vector with the components
glm::vec3 jop::Object::getGlobalFront ( ) const

Get the global front vector.

Returns
The global front vector
const glm::vec3& jop::Object::getGlobalPosition ( ) const

Get the global position.

Returns
The global position
glm::vec3 jop::Object::getGlobalRight ( ) const

Get the global right vector.

Returns
The global right vector
const glm::quat& jop::Object::getGlobalRotation ( ) const

Get the global rotation.

Returns
The global rotation
const glm::vec3& jop::Object::getGlobalScale ( ) const

Get the global scale.

Returns
The global scale
const Transform::Variables& jop::Object::getGlobalTransformVars ( ) const

Get the global transformation variables.

Returns
Reference to the internal variables
glm::vec3 jop::Object::getGlobalUp ( ) const

Get the global up vector.

Returns
The global up vector
const std::string& jop::Object::getID ( ) const

Get this object's identifier.

Returns
Reference to the internal id string
See also
setID()
const Transform& jop::Object::getInverseTransform ( ) const

Get the inverse transform.

Returns
Reference to the internal inverse transform
glm::vec3 jop::Object::getLocalFront ( ) const

Get the local front vector.

Returns
The local front vector
const glm::vec3& jop::Object::getLocalPosition ( ) const

Get the local position.

Returns
The local position
glm::vec3 jop::Object::getLocalRight ( ) const

Get the local right vector.

Returns
The local right vector
const glm::quat& jop::Object::getLocalRotation ( ) const

Get the local rotation.

Returns
The local rotation
const glm::vec3& jop::Object::getLocalScale ( ) const

Get the local scale.

Returns
Vector with the scale
const Transform::Variables& jop::Object::getLocalTransformVars ( ) const

Get the local transformation variables.

Returns
Reference to the internal variables
glm::vec3 jop::Object::getLocalUp ( ) const

Get the local up vector.

Returns
The local up vector
WeakReference<Object> jop::Object::getParent ( ) const

Get this object's parent.

If the result is empty, it means that this object is a scene.

Returns
Reference to the parent
Scene& jop::Object::getScene ( )

Get the scene this objects is bound to.

You should avoid calling this when you can use Engine::getCurrentScene() or Engine::getSharedScene().

Returns
Reference to the scene
const Scene& jop::Object::getScene ( ) const

Get the scene this objects is bound to.

You should avoid calling this when you can use Engine::getCurrentScene() or Engine::getSharedScene().

Returns
Reference to the scene
const Transform& jop::Object::getTransform ( ) const

Get the transform.

Returns
Reference to the internal transform
bool jop::Object::hasTag ( const std::string &  tag) const

Check if this object has a tag.

Parameters
tagThe tag to check
Returns
True if found
bool jop::Object::ignoresParent ( ) const

Check if this node ignores its parent.

Returns
True if ignores parent
bool jop::Object::ignoresTransform ( const uint32  flag) const

Check if a transform restriction has been set.

You should only check a single flag at a time.

Parameters
flagThe flag to check
Returns
True if the flag is set
bool jop::Object::isActive ( ) const

Check if this object is active.

Returns
True if active
bool jop::Object::isRemoved ( ) const

Check if this object has been marked to be removed.

Returns
True if this is to be removed
Object& jop::Object::lookAt ( const glm::vec3 &  point)

Set this transform to look at a certain point.

The rotation is applied locally. If you want to set the rotation to point at an absolute world position, use setIgnoreTransform() to restrict the rotation.

This overload will use Transform::Up as the up vector.

Parameters
pointThe point to look at
Returns
Reference to self
Object& jop::Object::lookAt ( const glm::vec3 &  point,
const glm::vec3 &  up 
)

Set this transform to look at a certain point.

The rotation is applied locally. If you want to set the rotation to point at an absolute world position, use setIgnoreTransform() to restrict the rotation.

This overload will use Transform::Up as the up vector.

Parameters
pointThe point to look at
Returns
Reference to self
Parameters
upCustom up vector
Object& jop::Object::lookAt ( const float  x,
const float  y,
const float  z 
)

Set this transform to look at a certain point.

Parameters
xThe X point
yThe Y point
zThe Z point
Returns
Reference to self
std::string jop::Object::makeSearchPath ( ) const

Make a string path through this object's parents.

The path will be in the following format: GrandParent>Parent>ThisObject. Due to how the format works, the character '>' in an object ID is forbidden.

Returns
String with the path
See also
findChildWithPath()
Object& jop::Object::move ( const float  x,
const float  y,
const float  z 
)

Move this object.

Parameters
xThe X offset
yThe Y offset
zThe Z offset
Returns
Reference to self
Object& jop::Object::move ( const glm::vec3 &  offset)

Move this object.

Parameters
offsetThe movement offset
Returns
Reference to self
Object& jop::Object::operator= ( Object &&  other)

Move assignment operator.

Returns
Reference to self
void jop::Object::printDebugTree ( ) const

Print the tree of objects into the console, this object as root.

Object& jop::Object::removeChildren ( const std::string &  ID)

Remove children with the given identifier.

The children will actually be removed only at the beginning of the next update call.

Parameters
IDThe id to search with
Returns
Reference to self
This method is exposed as command named removeChildren
Object& jop::Object::removeChildrenWithTag ( const std::string &  tag,
const bool  recursive 
)

Remove all children with the given tag.

The children will actually be removed only at the beginning of the next update call.

Parameters
tagThe tag to search with
recursiveSearch recursively?
Returns
Reference to self
template<typename T >
Object& jop::Object::removeComponent ( const uint32  ID = 0)

Remove a component.

Parameters
IDThe ID to search with
Returns
Reference to self
Object& jop::Object::removeComponents ( const uint32  ID)

Remove components.

All components matching the identifier will be removed

Parameters
IDThe ID to search with
Returns
Reference to self
This method is exposed as command named removeComponents
void jop::Object::removeSelf ( )

Mark this to be removed.

The object will be actually removed at the beginning of the next update call.

This method is exposed as command named removeSelf
Object& jop::Object::removeTag ( const std::string &  tag)

Remove a tag.

Parameters
tagThe tag to be removed
Returns
Reference to self
This method is exposed as command named removeTag
Object& jop::Object::reserveChildren ( const uint32  size)

Reserve memory for children.

Reallocates children if param size is greater than currently reserved size. It's recommended to call tis before adding a large amount of children.

Parameters
sizeSize to reserve
Returns
Reference to self
Object& jop::Object::rotate ( const float  x,
const float  y,
const float  z 
)

Rotate this object.

Parameters
xThe X offset
yThe Y offset
zThe Z offset
Returns
Reference to self
Object& jop::Object::rotate ( const glm::quat &  rotation)

Rotate this object.

Parameters
rotationThe rotation offset
Returns
Reference to self
Object& jop::Object::rotate ( const glm::vec3 &  rotation)

Rotate this object.

Parameters
rotationThe rotation offset
Returns
Reference to self
Object& jop::Object::rotate ( const float  angle,
const glm::vec3 &  axis 
)

Rotate this object using an axis-angle.

Parameters
angleThe angle
axisThe axis
Returns
Reference to self
Object& jop::Object::scale ( const float  x,
const float  y,
const float  z 
)

Scale this object.

Parameters
xThe X multiplier
yThe Y multiplier
zThe Z multiplier
Returns
Reference to self
Object& jop::Object::scale ( const glm::vec3 &  scale)

Scale this object.

Parameters
scaleThe scale multiplier
Returns
Reference to self
Object& jop::Object::scale ( const float  delta)

Scale this object.

This call is equal to scale(delta, delta, delta).

Parameters
deltaThe scale multiplier
Returns
Reference to self
Message::Result jop::Object::sendMessage ( const Message message)

Send a message.

The message will be forwarded to children and components.

Parameters
messageThe message
Returns
The message result
Object& jop::Object::setActive ( const bool  active)

Set this object active/inactive.

Parameters
activeTrue to set active
Returns
Reference to self
This method is exposed as command named setActive
Object& jop::Object::setID ( const std::string &  ID)

Set the identifier.

The character '>' in an object identifier is forbidden.

Parameters
IDObject identifier
Returns
Reference to self
This method is exposed as command named setID
Object& jop::Object::setIgnoreParent ( const bool  ignore)

Set this node to ignore its parent.

Objects that ignore their parent will not take into account the parent's transformation.

Parameters
ignoreThe flag to set
Returns
Reference to self
Object& jop::Object::setIgnoreTransform ( const uint32  flags)

Set transform restriction flags.

Use this function to ignore certain global transformations. The local transformation values remain unaffected.

Parameters
flagsThe flags to set
Returns
Reference to self
See also
TransformRestriction
WeakReference<Object> jop::Object::setParent ( Object newParent)

Set a new parent.

This is equivalent to calling newParent.adoptChild(this)

Parameters
newParentThe new parent
Returns
Reference to this. The old reference will become invalid
This method is exposed as command named setParent
Object& jop::Object::setPosition ( const float  x,
const float  y,
const float  z 
)

Set the position.

Parameters
xThe X component
yThe Y component
zThe Z component
Returns
Reference to self
Object& jop::Object::setPosition ( const glm::vec3 &  position)

Set the position.

Parameters
positionVector with the position to set
Returns
Reference to self
Object& jop::Object::setRotation ( const float  x,
const float  y,
const float  z 
)

Set the rotation.

Parameters
xThe X angle
yThe Y angle
zThe Z angle
Returns
Reference to self
Object& jop::Object::setRotation ( const glm::vec3 &  rotation)

Set the rotation.

Parameters
rotationRotation vector in euler angles
Returns
Reference to self
Object& jop::Object::setRotation ( const float  angle,
const glm::vec3 &  axis 
)

Set the rotation using angle-axis.

Parameters
angleThe angle
axisThe axis
Returns
Reference to self
Object& jop::Object::setRotation ( const glm::quat &  rotation)

Set the rotation.

Parameters
rotationQuaternion with the rotation to set
Returns
Reference to self
Object& jop::Object::setScale ( const float  x,
const float  y,
const float  z 
)

Set the scale.

1.f means the original scale.

Parameters
xThe X component
yThe Y component
zThe Z component
Returns
Reference to self
Object& jop::Object::setScale ( const glm::vec3 &  scale)

Set the scale.

Parameters
scaleVector with the scale to set
Returns
Reference to self
Object& jop::Object::setScale ( const float  delta)

Set the scale.

This call is equal to setScale(delta, delta, delta)

Parameters
deltaThe new scale
Returns
Reference to self
void jop::Object::update ( const float  deltaTime)

Update.

This is for internal use.

Parameters
deltaTimeThe delta time

Friends And Related Function Documentation

friend class Component
friend

Definition at line 50 of file Object.hpp.

friend class SceneLoader
friend

Definition at line 49 of file Object.hpp.


The documentation for this class was generated from the following file: