Skip to content

Core::MatrixTracker

The main tracking object, responsible for tracking a single chain of sequences. More...

#include "Core/Nodes/Tracking.h"

Public Classes

Name
structTrackedMatrix <br>Internal helper object representing a single matrix.
structTrackedNode <br>Internal wrapper of core nodes for managing tracking data for each node involved in the tracking operation.
structTrackedTransform <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)
IDgetCameraID() const<br>Returns the begin camera ID (if provided)
std::stringgetDebugString()
TrackingDirectiongetDirection() const
unsignedgetFullMatricesCount() 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.
IDgetInterpolatedTransformID() 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.
intgetMatrixCount() const<br>Returns the number of tracked matrices / transformations. Greater or equal to transform count.
floatgetProgress() 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.
IDgetSequenceID() 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.
intgetTransformCount() const<br>Returns the number of tracked transform nodes.
boolisTracking() const
boolisTrackingFromLeft() const
voidrequestChainUpdate()
voidrequestProgressUpdate()
voidreverseDirection()
voidsetProgress(float param)<br>Set the tracker's progress parameter, a value from 0 to 1.
voidupdate()<br>Updates the state of the tracker, reacts to any changes induced by other method calls.
voidonNodeDestroy(Node * node)<br>Alerts the tracker that a node has been destroyed.
voidonNodeGraphChange(Node * node)<br>Alerts the tracker of a structure change in the tracked nodes.
voidonNodeUpdate(Node * node)<br>Alerts the tracker that a tracked node has been updated.

Protected Functions

Name
voidclearModels()
voidclearTrackingData()
voidreset()<br>Reset the matrix tracker to empty / inactive state.
voidreverseChain()<br>Reverses the order of tracked transforms and sequences.
voidupdateChain()<br>Traverses the graph from the begin sequence, updating the sequence/matrix chain.
voidupdateModels()<br>Updates the tracked model list by traversing the subtree rooted in the begin sequence to find connected models.
voidupdateModelTransforms()<br>Updates tracked model transforms based on the current tracking state.
voidupdateProgress()<br>Updates the interpolated matrix and progress values.

Public Attributes

Name
floatg_trackingViewportScalingFactorXY
floatg_trackingViewportScalingFactorZ
boolm_decomposePerspectiveBrown
boolm_decomposePerspectiveShirley
boolm_decomposeProjection
glm::mat4m_iProjMatrix <br>Interpolated projection matrix, relevant during camera tracking when m_trackInWorldSpace is false.
glm::mat4m_iViewMatrix <br>Interpolated view matrix, relevant during camera tracking when m_trackInWorldSpace is false.
glm::mat4m_iViewportMatrix <br>Interpolated viewport matrix, relevant during camera tracking when m_trackInWorldSpace is false.
boolm_trackInWorldSpace

Friends

Name
structTrackedNodeData

Detailed Description

cpp
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

cpp
MatrixTracker() =default
MatrixTracker() =default

Constructs an empty / inactive tracker.

function MatrixTracker

cpp
MatrixTracker(
    Ptr< Sequence > beginSequence,
    Ptr< Camera > beginCamera,
    TrackingDirection direction
)
MatrixTracker(
    Ptr< Sequence > beginSequence,
    Ptr< Camera > beginCamera,
    TrackingDirection direction
)

function MatrixTracker

cpp
MatrixTracker(
    Ptr< Sequence > beginSequence,
    TrackingDirection direction
)
MatrixTracker(
    Ptr< Sequence > beginSequence,
    TrackingDirection direction
)

function ~MatrixTracker

cpp
~MatrixTracker()
~MatrixTracker()

function getCamera

cpp
Ptr< Camera > getCamera() const
Ptr< Camera > getCamera() const

Returns the begin camera (if provided)

function getCameraID

cpp
ID getCameraID() const
ID getCameraID() const

Returns the begin camera ID (if provided)

function getDebugString

cpp
std::string getDebugString()
std::string getDebugString()

function getDirection

cpp
TrackingDirection getDirection() const
TrackingDirection getDirection() const

function getFullMatricesCount

cpp
inline unsigned getFullMatricesCount() const
inline unsigned getFullMatricesCount() const

function getInterpolatedMatrix

cpp
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

cpp
inline const TrackedMatrix * getInterpolatedMatrixObject() const
inline const TrackedMatrix * getInterpolatedMatrixObject() const

Reference to the internal interpolated matrix object.

function getInterpolatedTransform

cpp
inline const TrackedTransform * getInterpolatedTransform() const
inline const TrackedTransform * getInterpolatedTransform() const

Reference to the internal interpolated transform object.

function getInterpolatedTransformID

cpp
inline ID getInterpolatedTransformID() const
inline ID getInterpolatedTransformID() const

Core ID of the currently interpolated transform.

function getMatrices

cpp
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

cpp
int getMatrixCount() const
int getMatrixCount() const

Returns the number of tracked matrices / transformations. Greater or equal to transform count.

function getProgress

cpp
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

cpp
Ptr< Sequence > getSequence() const
Ptr< Sequence > getSequence() const

Returns the begin sequence.

function getSequenceID

cpp
ID getSequenceID() const
ID getSequenceID() const

Returns the begin sequence ID.

function getTrackedCamera

cpp
const UPtr< TrackedNode > & getTrackedCamera() const
const UPtr< TrackedNode > & getTrackedCamera() const

function getTrackedModels

cpp
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

cpp
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

cpp
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

cpp
int getTransformCount() const
int getTransformCount() const

Returns the number of tracked transform nodes.

function isTracking

cpp
bool isTracking() const
bool isTracking() const

function isTrackingFromLeft

cpp
bool isTrackingFromLeft() const
bool isTrackingFromLeft() const

function requestChainUpdate

cpp
void requestChainUpdate()
void requestChainUpdate()

function requestProgressUpdate

cpp
void requestProgressUpdate()
void requestProgressUpdate()

function reverseDirection

cpp
void reverseDirection()
void reverseDirection()

function setProgress

cpp
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

cpp
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

cpp
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

cpp
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

cpp
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

cpp
void clearModels()
void clearModels()

function clearTrackingData

cpp
void clearTrackingData()
void clearTrackingData()

function reset

cpp
void reset()
void reset()

Reset the matrix tracker to empty / inactive state.

function reverseChain

cpp
void reverseChain()
void reverseChain()

Reverses the order of tracked transforms and sequences.

function updateChain

cpp
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

cpp
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

cpp
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

cpp
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

cpp
static float g_trackingViewportScalingFactorXY = 50.f;
static float g_trackingViewportScalingFactorXY = 50.f;

variable g_trackingViewportScalingFactorZ

cpp
static float g_trackingViewportScalingFactorZ = 50.f;
static float g_trackingViewportScalingFactorZ = 50.f;

variable m_decomposePerspectiveBrown

cpp
bool m_decomposePerspectiveBrown {false};
bool m_decomposePerspectiveBrown {false};

variable m_decomposePerspectiveShirley

cpp
bool m_decomposePerspectiveShirley {true};
bool m_decomposePerspectiveShirley {true};

variable m_decomposeProjection

cpp
bool m_decomposeProjection {true};
bool m_decomposeProjection {true};

variable m_iProjMatrix

cpp
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

cpp
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

cpp
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

cpp
bool m_trackInWorldSpace {false};
bool m_trackInWorldSpace {false};

Friends

friend TrackedNodeData

cpp
friend struct TrackedNodeData(
    TrackedNodeData 
);
friend struct TrackedNodeData(
    TrackedNodeData 
);

Updated on 2025-05-31 at 12:55:31 +0000