00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __PLSCENE_SCENENODEMODIFIER_ANCHOR_H__
00024 #define __PLSCENE_SCENENODEMODIFIER_ANCHOR_H__
00025 #pragma once
00026
00027
00028
00029
00030
00031 #include <PLMath/Vector3.h>
00032 #include "PLScene/Scene/SceneNodeHandler.h"
00033 #include "PLScene/Scene/SceneNodeModifier.h"
00034
00035
00036
00037
00038
00039 namespace PLScene {
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 class SNMAnchor : public SceneNodeModifier {
00053
00054
00055
00056
00057
00058 public:
00059
00060
00061
00062
00063 enum EFlags {
00064 NoPosition = 1<<2,
00065 NoRotation = 1<<3,
00066 NoContainerUpdate = 1<<4
00067 };
00068 pl_enum(EFlags)
00069 pl_enum_base(SceneNodeModifier::EFlags)
00070 pl_enum_value(NoPosition, "Do NOT manipulate the position")
00071 pl_enum_value(NoRotation, "Do NOT manipulate the rotation")
00072 pl_enum_value(NoContainerUpdate, "Do NOT change the container the attached node is in")
00073 pl_enum_end
00074
00075
00076
00077
00078
00079 pl_class(PLS_RTTI_EXPORT, SNMAnchor, "PLScene", PLScene::SceneNodeModifier, "Scene node anchor modifier class")
00080
00081 pl_attribute(AttachedNode, PLCore::String, "", ReadWrite, GetSet, "Name of the attached scene node", "")
00082 pl_attribute(PositionOffset, PLMath::Vector3, PLMath::Vector3(0.0f, 0.0f, 0.0f), ReadWrite, DirectValue, "Position offset (node space)", "")
00083 pl_attribute(RotationOffset, PLMath::Vector3, PLMath::Vector3(0.0f, 0.0f, 0.0f), ReadWrite, DirectValue, "Rotation offset in degree (node space)", "")
00084 pl_attribute(SkeletonJoint, PLCore::String, "", ReadWrite, DirectValue, "If not empty, the attached node is relative to this skeleton joint (there must be a mesh handler + skeleton)", "")
00085 pl_attribute(JointPositionOffset, PLMath::Vector3, PLMath::Vector3(0.0f, 0.0f, 0.0f), ReadWrite, DirectValue, "Joint position offset (joint space)", "")
00086 pl_attribute(JointRotationOffset, PLMath::Vector3, PLMath::Vector3(0.0f, 0.0f, 0.0f), ReadWrite, DirectValue, "Joint rotation offset in degree (joint space)", "")
00087
00088 pl_attribute(Flags, pl_flag_type(EFlags), 0, ReadWrite, GetSet, "Flags", "")
00089
00090 pl_constructor_1(ParameterConstructor, SceneNode&, "Parameter constructor", "")
00091
00092 pl_slot_0(OnContainer, "Called when the scene node container changed", "")
00093 pl_slot_0(OnPositionRotationUpdate, "Called when the scene node position or rotation changed or on update request", "")
00094 pl_class_end
00095
00096
00097
00098
00099
00100 public:
00101 PLS_API PLCore::String GetAttachedNode() const;
00102 PLS_API void SetAttachedNode(const PLCore::String &sValue);
00103
00104
00105
00106
00107
00108 public:
00109
00110
00111
00112
00113
00114
00115
00116 PLS_API SNMAnchor(SceneNode &cSceneNode);
00117
00118
00119
00120
00121
00122 PLS_API virtual ~SNMAnchor();
00123
00124
00125
00126
00127
00128 protected:
00129 PLS_API virtual void OnActivate(bool bActivate) override;
00130
00131
00132
00133
00134
00135 private:
00136
00137
00138
00139
00140 void OnContainer();
00141
00142
00143
00144
00145
00146 void OnPositionRotationUpdate();
00147
00148
00149
00150
00151
00152 private:
00153 PLCore::String m_sAttachedNode;
00154 SceneNodeHandler m_cAttachedNodeHandler;
00155
00156
00157 };
00158
00159
00160
00161
00162
00163 }
00164
00165
00166 #endif // __PLSCENE_SCENENODEMODIFIER_ANCHOR_H__