1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: Gas.h 4 5 Copyright (C)2009-2012 Nintendo Co., Ltd. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Rev: 46365 $ 14 *---------------------------------------------------------------------------*/ 15 16 /* 17 *------------------------------------------------------------ 18 * Copyright(c) 2009-2010 by Digital Media Professionals Inc. 19 * All rights reserved. 20 *------------------------------------------------------------ 21 * This source code is the confidential and proprietary 22 * of Digital Media Professionals Inc. 23 *------------------------------------------------------------ 24 */ 25 #ifndef DMP_GAS_H__ 26 #define DMP_GAS_H__ 27 28 #include <nn/gx.h> 29 30 /* 31 * Definitions 32 */ 33 34 #define APP_NAME "GasColorSimple" 35 36 /* Buffer size */ 37 #define DISPLAY_WIDTH (nn::gx::DISPLAY0_WIDTH) 38 #define DISPLAY_HEIGHT (nn::gx::DISPLAY0_HEIGHT) 39 40 /* accumulation buffer should have same size as display buffer */ 41 #define GAS_ACC_WIDTH (DISPLAY_WIDTH) 42 #define GAS_ACC_HEIGHT (DISPLAY_HEIGHT) 43 /* texture should have powered by 2 size which is bigger than DISPLAY size */ 44 #define GAS_TEX_WIDTH (512) 45 #define GAS_TEX_HEIGHT (512) 46 47 /* Default buffer ID */ 48 #define DISPLAY_BUFFER (0) /* default frame buffer */ 49 50 /* Particle pattern */ 51 #define PARTICLE_PATTERNS (1) 52 #define PARTICLE_FILES "rom:/resources/ptcl0.tga" 53 54 55 struct gas_data 56 { 57 /* Gas geometry definition (accumulation pass) */ 58 GLuint gasgeo_tri_ID; /* used in accumulation pass. Vertex Index buffer ID */ 59 GLuint gasgeo_center_ID; /* used in accumulation pass. Vertex position buffer ID */ 60 GLuint gasgeo_tx0_ID; /* used in accumulation pass. Vertex Texture coordinates buffer ID */ 61 GLuint gasgeo_density_ID; /* used in accumulation pass. Vertex color buffer ID */ 62 GLuint pattern[PARTICLE_PATTERNS]; /* Texture ID applied to each particle */ 63 GLsizei gasgeo_size; /* Number of elements (triangles) defining the gaseous object*/ 64 GLfloat _dela_z; /* used in accumulation pass, to control final alpha blending*/ 65 66 GLint _autoAcc; /* used in post synthesis pass */ 67 float _densMax; /* used in post synthesis pass. Shading control*/ 68 GLfloat _lightDirX; /* used in post synthesis pass. Shading control */ 69 GLfloat _lightDirY; /* used in post synthesis pass. Shading control */ 70 GLfloat _LightXY[4]; /* used in post synthesis pass. Shading control */ 71 GLfloat _LightZ[4]; /* used in post synthesis pass. Shading control */ 72 GLuint FogLut_ID; /* used in post synthesis pass. Look up table ID */ 73 GLuint CollectionLUT_ID; /* used in post synthesis pass. Texture collection ID */ 74 GLuint gasTransfert_ID[3]; /* used in post synthesis pass. Lookup table ID for gas color look up table */ 75 float RR[16],GG[16],BB[16]; /* used in post synthesis pass. Lookup table for gas color content */ 76 float fogTable[256]; /* used in post synthesis pass. Fog look up table for density to alpha conversion*/ 77 GLenum shadingDensitySrc; /* used in post synthesis pass. Density selection for shading input*/ 78 GLenum colorLutInput; /* used in post synthesis pass. Input selection for the gas color look up*/ 79 /* Gas geometry definition / simple quad (post synthesis pass) */ 80 GLuint quad_index_ID; /* used in post synthesis pass. Vertex Index buffer ID */ 81 GLuint quad_vertBuf_ID; /* used in post synthesis pass. Vertex position buffer ID */ 82 GLuint quad_texBuf_ID; /* used in post synthesis pass. Vertex Texture coordinates buffer ID */ 83 GLuint quad_colBuf_ID; /* used in post synthesis pass. Vertex color buffer ID */ 84 85 }; 86 87 /* 88 * Function declarations 89 */ 90 91 /* buffer initialization */ 92 void GasInitialize(GLuint depthBuf); 93 94 /* gaseous object data structure default initialization */ 95 void DefaultGasObject(struct gas_data *gas,float *gasColorTable); 96 97 /* accumulation pass */ 98 void GasAccumulation(); 99 100 /* shading pass */ 101 void GasShading(void); 102 103 104 #endif /* DMP_GAS_H__ */ 105