|
Brunot
|
#include <Transform.h>
Public Member Functions | |
| Transform () | |
| Transform (const Transform &) | |
| Transform (Transform &&) noexcept | |
| auto | operator= (const Transform &rhs) -> Transform &=default |
| ~Transform () override=default | |
| auto | parentTo (GameObject *newParent) -> bool override |
| Sets the GameObject as a child of another GameObject. | |
| auto | clone () const -> std::unique_ptr< GameObject > override |
| makes a copy a GameObject even if it's held polymorphically | |
| void | markDirty () |
| top ten ways to make the engine do extra work | |
| auto | componentShowMenu () -> void override |
| auto | onUpdate (float dt) -> void override |
| called once every frame. | |
| auto | endWindow () -> void override |
| currently unused, but intended to but was assumed to be necessary for a proper ImGui editor | |
| auto | onRender () -> void override |
| called every frame after update has been called for every object. | |
| auto | load (const Stream &stream) -> void override |
| Implementations will load the state of a GameObject from a th::Json Object. | |
| auto | save (Stream &stream) const -> void override |
| Implementations will load the state of a GameObject to a th::Json object. | |
| auto | move (float x, float y) -> void |
| auto | move (const Vector4D &vec) -> void |
| auto | x () const -> float |
| auto | y () const -> float |
| auto | z () const -> float |
| auto | setX (float x) -> void |
| auto | setY (float y) -> void |
| auto | setZ (float z) -> void |
| auto | adjustScale (float x, float y) -> void |
| auto | scale () const -> const Vector4D & |
| Get the local scale ( this is normally what you want). | |
| auto | scale (const Vector4D &scale) -> void |
| set the local scale ( this is normally what you want to do) | |
| auto | scale (float x, float y) -> void |
| Set the local scale without overriding the z layer (this is also normally what you want to do). | |
| auto | worldScale () -> Vector4D |
| get the world scale (mostly accurate) | |
| auto | worldScale (const Vector4D &scale) -> void |
| set the world scale | |
| auto | translation () const -> const Point2D & |
| get the local translation (this is normally what you want) | |
| auto | translation (const Vector4D &translation) -> void |
| set the local translation (this is what you normally want to do) | |
| auto | translation (float x, float y) -> void |
| set the local translation without overriding the z layer (this also is what you normally want to do) | |
| auto | worldTranslation () -> Point2D |
| get the world translation | |
| auto | worldTranslation (const Point2D &translation) -> void |
| set the world translation | |
| auto | rotation () const -> float |
| get the local rotation in degrees (this is what you normally want to do) | |
| auto | rotation (float rotation) -> void |
| set the local rotation in degrees (this is what you normally want to do) | |
| auto | worldRotation () -> float |
| get the world rotation in degrees | |
| auto | worldRotation (float rotation) -> void |
| set the world rotation in degrees | |
| auto | matrix () -> AffineMatrix & |
| get the world modeling matrix ( this is normally what you want ) | |
| auto | setMatrix (AffineMatrix &newMat) -> void |
| auto | makeMat3Rotation (float rotation) -> Eigen::Matrix3f |
| auto | setRotationViaMatrix (AffineMatrix &newMat) -> void |
| Public Member Functions inherited from Component | |
| auto | getType () const -> ComponentTypeEnum |
| auto | getKey () const -> Key override |
| Generates a unique Key that corresponds to the GameObject. | |
| auto | showMenu () -> void override |
| Called before update each frame, for calling ImGui editor code relevant to the gameObject. | |
| auto | getEntityParent () const -> Entity * |
| gets the parent as an Entity. | |
| auto | pop () const -> std::unique_ptr< Component > |
| Removes the Component from its Entity parent, and gives ownership to the caller. | |
| Public Member Functions inherited from GameObject | |
| GameObject (std::string typeName, gobj::Type parentType, gobj::Type type) | |
| constructor for gameobject. | |
| virtual | ~GameObject () |
| destructor for GameObject. | |
| GameObject (const GameObject &other) | |
| Copy Constructor. | |
| auto | operator= (const GameObject &other) -> GameObject & |
| copy assignment operator | |
| GameObject (GameObject &&other) noexcept | |
| Move constructor. | |
| auto | operator= (GameObject &&other) noexcept -> GameObject & |
| Move assignment operator. | |
| virtual auto | update (float dt) -> void |
| called once every frame. | |
| virtual auto | render () -> void |
| called every frame after update has been called for every object. | |
| virtual auto | destroy () -> void |
| Marks an GameObject to be destroyed. | |
| virtual auto | onEnterEngine () -> void |
| hook that is called when a GameObject enters the Engine tree. | |
| virtual auto | onSceneStart (const std::string &sceneName) -> void |
| Hook that is called before the first frame a scene is run, but after the entire scene is loaded into the engine To receive the hook, simply override the function in your class. | |
| virtual auto | onSceneExit (const std::string &sceneName) -> void |
| Hook that is called right before a scene is unloaded To receive the hook, simply override the function in your class. | |
| virtual auto | for_each (std::function< void(GameObject &)> func) -> void |
| applies a function to every child. | |
| virtual auto | for_each (std::function< void(const GameObject &)> func) const -> void |
| applies a const function to every child. | |
| virtual auto | getParent () const -> GameObject * |
| Gets the parent of a GameObject. | |
| auto | getInternalParent () const -> GameObject * |
| returns the actual owning parent of the GameObject | |
| virtual auto | addChild (std::unique_ptr< GameObject > newChild) -> bool |
| Adds a child to a GameObject. | |
| auto | addChildLua (std::unique_ptr< GameObject > &newChild) -> bool |
| for lua | |
| auto | destroyed () const -> bool |
| auto | getUUID () const -> gobj::UUID |
| auto | coolerGetUUID () const -> unsigned int |
| auto | isUUID (gobj::UUID compareUUID) const -> bool |
| auto | getName () const -> const std::string & |
| Gets the type of the object as a string. | |
| auto | getNickname () const -> const std::string & |
| Gets the nickname (custom, writable name) of a GameObject. | |
| auto | getFormattedName () const -> const std::string & |
| combines a GameObjects Type, Nickname, and UUID into one string, for use with logging. | |
| auto | nameEquals (const std::string &compareString) const -> bool |
| check whether a GameObjects typeName is equivilent to a given string. | |
| auto | isType (gobj::Type otherType) const -> bool |
| check whether the GameObject is the same as a given type. | |
| auto | getObjectType () const -> gobj::Type |
| gets the internal type of the GameObject, as an enum | |
| auto | setNickname (const std::string &newNickname) -> void |
| sets the GameObjects nickname. | |
| auto | updates () const -> bool |
| auto | renders () const -> bool |
| auto | receivesMessages () const -> bool |
| auto | isActive () const -> bool |
| virtual auto | setShouldUpdate (bool _shouldUpdate) -> void |
| set whether the GameObject should update every frame, and whether all of it's children should update every frame | |
| virtual auto | setShouldRender (bool _shouldRender) -> void |
| set whether the GameObject should render every frame, and whether all of it's children should render every frame | |
| virtual auto | setShouldReceiveMessages (bool _shouldReceiveMessages) -> void |
| set whether the GameObject should Receive Messags, and whether all of it's children should receive messages | |
| auto | setActive (bool shouldBeActive) -> void |
| set the GameObject should update, render, and receive messages | |
| auto | getGameObjectJson () const -> json |
| Used for serializing GameObjects. | |
| auto | setGameObjectJson (const json &stream) -> void |
| used for deserializing GameObjects | |
Static Public Member Functions | |
| static auto | getEnum () -> ComponentTypeEnum |
| static auto | bindLuaTypes (sol::state &lua) -> void |
Private Member Functions | |
| auto | recalculateMatrix () -> void |
| helper function for recalculating internal Matrix | |
| auto | getParentTransform () const -> Transform * |
| helper for grabbing parent transform | |
| auto | calculateAbsoluteMatrix () -> bool |
| computes the absolute matrix, by getting parent entity's transform @precondition calculateInternalMatrix should be called before this, if the absolute matrix is dirty | |
| auto | getWorldRotationAndScale () -> Eigen::Matrix3f |
| helper for getting approximate world scale | |
| auto | setGlobalRotationAndScale (const Eigen::Matrix3f &) -> void |
| helper for setting rotation and scale based on a world rotation and scale matrix | |
Private Attributes | |
| Vector4D | _scale |
| Point2D | _translation |
| float | _rotation |
| bool | isDirty |
| True if the transformation matrix needs to be recalculated. | |
| bool | lockedScale |
| Whether to lock x and y scale when editing it in the editor. | |
| AffineMatrix | _matrix |
| The transformation matrix resulting from concatenating the matrices Formed by scale*rotation*translation matrices. | |
| AffineMatrix | _absoluteMatrix |
| A matrix that holds the absolute transform of the component, after offsetting from parent Entities. | |
Friends | |
| auto | to_json (json &j, const Transform &p) ->void |
| auto | from_json (const json &j, Transform &p) ->void |
Additional Inherited Members | |
| Public Types inherited from Component | |
| enum | ComponentTypeEnum : unsigned short { cErrorType = 0 , cNewComponentStub = 1 } |
| This enum lists out every type of component we have. More... | |
| Public Attributes inherited from GameObject | |
| friend | Entity |
| friend | Node |
| friend | Engine |
| Protected Member Functions inherited from Component | |
| Component (ComponentTypeEnum type, const char *typeName) | |
| auto | getComponentJson () const -> json |
| auto | getChildren () const -> std::shared_ptr< std::vector< GameObject * > > override |
| override for component to return a vector of no children | |
| Protected Member Functions inherited from GameObject | |
| auto | setInternalParent (GameObject *parent) -> bool |
| sets the internal parent of a GameObject directly, avoiding abstractions provided by ParentTo(). | |
| auto | checkAddToSceneHook () -> void |
| Determine if the GameObject was recently added to the engine, and if it was, call onEngineEnter. | |
| Transform::Transform | ( | ) |
| Transform::Transform | ( | const Transform & | rhs | ) |
|
noexcept |
|
overridedefault |
| auto Transform::adjustScale | ( | float | x, |
| float | y )->void |
|
static |
|
private |
computes the absolute matrix, by getting parent entity's transform @precondition calculateInternalMatrix should be called before this, if the absolute matrix is dirty
|
overridevirtual |
makes a copy a GameObject even if it's held polymorphically
Implements GameObject.
|
overridevirtual |
Reimplemented from Component.
|
inlineoverridevirtual |
currently unused, but intended to but was assumed to be necessary for a proper ImGui editor
Implements GameObject.
|
inlinestatic |
|
private |
helper for grabbing parent transform
|
private |
helper for getting approximate world scale
|
overridevirtual |
Implementations will load the state of a GameObject from a th::Json Object.
Unimplemented in GameObject
| stream | th::Json Object |
Implements GameObject.
| auto Transform::makeMat3Rotation | ( | float | rotation | ) | ->Eigen::Matrix3f |
| void Transform::markDirty | ( | ) |
top ten ways to make the engine do extra work
| auto Transform::matrix | ( | ) | ->AffineMatrix & |
get the world modeling matrix ( this is normally what you want )
| auto Transform::move | ( | const Vector4D & | vec | ) | ->void |
| auto Transform::move | ( | float | x, |
| float | y )->void |
|
overridevirtual |
called every frame after update has been called for every object.
Generally used for rendering an object to the screen, when applicable. Unimplemented in GameObject
Implements GameObject.
|
overridevirtual |
called once every frame.
Generally used for timers, movement, condition checks, etc. Unimplemented in GameObject
| dt | the time in seconds that has elapsed |
Implements GameObject.
|
overridevirtual |
Sets the GameObject as a child of another GameObject.
calls setInternalParent() by default, but can be overriden by GameObjects complicated parent requirements, like Entity. Validates pointer and requires type to be valid
| newParent | the GameObject that this GameObject will be a child of |
calls setInternalParent() by default, can be overriden by complicated parent requirements, like Entity. Validates pointer and requires type to be valid
| newParent | the GameObject to parent to |
Reimplemented from GameObject.
|
private |
helper function for recalculating internal Matrix
| auto Transform::rotation | ( | ) | const->float |
get the local rotation in degrees (this is what you normally want to do)
| auto Transform::rotation | ( | float | rotation | ) | ->void |
set the local rotation in degrees (this is what you normally want to do)
|
overridevirtual |
Implementations will load the state of a GameObject to a th::Json object.
Unimplemented in GameObject
| stream | th::Json Object |
Implements GameObject.
| auto Transform::scale | ( | ) | const->constVector4D & |
Get the local scale ( this is normally what you want).
| auto Transform::scale | ( | const Vector4D & | scale | ) | ->void |
set the local scale ( this is normally what you want to do)
| auto Transform::scale | ( | float | x, |
| float | y )->void |
Set the local scale without overriding the z layer (this is also normally what you want to do).
|
private |
helper for setting rotation and scale based on a world rotation and scale matrix
| rotationAndScale | a matrix representing the world rotation and scale to set. The function will decompose this into local rotation and scale, and set those. |
| auto Transform::setMatrix | ( | AffineMatrix & | newMat | ) | ->void |
| auto Transform::setRotationViaMatrix | ( | AffineMatrix & | newMat | ) | ->void |
| auto Transform::setX | ( | float | x | ) | ->void |
| auto Transform::setY | ( | float | y | ) | ->void |
| auto Transform::setZ | ( | float | z | ) | ->void |
| auto Transform::translation | ( | ) | const->constPoint2D & |
get the local translation (this is normally what you want)
| auto Transform::translation | ( | const Vector4D & | translation | ) | ->void |
set the local translation (this is what you normally want to do)
| auto Transform::translation | ( | float | x, |
| float | y )->void |
set the local translation without overriding the z layer (this also is what you normally want to do)
| auto Transform::worldRotation | ( | ) | ->float |
get the world rotation in degrees
| auto Transform::worldRotation | ( | float | rotation | ) | ->void |
set the world rotation in degrees
| auto Transform::worldScale | ( | ) | ->Vector4D |
get the world scale (mostly accurate)
| auto Transform::worldScale | ( | const Vector4D & | scale | ) | ->void |
set the world scale
| auto Transform::worldTranslation | ( | ) | ->Point2D |
get the world translation
| auto Transform::worldTranslation | ( | const Point2D & | translation | ) | ->void |
set the world translation
| auto Transform::x | ( | ) | const->float |
| auto Transform::y | ( | ) | const->float |
| auto Transform::z | ( | ) | const->float |
|
private |
A matrix that holds the absolute transform of the component, after offsetting from parent Entities.
|
private |
The transformation matrix resulting from concatenating the matrices Formed by scale*rotation*translation matrices.
|
private |
|
private |
|
private |
|
private |
True if the transformation matrix needs to be recalculated.
|
private |
Whether to lock x and y scale when editing it in the editor.