Home

Resume

Blog

Teikitu


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

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Type Validation                                                                                                                                                       */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

CLANG_WARN_DISABLE_PUSH(extended-offsetof)
TgCOMPILER_ASSERT( sizeof( TgUINT32 ) == sizeof( ETgFX_COMMAND ), 0 );
TgCOMPILER_ASSERT( sizeof( TgUINT64 ) == sizeof( TgFX_DATA_INST_ID ), 0 );
TgCOMPILER_ASSERT( sizeof( TgUINT64 ) == sizeof( TgFX_CLIENT_INST_ID ), 0 );
TgCOMPILER_ASSERT( ETgFX_COMMAND__MAX < 0xFF, 0 );
TgCOMPILER_ASSERT( offsetof( STg2_FX_Command__Update__NoParam, m_sDest.m_tiData ) == offsetof( STg2_FX_Command__Update__1_S32, m_sDest.m_tiData ), 0 );
TgCOMPILER_ASSERT( offsetof( STg2_FX_Command__Update__NoParam, m_sDest.m_tiData ) == offsetof( STg2_FX_Command__Update__1_F32, m_sDest.m_tiData ), 0 );
TgCOMPILER_ASSERT( offsetof( STg2_FX_Command__Update__NoParam, m_sDest.m_tiData ) == offsetof( STg2_FX_Command__Update__1_F32_04, m_sDest.m_tiData ), 0 );
TgCOMPILER_ASSERT( offsetof( STg2_FX_Command__Update__NoParam, m_sDest.m_tiData ) == offsetof( STg2_FX_Command__Update__2_F32_04, m_sDest.m_tiData ), 0 );
TgCOMPILER_ASSERT( offsetof( STg2_FX_Command__Update__NoParam, m_sDest.m_tiData ) == offsetof( STg2_FX_Command__Update__1_UXX, m_sDest.m_tiData ), 0 );
TgCOMPILER_ASSERT( offsetof( STg2_FX_Command__Update__NoParam, m_sDest.m_tiData ) == offsetof( STg2_FX_Command__Update__2_UXX, m_sDest.m_tiData ), 0 );
CLANG_WARN_DISABLE_POP(extended-offsetof)




/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  System ID                                                                                                                                                             */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

TgKI_DEFINE( FX_CLIENT_INST_ID );
TgKI_DEFINE( FX_DATA_INST_ID );
TgKI_DEFINE( FX_EFFECT_ID );
TgKI_DEFINE( FX_CACHE_ID );
C_TgFX_CLIENT_INST_ID KTgFX_CLIENT_INST_ID__GROUP_DELAYED_SPAWN = { ~0LL + 1LL };




/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Profile Markers                                                                                                                                                       */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

PROFILE_DEFINE( FX_COMMANDS__CLIENT );
PROFILE_ARRAY_DEFINE( ETgFX_UPDATE__MAX + 1, FX_UPDATE__UPDATE );
PROFILE_DEFINE( FX_RENDER_PATCH_CONTEXT );
PROFILE_DEFINE( FX_RENDER_PROCESS_COMMANDS );
PROFILE_DEFINE( FX_RENDER_GENERATE );




/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Private Data                                                                                                                                                          */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

TgSINT32                                    g_iFX_Quality_Setting;
TgCN_VAR_ID                                 g_tiFX_CN__Quality_Setting;
TgFLOAT32                                   g_fFX_Alpha_Threshold;
TgCN_VAR_ID                                 g_tiFX_CN__Alpha_Threshold;
TgSINT32                                    g_iFX_Decal_Memory_Max;
TgCN_VAR_ID                                 g_tiFX_CN__Decal_Memory_Max;
TgFLOAT32                                   g_fFX_Decal_Normal_Threshold;
TgCN_VAR_ID                                 g_tiFX_CN__Decal_Normal_Threshold;
TgSINT32                                    g_iFX_Emitter_Memory_Max;
TgCN_VAR_ID                                 g_tiFX_CN__Emitter_Memory_Max;

TgATOMIC_SINT32                             g_xiFX_Fence__UPDATE; /*« Jobs are defined in the effect data files */
TgATOMIC_SINT32                             g_xiFX_Fence__TO_CLIENT__COMMAND_QUEUE_FULL;
TgATOMIC_SINT32                             g_xiFX_Fence__CLIENT_TO_UPDATE__PROCESS_COMMAND_STREAM;
TgATOMIC_SINT32                             g_xiFX_Fence__CLIENT_TO_UPDATE__COMMAND_QUEUE_FULL;
TgATOMIC_SINT32                             g_xiFX_Fence__SCENE_CULLING;
TgATOMIC_SINT32                             g_xiFX_Fence__SCENE_BOUNDING_BOX;
TgATOMIC_SINT32                             g_xiFX_Fence__SCENE_FINISH;
TgATOMIC_SINT32                             g_xiFX_Fence__RENDER_PROCESS_HEADERS;
TgATOMIC_SINT32                             g_xiFX_Fence__RENDER_ALLOCATE;
TgATOMIC_SINT32                             g_xiFX_Fence__RENDER_GENERATE;

P_STg2_FX_Descriptor                        g_apsFX_Descriptor[ETgFX__EFFECT_MAX];
C_TgUINT32                                  g_uiFX_Command_Size[ETgFX_COMMAND__MAX + 1] =
                                            {
                                                sizeof( STg2_FX_Command__Notify ),            /* ETgFX_COMMAND__CLIENT_TO_UPDATE__NOTIFY */
                                                sizeof( STg2_FX_Command__Update__Create ),    /* ETgFX_COMMAND__CLIENT_TO_UPDATE__CREATE */
                                                sizeof( STg2_FX_Command__Update__NoParam ),   /* ETgFX_COMMAND__CLIENT_TO_UPDATE__KILL */
                                                sizeof( STg2_FX_Command__Update__NoParam ),   /* ETgFX_COMMAND__CLIENT_TO_UPDATE__STOP */
                                                sizeof( STg2_FX_Command__Update__1_F32_04 ),  /* ETgFX_COMMAND__CLIENT_TO_UPDATE__POSITION_SET */
                                                sizeof( STg2_FX_Command__Update__1_F32_04 ),  /* ETgFX_COMMAND__CLIENT_TO_UPDATE__POSITION_UPDATE_FROM_PARENT */
                                                sizeof( STg2_FX_Command__Update__1_F32_04 ),  /* ETgFX_COMMAND__CLIENT_TO_UPDATE__ROTATION_SET */
                                                sizeof( STg2_FX_Command__Update__1_F32_04 ),  /* ETgFX_COMMAND__CLIENT_TO_UPDATE__ROTATION_UPDATE_FROM_PARENT */
                                                sizeof( STg2_FX_Command__Update__1_F32 ),     /* ETgFX_COMMAND__CLIENT_TO_UPDATE__SPIN */
                                                sizeof( STg2_FX_Command__Update__1_UXX ),     /* ETgFX_COMMAND__CLIENT_TO_UPDATE__VISIBLE */
                                                sizeof( STg2_FX_Command__Update__1_S32 ),     /* ETgFX_COMMAND__SCENE_TO_RENDER__PATCH_CONTEXT */
                                                sizeof( STg2_FX_Command__Client__Create ),    /* ETgFX_COMMAND__UPDATE_TO_CLIENT__CREATE */
                                                sizeof( STg2_FX_Command__Client__Free ),      /* ETgFX_COMMAND__UPDATE_TO_CLIENT__FREE */
                                                sizeof( STg2_FX_Command__Notify ),            /* ETgFX_COMMAND__UPDATE_TO_CLIENT__NOTIFY */
                                                KTgMAX_U32
                                            };

STg2_RN_Particle_Header                     g_asParticle_Header[KTgFX_MAX_RENDER_INSTANCE * ETgFX_MAX_HEADER_INDEX];
TgUINT32                                    g_uiParticle_Header_Index;

TgSINT32                                    g_aiFX__Client__Shared_State[KTgFX_MAX_EFFECT_INSTANCE];
STg2_UTM_AM_ST_ISO                          g_sFX_Effect__Client__Effect;
STg2_FX__Client                             g_asFX_Effect[KTgFX_MAX_EFFECT_INSTANCE];

TgFX_CLIENT_INST_ID                         g_atiFX__Client__Update__Head[ETgFX_UPDATE__MAX];
TgSINT32                                    g_niFX__Client__Update__Active;

TgFX_EFFECT_ID                              g_tiFX_File_Default;
TgFX_EFFECT_ID                              g_tiFX_File_Error;

TgUINTXX                                    g_auiFX_KN_File__Effect_Hash[ETgFX_DATA__EFFECT_MAX];
STg2_FX_Data__Effect                        g_asFX_KN_File__Effect[ETgFX_DATA__EFFECT_MAX];
STg2_FX_Data__Data                          g_asFX_Cache__Effect[ETgFX_DATA__EFFECT_MAX];

TgATOMIC_SINT32                             g_xiFX__Decal__Memory_Current;
TgATOMIC_SINT32                             g_xiFX__Emitter__Memory_Current;

#if TgS_DEBUG_EFFECT
TgCN_VAR_ID                                 g_tiFX_Debug__OSD__Profile_Enable;
TgCN_VAR_ID                                 g_tiFX_Debug__OSD__Profile_Sort;

TgCN_VAR_ID                                 g_tiFX_Debug__Draw_BA;
TgCN_VAR_ID                                 g_tiFX_Debug__Draw_Emitter;

TgCN_VAR_ID                                 g_tiFX_Debug__Disable_Module;
TgCN_VAR_ID                                 g_tiFX_Debug__Disable_Update;
TgCN_VAR_ID                                 g_tiFX_Debug__Disable_Render;
TgCN_VAR_ID                                 g_tiFX_Debug__Disable_Render_Buffer;

TgCN_VAR_ID                                 g_tiFX_Debug__Disable_Cull_On_Spawn;
TgCN_VAR_ID                                 g_tiFX_Debug__Disable_Cull_On_Render;

TgCHAR                                      g_aszFX_Cache__EFfect_Name[ETgFX_DATA__EFFECT_MAX][32];
/*# TgS_DEBUG_EFFECT */
#endif




/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Public Functions                                                                                                                                                      */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

/* ---- tgFX_Query_Fixed_Memory ----------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgSIZE tgFX_Query_Fixed_Memory( TgVOID )
{
    return (0
           + sizeof( g_iFX_Quality_Setting )
           + sizeof( g_tiFX_CN__Quality_Setting )
           + sizeof( g_fFX_Alpha_Threshold )
           + sizeof( g_tiFX_CN__Alpha_Threshold )
           + sizeof( g_iFX_Decal_Memory_Max )
           + sizeof( g_tiFX_CN__Decal_Memory_Max )
           + sizeof( g_fFX_Decal_Normal_Threshold )
           + sizeof( g_tiFX_CN__Decal_Normal_Threshold )
           + sizeof( g_iFX_Emitter_Memory_Max )
           + sizeof( g_tiFX_CN__Emitter_Memory_Max )

           + sizeof( g_xiFX_Fence__UPDATE )
           + sizeof( g_xiFX_Fence__TO_CLIENT__COMMAND_QUEUE_FULL )
           + sizeof( g_xiFX_Fence__CLIENT_TO_UPDATE__PROCESS_COMMAND_STREAM )
           + sizeof( g_xiFX_Fence__CLIENT_TO_UPDATE__COMMAND_QUEUE_FULL )
           + sizeof( g_xiFX_Fence__SCENE_CULLING )
           + sizeof( g_xiFX_Fence__SCENE_BOUNDING_BOX )
           + sizeof( g_xiFX_Fence__RENDER_PROCESS_HEADERS )
           + sizeof( g_xiFX_Fence__RENDER_ALLOCATE )
           + sizeof( g_xiFX_Fence__RENDER_GENERATE )
            
           + sizeof( g_apsFX_Descriptor )
           + sizeof( g_uiFX_Command_Size )

           + sizeof( g_asParticle_Header )
           + sizeof( g_uiParticle_Header_Index )

           + sizeof( g_aiFX__Client__Shared_State )
           + sizeof( g_sFX_Effect__Client__Effect )
           + sizeof( g_asFX_Effect )

           + sizeof( g_atiFX__Client__Update__Head )
           + sizeof( g_niFX__Client__Update__Active )

           + sizeof( g_tiFX_File_Default )
           + sizeof( g_tiFX_File_Error )

           + sizeof( g_auiFX_KN_File__Effect_Hash )
           + sizeof( g_asFX_KN_File__Effect )
           + sizeof( g_asFX_Cache__Effect )

           + sizeof( g_xiFX__Decal__Memory_Current )
           + sizeof( g_xiFX__Emitter__Memory_Current )

           + tgFX__Client__Trail_Query_Fixed_Memory()
           + tgFX__Client__Sound_Query_Fixed_Memory()
           + tgFX__Client__Post_Query_Fixed_Memory()
           + tgFX__Client__Liquid_Query_Fixed_Memory()
           + tgFX__Client__Light_Query_Fixed_Memory()
           + tgFX__Client__Group_Query_Fixed_Memory()
           + tgFX__Client__GIB_Query_Fixed_Memory()
           + tgFX__Client__Glass_Query_Fixed_Memory()
           + tgFX__Client__Emitter_Query_Fixed_Memory()
           + tgFX__Client__Decal_Query_Fixed_Memory()
           + tgFX__Client__Billboard_Query_Fixed_Memory()
           + tgFX__Client__Beam_Query_Fixed_Memory()

         #if TgS_DEBUG_EFFECT
            + sizeof( g_tiFX_Debug__OSD__Profile_Enable )
            + sizeof( g_tiFX_Debug__OSD__Profile_Sort )
            + sizeof( g_tiFX_Debug__Draw_BA )
            + sizeof( g_tiFX_Debug__Draw_Emitter )
            + sizeof( g_tiFX_Debug__Disable_Module )
            + sizeof( g_tiFX_Debug__Disable_Update )
            + sizeof( g_tiFX_Debug__Disable_Render )
            + sizeof( g_tiFX_Debug__Disable_Render_Buffer )
            + sizeof( g_tiFX_Debug__Disable_Cull_On_Spawn )
            + sizeof( g_tiFX_Debug__Disable_Cull_On_Render )
            + sizeof( g_aszFX_Cache__EFfect_Name )
         /*# TgS_DEBUG_EFFECT */
         #endif
    );
}