mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-03-21 02:01:03 +00:00
Remove the deprecated arb renderer
This commit is contained in:
parent
a5678d2368
commit
f4de0ed8c1
7 changed files with 5 additions and 550 deletions
|
@ -293,7 +293,6 @@ set(src_renderer
|
|||
renderer/RenderWorld_load.cpp
|
||||
renderer/RenderWorld_portals.cpp
|
||||
renderer/VertexCache.cpp
|
||||
renderer/draw_arb.cpp
|
||||
renderer/draw_arb2.cpp
|
||||
renderer/draw_common.cpp
|
||||
renderer/tr_backend.cpp
|
||||
|
|
|
@ -547,9 +547,7 @@ void idRenderSystemLocal::SetBackEndRenderer() {
|
|||
|
||||
backEndRenderer = BE_BAD;
|
||||
|
||||
if ( idStr::Icmp( r_renderer.GetString(), "arb" ) == 0 ) {
|
||||
backEndRenderer = BE_ARB;
|
||||
} else if ( idStr::Icmp( r_renderer.GetString(), "arb2" ) == 0 ) {
|
||||
if ( idStr::Icmp( r_renderer.GetString(), "arb2" ) == 0 ) {
|
||||
if ( glConfig.allowARB2Path ) {
|
||||
backEndRenderer = BE_ARB2;
|
||||
}
|
||||
|
@ -560,9 +558,6 @@ void idRenderSystemLocal::SetBackEndRenderer() {
|
|||
// choose the best
|
||||
if ( glConfig.allowARB2Path ) {
|
||||
backEndRenderer = BE_ARB2;
|
||||
} else {
|
||||
// the others are considered experimental
|
||||
backEndRenderer = BE_ARB;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -570,9 +565,6 @@ void idRenderSystemLocal::SetBackEndRenderer() {
|
|||
backEndRendererMaxLight = 1.0;
|
||||
|
||||
switch( backEndRenderer ) {
|
||||
case BE_ARB:
|
||||
common->Printf( "using ARB renderSystem\n" );
|
||||
break;
|
||||
case BE_ARB2:
|
||||
common->Printf( "using ARB2 renderSystem\n" );
|
||||
backEndRendererHasVertexPrograms = true;
|
||||
|
|
|
@ -49,7 +49,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
glconfig_t glConfig;
|
||||
|
||||
const char *r_rendererArgs[] = { "best", "arb", "arb2", NULL };
|
||||
const char *r_rendererArgs[] = { "best", "arb2", NULL };
|
||||
|
||||
idCVar r_inhibitFragmentProgram( "r_inhibitFragmentProgram", "0", CVAR_RENDERER | CVAR_BOOL, "ignore the fragment program extension" );
|
||||
idCVar r_useLightPortalFlow( "r_useLightPortalFlow", "1", CVAR_RENDERER | CVAR_BOOL, "use a more precise area reference determination" );
|
||||
|
@ -63,7 +63,6 @@ idCVar r_singleTriangle( "r_singleTriangle", "0", CVAR_RENDERER | CVAR_BOOL, "on
|
|||
idCVar r_checkBounds( "r_checkBounds", "0", CVAR_RENDERER | CVAR_BOOL, "compare all surface bounds with precalculated ones" );
|
||||
|
||||
idCVar r_useConstantMaterials( "r_useConstantMaterials", "1", CVAR_RENDERER | CVAR_BOOL, "use pre-calculated material registers if possible" );
|
||||
idCVar r_useTripleTextureARB( "r_useTripleTextureARB", "1", CVAR_RENDERER | CVAR_BOOL, "cards with 3+ texture units do a two pass instead of three pass" );
|
||||
idCVar r_useSilRemap( "r_useSilRemap", "1", CVAR_RENDERER | CVAR_BOOL, "consider verts with the same XYZ, but different ST the same for shadows" );
|
||||
idCVar r_useNodeCommonChildren( "r_useNodeCommonChildren", "1", CVAR_RENDERER | CVAR_BOOL, "stop pushing reference bounds early when possible" );
|
||||
idCVar r_useShadowProjectedCull( "r_useShadowProjectedCull", "1", CVAR_RENDERER | CVAR_BOOL, "discard triangles outside light volume before shadowing" );
|
||||
|
@ -1695,7 +1694,6 @@ static void GfxInfo_f( const idCmdArgs &args ) {
|
|||
}
|
||||
|
||||
const char *active[2] = { "", " (ACTIVE)" };
|
||||
common->Printf( "ARB path ENABLED%s\n", active[tr.backEndRenderer == BE_ARB] );
|
||||
|
||||
if ( glConfig.allowARB2Path ) {
|
||||
common->Printf( "ARB2 path ENABLED%s\n", active[tr.backEndRenderer == BE_ARB2] );
|
||||
|
@ -2160,5 +2158,5 @@ idRenderSystemLocal::GetCardCaps
|
|||
*/
|
||||
void idRenderSystemLocal::GetCardCaps( bool &oldCard, bool &nv10or20 ) {
|
||||
nv10or20 = false;
|
||||
oldCard = tr.backEndRenderer == BE_ARB;
|
||||
oldCard = false;
|
||||
}
|
||||
|
|
|
@ -1,527 +0,0 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
|
||||
|
||||
Doom 3 Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "sys/platform.h"
|
||||
#include "renderer/VertexCache.h"
|
||||
|
||||
#include "renderer/tr_local.h"
|
||||
|
||||
/*
|
||||
|
||||
with standard calls, we can't do bump mapping or vertex colors with
|
||||
shader colors
|
||||
|
||||
2 texture units:
|
||||
|
||||
falloff
|
||||
--
|
||||
light cube
|
||||
bump
|
||||
--
|
||||
light projection
|
||||
diffuse
|
||||
|
||||
|
||||
3 texture units:
|
||||
|
||||
light cube
|
||||
bump
|
||||
--
|
||||
falloff
|
||||
light projection
|
||||
diffuse
|
||||
|
||||
|
||||
5 texture units:
|
||||
|
||||
light cube
|
||||
bump
|
||||
falloff
|
||||
light projection
|
||||
diffuse
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
==================
|
||||
RB_ARB_DrawInteraction
|
||||
|
||||
backEnd.vLight
|
||||
|
||||
backEnd.depthFunc must be equal for alpha tested surfaces to work right,
|
||||
it is set to lessThan for blended transparent surfaces
|
||||
|
||||
==================
|
||||
*/
|
||||
static void RB_ARB_DrawInteraction( const drawInteraction_t *din ) {
|
||||
//const drawSurf_t *surf = din->surf;
|
||||
const srfTriangles_t *tri = din->surf->geo;
|
||||
|
||||
// set the vertex arrays, which may not all be enabled on a given pass
|
||||
idDrawVert *ac = (idDrawVert *)vertexCache.Position( tri->ambientCache );
|
||||
qglVertexPointer( 3, GL_FLOAT, sizeof( idDrawVert ), ac->xyz.ToFloatPtr() );
|
||||
GL_SelectTexture( 0 );
|
||||
qglTexCoordPointer( 2, GL_FLOAT, sizeof( idDrawVert ), (void *)&ac->st );
|
||||
|
||||
//-----------------------------------------------------
|
||||
//
|
||||
// bump / falloff
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
// render light falloff * bumpmap lighting
|
||||
|
||||
//
|
||||
// draw light falloff to the alpha channel
|
||||
//
|
||||
GL_State( GLS_COLORMASK | GLS_DEPTHMASK | backEnd.depthFunc );
|
||||
|
||||
qglColor3f( 1, 1, 1 );
|
||||
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
qglEnable( GL_TEXTURE_GEN_S );
|
||||
qglTexGenfv( GL_S, GL_OBJECT_PLANE, din->lightProjection[3].ToFloatPtr() );
|
||||
qglTexCoord2f( 0, 0.5 );
|
||||
|
||||
// ATI R100 can't do partial texgens
|
||||
#define NO_MIXED_TEXGEN
|
||||
|
||||
#ifdef NO_MIXED_TEXGEN
|
||||
idVec4 plane;
|
||||
plane[0] = 0;
|
||||
plane[1] = 0;
|
||||
plane[2] = 0;
|
||||
plane[3] = 0.5;
|
||||
qglEnable( GL_TEXTURE_GEN_T );
|
||||
qglTexGenfv( GL_T, GL_OBJECT_PLANE, plane.ToFloatPtr() );
|
||||
|
||||
plane[0] = 0;
|
||||
plane[1] = 0;
|
||||
plane[2] = 0;
|
||||
plane[3] = 1;
|
||||
qglEnable( GL_TEXTURE_GEN_Q );
|
||||
qglTexGenfv( GL_Q, GL_OBJECT_PLANE, plane.ToFloatPtr() );
|
||||
|
||||
#endif
|
||||
|
||||
din->lightFalloffImage->Bind();
|
||||
|
||||
// draw it
|
||||
RB_DrawElementsWithCounters( tri );
|
||||
|
||||
qglDisable( GL_TEXTURE_GEN_S );
|
||||
#ifdef NO_MIXED_TEXGEN
|
||||
qglDisable( GL_TEXTURE_GEN_T );
|
||||
qglDisable( GL_TEXTURE_GEN_Q );
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO | GLS_DEPTHMASK
|
||||
| backEnd.depthFunc );
|
||||
// the texccords are the non-normalized vector towards the light origin
|
||||
GL_SelectTexture( 0 );
|
||||
globalImages->normalCubeMapImage->Bind();
|
||||
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
qglTexCoordPointer( 3, GL_FLOAT, sizeof( lightingCache_t ), ((lightingCache_t *)vertexCache.Position(tri->lightingCache))->localLightVector.ToFloatPtr() );
|
||||
// draw it
|
||||
RB_DrawElementsWithCounters( tri );
|
||||
return;
|
||||
#endif
|
||||
|
||||
// we can't do bump mapping with standard calls, so skip it
|
||||
if ( glConfig.envDot3Available && glConfig.cubeMapAvailable ) {
|
||||
//
|
||||
// draw the bump map result onto the alpha channel
|
||||
//
|
||||
GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_ZERO | GLS_COLORMASK | GLS_DEPTHMASK
|
||||
| backEnd.depthFunc );
|
||||
|
||||
// texture 0 will be the per-surface bump map
|
||||
GL_SelectTexture( 0 );
|
||||
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
// FIXME: matrix work! RB_BindStageTexture( surfaceRegs, &surfaceStage->texture, surf );
|
||||
din->bumpImage->Bind();
|
||||
|
||||
// texture 1 is the normalization cube map
|
||||
// the texccords are the non-normalized vector towards the light origin
|
||||
GL_SelectTexture( 1 );
|
||||
if ( din->ambientLight ) {
|
||||
globalImages->ambientNormalMap->Bind(); // fixed value
|
||||
} else {
|
||||
globalImages->normalCubeMapImage->Bind();
|
||||
}
|
||||
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
qglTexCoordPointer( 3, GL_FLOAT, sizeof( lightingCache_t ), ((lightingCache_t *)vertexCache.Position(tri->lightingCache))->localLightVector.ToFloatPtr() );
|
||||
|
||||
// I just want alpha = Dot( texture0, texture1 )
|
||||
GL_TexEnv( GL_COMBINE_ARB );
|
||||
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_DOT3_RGBA_ARB );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1 );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_ALPHA_SCALE, 1 );
|
||||
|
||||
// draw it
|
||||
RB_DrawElementsWithCounters( tri );
|
||||
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
|
||||
globalImages->BindNull();
|
||||
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
|
||||
GL_SelectTexture( 0 );
|
||||
// RB_FinishStageTexture( &surfaceStage->texture, surf );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
//
|
||||
// projected light / surface color for diffuse maps
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
// don't trash alpha
|
||||
GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_ONE | GLS_ALPHAMASK | GLS_DEPTHMASK
|
||||
| backEnd.depthFunc );
|
||||
|
||||
// texture 0 will get the surface color texture
|
||||
GL_SelectTexture( 0 );
|
||||
|
||||
// select the vertex color source
|
||||
if ( din->vertexColor == SVC_IGNORE ) {
|
||||
qglColor4fv( din->diffuseColor.ToFloatPtr() );
|
||||
} else {
|
||||
// FIXME: does this not get diffuseColor blended in?
|
||||
qglColorPointer( 4, GL_UNSIGNED_BYTE, sizeof( idDrawVert ), (void *)&ac->color );
|
||||
qglEnableClientState( GL_COLOR_ARRAY );
|
||||
|
||||
if ( din->vertexColor == SVC_INVERSE_MODULATE ) {
|
||||
GL_TexEnv( GL_COMBINE_ARB );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PRIMARY_COLOR_ARB );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_ONE_MINUS_SRC_COLOR );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
// FIXME: does this not get the texture matrix?
|
||||
// RB_BindStageTexture( surfaceRegs, &surfaceStage->texture, surf );
|
||||
din->diffuseImage->Bind();
|
||||
|
||||
// texture 1 will get the light projected texture
|
||||
GL_SelectTexture( 1 );
|
||||
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
qglEnable( GL_TEXTURE_GEN_S );
|
||||
qglEnable( GL_TEXTURE_GEN_T );
|
||||
qglEnable( GL_TEXTURE_GEN_Q );
|
||||
qglTexGenfv( GL_S, GL_OBJECT_PLANE, din->lightProjection[0].ToFloatPtr() );
|
||||
qglTexGenfv( GL_T, GL_OBJECT_PLANE, din->lightProjection[1].ToFloatPtr() );
|
||||
qglTexGenfv( GL_Q, GL_OBJECT_PLANE, din->lightProjection[2].ToFloatPtr() );
|
||||
|
||||
din->lightImage->Bind();
|
||||
|
||||
// draw it
|
||||
RB_DrawElementsWithCounters( tri );
|
||||
|
||||
qglDisable( GL_TEXTURE_GEN_S );
|
||||
qglDisable( GL_TEXTURE_GEN_T );
|
||||
qglDisable( GL_TEXTURE_GEN_Q );
|
||||
|
||||
globalImages->BindNull();
|
||||
GL_SelectTexture( 0 );
|
||||
|
||||
if ( din->vertexColor != SVC_IGNORE ) {
|
||||
qglDisableClientState( GL_COLOR_ARRAY );
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
}
|
||||
|
||||
// RB_FinishStageTexture( &surfaceStage->texture, surf );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
RB_ARB_DrawThreeTextureInteraction
|
||||
|
||||
Used by radeon R100 and Intel graphics parts
|
||||
|
||||
backEnd.vLight
|
||||
|
||||
backEnd.depthFunc must be equal for alpha tested surfaces to work right,
|
||||
it is set to lessThan for blended transparent surfaces
|
||||
|
||||
==================
|
||||
*/
|
||||
static void RB_ARB_DrawThreeTextureInteraction( const drawInteraction_t *din ) {
|
||||
//const drawSurf_t *surf = din->surf;
|
||||
const srfTriangles_t *tri = din->surf->geo;
|
||||
|
||||
// set the vertex arrays, which may not all be enabled on a given pass
|
||||
idDrawVert *ac = (idDrawVert *)vertexCache.Position( tri->ambientCache );
|
||||
qglVertexPointer( 3, GL_FLOAT, sizeof( idDrawVert ), ac->xyz.ToFloatPtr() );
|
||||
GL_SelectTexture( 0 );
|
||||
qglTexCoordPointer( 2, GL_FLOAT, sizeof( idDrawVert ), (void *)&ac->st );
|
||||
qglColor3f( 1, 1, 1 );
|
||||
|
||||
//
|
||||
// bump map dot cubeMap into the alpha channel
|
||||
//
|
||||
GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO | GLS_COLORMASK | GLS_DEPTHMASK
|
||||
| backEnd.depthFunc );
|
||||
|
||||
// texture 0 will be the per-surface bump map
|
||||
GL_SelectTexture( 0 );
|
||||
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
// FIXME: matrix work! RB_BindStageTexture( surfaceRegs, &surfaceStage->texture, surf );
|
||||
din->bumpImage->Bind();
|
||||
|
||||
// texture 1 is the normalization cube map
|
||||
// the texccords are the non-normalized vector towards the light origin
|
||||
GL_SelectTexture( 1 );
|
||||
if ( din->ambientLight ) {
|
||||
globalImages->ambientNormalMap->Bind(); // fixed value
|
||||
} else {
|
||||
globalImages->normalCubeMapImage->Bind();
|
||||
}
|
||||
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
qglTexCoordPointer( 3, GL_FLOAT, sizeof( lightingCache_t ), ((lightingCache_t *)vertexCache.Position(tri->lightingCache))->localLightVector.ToFloatPtr() );
|
||||
|
||||
// I just want alpha = Dot( texture0, texture1 )
|
||||
GL_TexEnv( GL_COMBINE_ARB );
|
||||
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_DOT3_RGBA_ARB );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1 );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_ALPHA_SCALE, 1 );
|
||||
|
||||
// draw it
|
||||
RB_DrawElementsWithCounters( tri );
|
||||
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
|
||||
globalImages->BindNull();
|
||||
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
|
||||
GL_SelectTexture( 0 );
|
||||
// RB_FinishStageTexture( &surfaceStage->texture, surf );
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
//
|
||||
// light falloff / projected light / surface color for diffuse maps
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
// multiply result by alpha, but don't trash alpha
|
||||
GL_State( GLS_SRCBLEND_DST_ALPHA | GLS_DSTBLEND_ONE | GLS_ALPHAMASK | GLS_DEPTHMASK
|
||||
| backEnd.depthFunc );
|
||||
|
||||
// texture 0 will get the surface color texture
|
||||
GL_SelectTexture( 0 );
|
||||
|
||||
// select the vertex color source
|
||||
if ( din->vertexColor == SVC_IGNORE ) {
|
||||
qglColor4fv( din->diffuseColor.ToFloatPtr() );
|
||||
} else {
|
||||
// FIXME: does this not get diffuseColor blended in?
|
||||
qglColorPointer( 4, GL_UNSIGNED_BYTE, sizeof( idDrawVert ), (void *)&ac->color );
|
||||
qglEnableClientState( GL_COLOR_ARRAY );
|
||||
|
||||
if ( din->vertexColor == SVC_INVERSE_MODULATE ) {
|
||||
GL_TexEnv( GL_COMBINE_ARB );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PRIMARY_COLOR_ARB );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_ONE_MINUS_SRC_COLOR );
|
||||
qglTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
// FIXME: does this not get the texture matrix?
|
||||
// RB_BindStageTexture( surfaceRegs, &surfaceStage->texture, surf );
|
||||
din->diffuseImage->Bind();
|
||||
|
||||
// texture 1 will get the light projected texture
|
||||
GL_SelectTexture( 1 );
|
||||
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
qglEnable( GL_TEXTURE_GEN_S );
|
||||
qglEnable( GL_TEXTURE_GEN_T );
|
||||
qglEnable( GL_TEXTURE_GEN_Q );
|
||||
qglTexGenfv( GL_S, GL_OBJECT_PLANE, din->lightProjection[0].ToFloatPtr() );
|
||||
qglTexGenfv( GL_T, GL_OBJECT_PLANE, din->lightProjection[1].ToFloatPtr() );
|
||||
qglTexGenfv( GL_Q, GL_OBJECT_PLANE, din->lightProjection[2].ToFloatPtr() );
|
||||
din->lightImage->Bind();
|
||||
|
||||
// texture 2 will get the light falloff texture
|
||||
GL_SelectTexture( 2 );
|
||||
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
qglEnable( GL_TEXTURE_GEN_S );
|
||||
qglEnable( GL_TEXTURE_GEN_T );
|
||||
qglEnable( GL_TEXTURE_GEN_Q );
|
||||
|
||||
qglTexGenfv( GL_S, GL_OBJECT_PLANE, din->lightProjection[3].ToFloatPtr() );
|
||||
|
||||
idVec4 plane;
|
||||
plane[0] = 0;
|
||||
plane[1] = 0;
|
||||
plane[2] = 0;
|
||||
plane[3] = 0.5;
|
||||
qglTexGenfv( GL_T, GL_OBJECT_PLANE, plane.ToFloatPtr() );
|
||||
|
||||
plane[0] = 0;
|
||||
plane[1] = 0;
|
||||
plane[2] = 0;
|
||||
plane[3] = 1;
|
||||
qglTexGenfv( GL_Q, GL_OBJECT_PLANE, plane.ToFloatPtr() );
|
||||
|
||||
din->lightFalloffImage->Bind();
|
||||
|
||||
// draw it
|
||||
RB_DrawElementsWithCounters( tri );
|
||||
|
||||
qglDisable( GL_TEXTURE_GEN_S );
|
||||
qglDisable( GL_TEXTURE_GEN_T );
|
||||
qglDisable( GL_TEXTURE_GEN_Q );
|
||||
globalImages->BindNull();
|
||||
|
||||
GL_SelectTexture( 1 );
|
||||
qglDisable( GL_TEXTURE_GEN_S );
|
||||
qglDisable( GL_TEXTURE_GEN_T );
|
||||
qglDisable( GL_TEXTURE_GEN_Q );
|
||||
globalImages->BindNull();
|
||||
|
||||
GL_SelectTexture( 0 );
|
||||
|
||||
if ( din->vertexColor != SVC_IGNORE ) {
|
||||
qglDisableClientState( GL_COLOR_ARRAY );
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
}
|
||||
|
||||
// RB_FinishStageTexture( &surfaceStage->texture, surf );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
RB_CreateDrawInteractions
|
||||
==================
|
||||
*/
|
||||
static void RB_CreateDrawInteractions( const drawSurf_t *surf ) {
|
||||
if ( !surf ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// force a space calculation
|
||||
backEnd.currentSpace = NULL;
|
||||
|
||||
if ( r_useTripleTextureARB.GetBool() && glConfig.maxTextureUnits >= 3 ) {
|
||||
for ( ; surf ; surf = surf->nextOnLight ) {
|
||||
// break it up into multiple primitive draw interactions if necessary
|
||||
RB_CreateSingleDrawInteractions( surf, RB_ARB_DrawThreeTextureInteraction );
|
||||
}
|
||||
} else {
|
||||
for ( ; surf ; surf = surf->nextOnLight ) {
|
||||
// break it up into multiple primitive draw interactions if necessary
|
||||
RB_CreateSingleDrawInteractions( surf, RB_ARB_DrawInteraction );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
RB_RenderViewLight
|
||||
|
||||
==================
|
||||
*/
|
||||
static void RB_RenderViewLight( viewLight_t *vLight ) {
|
||||
backEnd.vLight = vLight;
|
||||
|
||||
// do fogging later
|
||||
if ( vLight->lightShader->IsFogLight() ) {
|
||||
return;
|
||||
}
|
||||
if ( vLight->lightShader->IsBlendLight() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// clear the stencil buffer if needed
|
||||
if ( vLight->globalShadows || vLight->localShadows ) {
|
||||
backEnd.currentScissor = vLight->scissorRect;
|
||||
if ( r_useScissor.GetBool() ) {
|
||||
qglScissor( backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1,
|
||||
backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1,
|
||||
backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1,
|
||||
backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1 );
|
||||
}
|
||||
qglClear( GL_STENCIL_BUFFER_BIT );
|
||||
} else {
|
||||
// no shadows, so no need to read or write the stencil buffer
|
||||
// we might in theory want to use GL_ALWAYS instead of disabling
|
||||
// completely, to satisfy the invarience rules
|
||||
qglStencilFunc( GL_ALWAYS, 128, 255 );
|
||||
}
|
||||
|
||||
backEnd.depthFunc = GLS_DEPTHFUNC_EQUAL;
|
||||
RB_StencilShadowPass( vLight->globalShadows );
|
||||
RB_CreateDrawInteractions( vLight->localInteractions );
|
||||
RB_StencilShadowPass( vLight->localShadows );
|
||||
RB_CreateDrawInteractions( vLight->globalInteractions );
|
||||
|
||||
if ( r_skipTranslucent.GetBool() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// disable stencil testing for translucent interactions, because
|
||||
// the shadow isn't calculated at their point, and the shadow
|
||||
// behind them may be depth fighting with a back side, so there
|
||||
// isn't any reasonable thing to do
|
||||
qglStencilFunc( GL_ALWAYS, 128, 255 );
|
||||
backEnd.depthFunc = GLS_DEPTHFUNC_LESS;
|
||||
RB_CreateDrawInteractions( vLight->translucentInteractions );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
RB_ARB_DrawInteractions
|
||||
==================
|
||||
*/
|
||||
void RB_ARB_DrawInteractions( void ) {
|
||||
qglEnable( GL_STENCIL_TEST );
|
||||
|
||||
for ( viewLight_t *vLight = backEnd.viewDef->viewLights ; vLight ; vLight = vLight->next ) {
|
||||
RB_RenderViewLight( vLight );
|
||||
}
|
||||
}
|
|
@ -1672,9 +1672,6 @@ void RB_STD_DrawView( void ) {
|
|||
|
||||
// main light renderer
|
||||
switch( tr.backEndRenderer ) {
|
||||
case BE_ARB:
|
||||
RB_ARB_DrawInteractions();
|
||||
break;
|
||||
case BE_ARB2:
|
||||
RB_ARB2_DrawInteractions();
|
||||
break;
|
||||
|
|
|
@ -694,7 +694,7 @@ void R_LinkLightSurf( const drawSurf_t **link, const srfTriangles_t *tri, const
|
|||
}
|
||||
|
||||
// calculate the specular coordinates if we aren't using vertex programs
|
||||
if ( !tr.backEndRendererHasVertexPrograms && !r_skipSpecular.GetBool() && tr.backEndRenderer != BE_ARB ) {
|
||||
if ( !tr.backEndRendererHasVertexPrograms && !r_skipSpecular.GetBool() ) {
|
||||
R_SpecularTexGen( drawSurf, light->globalLightOrigin, tr.viewDef->renderView.vieworg );
|
||||
// if we failed to allocate space for the specular calculations, drop the surface
|
||||
if ( !drawSurf->dynamicTexCoords ) {
|
||||
|
|
|
@ -672,7 +672,6 @@ const int MAX_GUI_SURFACES = 1024; // default size of the drawSurfs list for gu
|
|||
// be automatically expanded as needed
|
||||
|
||||
typedef enum {
|
||||
BE_ARB,
|
||||
BE_ARB2,
|
||||
BE_BAD
|
||||
} backEndName_t;
|
||||
|
@ -832,12 +831,11 @@ extern idCVar r_flareSize; // scale the flare deforms from the material def
|
|||
extern idCVar r_gamma; // changes gamma tables
|
||||
extern idCVar r_brightness; // changes gamma tables
|
||||
|
||||
extern idCVar r_renderer; // arb, gl2, etc
|
||||
extern idCVar r_renderer; // arb2, etc
|
||||
|
||||
extern idCVar r_checkBounds; // compare all surface bounds with precalculated ones
|
||||
|
||||
extern idCVar r_useLightPortalFlow; // 1 = do a more precise area reference determination
|
||||
extern idCVar r_useTripleTextureARB; // 1 = cards with 3+ texture units do a two pass instead of three pass
|
||||
extern idCVar r_useShadowSurfaceScissor;// 1 = scissor shadows by the scissor rect of the interaction surfaces
|
||||
extern idCVar r_useConstantMaterials; // 1 = use pre-calculated material registers if possible
|
||||
extern idCVar r_useInteractionTable; // create a full entityDefs * lightDefs table to make finding interactions faster
|
||||
|
@ -1273,8 +1271,6 @@ DRAW_*
|
|||
============================================================
|
||||
*/
|
||||
|
||||
void RB_ARB_DrawInteractions( void );
|
||||
|
||||
void R_ARB2_Init( void );
|
||||
void RB_ARB2_DrawInteractions( void );
|
||||
void R_ReloadARBPrograms_f( const idCmdArgs &args );
|
||||
|
|
Loading…
Reference in a new issue