28 #include "../idlib/precompiled.h"
42 genMatrix[0] = lightProject[0][0];
43 genMatrix[4] = lightProject[0][1];
44 genMatrix[8] = lightProject[0][2];
45 genMatrix[12] = lightProject[0][3];
47 genMatrix[1] = lightProject[1][0];
48 genMatrix[5] = lightProject[1][1];
49 genMatrix[9] = lightProject[1][2];
50 genMatrix[13] = lightProject[1][3];
57 genMatrix[3] = lightProject[2][0];
58 genMatrix[7] = lightProject[2][1];
59 genMatrix[11] = lightProject[2][2];
60 genMatrix[15] = lightProject[2][3];
64 lightProject[0][0] =
final[0];
65 lightProject[0][1] =
final[4];
66 lightProject[0][2] =
final[8];
67 lightProject[0][3] =
final[12];
69 lightProject[1][0] =
final[1];
70 lightProject[1][1] =
final[5];
71 lightProject[1][2] =
final[9];
72 lightProject[1][3] =
final[13];
104 float mat[16], plane[4];
131 float mat[16], plane[4];
168 float mat[16], plane[4];
318 qglTexGenf( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
319 qglTexGenf( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
320 qglTexGenf( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
389 common->
Printf(
"RB_T_FillDepthBuffer: !tri->ambientCache\n" );
397 for ( stage = 0; stage < shader->
GetNumStages() ; stage++ ) {
433 bool drawSolid =
false;
443 bool didDraw =
false;
447 for ( stage = 0; stage < shader->
GetNumStages() ; stage++ ) {
467 if ( color[3] <= 0 ) {
527 RB_LogComment(
"---------- RB_STD_FillDepthBuffer ----------\n" );
595 parm[0] = (
float)(w-1) / pot;
603 parm[1] = (
float)(h-1) / pot;
614 parm[0] = (
float)w / pot;
618 parm[1] = (
float)h / pot;
733 common->
Printf(
"RB_T_RenderShaderPasses: !tri->ambientCache\n" );
761 for ( stage = 0; stage < shader->
GetNumStages() ; stage++ ) {
877 && color[0] <= 0 && color[1] <= 0 && color[2] <= 0 ) {
906 if ( color[0] != 1 || color[1] != 1 || color[2] != 1 || color[3] != 1 ) {
912 qglTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color );
926 qglTexEnvi( GL_TEXTURE_ENV, GL_ALPHA_SCALE, 1 );
980 RB_LogComment(
"---------- RB_STD_DrawShaderPasses ----------\n" );
1010 for (i = 0 ; i < numDrawSurfs ; i++ ) {
1011 if ( drawSurfs[i]->material->SuppressInSubview() ) {
1016 if ( drawSurfs[i]->space->entityDef->parms.xrayIndex != 2 ) {
1053 static void RB_T_Shadow(
const drawSurf_t *surf ) {
1062 localLight.
w = 0.0f;
1076 bool external =
false;
1082 }
else if ( !(surf->
dsFlags & DSF_VIEW_INSIDE_SHADOW) ) {
1185 RB_LogComment(
"---------- RB_StencilShadowPass ----------\n" );
1249 static void RB_T_BlendLight(
const drawSurf_t *surf ) {
1258 for ( i = 0 ; i < 4 ; i++ ) {
1263 qglTexGenfv( GL_S, GL_OBJECT_PLANE, lightProject[0].ToFloatPtr() );
1264 qglTexGenfv( GL_T, GL_OBJECT_PLANE, lightProject[1].ToFloatPtr() );
1265 qglTexGenfv( GL_Q, GL_OBJECT_PLANE, lightProject[2].ToFloatPtr() );
1268 qglTexGenfv( GL_S, GL_OBJECT_PLANE, lightProject[3].ToFloatPtr() );
1323 for ( i = 0 ; i < lightShader->
GetNumStages() ; i++ ) {
1378 static void RB_T_BasicFog(
const drawSurf_t *surf ) {
1390 local[0] = local[1] = local[2] = 0; local[3] = 0.5;
1391 qglTexGenfv( GL_T, GL_OBJECT_PLANE, local.ToFloatPtr() );
1398 qglTexGenfv( GL_T, GL_OBJECT_PLANE, local.ToFloatPtr() );
1401 qglTexGenfv( GL_S, GL_OBJECT_PLANE, local.ToFloatPtr() );
1430 memset( &ds, 0,
sizeof( ds ) );
1432 ds.
geo = frustumTris;
1497 fogPlanes[3][0] = 0;
1498 fogPlanes[3][1] = 0;
1499 fogPlanes[3][2] = 0;
1541 RB_LogComment(
"---------- RB_STD_FogAllLights ----------\n" );
1552 #if 0 // _D3XP disabled that
1609 RB_LogComment(
"---------- RB_STD_LightScale ----------\n" );
1719 if ( processed < numDrawSurfs ) {
int numShadowIndexesNoFrontCaps
const int GLS_DSTBLEND_ONE
#define qglTexCoordPointer
void SetMappingForSurface(const srfTriangles_t *tri)
const srfTriangles_t * geo
const int GLS_DEPTHFUNC_LESS
void RB_RenderDrawSurfChainWithFunction(const drawSurf_t *drawSurfs, void(*triFunc_)(const drawSurf_t *))
void RB_BindVariableStageImage(const textureStage_t *texture, const float *shaderRegisters)
const idVec3 & Normal(void) const
PFNGLVERTEXATTRIBPOINTERARBPROC qglVertexAttribPointerARB
#define qglEnableClientState
const float GetSort(void) const
#define qglDisableClientState
const int GLS_SRCBLEND_SRC_ALPHA
const int GLS_POLYMODE_LINE
float GetFloat(void) const
const int GetNumStages(void) const
const int GLS_DSTBLEND_SRC_COLOR
void RB_R200_DrawInteractions(void)
idCVar r_useShadowVertexProgram("r_useShadowVertexProgram","1", CVAR_RENDERER|CVAR_BOOL,"do the shadow projection in the vertex program on capable cards")
const float * ToFloatPtr(void) const
void RB_STD_DrawView(void)
#define GL_OPERAND1_ALPHA_ARB
#define GL_COMBINE_ALPHA_ARB
idCVar r_shadowPolygonFactor("r_shadowPolygonFactor","0", CVAR_RENDERER|CVAR_FLOAT,"scale value for stencil shadow drawing")
idImage * fragmentProgramImages[MAX_FRAGMENT_IMAGES]
idCVar r_shadowPolygonOffset("r_shadowPolygonOffset","-1", CVAR_RENDERER|CVAR_FLOAT,"bias value added to depth test for stencil shadow drawing")
void RB_SetProgramEnvironment(void)
PFNGLDISABLEVERTEXATTRIBARRAYARBPROC qglDisableVertexAttribArrayARB
bool depthBoundsTestAvailable
void RB_ARB2_DrawInteractions(void)
const float * ToFloatPtr(void) const
const shaderStage_t * GetBumpStage(void) const
float GetPolygonOffset(void) const
const int GLS_DEPTHFUNC_ALWAYS
#define GL_SOURCE1_ALPHA_ARB
idCVar r_useExternalShadows("r_useExternalShadows","1", CVAR_RENDERER|CVAR_INTEGER,"1 = skip drawing caps when outside the light volume, 2 = force to no caps for testing", 0, 2, idCmdSystem::ArgCompletion_Integer< 0, 2 >)
idImage * currentRenderImage
void RB_BakeTextureMatrixIntoTexgen(idPlane lightProject[3], const float *textureMatrix)
idCVar r_shadows("r_shadows","1", CVAR_RENDERER|CVAR_BOOL|CVAR_ARCHIVE,"enable shadows")
const struct drawSurf_s * globalInteractions
bool IsBlendLight() const
void RB_EnterWeaponDepthHack()
void RB_EnterModelDepthHack(float depth)
const struct viewEntity_s * space
idCVar r_showOverDraw("r_showOverDraw","0", CVAR_RENDERER|CVAR_INTEGER,"1 = geometry overdraw, 2 = light interaction overdraw, 3 = geometry and light interaction overdraw", 0, 3, idCmdSystem::ArgCompletion_Integer< 0, 3 >)
void RB_FinishStageTexturing(const shaderStage_t *pStage, const drawSurf_t *surf, idDrawVert *ac)
struct vertCache_s * ambientCache
void RB_PrepareStageTexturing(const shaderStage_t *pStage, const drawSurf_t *surf, idDrawVert *ac)
const idMaterial * material
void RB_LoadShaderTextureMatrix(const float *shaderRegisters, const textureStage_t *texture)
float projectionMatrix[16]
const viewEntity_t * currentSpace
#define GL_SOURCE1_RGB_ARB
const idMaterial * lightShader
void CopyFramebuffer(int x, int y, int width, int height, bool useOversizedBuffer)
void RB_NV20_DrawInteractions(void)
void GL_Cull(int cullType)
void RB_BeginDrawingView(void)
#define GL_OPERAND0_ALPHA_ARB
backEndName_t backEndRenderer
idCVar r_ignore("r_ignore","0", CVAR_RENDERER,"used for random debugging without defining new vars")
idImage * alphaNotchImage
#define GL_REFLECTION_MAP_EXT
const int GLS_DEPTHFUNC_EQUAL
idCVar r_skipNewAmbient("r_skipNewAmbient","0", CVAR_RENDERER|CVAR_BOOL|CVAR_ARCHIVE,"bypasses all vertex/fragment program ambient drawing")
struct viewLight_s * next
void RB_RenderDrawSurfListWithFunction(drawSurf_t **drawSurfs, int numDrawSurfs, void(*triFunc_)(const drawSurf_t *))
int numFragmentProgramImages
struct viewLight_s * viewLights
materialCoverage_t Coverage(void) const
void RB_DetermineLightScale(void)
bool backEndRendererHasVertexPrograms
int viewSeesShadowPlaneBits
const int GLS_SRCBLEND_BITS
const float DEFAULT_FOG_DISTANCE
GLubyte GLubyte GLubyte GLubyte w
const cullType_t GetCullType(void) const
const shaderStage_t * GetStage(const int index) const
PFNGLENABLEVERTEXATTRIBARRAYARBPROC qglEnableVertexAttribArrayARB
newShaderStage_t * newStage
idCVar r_useDepthBoundsTest("r_useDepthBoundsTest","1", CVAR_RENDERER|CVAR_BOOL,"use depth bounds test to reduce shadow fill")
static float Fabs(float f)
void BindForViewOrigin(const idVec3 origin)
PFNGLBINDPROGRAMARBPROC qglBindProgramARB
struct vertCache_s * dynamicTexCoords
const int SHADOW_CAP_INFINITE
int GetInteger(void) const
float privatePolygonOffset
const int GLS_SRCBLEND_ONE
idImageManager * globalImages
bool ARBVertexProgramAvailable
int vertexParms[MAX_VERTEX_PARMS][4]
float lightTextureMatrix[16]
idCVar r_showShadows("r_showShadows","0", CVAR_RENDERER|CVAR_INTEGER,"1 = visualize the stencil shadow volumes, 2 = draw filled in", 0, 3, idCmdSystem::ArgCompletion_Integer< 0, 3 >)
#define GL_OPERAND0_RGB_ARB
void RB_T_RenderTriangleSurface(const drawSurf_t *surf)
void RB_ARB_DrawInteractions(void)
int RB_STD_DrawShaderPasses(drawSurf_t **drawSurfs, int numDrawSurfs)
idCVar r_skipPostProcess("r_skipPostProcess","0", CVAR_RENDERER|CVAR_BOOL,"skip all post-process renderings")
bool HasAmbient(void) const
idRenderEntityLocal * entityDef
struct vertCache_s * shadowCache
GLubyte GLubyte GLubyte a
virtual void Printf(const char *fmt,...) id_attribute((format(printf
void RB_DrawShadowElementsWithCounters(const srfTriangles_t *tri, int numIndexes)
void RB_DrawElementsWithCounters(const srfTriangles_t *tri)
const float * ToFloatPtr(void) const
void R_TransposeGLMatrix(const float in[16], float out[16])
#define GL_SOURCE0_ALPHA_ARB
#define GL_SOURCE0_RGB_ARB
const int GLS_DSTBLEND_ZERO
const float * shaderRegisters
idCVar r_offsetUnits("r_offsetunits","-600", CVAR_RENDERER|CVAR_FLOAT,"polygon offset parameter")
#define GL_PRIMARY_COLOR_ARB
void myGlMultMatrix(const float *a, const float *b, float *out)
int numShadowIndexesNoCaps
void R_GlobalPointToLocal(const float modelMatrix[16], const idVec3 &in, idVec3 &out)
PFNGLDEPTHBOUNDSEXTPROC qglDepthBoundsEXT
void RB_LogComment(const char *comment,...)
const int GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA
struct viewEntity_s * viewEntitys
idMegaTexture * megaTexture
void RB_NV10_DrawInteractions(void)
void RB_RenderDebugTools(drawSurf_t **drawSurfs, int numDrawSurfs)
idCVar r_skipAmbient("r_skipAmbient","0", CVAR_RENDERER|CVAR_BOOL,"bypasses all non-interaction drawing")
const struct drawSurf_s * localInteractions
void RB_STD_FillDepthBuffer(drawSurf_t **drawSurfs, int numDrawSurfs)
void * Position(vertCache_t *buffer)
#define GL_VERTEX_PROGRAM_ARB
const int GLS_SRCBLEND_ZERO
float modelViewMatrix[16]
PFNGLPROGRAMENVPARAMETER4FVARBPROC qglProgramEnvParameter4fvARB
PFNGLPROGRAMLOCALPARAMETER4FVARBPROC qglProgramLocalParameter4fvARB
void RB_T_FillDepthBuffer(const drawSurf_t *surf)
stageVertexColor_t vertexColor
bool TestMaterialFlag(const int flag) const
idVertexCache vertexCache
const int GLS_SRCBLEND_DST_COLOR
const idVec3 & ToVec3(void) const
void GL_State(int stateBits)
void RB_StencilShadowPass(const drawSurf_t *drawSurfs)
void RB_STD_LightScale(void)
idCVar r_useScissor("r_useScissor","1", CVAR_RENDERER|CVAR_BOOL,"scissor clip as portals and lights are processed")
const srfTriangles_t * frustumTris
void GL_SelectTexture(int unit)
void RB_STD_T_RenderShaderPasses(const drawSurf_t *surf)
#define GL_COMBINE_RGB_ARB
idCVar r_offsetFactor("r_offsetfactor","0", CVAR_RENDERER|CVAR_FLOAT,"polygon offset parameter")
idScreenRect currentScissor
#define GL_OPERAND1_RGB_ARB
idCVar r_skipFogLights("r_skipFogLights","0", CVAR_RENDERER|CVAR_BOOL,"skip all fog lights")
idPlane clipPlanes[MAX_CLIP_PLANES]
idCVar r_skipLightScale("r_skipLightScale","0", CVAR_RENDERER|CVAR_BOOL,"don't do any post-interaction light scaling, makes things dim on low-dynamic range cards")
const int GLS_DSTBLEND_BITS
void R_GlobalPlaneToLocal(const float modelMatrix[16], const idPlane &in, idPlane &out)
const float * shaderRegisters
idCVar r_skipBlendLights("r_skipBlendLights","0", CVAR_RENDERER|CVAR_BOOL,"skip all blend lights")
void RB_STD_FogAllLights(void)
#define GL_DEPTH_BOUNDS_TEST_EXT
bool Equals(const idScreenRect &rect) const
void RB_SetProgramEnvironmentSpace(void)
#define GL_FRAGMENT_PROGRAM_ARB
const viewDef_t * viewDef