Core::MatrixTracker
The main tracking object, responsible for tracking a single chain of sequences. More...
#include "Core/Nodes/Tracking.h"
Public Classes
Name | |
---|---|
struct | TrackedMatrix <br>Internal helper object representing a single matrix. |
struct | TrackedNode <br>Internal wrapper of core nodes for managing tracking data for each node involved in the tracking operation. |
struct | TrackedTransform <br>Internal tracked node wrapper representing a "transform", a node containing matrix data. |
Public Functions
Name | |
---|---|
MatrixTracker() =default<br>Constructs an empty / inactive tracker. | |
MatrixTracker(Ptr< Sequence > beginSequence, Ptr< Camera > beginCamera, TrackingDirection direction) | |
MatrixTracker(Ptr< Sequence > beginSequence, TrackingDirection direction) | |
~MatrixTracker() | |
Ptr< Camera > | getCamera() const<br>Returns the begin camera (if provided) |
ID | getCameraID() const<br>Returns the begin camera ID (if provided) |
std::string | getDebugString() |
TrackingDirection | getDirection() const |
unsigned | getFullMatricesCount() const |
const glm::mat4 & | getInterpolatedMatrix() const<br>Result of the tracking operation, returns the complete accumulated and interpolated matrix. |
const TrackedMatrix * | getInterpolatedMatrixObject() const<br>Reference to the internal interpolated matrix object. |
const TrackedTransform * | getInterpolatedTransform() const<br>Reference to the internal interpolated transform object. |
ID | getInterpolatedTransformID() const<br>Core ID of the currently interpolated transform. |
const std::vector< UPtr< TrackedMatrix > > & | getMatrices() const<br>Returns an internal list of matrix objects. Use with care and DO NOT MODIFY. |
int | getMatrixCount() const<br>Returns the number of tracked matrices / transformations. Greater or equal to transform count. |
float | getProgress() const<br>Returns the current processed time parameter of the tracker. The value might change after a call to update(). |
Ptr< Sequence > | getSequence() const<br>Returns the begin sequence. |
ID | getSequenceID() const<br>Returns the begin sequence ID. |
const UPtr< TrackedNode > & | getTrackedCamera() const |
const std::vector< UPtr< TrackedNode > > & | getTrackedModels() const<br>Returns an internal list of tracked model objects. Use with care and DO NOT MODIFY. |
const std::vector< Ptr< TrackedTransform > > & | getTrackedSequences() const<br>Returns an internal list of tracked sequence objects. Use with care and DO NOT MODIFY. |
const std::vector< Ptr< TrackedTransform > > & | getTrackedTransforms() const<br>Returns an internal list of tracked transform objects. Use with care and DO NOT MODIFY. |
int | getTransformCount() const<br>Returns the number of tracked transform nodes. |
bool | isTracking() const |
bool | isTrackingFromLeft() const |
void | requestChainUpdate() |
void | requestProgressUpdate() |
void | reverseDirection() |
void | setProgress(float param)<br>Set the tracker's progress parameter, a value from 0 to 1. |
void | update()<br>Updates the state of the tracker, reacts to any changes induced by other method calls. |
void | onNodeDestroy(Node * node)<br>Alerts the tracker that a node has been destroyed. |
void | onNodeGraphChange(Node * node)<br>Alerts the tracker of a structure change in the tracked nodes. |
void | onNodeUpdate(Node * node)<br>Alerts the tracker that a tracked node has been updated. |
Protected Functions
Name | |
---|---|
void | clearModels() |
void | clearTrackingData() |
void | reset()<br>Reset the matrix tracker to empty / inactive state. |
void | reverseChain()<br>Reverses the order of tracked transforms and sequences. |
void | updateChain()<br>Traverses the graph from the begin sequence, updating the sequence/matrix chain. |
void | updateModels()<br>Updates the tracked model list by traversing the subtree rooted in the begin sequence to find connected models. |
void | updateModelTransforms()<br>Updates tracked model transforms based on the current tracking state. |
void | updateProgress()<br>Updates the interpolated matrix and progress values. |
Public Attributes
Name | |
---|---|
float | g_trackingViewportScalingFactorXY |
float | g_trackingViewportScalingFactorZ |
bool | m_decomposePerspectiveBrown |
bool | m_decomposePerspectiveShirley |
bool | m_decomposeProjection |
glm::mat4 | m_iProjMatrix <br>Interpolated projection matrix, relevant during camera tracking when m_trackInWorldSpace is false. |
glm::mat4 | m_iViewMatrix <br>Interpolated view matrix, relevant during camera tracking when m_trackInWorldSpace is false. |
glm::mat4 | m_iViewportMatrix <br>Interpolated viewport matrix, relevant during camera tracking when m_trackInWorldSpace is false. |
bool | m_trackInWorldSpace |
Friends
Name | |
---|---|
struct | TrackedNodeData |
Detailed Description
class Core::MatrixTracker;
class Core::MatrixTracker;
The main tracking object, responsible for tracking a single chain of sequences.
This object assignes and manages TrackedNodeData objects accessible via Core::Node::getTrackingData(). Tracking data is assigned to all transformations, sequences, models and possibly cameras involved in the tracking operation. Tracking data of models contains an additional TrackedModelData object containg the interpolated matrix data. A null pointer indicates that no tracking operation is active.
The MatrixTracker does not rebuild the sequence chain every frame, but reacts to value updates in any nodes that have tracking data assigned (so transformations, sequences and possibly their external operators). This behavior is implemented directly in Core::Node.
Tracking operation consists of the "chain" and "model subtree". The chain is a set of sequences as well as their transforms (transformations or operators) from the root of the scene graph to the begin sequence. The begin sequence marks the end of this chain. The subtree rooted in the begin sequence, referred to as "model subtree", is NOT tracked, as that would require the tracking "cursor" to split into multiple cursors. Instead this subtree is traversed to find all models, which are then tracked as if they were connected directly to the begin sequence.
The nodes in the model subtree are considered part of the tracking operation and do carry tracking data with a flag marking them as model subtree nodes.
All involved nodes notify the tracker of any value or structure changes, which causes the entire chain and/or subtree to be rebuilt.
Public Functions Documentation
function MatrixTracker
MatrixTracker() =default
MatrixTracker() =default
Constructs an empty / inactive tracker.
function MatrixTracker
MatrixTracker(
Ptr< Sequence > beginSequence,
Ptr< Camera > beginCamera,
TrackingDirection direction
)
MatrixTracker(
Ptr< Sequence > beginSequence,
Ptr< Camera > beginCamera,
TrackingDirection direction
)
function MatrixTracker
MatrixTracker(
Ptr< Sequence > beginSequence,
TrackingDirection direction
)
MatrixTracker(
Ptr< Sequence > beginSequence,
TrackingDirection direction
)
function ~MatrixTracker
~MatrixTracker()
~MatrixTracker()
function getCamera
Ptr< Camera > getCamera() const
Ptr< Camera > getCamera() const
Returns the begin camera (if provided)
function getCameraID
ID getCameraID() const
ID getCameraID() const
Returns the begin camera ID (if provided)
function getDebugString
std::string getDebugString()
std::string getDebugString()
function getDirection
TrackingDirection getDirection() const
TrackingDirection getDirection() const
function getFullMatricesCount
inline unsigned getFullMatricesCount() const
inline unsigned getFullMatricesCount() const
function getInterpolatedMatrix
inline const glm::mat4 & getInterpolatedMatrix() const
inline const glm::mat4 & getInterpolatedMatrix() const
Result of the tracking operation, returns the complete accumulated and interpolated matrix.
function getInterpolatedMatrixObject
inline const TrackedMatrix * getInterpolatedMatrixObject() const
inline const TrackedMatrix * getInterpolatedMatrixObject() const
Reference to the internal interpolated matrix object.
function getInterpolatedTransform
inline const TrackedTransform * getInterpolatedTransform() const
inline const TrackedTransform * getInterpolatedTransform() const
Reference to the internal interpolated transform object.
function getInterpolatedTransformID
inline ID getInterpolatedTransformID() const
inline ID getInterpolatedTransformID() const
Core ID of the currently interpolated transform.
function getMatrices
const std::vector< UPtr< TrackedMatrix > > & getMatrices() const
const std::vector< UPtr< TrackedMatrix > > & getMatrices() const
Returns an internal list of matrix objects. Use with care and DO NOT MODIFY.
function getMatrixCount
int getMatrixCount() const
int getMatrixCount() const
Returns the number of tracked matrices / transformations. Greater or equal to transform count.
function getProgress
inline float getProgress() const
inline float getProgress() const
Returns the current processed time parameter of the tracker. The value might change after a call to update().
function getSequence
Ptr< Sequence > getSequence() const
Ptr< Sequence > getSequence() const
Returns the begin sequence.
function getSequenceID
ID getSequenceID() const
ID getSequenceID() const
Returns the begin sequence ID.
function getTrackedCamera
const UPtr< TrackedNode > & getTrackedCamera() const
const UPtr< TrackedNode > & getTrackedCamera() const
function getTrackedModels
const std::vector< UPtr< TrackedNode > > & getTrackedModels() const
const std::vector< UPtr< TrackedNode > > & getTrackedModels() const
Returns an internal list of tracked model objects. Use with care and DO NOT MODIFY.
function getTrackedSequences
const std::vector< Ptr< TrackedTransform > > & getTrackedSequences() const
const std::vector< Ptr< TrackedTransform > > & getTrackedSequences() const
Returns an internal list of tracked sequence objects. Use with care and DO NOT MODIFY.
function getTrackedTransforms
const std::vector< Ptr< TrackedTransform > > & getTrackedTransforms() const
const std::vector< Ptr< TrackedTransform > > & getTrackedTransforms() const
Returns an internal list of tracked transform objects. Use with care and DO NOT MODIFY.
function getTransformCount
int getTransformCount() const
int getTransformCount() const
Returns the number of tracked transform nodes.
function isTracking
bool isTracking() const
bool isTracking() const
function isTrackingFromLeft
bool isTrackingFromLeft() const
bool isTrackingFromLeft() const
function requestChainUpdate
void requestChainUpdate()
void requestChainUpdate()
function requestProgressUpdate
void requestProgressUpdate()
void requestProgressUpdate()
function reverseDirection
void reverseDirection()
void reverseDirection()
function setProgress
void setProgress(
float param
)
void setProgress(
float param
)
Set the tracker's progress parameter, a value from 0 to 1.
The change will only take effect after the next MatrixTracker::update() call. Meaning subsequent getProgress() calls will return the old value until update.
function update
void update()
void update()
Updates the state of the tracker, reacts to any changes induced by other method calls.
This method is meant to be run frequently and does lazy evaluation based on internal flags.
function onNodeDestroy
static void onNodeDestroy(
Node * node
)
static void onNodeDestroy(
Node * node
)
Alerts the tracker that a node has been destroyed.
Note: MatrixTracker::update() must be called for changes to take effect.
Called in Core::Node::finalize().
function onNodeGraphChange
static void onNodeGraphChange(
Node * node
)
static void onNodeGraphChange(
Node * node
)
Alerts the tracker of a structure change in the tracked nodes.
Note: MatrixTracker::update() must be called for changes to take effect.
Called in Core::Node::onPlug().
function onNodeUpdate
static void onNodeUpdate(
Node * node
)
static void onNodeUpdate(
Node * node
)
Alerts the tracker that a tracked node has been updated.
Note: MatrixTracker::update() must be called for changes to take effect.
Called in Core::Node::onUpdate().
Protected Functions Documentation
function clearModels
void clearModels()
void clearModels()
function clearTrackingData
void clearTrackingData()
void clearTrackingData()
function reset
void reset()
void reset()
Reset the matrix tracker to empty / inactive state.
function reverseChain
void reverseChain()
void reverseChain()
Reverses the order of tracked transforms and sequences.
function updateChain
void updateChain()
void updateChain()
Traverses the graph from the begin sequence, updating the sequence/matrix chain.
Note: Should be called when the matrices along the chain change, be it due to change of structure or any value.
Regenerates tracking data for all nodes.
Transform, sequence and relevant child indicies are set. Matrix indices are set later in updateProgress(). The chain and isInCamera flags are set too, as well as the node space type.
function updateModels
void updateModels()
void updateModels()
Updates the tracked model list by traversing the subtree rooted in the begin sequence to find connected models.
Note: Should be called if the structure of the begin sequence (model) subtree changes.
function updateModelTransforms
void updateModelTransforms()
void updateModelTransforms()
Updates tracked model transforms based on the current tracking state.
Note: Should be called if any matrix along the chain and model subtree change.
Reference space of models is derived from model and begin sequence data (no traversal is needed)
function updateProgress
void updateProgress()
void updateProgress()
Updates the interpolated matrix and progress values.
Note: Should be called on chain update and when the tracking time parameter changes.
Traverses the current chain, accumulating matrices and updating tracking data.
Public Attributes Documentation
variable g_trackingViewportScalingFactorXY
static float g_trackingViewportScalingFactorXY = 50.f;
static float g_trackingViewportScalingFactorXY = 50.f;
variable g_trackingViewportScalingFactorZ
static float g_trackingViewportScalingFactorZ = 50.f;
static float g_trackingViewportScalingFactorZ = 50.f;
variable m_decomposePerspectiveBrown
bool m_decomposePerspectiveBrown {false};
bool m_decomposePerspectiveBrown {false};
variable m_decomposePerspectiveShirley
bool m_decomposePerspectiveShirley {true};
bool m_decomposePerspectiveShirley {true};
variable m_decomposeProjection
bool m_decomposeProjection {true};
bool m_decomposeProjection {true};
variable m_iProjMatrix
glm::mat4 m_iProjMatrix {1.0f};
glm::mat4 m_iProjMatrix {1.0f};
Interpolated projection matrix, relevant during camera tracking when m_trackInWorldSpace is false.
variable m_iViewMatrix
glm::mat4 m_iViewMatrix {1.0f};
glm::mat4 m_iViewMatrix {1.0f};
Interpolated view matrix, relevant during camera tracking when m_trackInWorldSpace is false.
variable m_iViewportMatrix
glm::mat4 m_iViewportMatrix {1.0f};
glm::mat4 m_iViewportMatrix {1.0f};
Interpolated viewport matrix, relevant during camera tracking when m_trackInWorldSpace is false.
variable m_trackInWorldSpace
bool m_trackInWorldSpace {false};
bool m_trackInWorldSpace {false};
Friends
friend TrackedNodeData
friend struct TrackedNodeData(
TrackedNodeData
);
friend struct TrackedNodeData(
TrackedNodeData
);
Updated on 2025-05-31 at 12:55:31 +0000