Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
TransformInfo.h
Go to the documentation of this file.
1#pragma once
2
3#include "Math/TVector3.h"
4#include "Math/TQuaternion.h"
6#include "SDL/sdl_interface.h"
7
8#include <Common/primitive_type.h>
9
10namespace ph::math { class StaticAffineTransform; }
11namespace ph::math { class StaticRigidTransform; }
12
13namespace ph
14{
15
16class TransformInfo final
17{
18public:
19 TransformInfo& setPos(real x, real y, real z);
21 TransformInfo& setRot(const math::Vector3R& axis, real degrees);
23 TransformInfo& setScale(real uniformScale);
24 TransformInfo& setScale(real x, real y, real z);
26
27 TransformInfo& translate(real amountX, real amountY, real amountZ);
29 TransformInfo& rotate(const math::Vector3R& axis, real additionalDegrees);
30 TransformInfo& rotate(const math::QuaternionR& additionalRot);
31 TransformInfo& scale(real uniformAmount);
32 TransformInfo& scale(real amountX, real amountY, real amountZ);
33 TransformInfo& scale(const math::Vector3R& amount);
34
35 math::Vector3R getPos() const;
38
45
46private:
47 math::Vector3R m_pos;
49 math::Vector3R m_scale;
50
51public:
53 {
54 StructType ztruct("transform");
55 ztruct.description("Data structure describing placement of an entity in the virtual world.");
56
57 TSdlVector3<OwnerType> pos("pos", &OwnerType::m_pos);
58 pos.description("Position of the entity.");
59 pos.optional();
60 pos.defaultTo({0, 0, 0});
61 ztruct.addField(pos);
62
63 TSdlQuaternion<OwnerType> rot("rot", &OwnerType::m_rot);
64 rot.description("Rotation of the entity");
65 rot.optional();
67 ztruct.addField(rot);
68
69 TSdlVector3<OwnerType> scale("scale", &OwnerType::m_scale);
70 scale.description("Scale of the entity.");
71 scale.optional();
72 scale.defaultTo({1, 1, 1});
73 ztruct.addField(scale);
74
75 return ztruct;
76 }
77};
78
79}// end namespace ph
SDL binding type for a typical C++ struct.
Definition TSdlOwnerStruct.h:18
Definition TSdlQuaternion.h:19
TSdlValue & description(std::string descriptionStr)
Definition TSdlValue.ipp:95
TSdlValue & optional()
Definition TSdlValue.ipp:103
TSdlValue & defaultTo(T defaultValue)
Definition TSdlValue.ipp:71
Definition TSdlVector3.h:19
Definition TransformInfo.h:17
math::QuaternionR getRot() const
Definition TransformInfo.cpp:91
math::Vector3R getScale() const
Definition TransformInfo.cpp:96
math::TDecomposedTransform< real > getDecomposed() const
Definition TransformInfo.cpp:101
TransformInfo & rotate(const math::Vector3R &axis, real additionalDegrees)
Definition TransformInfo.cpp:60
TransformInfo & translate(real amountX, real amountY, real amountZ)
Definition TransformInfo.cpp:50
TransformInfo & setRot(const math::Vector3R &axis, real degrees)
Definition TransformInfo.cpp:20
math::StaticAffineTransform getForwardStaticAffine() const
Definition TransformInfo.cpp:109
TransformInfo & scale(real uniformAmount)
Definition TransformInfo.cpp:71
TransformInfo & set(const math::TDecomposedTransform< real > &decomposed)
Definition TransformInfo.cpp:129
math::Vector3R getPos() const
Definition TransformInfo.cpp:86
PH_DEFINE_SDL_STRUCT(TSdlOwnerStruct< TransformInfo >)
Definition TransformInfo.h:52
TransformInfo & setScale(real uniformScale)
Definition TransformInfo.cpp:33
math::StaticAffineTransform getInverseStaticAffine() const
Definition TransformInfo.cpp:114
math::StaticRigidTransform getForwardStaticRigid() const
Definition TransformInfo.cpp:119
math::StaticRigidTransform getInverseStaticRigid() const
Definition TransformInfo.cpp:124
TransformInfo & setPos(real x, real y, real z)
Definition TransformInfo.cpp:8
Definition StaticAffineTransform.h:14
Definition StaticRigidTransform.h:19
Perform affine transformations in decomposed form.
Definition TDecomposedTransform.h:24
static TQuaternion makeNoRotation()
Definition TQuaternion.ipp:14
Math functions and utilities.
Definition TransformInfo.h:10
The root for all renderer implementations.
Definition EEngineProject.h:6