diff options
Diffstat (limited to 'src/renderergl2/tr_local.h')
-rw-r--r-- | src/renderergl2/tr_local.h | 69 |
1 files changed, 49 insertions, 20 deletions
diff --git a/src/renderergl2/tr_local.h b/src/renderergl2/tr_local.h index f9b52028..d8950023 100644 --- a/src/renderergl2/tr_local.h +++ b/src/renderergl2/tr_local.h @@ -60,6 +60,8 @@ typedef unsigned int glIndex_t; #define MAX_CALC_PSHADOWS 64 #define MAX_DRAWN_PSHADOWS 16 // do not increase past 32, because bit flags are used on surfaces #define PSHADOW_MAP_SIZE 512 +#define CUBE_MAP_MIPS 7 +#define CUBE_MAP_SIZE (1 << CUBE_MAP_MIPS) #define USE_VERT_TANGENT_SPACE @@ -369,7 +371,8 @@ enum TB_SHADOWMAP2 = 3, TB_SPECULARMAP = 4, TB_SHADOWMAP = 5, - NUM_TEXTURE_BUNDLES = 6 + TB_CUBEMAP = 6, + NUM_TEXTURE_BUNDLES = 7 }; typedef enum @@ -699,13 +702,12 @@ enum LIGHTDEF_LIGHTTYPE_MASK = 0x0003, LIGHTDEF_ENTITY = 0x0004, LIGHTDEF_USE_TCGEN_AND_TCMOD = 0x0008, - LIGHTDEF_USE_NORMALMAP = 0x0010, - LIGHTDEF_USE_SPECULARMAP = 0x0020, - LIGHTDEF_USE_DELUXEMAP = 0x0040, - LIGHTDEF_USE_PARALLAXMAP = 0x0080, - LIGHTDEF_USE_SHADOWMAP = 0x0100, - LIGHTDEF_ALL = 0x01FF, - LIGHTDEF_COUNT = 0x0200 + LIGHTDEF_USE_DELUXEMAP = 0x0010, + LIGHTDEF_USE_PARALLAXMAP = 0x0020, + LIGHTDEF_USE_SHADOWMAP = 0x0040, + LIGHTDEF_USE_CUBEMAP = 0x0080, + LIGHTDEF_ALL = 0x00FF, + LIGHTDEF_COUNT = 0x0100 }; enum @@ -729,6 +731,7 @@ typedef enum UNIFORM_TEXTUREMAP, UNIFORM_LEVELSMAP, + UNIFORM_CUBEMAP, UNIFORM_SCREENIMAGEMAP, UNIFORM_SCREENDEPTHMAP, @@ -897,12 +900,14 @@ typedef struct { typedef enum { VPF_NONE = 0x00, - VPF_SHADOWMAP = 0x01, - VPF_DEPTHSHADOW = 0x02, - VPF_DEPTHCLAMP = 0x04, - VPF_ORTHOGRAPHIC = 0x08, - VPF_USESUNLIGHT = 0x10, - VPF_FARPLANEFRUSTUM = 0x20 + VPF_NOVIEWMODEL = 0x01, + VPF_SHADOWMAP = 0x02, + VPF_DEPTHSHADOW = 0x04, + VPF_DEPTHCLAMP = 0x08, + VPF_ORTHOGRAPHIC = 0x10, + VPF_USESUNLIGHT = 0x20, + VPF_FARPLANEFRUSTUM = 0x40, + VPF_NOCUBEMAPS = 0x80 } viewParmFlags_t; typedef struct { @@ -917,6 +922,8 @@ typedef struct { cplane_t portalPlane; // clip anything behind this if mirroring int viewportX, viewportY, viewportWidth, viewportHeight; FBO_t *targetFbo; + int targetFboLayer; + int targetFboCubemapIndex; float fovX, fovY; float projectionMatrix[16]; cplane_t frustum[5]; @@ -959,7 +966,8 @@ typedef enum { } surfaceType_t; typedef struct drawSurf_s { - unsigned sort; // bit combination for fast compares + unsigned int sort; // bit combination for fast compares + int cubemapIndex; surfaceType_t *surface; // any of surface*_t } drawSurf_t; @@ -1171,6 +1179,7 @@ typedef struct srfVBOMesh_s struct shader_s *shader; // FIXME move this to somewhere else int fogIndex; + int cubemapIndex; // dynamic lighting information int dlightBits; @@ -1272,6 +1281,7 @@ typedef struct msurface_s { //int viewCount; // if == tr.viewCount, already added struct shader_s *shader; int fogIndex; + int cubemapIndex; cullinfo_t cullinfo; surfaceType_t *data; // any of srf*_t @@ -1601,9 +1611,12 @@ typedef struct { qboolean framebufferMultisample; qboolean framebufferBlit; - qboolean texture_srgb; + qboolean textureSrgb; + qboolean framebufferSrgb; + qboolean textureSrgbDecode; qboolean depthClamp; + qboolean seamlessCubeMap; } glRefConfig_t; @@ -1696,6 +1709,7 @@ typedef struct { image_t *fogImage; image_t *dlightImage; // inverse-quare highlight for projective adding image_t *flareImage; + image_t *greyImage; // full of 0x80 image_t *whiteImage; // full of 0xff image_t *identityLightImage; // full of tr.identityLightByte @@ -1716,6 +1730,7 @@ typedef struct { image_t *screenShadowImage; image_t *screenSsaoImage; image_t *hdrDepthImage; + image_t *renderCubeImage; image_t *textureDepthImage; @@ -1733,6 +1748,7 @@ typedef struct { FBO_t *screenShadowFbo; FBO_t *screenSsaoFbo; FBO_t *hdrDepthFbo; + FBO_t *renderCubeFbo; shader_t *defaultShader; shader_t *shadowShader; @@ -1750,6 +1766,10 @@ typedef struct { int fatLightmapSize; int fatLightmapStep; + int numCubemaps; + vec3_t *cubemapOrigins; + image_t **cubemaps; + trRefEntity_t *currentEntity; trRefEntity_t worldEntity; // point currentEntity at this when rendering world int currentEntityNum; @@ -1773,6 +1793,7 @@ typedef struct { shaderProgram_t shadowmaskShader; shaderProgram_t ssaoShader; shaderProgram_t depthBlurShader[2]; + shaderProgram_t testcubeShader; // ----------------------------------------- @@ -1964,7 +1985,11 @@ extern cvar_t *r_normalMapping; extern cvar_t *r_specularMapping; extern cvar_t *r_deluxeMapping; extern cvar_t *r_parallaxMapping; -extern cvar_t *r_normalAmbient; +extern cvar_t *r_cubeMapping; +extern cvar_t *r_deluxeSpecular; +extern cvar_t *r_specularIsMetallic; +extern cvar_t *r_baseSpecular; +extern cvar_t *r_baseGloss; extern cvar_t *r_dlightMode; extern cvar_t *r_pshadowDist; extern cvar_t *r_recalcMD3Normals; @@ -2011,6 +2036,7 @@ void R_RenderView( viewParms_t *parms ); void R_RenderDlightCubemaps(const refdef_t *fd); void R_RenderPshadowMaps(const refdef_t *fd); void R_RenderSunShadowMaps(const refdef_t *fd, int level); +void R_RenderCubemapSide( int cubemapIndex, int cubemapSide, qboolean subscene ); void R_AddMD3Surfaces( trRefEntity_t *e ); void R_AddNullModelSurfaces( trRefEntity_t *e ); @@ -2024,7 +2050,7 @@ void R_DecomposeSort( unsigned sort, int *entityNum, shader_t **shader, int *fogNum, int *dlightMap, int *pshadowMap ); void R_AddDrawSurf( surfaceType_t *surface, shader_t *shader, - int fogIndex, int dlightMap, int pshadowMap ); + int fogIndex, int dlightMap, int pshadowMap, int cubemap ); void R_CalcTangentSpace(vec3_t tangent, vec3_t bitangent, vec3_t normal, const vec3_t v0, const vec3_t v1, const vec3_t v2, const vec2_t t0, const vec2_t t1, const vec2_t t2); @@ -2050,7 +2076,6 @@ void R_RotateForEntity( const trRefEntity_t *ent, const viewParms_t *viewParms, ** GL wrapper/helper functions */ void GL_Bind( image_t *image ); -void GL_BindCubemap( image_t *image ); void GL_BindToTMU( image_t *image, int tmu ); void GL_SetDefaultState (void); void GL_SelectTexture( int unit ); @@ -2201,6 +2226,7 @@ typedef struct shaderCommands_s shader_t *shader; float shaderTime; int fogNum; + int cubemapIndex; int dlightBits; // or together of all vertexDlightBits int pshadowBits; @@ -2226,7 +2252,7 @@ typedef struct shaderCommands_s extern shaderCommands_t tess; -void RB_BeginSurface(shader_t *shader, int fogNum ); +void RB_BeginSurface(shader_t *shader, int fogNum, int cubemapIndex ); void RB_EndSurface(void); void RB_CheckOverflow( int verts, int indexes ); #define RB_CHECKOVERFLOW(v,i) if (tess.numVertexes + (v) >= SHADER_MAX_VERTEXES || tess.numIndexes + (i) >= SHADER_MAX_INDEXES ) {RB_CheckOverflow(v,i);} @@ -2286,6 +2312,7 @@ void R_SetupEntityLighting( const trRefdef_t *refdef, trRefEntity_t *ent ); void R_TransformDlights( int count, dlight_t *dl, orientationr_t *or ); int R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir ); int R_LightDirForPoint( vec3_t point, vec3_t lightDir, vec3_t normal, world_t *world ); +int R_CubemapForPoint( vec3_t point ); /* @@ -2408,7 +2435,9 @@ void RE_AddRefEntityToScene( const refEntity_t *ent ); void RE_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts, int num ); void RE_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b ); void RE_AddAdditiveLightToScene( const vec3_t org, float intensity, float r, float g, float b ); +void RE_BeginScene( const refdef_t *fd ); void RE_RenderScene( const refdef_t *fd ); +void RE_EndScene( void ); /* ============================================================= |