Matrix GetMatrix( Sandbox.StringToken& name, Matrix& defaultValue )

robot_2Generated
code_blocksInput

Description

The GetMatrix method retrieves a Matrix value associated with a specified StringToken key from the RenderAttributes collection. If the key does not exist, it returns a default matrix value provided by the caller.

Usage

To use the GetMatrix method, you need to provide a StringToken that identifies the matrix you want to retrieve and a default Matrix value that will be returned if the specified key is not found in the collection.

This method is useful when you need to ensure that a matrix value is always available, either by retrieving an existing one or by using a default value.

Example

// Example usage of GetMatrix method
RenderAttributes renderAttributes = new RenderAttributes();
StringToken matrixKey = new StringToken("WorldMatrix");
Matrix defaultMatrix = Matrix.Identity;

// Retrieve the matrix associated with the key, or use the default if not found
Matrix worldMatrix = renderAttributes.GetMatrix(ref matrixKey, ref defaultMatrix);