D3D API for work with matrices and perspective object

The file contains depricated methods that shouldn’t be a part of d3d API. We a re going to remove getters/setters because they are used for global state access. Other matric calculation methods should be moved out of d3d namespace.

Typedefs

using Matrix44 = TMatrix4
namespace d3d

Functions

bool settm(int which, const Matrix44 *tm)

Set the transformation matrix for the specified index.

Parameters:
  • which – The index of the transformation matrix. One of TM_XXX enum.

  • tm – Pointer to a Matrix44 object.

Returns:

True if the transformation matrix is set successfully, false otherwise.

bool settm(int which, const TMatrix &tm)

Set the transformation matrix for the specified index.

Parameters:
  • which – The index of the transformation matrix. One of TM_XXX enum.

  • tm – Reference to a TMatrix object.

Returns:

True if the transformation matrix is set successfully, false otherwise.

void settm(int which, const mat44f &tm)

Set the transformation matrix for the specified index.

Parameters:
  • which – The index of the transformation matrix. One of TM_XXX enum.

  • tm – The output mat44f object.

Returns:

True if the transformation matrix is set successfully, false otherwise.

bool gettm(int which, Matrix44 *out_tm)

Get the transformation matrix for the specified index.

Deprecated:

Parameters:
  • which – The index of the transformation matrix. One of TM_XXX enum.

  • out_tm – Pointer to a Matrix44 object to store the result.

Returns:

True if the transformation matrix is retrieved successfully, false otherwise.

bool gettm(int which, TMatrix &out_tm)

Get the transformation matrix for the specified index.

Deprecated:

Parameters:
  • which – The index of the transformation matrix. One of TM_XXX enum.

  • out_tm – Reference to a TMatrix object to store the result.

Returns:

True if the transformation matrix is retrieved successfully, false otherwise.

void gettm(int which, mat44f &out_tm)

Get the transformation matrix for the specified index.

Deprecated:

Parameters:
  • which – The index of the transformation matrix. One of TM_XXX enum.

  • out_tm – The output mat44f object.

const mat44f &gettm_cref(int which)

Get the constant reference to the transformation matrix for the specified index.

Deprecated:

Parameters:

which – The index of the transformation matrix. One of TM_XXX enum.

Returns:

The constant reference to the transformation matrix.

void getm2vtm(TMatrix &out_m2v)

Get the model to view matrix.

Deprecated:

Parameters:

out_m2v – Reference to a TMatrix object to store the result.

void getglobtm(Matrix44 &out)

Get the current globtm matrix.

Deprecated:

Parameters:

out – Reference to a Matrix44 object to store the result.

void setglobtm(Matrix44 &globtm)

Set the custom globtm matrix.

Parameters:

globtm – Reference to a Matrix44 object representing the custom globtm matrix.

void getglobtm(mat44f &out)

Get the current globtm matrix.

Deprecated:

Parameters:

out – Reference to a mat44f object to store the result.

void setglobtm(const mat44f &globtm)

Set the custom globtm matrix.

Parameters:

globtm – Reference to a mat44f object representing the custom globtm matrix.

bool setpersp(const Driver3dPerspective &p, TMatrix4 *proj_tm = nullptr)

Calculate and set the perspective matrix.

Parameters:
  • p – The Driver3dPerspective object representing the perspective parameters.

  • proj_tm – Pointer to a TMatrix4 object to store the perspective matrix. Optional.

Returns:

True if the perspective matrix is calculated and set successfully, false otherwise.

bool getpersp(Driver3dPerspective &p)

Get the last values set by setpersp().

Deprecated:

Parameters:

p – Reference to a Driver3dPerspective object to store the result.

Returns:

True if the last values are retrieved successfully, false otherwise.

bool validatepersp(const Driver3dPerspective &p)

Check if the given perspective parameters are valid.

Parameters:

p – The Driver3dPerspective object representing the perspective parameters.

Returns:

True if the perspective parameters are valid, false otherwise.

bool calcproj(const Driver3dPerspective &p, mat44f &proj_tm)

Calculate the perspective matrix without setting it.

Parameters:
  • p – The Driver3dPerspective object representing the perspective parameters.

  • proj_tm – Reference to a mat44f object to store the perspective matrix.

Returns:

True if the perspective matrix is calculated successfully, false otherwise.

bool calcproj(const Driver3dPerspective &p, TMatrix4 &proj_tm)

Calculate the perspective matrix without setting it.

Parameters:
  • p – The Driver3dPerspective object representing the perspective parameters.

  • proj_tm – Reference to a TMatrix4 object to store the perspective matrix.

Returns:

True if the perspective matrix is calculated successfully, false otherwise.

void calcglobtm(const mat44f &view_tm, const mat44f &proj_tm, mat44f &result)

Calculate the globtm matrix without setting it.

Parameters:
  • view_tm – The view matrix.

  • proj_tm – The perspective matrix.

  • result – Reference to a mat44f object to store the result.

void calcglobtm(const mat44f &view_tm, const Driver3dPerspective &persp, mat44f &result)

Calculate the globtm matrix without setting it.

Parameters:
  • view_tm – The view matrix.

  • persp – The Driver3dPerspective object representing the perspective parameters.

  • result – Reference to a mat44f object to store the result.

void calcglobtm(const TMatrix &view_tm, const TMatrix4 &proj_tm, TMatrix4 &result)

Calculate the globtm matrix without setting it.

Parameters:
  • view_tm – The view matrix.

  • proj_tm – The perspective matrix.

  • result – Reference to a TMatrix4 object to store the result.

void calcglobtm(const TMatrix &view_tm, const Driver3dPerspective &persp, TMatrix4 &result)

Calculate the globtm matrix without setting it.

Parameters:
  • view_tm – The view matrix.

  • persp – The Driver3dPerspective object representing the perspective parameters.

  • result – Reference to a TMatrix4 object to store the result.