![]() |
ezEngine Release 26.3
|
Describes a Spline shape. More...
#include <SplineComponent.h>

Public Member Functions | |
| virtual void | SerializeComponent (ezWorldWriter &ref_stream) const override |
| Override this to save the current state of the component to the given stream. | |
| virtual void | DeserializeComponent (ezWorldReader &ref_stream) override |
| Override this to load the current state of the component from the given stream. | |
| void | SetClosed (bool bClosed) |
| Whether the spline end connects to the beginning. | |
| bool | GetClosed () const |
| void | SetSplineFlags (ezBitflags< ezSplineComponentFlags > flags) |
| ezBitflags< ezSplineComponentFlags > | GetSplineFlags () const |
| ezVec3 | GetPositionAtKey (float fKey, ezEnum< ezSplineComponentSpace > space=ezSplineComponentSpace::Default) const |
| Returns the position of the spline at the given key (segment index + t). | |
| ezVec3 | GetForwardDirAtKey (float fKey, ezEnum< ezSplineComponentSpace > space=ezSplineComponentSpace::Default) const |
| Returns the forward direction of the spline at the given key (segment index + t). | |
| ezVec3 | GetUpDirAtKey (float fKey, ezEnum< ezSplineComponentSpace > space=ezSplineComponentSpace::Default) const |
| Returns the up direction of the spline at the given key (segment index + t). | |
| ezVec3 | GetScaleAtKey (float fKey, ezEnum< ezSplineComponentSpace > space=ezSplineComponentSpace::Default) const |
| Returns the scale of the spline at the given key (segment index + t). | |
| ezTransform | GetTransformAtKey (float fKey, ezEnum< ezSplineComponentSpace > space=ezSplineComponentSpace::Default) const |
| Returns the transform of the spline at the given key (segment index + t). | |
| float | GetTotalLength () const |
| Returns the total length of the spline (in local space) | |
| float | GetSegmentLength (ezUInt32 uiSegmentIndex) const |
| Returns the segment length for the given segment index (in local space) | |
| float | GetKeyAtDistance (float fDistance) const |
| Returns the spline key (segment index + t) for the given distance along the spline. | |
| ezVec3 | GetPositionAtDistance (float fDistance, ezEnum< ezSplineComponentSpace > space=ezSplineComponentSpace::Default) const |
| Returns the position of the spline at the given distance along the spline. | |
| ezVec3 | GetForwardDirAtDistance (float fDistance, ezEnum< ezSplineComponentSpace > space=ezSplineComponentSpace::Default) const |
| Returns the forward direction of the spline at the given distance along the spline. | |
| ezVec3 | GetUpDirAtDistance (float fDistance, ezEnum< ezSplineComponentSpace > space=ezSplineComponentSpace::Default) const |
| Returns the up direction of the spline at the given distance along the spline. | |
| ezVec3 | GetScaleAtDistance (float fDistance, ezEnum< ezSplineComponentSpace > space=ezSplineComponentSpace::Default) const |
| Returns the scale of the spline at the given distance along the spline. | |
| ezTransform | GetTransformAtDistance (float fDistance, ezEnum< ezSplineComponentSpace > space=ezSplineComponentSpace::Default) const |
| Returns the full transform of the spline at the given distance along the spline. | |
| float | FindKeyClosestToPoint (const ezVec3 &vPoint, float &out_fDistanceToPoint, ezEnum< ezSplineComponentSpace > space=ezSplineComponentSpace::Default, float fMaxError=0.1f) const |
| Finds the closest point on the spline to the given point in space. | |
| const ezSpline & | GetSpline () const |
| Access to the underlying spline object. | |
| void | SetSpline (ezSpline &&spline) |
| const ezArrayMap< float, float > & | GetDistanceToKeyRemapping () const |
| Returns the underlying mapping of distances to spline keys. | |
| ezUInt32 | GetChangeCounter () const |
| const ezUuid & | GetUuid () const |
| Returns the unique identifier of this spline component. This is only valid for spline components created in the editor. | |
Public Member Functions inherited from ezComponent | |
| void | SetActiveFlag (bool bEnabled) |
| Sets the active flag of the component, which affects its active state. | |
| bool | GetActiveFlag () const |
| Checks whether the 'active flag' is set on this component. Note that this does not mean that the component is also 'active'. | |
| bool | IsActive () const |
| Checks whether this component is in an active state. | |
| bool | IsActiveAndInitialized () const |
| Returns whether this component is active and initialized. | |
| bool | IsActiveAndSimulating () const |
| Whether the component is currently active and simulation has been started as well. | |
| ezComponentManagerBase * | GetOwningManager () |
| Returns the corresponding manager for this component. | |
| const ezComponentManagerBase * | GetOwningManager () const |
| Returns the corresponding manager for this component. | |
| ezGameObject * | GetOwner () |
| Returns the owner game object if the component is attached to one or nullptr. | |
| const ezGameObject * | GetOwner () const |
| Returns the owner game object if the component is attached to one or nullptr. | |
| ezWorld * | GetWorld () |
| Returns the corresponding world for this component. | |
| const ezWorld * | GetWorld () const |
| Returns the corresponding world for this component. | |
| ezComponentHandle | GetHandle () const |
| Returns a handle to this component. | |
| ezUInt32 | GetUniqueID () const |
| Returns the unique id for this component. | |
| void | SetUniqueID (ezUInt32 uiUniqueID) |
| Sets the unique id for this component. | |
| void | EnsureInitialized () |
| Ensures that the component is initialized. Must only be called from another component's Initialize callback. | |
| void | EnsureSimulationStarted () |
| Ensures that the OnSimulationStarted method has been called. Must only be called from another component's OnSimulationStarted callback. | |
| EZ_ALWAYS_INLINE bool | SendMessage (ezMessage &ref_msg) |
| Sends a message to this component. | |
| EZ_ALWAYS_INLINE bool | SendMessage (ezMessage &ref_msg) const |
| void | PostMessage (const ezMessage &msg, ezTime delay=ezTime::MakeZero(), ezObjectMsgQueueType::Enum queueType=ezObjectMsgQueueType::NextFrame) const |
| Queues the message for the given phase. The message is processed after the given delay in the corresponding phase. | |
| virtual bool | HandlesMessage (const ezMessage &msg) const |
| Returns whether the given Message is handled by this component. | |
| void | SetUserFlag (ezUInt8 uiFlagIndex, bool bSet) |
| Be careful to check which flags may already be in use by base classes. | |
| bool | GetUserFlag (ezUInt8 uiFlagIndex) const |
| Retrieves a custom flag. Index must be between 0 and 7. | |
| void | SetCreatedByPrefab () |
| Adds ezObjectFlags::CreatedByPrefab to the component. See the flag for details. | |
| bool | WasCreatedByPrefab () const |
| Checks whether the ezObjectFlags::CreatedByPrefab flag is set on this component. | |
| void | DeleteComponent () |
| Deletes this component. Note that the component will be invalidated first and the actual deletion is postponed. | |
Public Member Functions inherited from ezReflectedClass | |
| virtual const ezRTTI * | GetDynamicRTTI () const |
| bool | IsInstanceOf (const ezRTTI *pType) const |
| Returns whether the type of this instance is of the given type or derived from it. | |
| template<typename T > | |
| EZ_ALWAYS_INLINE bool | IsInstanceOf () const |
| Returns whether the type of this instance is of the given type or derived from it. | |
Static Public Member Functions | |
| static float | GetKeyAtDistanceHelper (const ezArrayMap< float, float > &distanceToKey, float fDistance) |
Static Public Member Functions inherited from ezNoBase | |
| static const ezRTTI * | GetStaticRTTI () |
Protected Member Functions | |
| virtual void | OnActivated () override |
| This method is called when the component gets activated. | |
| virtual void | OnDeactivated () override |
| This method is called when the component gets deactivated. | |
| void | OnMsgSplineChanged (ezMsgSplineChanged &ref_msg) |
| Informs the spline component, that its shape has changed. Sent by spline nodes when they are modified. | |
| void | SendSplineChangedEvent () |
| ezUInt32 | Nodes_GetCount () const |
| const ezHashedString & | Nodes_GetNode (ezUInt32 uiIndex) const |
| void | Nodes_SetNode (ezUInt32 uiIndex, const ezHashedString &sNodeName) |
| void | Nodes_Insert (ezUInt32 uiIndex, const ezHashedString &sNodeName) |
| void | Nodes_Remove (ezUInt32 uiIndex) |
| void | UpdateSpline (bool bSendChangedEvent=true) |
| ezSplineNodeComponent * | FindNodeComponent (const ezHashedString &sNodeName) |
| void | UpdateFromNodeObjects () |
| void | InsertHalfPoint (ezDynamicArray< float > &ref_Ts, ezUInt32 uiCp0, float fLowerT, float fUpperT, const ezSimdVec4f &vLowerPos, const ezSimdVec4f &vUpperPos, float fDistSqr, ezInt32 iMinSteps, ezInt32 iMaxSteps) const |
| void | CreateDistanceToKeyRemapping () |
| void | DrawDebugVisualizations (ezBitflags< ezSplineComponentFlags > flags) const |
| void | DrawDebugTangents (ezUInt32 uiPointIndex, ezSplineTangentMode::Enum tangentModeIn=ezSplineTangentMode::Default, ezSplineTangentMode::Enum tangentModeOut=ezSplineTangentMode::Default) const |
| bool | DrawSplineOnSelection () const |
| void | OnMsgExtractRenderData (ezMsgExtractRenderData &msg) const |
| void | OnObjectCreated (const ezAbstractObjectNode &node) |
Protected Member Functions inherited from ezComponent | |
| ezComponent () | |
| Keep the constructor private or protected in derived classes, so it cannot be called manually. | |
| bool | IsDynamic () const |
| Returns whether this component is dynamic and thus can only be attached to dynamic game objects. | |
| virtual ezWorldModuleTypeId | GetTypeId () const =0 |
| virtual ezComponentMode::Enum | GetMode () const =0 |
| virtual void | Initialize () |
| Can be overridden for basic initialization that depends on a valid hierarchy and position. | |
| virtual void | Deinitialize () |
| This method is called before the component is destroyed. A derived type can override this method to do common de-initialization work. | |
| virtual void | OnSimulationStarted () |
| This method is called once for active components, at the start of the next world update, but only when the world is simulated. | |
| void | EnableUnhandledMessageHandler (bool enable) |
| By default disabled. Enable to have OnUnhandledMessage() called for every unhandled message. | |
| virtual bool | OnUnhandledMessage (ezMessage &msg, bool bWasPostedMsg) |
| When EnableUnhandledMessageHandler() was activated, this is called for all messages for which there is no dedicated message handler. | |
| virtual bool | OnUnhandledMessage (ezMessage &msg, bool bWasPostedMsg) const |
| When EnableUnhandledMessageHandler() was activated, this is called for all messages for which there is no dedicated message handler. | |
| bool | IsInitialized () const |
| bool | IsInitializing () const |
| bool | IsSimulationStarted () const |
Protected Attributes | |
| ezSpline | m_Spline |
| ezSmallArray< ezHashedString, 1 > | m_Nodes |
| ezArrayMap< float, float > | m_DistanceToKey |
| float | m_fTotalLength = 0.0f |
| ezBitflags< ezSplineComponentFlags > | m_SplineFlags |
| ezUInt8 | m_uiDummy = 0 |
| ezUInt16 | m_uiExtractedFrame = 0 |
| ezUuid | m_Uuid |
Protected Attributes inherited from ezComponent | |
| const ezRTTI * | m_pMessageDispatchType = nullptr |
| Messages will be dispatched to this type. Default is what GetDynamicRTTI() returns, can be redirected if necessary. | |
Friends | |
| class | ezSplineNodeComponent |
Describes a Spline shape.
This can be used for moving things along the spline (see ezFollowSplineComponent) or to describe the (complex) shape of an object, for example a rope.
The ezSplineComponent stores the shape as nodes with positions and tangents. It additionally creates a remapping from distance along the spline to spline key (segment index + t) for easier evaluation by distance.
To set up the shape, attach child objects and attach an ezSplineNodeComponent to each. Also give each child object a distinct name. Then reference these child objects by name through the "Nodes" property on the spline shape.
During scene export, typically the child objects are automatically deleted (if they have no children and no other components). Instead, the ezSplineComponent stores all necessary information in a more compact representation.
|
overridevirtual |
Override this to load the current state of the component from the given stream.
The active state will be automatically serialized. The 'initialized' state is not serialized, all components will be initialized after creation, even if they were already in an initialized state when they were serialized.
Reimplemented from ezComponent.
|
overrideprotectedvirtual |
This method is called when the component gets activated.
By default a component is active, but it can be created in an inactive state. In such a case OnActivated() is only called once a component is activated. If a component gets switched between active and inactive at runtime, OnActivated() and OnDeactivated() are called accordingly. In contrast Initialize() and Deinitialize() are only ever called once.
Reimplemented from ezComponent.
|
overrideprotectedvirtual |
This method is called when the component gets deactivated.
Upon destruction, a component that is active first gets deactivated. Therefore OnDeactivated() should be used for typical game code cleanup.
Reimplemented from ezComponent.
|
overridevirtual |
Override this to save the current state of the component to the given stream.
Reimplemented from ezComponent.