Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Effect - Render.inl
    »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_EFFECT_INTERNAL_INL)
#define TGS_EFFECT_INTERNAL_INL

/* == Effects =========================================================================================================================================================== */

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Private Functions                                                                                                                                                     */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

/* ---- tgFX_Calc_Quad -------------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgINLINE TgVOID tgFX_Calc_Quad( P_TgVEC_M_F32_04 pvPos_W, P_TgVEC_M_F32_04 pvBasis, C_TgFLOAT32 fSpin, CP_STg2_FX_Calc_Quad psCalcData )
{
    TgFLOAT32                           fCos;
    TgFLOAT32                           fSin;

    tgPM_SINCOS_F32( &fCos, &fSin, fSpin );

    {
        C_TgVEC_M_F32_04                    vCos = MS_SET1_F32_04( fCos );
        C_TgVEC_M_F32_04                    vSin = MS_SET1_F32_04( fSin );
        C_TgVEC_M_F32_04                    vAxis_Right = M_MAD_F32_04( vSin, psCalcData->m_vDir_Up, M_MUL_F32_04( vCos, psCalcData->m_vDir_Right ) );
        C_TgVEC_M_F32_04                    vQuad_Right = M_MUL_F32_04( psCalcData->m_vSize_X, vAxis_Right );
        C_TgVEC_M_F32_04                    vAxis_Up = M_NMS_F32_04( vSin, psCalcData->m_vDir_Right, M_MUL_F32_04( vCos, psCalcData->m_vDir_Up ) );
        C_TgVEC_M_F32_04                    vQuad_Up = M_MUL_F32_04( psCalcData->m_vSize_Y, vAxis_Up );
        C_TgVEC_M_F32_04                    vOne = MS_SET1_F32_04( 1.0F );
        C_TgVEC_M_F32_04                    vX0 = M_MUL_F32_04( vQuad_Right, M_ADD_F32_04( vOne, psCalcData->m_vPivot_X ) );
        C_TgVEC_M_F32_04                    vX1 = M_MUL_F32_04( vQuad_Right, M_SUB_F32_04( vOne, psCalcData->m_vPivot_X ) );
        C_TgVEC_M_F32_04                    vY0 = M_MUL_F32_04( vQuad_Up, M_SUB_F32_04( vOne, psCalcData->m_vPivot_Y ) );
        C_TgVEC_M_F32_04                    vY1 = M_MUL_F32_04( vQuad_Up, M_ADD_F32_04( vOne, psCalcData->m_vPivot_Y ) );

        pvBasis[0] = M_NORM_F32_04( vAxis_Right );
        pvBasis[1] = M_NORM_F32_04( vAxis_Up );
        pvPos_W[0] = M_ADD_F32_04( psCalcData->m_vPos_W, M_SUB_F32_04( vY0, vX0 ) );
        pvPos_W[1] = M_SUB_F32_04( psCalcData->m_vPos_W, M_ADD_F32_04( vX0, vY1 ) );
        pvPos_W[2] = M_ADD_F32_04( psCalcData->m_vPos_W, M_SUB_F32_04( vX1, vY1 ) );
        pvPos_W[3] = M_ADD_F32_04( psCalcData->m_vPos_W, M_ADD_F32_04( vX1, vY0 ) );
    };
}


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