Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Common - Math [Vector].h
    »Author«    Andrew Aye (EMail: mailto:andrew.aye@gmail.com, Web: http://www.andrewaye.com)
    »Version«   4.51 / »GUID« A9981407-3EC9-42AF-8B6F-8BE6DD919615                                                                                                        */
/*   -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
/*  Copyright: © 2002-2017, Andrew Aye.  All Rights Reserved.
    This software is free for non-commercial use.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
      following conditions are met:
        Redistribution of source code must retain this copyright notice, this list of conditions and the following disclaimers.
        Redistribution in binary form must reproduce this copyright notice, this list of conditions and the following disclaimers in the documentation and other materials
          provided with the distribution.
    The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
    The intellectual property rights of the algorithms used reside with Andrew Aye.
    You may not use this software, in whole or in part, in support of any commercial product without the express written consent of the author.
    There is no warranty or other guarantee of fitness of this software for any purpose. It is provided solely "as is".                                                   */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
#if !defined(TGS_COMMON_MATH_VECTOR_H)
#define TGS_COMMON_MATH_VECTOR_H
#pragma once


/* == Common ============================================================================================================================================================ */

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Public Types                                                                                                                                                          */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

#if !defined(TGS_COMMON_MATH_VECTOR_SPECIALIZATION)

TgTYPE_UNION_ALIGN(TgVEC_M_U08_16,16,)
{
    TgUINT08                                    m_aData[16];
};

TgTYPE_UNION_ALIGN(TgVEC_M_U16_08,16,)
{
    TgUINT16                                    m_aData[8];
};

TgTYPE_UNION_ALIGN(TgVEC_M_U32_04,16,)
{
    TgUINT32                                    m_aData[4];
};

TgTYPE_UNION_ALIGN(TgVEC_M_S08_16,16,)
{
    TgSINT08                                    m_aData[16];
};

TgTYPE_UNION_ALIGN(TgVEC_M_S16_08,16,)
{
    TgSINT16                                    m_aData[8];
};

TgTYPE_UNION_ALIGN(TgVEC_M_S32_04,16,)
{
    TgSINT32                                    m_aData[4];
};

TgTYPE_UNION_ALIGN(TgVEC_M_F32_04,16,)
{
    TgFLOAT32                                   m_aData[4];
};

/*# !defined(TGS_COMMON_MATH_VECTOR_SPECIALIZATION) */
#endif

/* Non-SIMD Integer Vectors */

TgTYPE_UNION(TgVEC_U08_04,)
{
    struct { TgUINT08                           r,g,b,a; } m;
    TgUINT08                                    m_aData[4];
};

TgTYPE_UNION(TgVEC_U16_02,)
{
    struct { TgUINT16                           x,y; } m;
    TgUINT16                                    m_aData[2];
};

TgTYPE_UNION(TgVEC_U64_04,)
{
    TgUINT64                                    m_aData[4];
};

TgTYPE_UNION(TgVEC_S64_04,)
{
    TgSINT64                                    m_aData[4];
};


/* Non-SIMD Floating Point Vectors */

TgTYPE_UNION(TgVEC_F32_02,)
{
    struct { TgFLOAT32                          x,y; } m;
    TgFLOAT32                                   m_aData[2];
};

TgTYPE_UNION(TgVEC_F32_03,)
{
    struct { TgFLOAT32                          x,y,z; } m;
    struct { TgFLOAT32                          r,g,b; } c;
    TgFLOAT32                                   m_aData[3];
};

TgTYPE_UNION(TgVEC_F64_02,)
{
    struct { TgFLOAT64                          x,y; } m;
    TgFLOAT64                                   m_aData[2];
};

TgTYPE_UNION(TgVEC_F64_03,)
{
    struct { TgFLOAT64                          x,y,z; } m;
    struct { TgFLOAT64                          r,g,b; } c;
    TgFLOAT64                                   m_aData[3];
};

TgTYPE_UNION(TgVEC_F64_04,)
{
    struct { TgFLOAT64                          x,y,z,w; } m;
    struct { TgFLOAT64                          r,g,b,a; } c;
    TgFLOAT64                                   m_aData[4];
};


/* SIMD Vectors */

TgTYPE_UNION(TgVEC_U08_16,)
{
    TgUINT08                                    m_aData[16];
    TgVEC_M_U08_16                              m_mData;
};

TgTYPE_UNION(TgVEC_U16_08,)
{
    TgUINT16                                    m_aData[8];
    TgVEC_M_U16_08                              m_mData;
};

TgTYPE_UNION(TgVEC_U32_04,)
{
    struct { TgUINT32                           x,y,z,w; } m;
    TgUINT32                                    m_aData[4];
    TgVEC_M_U32_04                              m_mData;
};

TgTYPE_UNION(TgVEC_S08_16,)
{
    TgSINT08                                    m_aData[16];
    TgVEC_M_S08_16                              m_mData;
};

TgTYPE_UNION(TgVEC_S16_08,)
{
    TgSINT16                                    m_aData[8];
    TgVEC_M_S16_08                              m_mData;
};

TgTYPE_UNION(TgVEC_S32_04,)
{
    struct { TgSINT32                           x,y,z,w; } m;
    TgSINT32                                    m_aData[4];
    TgVEC_M_S32_04                              m_mData;
};

TgTYPE_UNION(TgVEC_F32_04,)
{
    struct { TgFLOAT32                          x,y,z,w; } m;
    struct { TgFLOAT32                          r,g,b,a; } c;
    TgFLOAT32                                   m_aData[4];
    TgVEC_M_F32_04                              m_mData;
};


/* Alias Union for Vector Types */
TgTYPE_UNION(TgVECTOR_ALIAS_UNION,)
{
    TgVEC_U32_04                                m_u32_v04;
    TgVEC_U16_08                                m_u16_v08;
    TgVEC_U08_16                                m_u08_v16;
    TgVEC_S32_04                                m_i32_v04;
    TgVEC_S16_08                                m_i16_v08;
    TgVEC_S08_16                                m_i08_v16;
    TgVEC_F32_04                                m_f32_v04;
};

TgTYPE_UNION(TgP_VECTOR_ALIAS_UNION,)
{
    P_TgVEC_U08_16                              m_pu08_v16;
    P_TgVEC_U16_08                              m_pu16_v08;
    P_TgVEC_U32_04                              m_pu32_v04;
    P_TgVEC_S08_16                              m_pi08_v16;
    P_TgVEC_S16_08                              m_pi16_v08;
    P_TgVEC_S32_04                              m_pi32_v04;
    P_TgVEC_F32_04                              m_pf32_v04;
};


/* ====================================================================================================================================================================== */
#endif