Loading [MathJax]/extensions/tex2jax.js
ProtoTracer  1.0
Real-time 3D rendering and animation engine
All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Pages
MorphTransform.h
Go to the documentation of this file.
1/**
2 * @file MorphTransform.h
3 * @brief Declares the MorphTransform template class for handling 3D transformations.
4 *
5 * This file defines the MorphTransform class, which manages position, scale, and
6 * rotation offsets for 3D transformations using a dictionary-based approach and
7 * an animation controller.
8 *
9 * @author Coela Can't
10 * @date 22/12/2024
11 */
12
13#pragma once
14
15#include "IEasyEaseAnimator.h" // Include for animation controller interface.
16#include "../Utils/Math/Vector3D.h" // Include for 3D vector operations.
17
18/**
19 * @class MorphTransform
20 * @brief A template class for managing 3D transformations using morph targets.
21 *
22 * The MorphTransform class allows the definition of multiple morph targets with position,
23 * scale, and rotation offsets. It integrates with an animation controller to dynamically
24 * calculate the resulting transformation based on animation values.
25 *
26 * @tparam maxMorphs The maximum number of morph targets this class can handle.
27 */
28template<size_t maxMorphs>
30private:
31 IEasyEaseAnimator* eEA; ///< Pointer to the animation controller.
32 uint16_t dictionary[maxMorphs]; ///< Dictionary mapping morph targets to identifiers.
33 uint16_t currentMorphs = 0; ///< Current number of morph targets.
34 Vector3D positionOffsets[maxMorphs]; ///< Array of position offsets for morph targets.
35 Vector3D scaleOffsets[maxMorphs]; ///< Array of scale offsets for morph targets.
36 Vector3D rotationOffsets[maxMorphs]; ///< Array of rotation offsets for morph targets.
37
38public:
39 /**
40 * @brief Constructs a MorphTransform object with an animation controller.
41 *
42 * @param eEA Pointer to the IEasyEaseAnimator instance.
43 */
45
46 /**
47 * @brief Adds a morph target with a position offset.
48 *
49 * @param dictionaryValue The identifier for the morph target.
50 * @param positionOffset The position offset for the morph target.
51 */
52 void AddMorph(uint16_t dictionaryValue, Vector3D positionOffset);
53
54 /**
55 * @brief Adds a morph target with position and scale offsets.
56 *
57 * @param dictionaryValue The identifier for the morph target.
58 * @param positionOffset The position offset for the morph target.
59 * @param scaleOffset The scale offset for the morph target.
60 */
61 void AddMorph(uint16_t dictionaryValue, Vector3D positionOffset, Vector3D scaleOffset);
62
63 /**
64 * @brief Adds a morph target with position, scale, and rotation offsets.
65 *
66 * @param dictionaryValue The identifier for the morph target.
67 * @param positionOffset The position offset for the morph target.
68 * @param scaleOffset The scale offset for the morph target.
69 * @param rotationOffset The rotation offset for the morph target.
70 */
71 void AddMorph(uint16_t dictionaryValue, Vector3D positionOffset, Vector3D scaleOffset, Vector3D rotationOffset);
72
73 /**
74 * @brief Sets the position offset for a specific morph target.
75 *
76 * @param dictionaryValue The identifier for the morph target.
77 * @param positionOffset The new position offset.
78 */
79 void SetMorphPositionOffset(uint16_t dictionaryValue, Vector3D positionOffset);
80
81 /**
82 * @brief Sets the scale offset for a specific morph target.
83 *
84 * @param dictionaryValue The identifier for the morph target.
85 * @param scaleOffset The new scale offset.
86 */
87 void SetMorphScaleOffset(uint16_t dictionaryValue, Vector3D scaleOffset);
88
89 /**
90 * @brief Sets the rotation offset for a specific morph target.
91 *
92 * @param dictionaryValue The identifier for the morph target.
93 * @param rotationOffset The new rotation offset.
94 */
95 void SetMorphRotationOffset(uint16_t dictionaryValue, Vector3D rotationOffset);
96
97 /**
98 * @brief Retrieves the combined position offset for all active morph targets.
99 *
100 * @return The cumulative position offset.
101 */
103
104 /**
105 * @brief Retrieves the combined scale offset for all active morph targets.
106 *
107 * @return The cumulative scale offset.
108 */
110
111 /**
112 * @brief Retrieves the combined rotation offset for all active morph targets.
113 *
114 * @return The cumulative rotation offset.
115 */
117};
118
119#include "MorphTransform.tpp" // Include the template implementation.
Declares the IEasyEaseAnimator interface for defining animation behaviors.
Interface for defining animation behaviors with easing and interpolation.
A template class for managing 3D transformations using morph targets.
void SetMorphPositionOffset(uint16_t dictionaryValue, Vector3D positionOffset)
Sets the position offset for a specific morph target.
Vector3D GetRotationOffset()
Retrieves the combined rotation offset for all active morph targets.
void SetMorphRotationOffset(uint16_t dictionaryValue, Vector3D rotationOffset)
Sets the rotation offset for a specific morph target.
uint16_t dictionary[maxMorphs]
Dictionary mapping morph targets to identifiers.
void AddMorph(uint16_t dictionaryValue, Vector3D positionOffset)
Adds a morph target with a position offset.
MorphTransform(IEasyEaseAnimator *eEA)
Constructs a MorphTransform object with an animation controller.
Vector3D positionOffsets[maxMorphs]
Array of position offsets for morph targets.
IEasyEaseAnimator * eEA
Pointer to the animation controller.
void AddMorph(uint16_t dictionaryValue, Vector3D positionOffset, Vector3D scaleOffset)
Adds a morph target with position and scale offsets.
Vector3D rotationOffsets[maxMorphs]
Array of rotation offsets for morph targets.
Vector3D GetPositionOffset()
Retrieves the combined position offset for all active morph targets.
uint16_t currentMorphs
Current number of morph targets.
void AddMorph(uint16_t dictionaryValue, Vector3D positionOffset, Vector3D scaleOffset, Vector3D rotationOffset)
Adds a morph target with position, scale, and rotation offsets.
void SetMorphScaleOffset(uint16_t dictionaryValue, Vector3D scaleOffset)
Sets the scale offset for a specific morph target.
Vector3D scaleOffsets[maxMorphs]
Array of scale offsets for morph targets.
Vector3D GetScaleOffset()
Retrieves the combined scale offset for all active morph targets.
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
Definition Vector3D.h:26