Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Effect - Trail - Scene.c
    »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".                                                   */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */

#define T_NAME( A, ... ) A##Trail##__VA_ARGS__
#define T_TYPE( A, ... ) A##TRAIL##__VA_ARGS__
#define T_TEXT( ... ) __VA_ARGS__ TgT("Trail")
#define T_EFFECT_FRAME 0
#define T_EFFECT_TIME_DEFAULT 0
#define T_EFFECT_PROCESS_COMMMAND_DEFAULT 0

#include "TgS Effect - Effect - Type.h_inc"


/* == Effect ============================================================================================================================================================ */

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Shared Implementation                                                                                                                                                 */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

#include "TgS Effect - Effect - Scene.c_inc"




/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Parent File Local Functions                                                                                                                                           */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

/* ---- tgFX_Trail__Update_BA ------------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
static TgVOID tgFX_Trail__Update_BA( TgFX_DATA_INST_ID tiData )
{
    P_STg2_FX__Trail                    psTrail;

    TgVEC_M_F32_04                      vBA_Radius;
    TgUINT32                            uiIndex;

    psTrail = g_asFX__Trail + tiData.m.iI;

    psTrail->m_vBA_Min_W = MS_SET1_F32_04( FLT_MAX );
    psTrail->m_vBA_Max_W = MS_SET1_F32_04( -FLT_MAX );
    vBA_Radius = M_MUL_F32_04( psTrail->m_sExtend.m_vWidth, psTrail->m_sExtend.m_vScaleFactor );

    for (uiIndex = psTrail->m_sExtend.m_uiPoint_Head; uiIndex != psTrail->m_sExtend.m_uiPoint_Tail;)
    {
        psTrail->m_vBA_Min_W = M_MIN_F32_04( psTrail->m_vBA_Min_W, M_SUB_F32_04( psTrail->m_sExtend.m_vPos_W[uiIndex], vBA_Radius ) );
        psTrail->m_vBA_Max_W = M_MAX_F32_04( psTrail->m_vBA_Max_W, M_ADD_F32_04( psTrail->m_sExtend.m_vPos_W[uiIndex], vBA_Radius ) );
        uiIndex = ((KTgFX_MAX_POINTS_IN_TRAIL + uiIndex - 1) % KTgFX_MAX_POINTS_IN_TRAIL);
    };
}


/* ---- tgFX__Scene__Trail_Cull__Insert_Frame_Mesh ---------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
static TgVOID tgFX__Scene__Trail_Cull__Insert_Frame_Mesh( PC_STg2_SE_Context UNUSED_PARAM psSE_Context, C_TgSINT32 UNUSED_PARAM iView_Index, TgFX_DATA_INST_ID UNUSED_PARAM tiActive )
{
    /* Blank on purpose - Not needed */
}