Home

Resume

Blog

Teikitu


// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= //
//  »Project«   Teikitu Gaming System (TgS) (∂)
//  »File«      TgS (IPH) Common - Math API [Vector] [M] [S].inl
//  »Author«    Andrew Aye (EMail: mailto:andrew.aye@gmail.com, Web: http://www.andrewaye.com)
//  »Version«   4.0
// ------------------------------------------------------------------------------------------------------------------------------ //
//  Copyright: © 2002-2010, 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: 
//    Redistributions of source code must retain this copyright notice, this list of conditions and the following disclaimers. 
//    Redistributions 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. 
//  Neither the names of the copyright owner nor the names of its contributors may 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_IPH_COMMON_MATH_API_VECTOR_M_S_INL_)
#define _TGS_IPH_COMMON_MATH_API_VECTOR_M_S_INL_
#pragma once


// ---- VECTOR 4 - INIT --------------------------------------------------------------------------------------------------------- //

TgINLINE TgVEC_M_F32_04 M_SET_ELEM_F32_04( C_TgFLOAT32 fX, C_TgFLOAT32 fY, C_TgFLOAT32 fZ, C_TgFLOAT32 fW )
{
    return (F_SET_ELEM_F32_04( fX, fY, fZ, fW ).m_mData);
}


TgINLINE TgVEC_M_F32_04 M_SETP_ELEM_F32_04( C_TgFLOAT32 fX, C_TgFLOAT32 fY, C_TgFLOAT32 fZ )
{
    return (F_SETP_ELEM_F32_04( fX, fY, fZ ).m_mData);
}


TgINLINE TgVEC_M_F32_04 M_SETV_ELEM_F32_04( C_TgFLOAT32 fX, C_TgFLOAT32 fY, C_TgFLOAT32 fZ )
{
    return (F_SETV_ELEM_F32_04( fX, fY, fZ ).m_mData);
}


TgINLINE TgVEC_M_F32_04 M_SETP_F32_04( C_TgVEC_M_F32_04 tvRight )
{
    return (F_SETP_F32_04( (CP_TgVEC_F32_04)&tvRight ).m_mData);
}


TgINLINE TgVEC_M_F32_04 M_SETV_F32_04( C_TgVEC_M_F32_04 tvRight )
{
    return (F_SETV_F32_04( (CP_TgVEC_F32_04)&tvRight ).m_mData);
}




// ---- HOMOGENEOUS THREE ELEMENT DOT PRODUCT ----------------------------------------------------------------------------------- //

TgINLINE TgVEC_M_F32_04 M_DOT3_VV_F32_04( C_TgVEC_M_F32_04 tvLeft, C_TgVEC_M_F32_04 tvRight )
{
    TgFLOAT32                           fLength = F_DOT3_VV_F32_04( (CP_TgVEC_F32_04)&tvLeft, (CP_TgVEC_F32_04)&tvRight );
    
    return (M_SET_ELEM_F32_04( fLength, fLength, fLength, fLength ));
}


TgINLINE TgVEC_M_F32_04 M_CX_F32_04( C_TgVEC_M_F32_04 tvLeft, C_TgVEC_M_F32_04 tvRight )
{
    return (F_CX_F32_04( (CP_TgVEC_F32_04)&tvLeft, (CP_TgVEC_F32_04)&tvRight ).m_mData);
}


TgINLINE TgVEC_M_F32_04 M_UCX_F32_04( C_TgVEC_M_F32_04 tvLeft, C_TgVEC_M_F32_04 tvRight )
{
    return (F_UCX_F32_04( (CP_TgVEC_F32_04)&tvLeft, (CP_TgVEC_F32_04)&tvRight ).m_mData);
}


TgINLINE TgVEC_M_F32_04 M_UCX_LEN_F32_04( PCU_TgVEC_M_F32_04 ptvRet_Length, C_TgVEC_M_F32_04 tvLeft, C_TgVEC_M_F32_04 tvRight )
{
    TgFLOAT32                           fLength;
    C_TgVEC_M_F32_04                    tvRet = F_UCX_LEN_F32_04( &fLength, (CP_TgVEC_F32_04)&tvLeft, (CP_TgVEC_F32_04)&tvRight ).m_mData;
    
    *ptvRet_Length = M_SET_ELEM_F32_04( fLength, fLength, fLength, fLength );
    return (tvRet);
}




// Quaternion - Functions
TgINLINE TgVEC_M_F32_04 M_QT_MUL_F32_04( C_TgVEC_M_F32_04 b, C_TgVEC_M_F32_04 c )
{
    return (F_QT_MUL_F32_04( (CP_TgVEC_F32_04)&b, (CP_TgVEC_F32_04)&c ).m_mData);
}


TgINLINE TgVEC_M_F32_04 M_QT_SLERP_F32_04( C_TgVEC_M_F32_04 b, C_TgVEC_M_F32_04 c, C_TgVEC_M_F32_04 d )
{
    return (F_QT_SLERP_F32_04( *(CP_TgFLOAT32)&b, (CP_TgVEC_F32_04)&c, (CP_TgVEC_F32_04)&d ).m_mData);
}


TgINLINE TgVEC_M_F32_04 M_QT_VECTOR_TO_VECTOR_F32_04( C_TgVEC_M_F32_04 b, C_TgVEC_M_F32_04 c )
{
    return (F_QT_VECTOR_TO_VECTOR_F32_04( (CP_TgVEC_F32_04)&b, (CP_TgVEC_F32_04)&c ).m_mData);
}


#endif //  END  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////