osci-render/Source/mathter/Common/Definitions.hpp

76 wiersze
2.8 KiB
C++

// L=============================================================================
// L This software is distributed under the MIT license.
// L Copyright 2021 Péter Kardos
// L=============================================================================
#pragma once
namespace mathter {
//------------------------------------------------------------------------------
// Enums
//------------------------------------------------------------------------------
/// <summary> Determines if you want to left- or right-multiply your matrices with vectors. </summary>
/// <remarks>
/// <para> This flag affects the generated transformation matrices. If you want to write M2*M1*v in your code,
/// then choose PRECEDE_VECTOR, if you want v*M1*M2, choose FOLLOW_VECTOR. Matrices generated by Transform, Scale,
/// Rotation and similar functions will match your order of multiplication. (I.e. bottom row is translation if you
/// choose FOLLOW_VECTOR). </para>
/// <para> You can still use M*v and v*M in your code. </para>
/// </remarks>
enum class eMatrixOrder {
PRECEDE_VECTOR,
FOLLOW_VECTOR,
};
/// <summary> Determines the memory layout of matrices. </summary>
/// <remarks>
/// <para> For ROW_MAJOR layout, the matrix's first row comes first in memory, followed immediately by
/// the second row's elements. For COLUMN_MAJOR matrices, the memory region begins with the first column. </para>
/// <para> This does not affect arithmetic or matrix generator function in any way. Your arithmetic will work
/// the same way if you change this. </para>
/// <para> Please note that changing this flag may affect performance of arithmetic operations. Profile your
/// code to determine optimal settings. Performance may depend on multiple factors. </para>
/// </remarks>
enum class eMatrixLayout {
ROW_MAJOR,
COLUMN_MAJOR,
};
//------------------------------------------------------------------------------
// Constants
//------------------------------------------------------------------------------
/// <summary> Specify this as Vector or Matrix dimension template parameter to set size at runtime.
/// PLEASE NOTE THAT DYNAMICALLY SIZED VECTORS AND MATRICES ARE NOT SUPPORTED YET. </summary>
constexpr int DYNAMIC = -1;
//------------------------------------------------------------------------------
// Classes
//------------------------------------------------------------------------------
template <class T, int Dim, bool Packed>
struct VectorData;
template <class T, int Dim, bool Packed>
class Vector;
template <class T, int Dim, bool Packed, int... Indices>
class Swizzle;
template <class T, int Rows, int Columns, eMatrixOrder Order, eMatrixLayout Layout, bool Packed>
class Matrix;
template <class MatrixT, int SRows, int SColumns>
class SubmatrixHelper;
template <class T, bool Packed>
class Quaternion;
} // namespace mathter