/* *------------------------------------------------------------ * Copyright(c) 2009-2010 by Digital Media Professionals Inc. * All rights reserved. *------------------------------------------------------------ * This source code is the confidential and proprietary * of Digital Media Professionals Inc. *------------------------------------------------------------ */ #ifndef __GAS_H__ #define __GAS_H__ /* * Definitions */ #include #include #define APP_NAME "PartsysGas" /* accumulation buffer should have same size as display buffer */ #define GAS_ACC_WIDTH (nn::gx::DISPLAY0_WIDTH) #define GAS_ACC_HEIGHT (nn::gx::DISPLAY0_HEIGHT) /* texture should have powered by 2 size which is bigger than DISPLAY size */ #define GAS_TEX_WIDTH (512) #define GAS_TEX_HEIGHT (512) /* Default buffer ID */ #define DISPLAY_BUFFER (0) /* default frame buffer */ /* Particle pattern */ #define PARTICLE_PATTERNS (1) #define PARTICLE_FILES "rom:/resources/ptcl0.tga" struct _particleSys { GLuint m_pSysPositionID; nn::math::Matrix44 m_partsys_center; nn::math::Matrix44 m_partsys_color; nn::math::Matrix44 m_partsys_radius; nn::math::Matrix44 m_partsys_aspect; float m_speed; float m_particleCountMax; float m_size_min_max[2]; float m_prng[4]; /* constant for the Pseudo Random Number Generator (modulo based) */ float m_random_seed[4]; /* seeds for the PRNG */ float simulationTime; /* application side. Holds the current time for particle system */ float dTime; /* application side. Holds the time interval between each frame */ int NFrame; /* application side. Number of frames for this particle system */ }; struct gas_data { /* Gas geometry definition (accumulation pass) */ struct _particleSys pSys; GLuint pattern[PARTICLE_PATTERNS]; /* Texture ID applied to each particle */ GLfloat _dela_z; /* used in accumulation pass, to control final alpha blending*/ GLint _autoAcc; /* used in post synthesis pass */ float _densMax; /* used in post synthesis pass. Shading control*/ GLfloat _lightDirX; /* used in post synthesis pass. Shading control */ GLfloat _lightDirY; /* used in post synthesis pass. Shading control */ GLfloat _LightXY[4]; /* used in post synthesis pass. Shading control */ GLfloat _LightZ[4]; /* used in post synthesis pass. Shading control */ GLuint FogLut_ID; /* used in post synthesis pass. Look up table ID */ GLuint CollectionLUT_ID; /* used in post synthesis pass. Texture collection ID */ GLuint gasTransfert_ID[3]; /* used in post synthesis pass. Lookup table ID for gas color look up table */ float RR[16],GG[16],BB[16]; /* used in post synthesis pass. Lookup table for gas color content */ float fogTable[256]; /* used in post synthesis pass. Fog look up table for density to alpha conversion*/ GLenum shadingDensitySrc; /* used in post synthesis pass. Density selection for shading input*/ GLenum colorLutInput; /* used in post synthesis pass. Input selection for the gas color look up*/ /* Gas geometry definition / simple quad (post synthesis pass) */ GLuint quad_index_ID; /* used in post synthesis pass. Vertex Index buffer ID */ GLuint quad_vertBuf_ID; /* used in post synthesis pass. Vertex position buffer ID */ GLuint quad_texBuf_ID; /* used in post synthesis pass. Vertex Texture coordinates buffer ID */ GLuint quad_colBuf_ID; /* used in post synthesis pass. Vertex color buffer ID */ }; /* * Function declarations */ /* buffer initialization */ void GasInitialize(void); /* gaseous object data structure default initialization */ void DefaultGasObject(struct gas_data *gas,float *gasColorTable); /* utility function to update the gas color lookup table */ void SetGasColorTable(struct gas_data *gas,float *gasColorTable); /* accumulation pass */ void GasAccumulation(); /* shading pass */ void GasShading(void); #endif /* __GAS_H__ */