mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-26 05:50:57 +00:00
repair some strange quality regressions in the renderer source, as well as what looks like some half-merged pmx pieces. add glext for win32 platforms. NOTE: vc has poisoned a bunch of files with CRLF endings, because apparently you're not allowed to have those work properly in vs2013 and later, sigh
This commit is contained in:
parent
97db9f2314
commit
1afbf12d80
27 changed files with 12304 additions and 905 deletions
|
@ -1,4 +1,9 @@
|
||||||
|
|
||||||
|
xx Dec 16 - 1.48
|
||||||
|
|
||||||
|
chg: remove the byzantine r_mode usage added in 1.47
|
||||||
|
|
||||||
|
|
||||||
17 Sep 11 - 1.47
|
17 Sep 11 - 1.47
|
||||||
|
|
||||||
add: backported another bunch of dlight stuff from the pmx branch
|
add: backported another bunch of dlight stuff from the pmx branch
|
||||||
|
|
|
@ -309,8 +309,6 @@ static void SCR_PerformanceCounters()
|
||||||
SCR_DrawString( x, y, cw, ch, va("FrusLeafs: %i", pcFE[RF_LEAFS]), qfalse ); y += ch;
|
SCR_DrawString( x, y, cw, ch, va("FrusLeafs: %i", pcFE[RF_LEAFS]), qfalse ); y += ch;
|
||||||
SCR_DrawString( x, y, cw, ch, va("MD3 Cull S: %i %i %i", pcFE[RF_MD3_CULL_S_IN], pcFE[RF_MD3_CULL_S_CLIP], pcFE[RF_MD3_CULL_S_OUT]), qfalse ); y += ch;
|
SCR_DrawString( x, y, cw, ch, va("MD3 Cull S: %i %i %i", pcFE[RF_MD3_CULL_S_IN], pcFE[RF_MD3_CULL_S_CLIP], pcFE[RF_MD3_CULL_S_OUT]), qfalse ); y += ch;
|
||||||
SCR_DrawString( x, y, cw, ch, va("MD3 Cull B: %i %i %i", pcFE[RF_MD3_CULL_B_IN], pcFE[RF_MD3_CULL_B_CLIP], pcFE[RF_MD3_CULL_B_OUT]), qfalse ); y += ch;
|
SCR_DrawString( x, y, cw, ch, va("MD3 Cull B: %i %i %i", pcFE[RF_MD3_CULL_B_IN], pcFE[RF_MD3_CULL_B_CLIP], pcFE[RF_MD3_CULL_B_OUT]), qfalse ); y += ch;
|
||||||
SCR_DrawString( x, y, cw, ch, va("MD5 Cull S: %i %i %i", pcFE[RF_MD5_CULL_S_IN], pcFE[RF_MD5_CULL_S_CLIP], pcFE[RF_MD5_CULL_S_OUT]), qfalse ); y += ch;
|
|
||||||
SCR_DrawString( x, y, cw, ch, va("MD5 Cull B: %i %i %i", pcFE[RF_MD5_CULL_B_IN], pcFE[RF_MD5_CULL_B_CLIP], pcFE[RF_MD5_CULL_B_OUT]), qfalse ); y += ch;
|
|
||||||
SCR_DrawString( x, y, cw, ch, va("Bez Cull S: %i %i %i", pcFE[RF_BEZ_CULL_S_IN], pcFE[RF_BEZ_CULL_S_CLIP], pcFE[RF_BEZ_CULL_S_OUT]), qfalse ); y += ch;
|
SCR_DrawString( x, y, cw, ch, va("Bez Cull S: %i %i %i", pcFE[RF_BEZ_CULL_S_IN], pcFE[RF_BEZ_CULL_S_CLIP], pcFE[RF_BEZ_CULL_S_OUT]), qfalse ); y += ch;
|
||||||
SCR_DrawString( x, y, cw, ch, va("Bez Cull B: %i %i %i", pcFE[RF_BEZ_CULL_B_IN], pcFE[RF_BEZ_CULL_B_CLIP], pcFE[RF_BEZ_CULL_B_OUT]), qfalse ); y += ch;
|
SCR_DrawString( x, y, cw, ch, va("Bez Cull B: %i %i %i", pcFE[RF_BEZ_CULL_B_IN], pcFE[RF_BEZ_CULL_B_CLIP], pcFE[RF_BEZ_CULL_B_OUT]), qfalse ); y += ch;
|
||||||
SCR_DrawString( x, y, cw, ch, va("Light Cull: %i %i", pcFE[RF_LIGHT_CULL_IN], pcFE[RF_LIGHT_CULL_OUT]), qfalse ); y += ch;
|
SCR_DrawString( x, y, cw, ch, va("Light Cull: %i %i", pcFE[RF_LIGHT_CULL_IN], pcFE[RF_LIGHT_CULL_OUT]), qfalse ); y += ch;
|
||||||
|
|
|
@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
// q_shared.h -- included first by ALL program modules.
|
// q_shared.h -- included first by ALL program modules.
|
||||||
// A user mod should never modify this file
|
// A user mod should never modify this file
|
||||||
|
|
||||||
#define Q3_VERSION "CNQ3 1.47"
|
#define Q3_VERSION "CNQ3 1.48"
|
||||||
#define CLIENT_WINDOW_TITLE "CNQ3"
|
#define CLIENT_WINDOW_TITLE "CNQ3"
|
||||||
#define CONSOLE_WINDOW_TITLE "CNQ3 Console"
|
#define CONSOLE_WINDOW_TITLE "CNQ3 Console"
|
||||||
|
|
||||||
|
@ -72,20 +72,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(__cplusplus) || defined(bool)
|
|
||||||
#define bool DO_NOT_WANT
|
|
||||||
#define true DO_NOT_WANT
|
|
||||||
#define false DO_NOT_WANT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// technically-correct form, handy for catching sloppy code that mismixes bool and int, *cough* JPVW :P
|
// technically-correct form, handy for catching sloppy code that mismixes bool and int, *cough* JPVW :P
|
||||||
//typedef enum { qfalse, qtrue } qbool;
|
|
||||||
#if defined(Q3_VM)
|
#if defined(Q3_VM)
|
||||||
#define assert(x) { if (!(x)) Com_Error(ERR_FATAL, "ASSERT "__FILE__"(%d): %s", __LINE__, #x); }
|
#define assert(x) { if (!(x)) Com_Error(ERR_FATAL, "ASSERT "__FILE__"(%d): %s", __LINE__, #x); }
|
||||||
typedef enum { qfalse, qtrue } qbool;
|
typedef enum { qfalse, qtrue } qbool;
|
||||||
|
|
|
@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glext.h>
|
#include "../win32/glext.h"
|
||||||
|
|
||||||
#elif defined(MACOS_X)
|
#elif defined(MACOS_X)
|
||||||
|
|
||||||
|
@ -80,9 +80,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#define WINAPI
|
#define WINAPI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Quake OpenGL Extensions
|
|
||||||
#include "qgl_ext.h"
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
#ifndef __qglext_h_
|
|
||||||
#define __qglext_h_
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif // __cplusplus
|
|
||||||
|
|
||||||
#include <GL/gl.h>
|
|
||||||
#include <GL/glext.h>
|
|
||||||
|
|
||||||
#include "../qcommon/q_shared.h"
|
|
||||||
|
|
||||||
extern cvar_t *r_arb_vertex_buffer_object;
|
|
||||||
|
|
||||||
// ARB_vertex_buffer_object
|
|
||||||
extern PFNGLBINDBUFFERARBPROC qglBindBufferARB;
|
|
||||||
extern PFNGLDELETEBUFFERSARBPROC qglDeleteBuffersARB;
|
|
||||||
extern PFNGLGENBUFFERSARBPROC qglGenBuffersARB;
|
|
||||||
extern PFNGLISBUFFERARBPROC qglIsBufferARB;
|
|
||||||
extern PFNGLBUFFERDATAARBPROC qglBufferDataARB;
|
|
||||||
extern PFNGLBUFFERSUBDATAARBPROC qglBufferSubDataARB;
|
|
||||||
extern PFNGLGETBUFFERSUBDATAARBPROC qglGetBufferSubDataARB;
|
|
||||||
extern PFNGLMAPBUFFERARBPROC qglMapBufferARB;
|
|
||||||
extern PFNGLUNMAPBUFFERARBPROC qglUnmapBufferARB;
|
|
||||||
extern PFNGLGETBUFFERPARAMETERIVARBPROC qglGetBufferParameterivARB;
|
|
||||||
extern PFNGLGETBUFFERPOINTERVARBPROC qglGetBufferPointervARB;
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------
|
|
||||||
// VBO related stuff
|
|
||||||
extern GLuint idVBOData;
|
|
||||||
extern GLuint idVBOIndexes;
|
|
||||||
|
|
||||||
extern GLsizeiptrARB szVBOData_XYZ_Offset;
|
|
||||||
extern GLsizeiptrARB szVBOData_XYZ_Size;
|
|
||||||
extern GLsizeiptrARB szVBOData_TexCoords0_Offset;
|
|
||||||
extern GLsizeiptrARB szVBOData_TexCoords0_Size;
|
|
||||||
extern GLsizeiptrARB szVBOData_TexCoords1_Offset;
|
|
||||||
extern GLsizeiptrARB szVBOData_TexCoords1_Size;
|
|
||||||
extern GLsizeiptrARB szVBOData_VertColors_Offset;
|
|
||||||
extern GLsizeiptrARB szVBOData_VertColors_Size;
|
|
||||||
extern GLsizeiptrARB szVBOData_TotalSize;
|
|
||||||
|
|
||||||
extern GLsizeiptrARB szVBOIndexes_TotalSize;
|
|
||||||
// ----------------------------------------------------------------
|
|
||||||
// ----------------------------------------------------------------
|
|
||||||
|
|
||||||
qbool QGL_InitExtensions();
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif // __cplusplus
|
|
||||||
|
|
||||||
#endif // __qglext_h_
|
|
|
@ -10,38 +10,9 @@
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
// vertex attribs are a total clusterfuck, especially on nvidia drivers :(
|
|
||||||
|
|
||||||
static const GLuint VAA_TANGENT = 6;
|
|
||||||
static const GLuint VAA_FREE7 = 7;
|
|
||||||
|
|
||||||
static const unsigned GLA_TANGENT = (1 << VAA_TANGENT);
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned glslAttribBits;
|
|
||||||
|
|
||||||
static void GL_Arrays( int mask )
|
|
||||||
{
|
|
||||||
unsigned diff = mask ^ glslAttribBits;
|
|
||||||
|
|
||||||
if (!diff)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (diff & GLA_TANGENT) {
|
|
||||||
((mask & GLA_TANGENT) ? qglEnableVertexAttribArray : qglDisableVertexAttribArray)( VAA_TANGENT );
|
|
||||||
}
|
|
||||||
|
|
||||||
glslAttribBits = mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
struct GLSL_Program {
|
struct GLSL_Program {
|
||||||
GLuint vs;
|
GLuint vs;
|
||||||
GLuint fs;
|
GLuint fs;
|
||||||
GLuint p;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,36 +61,12 @@ static GLSL_Program progDynamic;
|
||||||
|
|
||||||
static void ARB_Lighting_Setup()
|
static void ARB_Lighting_Setup()
|
||||||
{
|
{
|
||||||
const shaderStage_t* pStage;
|
const shaderStage_t* pStage = tess.xstages[tess.shader->lightingStages[ST_DIFFUSE]];
|
||||||
|
|
||||||
// bind TMU0 last so we don't have to switch back to it after lighting
|
|
||||||
// because the rest of the system always just assumes TMU0 is selected
|
|
||||||
|
|
||||||
GL_SelectTexture( 2 );
|
|
||||||
if (tess.shader->lightingStages[ST_SPECULAR] != -1) {
|
|
||||||
pStage = tess.xstages[ tess.shader->lightingStages[ST_SPECULAR] ];
|
|
||||||
R_BindAnimatedImage( &pStage->bundle );
|
|
||||||
} else {
|
|
||||||
GL_Bind( tr.shinyImage );
|
|
||||||
}
|
|
||||||
|
|
||||||
GL_SelectTexture( 1 );
|
|
||||||
if (tess.shader->lightingStages[ST_BUMPMAP] != -1) {
|
|
||||||
pStage = tess.xstages[ tess.shader->lightingStages[ST_BUMPMAP] ];
|
|
||||||
R_BindAnimatedImage( &pStage->bundle );
|
|
||||||
} else {
|
|
||||||
GL_Bind( tr.flatImage );
|
|
||||||
}
|
|
||||||
|
|
||||||
pStage = tess.xstages[ tess.shader->lightingStages[ST_DIFFUSE] ];
|
|
||||||
GL_SelectTexture(0);
|
GL_SelectTexture(0);
|
||||||
R_BindAnimatedImage( &pStage->bundle );
|
R_BindAnimatedImage( &pStage->bundle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// things that are already set up:
|
|
||||||
// geom, normals, tangents, and ST0 are all in CVA
|
|
||||||
|
|
||||||
static void ARB_Lighting()
|
static void ARB_Lighting()
|
||||||
{
|
{
|
||||||
backEnd.pc[RB_LIT_VERTICES_LATECULLTEST] += tess.numVertexes;
|
backEnd.pc[RB_LIT_VERTICES_LATECULLTEST] += tess.numVertexes;
|
||||||
|
@ -131,15 +78,12 @@ static void ARB_Lighting()
|
||||||
for ( i = 0; i < tess.numVertexes; ++i ) {
|
for ( i = 0; i < tess.numVertexes; ++i ) {
|
||||||
vec3_t dist;
|
vec3_t dist;
|
||||||
VectorSubtract( dl->transformed, tess.xyz[i], dist );
|
VectorSubtract( dl->transformed, tess.xyz[i], dist );
|
||||||
/* hrm...
|
|
||||||
// on the armor md5, this is clearly being SLIGHTLY too agressive
|
|
||||||
// and you can (just) see surfaces being culled for near-coplanar lights
|
|
||||||
// because the triangles are using VERTEX normals rather than SURFACE ones
|
|
||||||
if ( DotProduct( dist, tess.normal[i] ) <= 0.0 ) {
|
if ( DotProduct( dist, tess.normal[i] ) <= 0.0 ) {
|
||||||
clipBits[i] = (byte)-1;
|
clipBits[i] = (byte)-1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
int clip = 0;
|
int clip = 0;
|
||||||
if ( dist[0] > dl->radius ) {
|
if ( dist[0] > dl->radius ) {
|
||||||
clip |= 1;
|
clip |= 1;
|
||||||
|
@ -221,8 +165,6 @@ static void ARB_LightingPass()
|
||||||
|
|
||||||
GL_Cull( tess.shader->cullType );
|
GL_Cull( tess.shader->cullType );
|
||||||
|
|
||||||
// the bump and specular layers implicitly have the TCs of the base layer
|
|
||||||
// (it's nonsensical for them not to, if you think about it)
|
|
||||||
const shaderStage_t* pStage = tess.xstages[ tess.shader->lightingStages[ST_DIFFUSE] ];
|
const shaderStage_t* pStage = tess.xstages[ tess.shader->lightingStages[ST_DIFFUSE] ];
|
||||||
R_ComputeTexCoords( pStage, tess.svars );
|
R_ComputeTexCoords( pStage, tess.svars );
|
||||||
|
|
||||||
|
@ -236,9 +178,6 @@ static void ARB_LightingPass()
|
||||||
qglEnableClientState( GL_NORMAL_ARRAY );
|
qglEnableClientState( GL_NORMAL_ARRAY );
|
||||||
qglNormalPointer( GL_FLOAT, 16, tess.normal );
|
qglNormalPointer( GL_FLOAT, 16, tess.normal );
|
||||||
|
|
||||||
GL_Arrays( GLA_TANGENT );
|
|
||||||
qglVertexAttribPointer( VAA_TANGENT, 4, GL_FLOAT, GL_FALSE, 0, tess.tangent );
|
|
||||||
|
|
||||||
qglVertexPointer( 3, GL_FLOAT, 16, tess.xyz );
|
qglVertexPointer( 3, GL_FLOAT, 16, tess.xyz );
|
||||||
qglLockArraysEXT( 0, tess.numVertexes );
|
qglLockArraysEXT( 0, tess.numVertexes );
|
||||||
|
|
||||||
|
@ -247,7 +186,6 @@ static void ARB_LightingPass()
|
||||||
qglUnlockArraysEXT();
|
qglUnlockArraysEXT();
|
||||||
|
|
||||||
qglDisableClientState( GL_NORMAL_ARRAY );
|
qglDisableClientState( GL_NORMAL_ARRAY );
|
||||||
GL_Arrays( 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -308,10 +246,6 @@ void ARB_StageIterator()
|
||||||
|
|
||||||
for ( int stage = 0; stage < tess.shader->numStages; ++stage ) {
|
for ( int stage = 0; stage < tess.shader->numStages; ++stage ) {
|
||||||
const shaderStage_t* pStage = tess.xstages[stage];
|
const shaderStage_t* pStage = tess.xstages[stage];
|
||||||
|
|
||||||
if ( (pStage->type == ST_BUMPMAP) || (pStage->type == ST_SPECULAR) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
R_ComputeColors( pStage, tess.svars );
|
R_ComputeColors( pStage, tess.svars );
|
||||||
R_ComputeTexCoords( pStage, tess.svars );
|
R_ComputeTexCoords( pStage, tess.svars );
|
||||||
R_BindAnimatedImage( &pStage->bundle );
|
R_BindAnimatedImage( &pStage->bundle );
|
||||||
|
@ -343,42 +277,25 @@ void ARB_StageIterator()
|
||||||
qglDisable( GL_POLYGON_OFFSET_FILL );
|
qglDisable( GL_POLYGON_OFFSET_FILL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
static qbool ARB_LoadProgram( GLSL_Program& prog, const char* name )
|
static qbool ARB_LoadProgram(GLSL_Program& prog, const char* vp, const char* fp)
|
||||||
{
|
{
|
||||||
int len;
|
|
||||||
byte* sp;
|
|
||||||
const char* s;
|
|
||||||
|
|
||||||
s = va( "glsl/%s.vp", name );
|
|
||||||
len = FS_ReadFile( s, (void**)&sp );
|
|
||||||
if ( !sp )
|
|
||||||
Com_Error( ERR_FATAL, "Couldn't load %s", s );
|
|
||||||
|
|
||||||
qglGenPrograms(1, &prog.vs);
|
qglGenPrograms(1, &prog.vs);
|
||||||
qglBindProgram(GL_VERTEX_PROGRAM_ARB, prog.vs);
|
qglBindProgram(GL_VERTEX_PROGRAM_ARB, prog.vs);
|
||||||
qglProgramString( GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, len, sp );
|
qglProgramString(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(vp), vp);
|
||||||
FS_FreeFile( sp );
|
|
||||||
|
|
||||||
if (glGetError() != GL_NO_ERROR) {
|
if (qglGetError() != GL_NO_ERROR)
|
||||||
ri.Error( ERR_FATAL, "VP Compile Error: %s : %s", s, glGetString(GL_PROGRAM_ERROR_STRING_ARB) );
|
ri.Error(ERR_FATAL, "VP Compile Error: %s", qglGetString(GL_PROGRAM_ERROR_STRING_ARB));
|
||||||
}
|
|
||||||
|
|
||||||
s = va( "glsl/%s.fp", name );
|
|
||||||
len = FS_ReadFile( s, (void**)&sp );
|
|
||||||
if ( !sp )
|
|
||||||
Com_Error( ERR_FATAL, "Couldn't load %s", s );
|
|
||||||
|
|
||||||
qglGenPrograms(1, &prog.fs);
|
qglGenPrograms(1, &prog.fs);
|
||||||
qglBindProgram(GL_FRAGMENT_PROGRAM_ARB, prog.fs);
|
qglBindProgram(GL_FRAGMENT_PROGRAM_ARB, prog.fs);
|
||||||
qglProgramString( GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, len, sp );
|
qglProgramString(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(fp), fp);
|
||||||
FS_FreeFile( sp );
|
|
||||||
|
|
||||||
if (glGetError() != GL_NO_ERROR) {
|
if (qglGetError() != GL_NO_ERROR)
|
||||||
ri.Error( ERR_FATAL, "FP Compile Error: %s : %s", s, glGetString(GL_PROGRAM_ERROR_STRING_ARB) );
|
ri.Error(ERR_FATAL, "FP Compile Error: %s", qglGetString(GL_PROGRAM_ERROR_STRING_ARB));
|
||||||
}
|
|
||||||
|
|
||||||
return qtrue;
|
return qtrue;
|
||||||
}
|
}
|
||||||
|
@ -440,9 +357,7 @@ static const char* legacyFP =
|
||||||
|
|
||||||
qbool QGL_InitARB()
|
qbool QGL_InitARB()
|
||||||
{
|
{
|
||||||
GL_Arrays( 0 );
|
ARB_LoadProgram( progDynamic, legacyVP, legacyFP );
|
||||||
|
|
||||||
ARB_LoadProgram( progDynamic, "dynamic" );
|
|
||||||
|
|
||||||
GL_Program();
|
GL_Program();
|
||||||
|
|
||||||
|
|
|
@ -746,8 +746,8 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
|
||||||
qglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB8, cols, rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, data );
|
qglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB8, cols, rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, data );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, gl_clamp_mode );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gl_clamp_mode );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
|
||||||
} else {
|
} else {
|
||||||
if (dirty) {
|
if (dirty) {
|
||||||
// otherwise, just subimage upload it so that drivers can tell we are going to be changing
|
// otherwise, just subimage upload it so that drivers can tell we are going to be changing
|
||||||
|
@ -788,8 +788,8 @@ void RE_UploadCinematic (int w, int h, int cols, int rows, const byte *data, int
|
||||||
qglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB8, cols, rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, data );
|
qglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB8, cols, rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, data );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, gl_clamp_mode );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
|
||||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gl_clamp_mode );
|
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
|
||||||
} else {
|
} else {
|
||||||
if (dirty) {
|
if (dirty) {
|
||||||
// otherwise, just subimage upload it so that drivers can tell we are going to be changing
|
// otherwise, just subimage upload it so that drivers can tell we are going to be changing
|
||||||
|
|
|
@ -201,74 +201,6 @@ static shader_t* ShaderForShaderNum( int shaderNum, int lightmapNum )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// lengyel's algorithm: see http://www.terathon.com/code/tangent.html
|
|
||||||
|
|
||||||
static void CalcTangents( srfSurfaceFace_t* srf )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
const int* indices = srf->indexes;
|
|
||||||
|
|
||||||
vec3_t tan1[MAX_FACE_POINTS];
|
|
||||||
Com_Memset( tan1, 0, sizeof(tan1) );
|
|
||||||
|
|
||||||
vec3_t tan2[MAX_FACE_POINTS];
|
|
||||||
Com_Memset( tan2, 0, sizeof(tan2) );
|
|
||||||
|
|
||||||
for ( i = 0; i < srf->numIndexes / 3; ++i, indices += 3 ) {
|
|
||||||
int i1 = indices[0];
|
|
||||||
int i2 = indices[1];
|
|
||||||
int i3 = indices[2];
|
|
||||||
|
|
||||||
const vec3_t& v1 = srf->verts[i1].xyz;
|
|
||||||
const vec3_t& v2 = srf->verts[i2].xyz;
|
|
||||||
const vec3_t& v3 = srf->verts[i3].xyz;
|
|
||||||
|
|
||||||
const vec2_t& tc1 = srf->verts[i1].st;
|
|
||||||
const vec2_t& tc2 = srf->verts[i2].st;
|
|
||||||
const vec2_t& tc3 = srf->verts[i3].st;
|
|
||||||
|
|
||||||
float x1 = v2[0] - v1[0];
|
|
||||||
float x2 = v3[0] - v1[0];
|
|
||||||
float y1 = v2[1] - v1[1];
|
|
||||||
float y2 = v3[1] - v1[1];
|
|
||||||
float z1 = v2[2] - v1[2];
|
|
||||||
float z2 = v3[2] - v1[2];
|
|
||||||
|
|
||||||
float s1 = tc2[0] - tc1[0];
|
|
||||||
float s2 = tc3[0] - tc1[0];
|
|
||||||
float t1 = tc2[1] - tc1[1];
|
|
||||||
float t2 = tc3[1] - tc1[1];
|
|
||||||
|
|
||||||
float r = 1.0 / (s1 * t2 - s2 * t1);
|
|
||||||
|
|
||||||
vec3_t sdir, tdir;
|
|
||||||
VectorSet( sdir, (t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r, (t2 * z1 - t1 * z2) * r );
|
|
||||||
VectorSet( tdir, (s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) * r, (s1 * z2 - s2 * z1) * r );
|
|
||||||
|
|
||||||
VectorAdd( tan1[i1], sdir, tan1[i1] );
|
|
||||||
VectorAdd( tan1[i2], sdir, tan1[i2] );
|
|
||||||
VectorAdd( tan1[i3], sdir, tan1[i3] );
|
|
||||||
|
|
||||||
VectorAdd( tan2[i1], tdir, tan2[i1] );
|
|
||||||
VectorAdd( tan2[i2], tdir, tan2[i2] );
|
|
||||||
VectorAdd( tan2[i3], tdir, tan2[i3] );
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( i = 0; i < srf->numVerts; ++i ) {
|
|
||||||
// Gram-Schmidt orthogonalize
|
|
||||||
vec3_t t;
|
|
||||||
float f = DotProduct( srf->plane.normal, tan1[i] );
|
|
||||||
VectorMA( tan1[i], -f, srf->plane.normal, t );
|
|
||||||
VectorNormalize2( t, srf->verts[i].tangent );
|
|
||||||
|
|
||||||
// stash the handedness in tan.w
|
|
||||||
vec3_t x;
|
|
||||||
CrossProduct( srf->plane.normal, tan1[i], x );
|
|
||||||
srf->verts[i].tangent[3] = (DotProduct(x, tan2[i]) < 0.0f) ? -1.0f : 1.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <class T> T* AllocSurface( int numVerts, int numIndexes )
|
template <class T> T* AllocSurface( int numVerts, int numIndexes )
|
||||||
{
|
{
|
||||||
T* surf = (T*)RI_New<byte>
|
T* surf = (T*)RI_New<byte>
|
||||||
|
@ -326,8 +258,6 @@ static void ParseFace( const dsurface_t* ds, const drawVert_t* verts, msurface_t
|
||||||
cv->plane.dist = DotProduct( cv->verts[0].xyz, cv->plane.normal );
|
cv->plane.dist = DotProduct( cv->verts[0].xyz, cv->plane.normal );
|
||||||
SetPlaneSignbits( &cv->plane );
|
SetPlaneSignbits( &cv->plane );
|
||||||
cv->plane.type = PlaneTypeForNormal( cv->plane.normal );
|
cv->plane.type = PlaneTypeForNormal( cv->plane.normal );
|
||||||
|
|
||||||
CalcTangents( cv );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -383,74 +313,6 @@ static void ParseMesh( const dsurface_t* ds, const drawVert_t* verts, msurface_t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// HACK HACK HACK copypaste HACK !!!
|
|
||||||
|
|
||||||
static void CalcTangents_TriSurf( srfTriangles_t* srf )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
const int* indices = srf->indexes;
|
|
||||||
|
|
||||||
vec3_t tan1[SHADER_MAX_VERTEXES];
|
|
||||||
Com_Memset( tan1, 0, sizeof(tan1) );
|
|
||||||
|
|
||||||
vec3_t tan2[SHADER_MAX_VERTEXES];
|
|
||||||
Com_Memset( tan2, 0, sizeof(tan2) );
|
|
||||||
|
|
||||||
for ( i = 0; i < srf->numIndexes / 3; ++i, indices += 3 ) {
|
|
||||||
int i1 = indices[0];
|
|
||||||
int i2 = indices[1];
|
|
||||||
int i3 = indices[2];
|
|
||||||
|
|
||||||
const vec3_t& v1 = srf->verts[i1].xyz;
|
|
||||||
const vec3_t& v2 = srf->verts[i2].xyz;
|
|
||||||
const vec3_t& v3 = srf->verts[i3].xyz;
|
|
||||||
|
|
||||||
const vec2_t& tc1 = srf->verts[i1].st;
|
|
||||||
const vec2_t& tc2 = srf->verts[i2].st;
|
|
||||||
const vec2_t& tc3 = srf->verts[i3].st;
|
|
||||||
|
|
||||||
float x1 = v2[0] - v1[0];
|
|
||||||
float x2 = v3[0] - v1[0];
|
|
||||||
float y1 = v2[1] - v1[1];
|
|
||||||
float y2 = v3[1] - v1[1];
|
|
||||||
float z1 = v2[2] - v1[2];
|
|
||||||
float z2 = v3[2] - v1[2];
|
|
||||||
|
|
||||||
float s1 = tc2[0] - tc1[0];
|
|
||||||
float s2 = tc3[0] - tc1[0];
|
|
||||||
float t1 = tc2[1] - tc1[1];
|
|
||||||
float t2 = tc3[1] - tc1[1];
|
|
||||||
|
|
||||||
float r = 1.0 / (s1 * t2 - s2 * t1);
|
|
||||||
|
|
||||||
vec3_t sdir, tdir;
|
|
||||||
VectorSet( sdir, (t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r, (t2 * z1 - t1 * z2) * r );
|
|
||||||
VectorSet( tdir, (s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) * r, (s1 * z2 - s2 * z1) * r );
|
|
||||||
|
|
||||||
VectorAdd( tan1[i1], sdir, tan1[i1] );
|
|
||||||
VectorAdd( tan1[i2], sdir, tan1[i2] );
|
|
||||||
VectorAdd( tan1[i3], sdir, tan1[i3] );
|
|
||||||
|
|
||||||
VectorAdd( tan2[i1], tdir, tan2[i1] );
|
|
||||||
VectorAdd( tan2[i2], tdir, tan2[i2] );
|
|
||||||
VectorAdd( tan2[i3], tdir, tan2[i3] );
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( i = 0; i < srf->numVerts; ++i ) {
|
|
||||||
// Gram-Schmidt orthogonalize
|
|
||||||
vec3_t t;
|
|
||||||
float f = DotProduct( srf->verts[i].normal, tan1[i] );
|
|
||||||
VectorMA( tan1[i], -f, srf->verts[i].normal, t );
|
|
||||||
VectorNormalize2( t, srf->verts[i].tangent );
|
|
||||||
|
|
||||||
// stash the handedness in tan.w
|
|
||||||
vec3_t x;
|
|
||||||
CrossProduct( srf->verts[i].normal, tan1[i], x );
|
|
||||||
srf->verts[i].tangent[3] = (DotProduct(x, tan2[i]) < 0.0f) ? -1.0f : 1.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void ParseTriSurf( const dsurface_t* ds, const drawVert_t* verts, msurface_t* surf, const int* indexes )
|
static void ParseTriSurf( const dsurface_t* ds, const drawVert_t* verts, msurface_t* surf, const int* indexes )
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@ -488,8 +350,6 @@ static void ParseTriSurf( const dsurface_t* ds, const drawVert_t* verts, msurfac
|
||||||
ri.Error( ERR_DROP, "Bad index in triangle surface" );
|
ri.Error( ERR_DROP, "Bad index in triangle surface" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CalcTangents_TriSurf( tri );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,90 +0,0 @@
|
||||||
#include "../qcommon/q_shared.h"
|
|
||||||
#include "../renderer/tr_local.h"
|
|
||||||
|
|
||||||
#if defined(USE_SDL_VIDEO)
|
|
||||||
#include <SDL.h>
|
|
||||||
#include <SDL_opengl.h>
|
|
||||||
#else
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <dlfcn.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "qgl_ext.h"
|
|
||||||
|
|
||||||
cvar_t *r_arb_vertex_buffer_object;
|
|
||||||
|
|
||||||
// ARB_vertex_buffer_object
|
|
||||||
PFNGLBINDBUFFERARBPROC qglBindBufferARB;
|
|
||||||
PFNGLDELETEBUFFERSARBPROC qglDeleteBuffersARB;
|
|
||||||
PFNGLGENBUFFERSARBPROC qglGenBuffersARB;
|
|
||||||
PFNGLISBUFFERARBPROC qglIsBufferARB;
|
|
||||||
PFNGLBUFFERDATAARBPROC qglBufferDataARB;
|
|
||||||
PFNGLBUFFERSUBDATAARBPROC qglBufferSubDataARB;
|
|
||||||
PFNGLGETBUFFERSUBDATAARBPROC qglGetBufferSubDataARB;
|
|
||||||
PFNGLMAPBUFFERARBPROC qglMapBufferARB;
|
|
||||||
PFNGLUNMAPBUFFERARBPROC qglUnmapBufferARB;
|
|
||||||
PFNGLGETBUFFERPARAMETERIVARBPROC qglGetBufferParameterivARB;
|
|
||||||
PFNGLGETBUFFERPOINTERVARBPROC qglGetBufferPointervARB;
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------
|
|
||||||
// VBO related stuff
|
|
||||||
GLuint idVBOData = 0;
|
|
||||||
GLuint idVBOIndexes = 0;
|
|
||||||
|
|
||||||
GLsizeiptrARB szVBOData_XYZ_Offset = 0;
|
|
||||||
GLsizeiptrARB szVBOData_XYZ_Size = 0;
|
|
||||||
GLsizeiptrARB szVBOData_TexCoords0_Offset = 0;
|
|
||||||
GLsizeiptrARB szVBOData_TexCoords0_Size = 0;
|
|
||||||
GLsizeiptrARB szVBOData_TexCoords1_Offset = 0;
|
|
||||||
GLsizeiptrARB szVBOData_TexCoords1_Size = 0;
|
|
||||||
GLsizeiptrARB szVBOData_VertColors_Offset = 0;
|
|
||||||
GLsizeiptrARB szVBOData_VertColors_Size = 0;
|
|
||||||
GLsizeiptrARB szVBOData_TotalSize = 0;
|
|
||||||
|
|
||||||
GLsizeiptrARB szVBOIndexes_TotalSize = 0;
|
|
||||||
// ----------------------------------------------------------------
|
|
||||||
// ----------------------------------------------------------------
|
|
||||||
|
|
||||||
#if USE_SDL_VIDEO
|
|
||||||
#define GPA( a ) SDL_GL_GetProcAddress( a )
|
|
||||||
qbool GLimp_sdl_init_video(void);
|
|
||||||
#else
|
|
||||||
#define GPA( a ) dlsym( glw_state.OpenGLLib, a )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#define QGL_GetFunction(apicall, fn) q##fn = ( apicall )qwglGetProcAddress( #fn## ); \
|
|
||||||
if (!q##fn) Com_Error( ERR_FATAL, "QGL_InitExtensions: "#fn" not found" );
|
|
||||||
#else
|
|
||||||
#define QGL_GetFunction(apicall, fn) q##fn = ( apicall ) GPA( #fn ); \
|
|
||||||
if (!q##fn) Com_Error( ERR_FATAL, "QGL_InitExtensions: "#fn" not found" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
qbool QGL_InitExtensions() {
|
|
||||||
r_arb_vertex_buffer_object = ri.Cvar_Get("r_arb_vertex_buffer_object", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
|
||||||
|
|
||||||
ri.Printf(PRINT_ALL, "--------------------- QGL_InitExtensions ---------------------\n");
|
|
||||||
|
|
||||||
if (strstr(glConfig.extensions_string, "GL_ARB_vertex_buffer_object")) {
|
|
||||||
ri.Printf(PRINT_ALL, "+ QGL_InitExtensions: using ARB_vertex_buffer_object\n");
|
|
||||||
QGL_GetFunction(PFNGLBINDBUFFERARBPROC, glBindBufferARB);
|
|
||||||
QGL_GetFunction(PFNGLDELETEBUFFERSARBPROC, glDeleteBuffersARB);
|
|
||||||
QGL_GetFunction(PFNGLGENBUFFERSARBPROC, glGenBuffersARB);
|
|
||||||
QGL_GetFunction(PFNGLISBUFFERARBPROC, glIsBufferARB);
|
|
||||||
QGL_GetFunction(PFNGLBUFFERDATAARBPROC, glBufferDataARB);
|
|
||||||
QGL_GetFunction(PFNGLBUFFERSUBDATAARBPROC, glBufferSubDataARB);
|
|
||||||
QGL_GetFunction(PFNGLGETBUFFERSUBDATAARBPROC, glGetBufferSubDataARB);
|
|
||||||
QGL_GetFunction(PFNGLMAPBUFFERARBPROC, glMapBufferARB);
|
|
||||||
QGL_GetFunction(PFNGLUNMAPBUFFERARBPROC, glUnmapBufferARB);
|
|
||||||
QGL_GetFunction(PFNGLGETBUFFERPARAMETERIVARBPROC, glGetBufferParameterivARB);
|
|
||||||
QGL_GetFunction(PFNGLGETBUFFERPOINTERVARBPROC, glGetBufferPointervARB);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ri.Printf(PRINT_ALL, "- QGL_InitExtensions: ARB_vertex_buffer_object not found\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
ri.Printf(PRINT_ALL, "--------------------------------------------------------------\n");
|
|
||||||
|
|
||||||
return qtrue;
|
|
||||||
}
|
|
|
@ -1018,13 +1018,6 @@ static void R_CreateBuiltinImages()
|
||||||
Com_Memset( data, 255, 4 );
|
Com_Memset( data, 255, 4 );
|
||||||
tr.whiteImage = R_CreateImage( "*white", data, 1, 1, GL_RGBA, IMG_NOMIPMAP, GL_REPEAT );
|
tr.whiteImage = R_CreateImage( "*white", data, 1, 1, GL_RGBA, IMG_NOMIPMAP, GL_REPEAT );
|
||||||
|
|
||||||
data[0] = 128;
|
|
||||||
data[1] = 128;
|
|
||||||
tr.flatImage = R_CreateImage( "*flat", data, 1, 1, GL_RGBA, IMG_NOMIPMAP | IMG_NOIMANIP, GL_REPEAT );
|
|
||||||
|
|
||||||
Com_Memset( data, 64, 4 );
|
|
||||||
tr.shinyImage = R_CreateImage( "*shiny", data, 1, 1, GL_RGBA, IMG_NOMIPMAP | IMG_NOIMANIP, GL_REPEAT );
|
|
||||||
|
|
||||||
// scratchimages usually used for cinematic drawing (signal-quality effects)
|
// scratchimages usually used for cinematic drawing (signal-quality effects)
|
||||||
// these are just placeholders: RE_StretchRaw will regenerate them when it wants them
|
// these are just placeholders: RE_StretchRaw will regenerate them when it wants them
|
||||||
for (i = 0; i < 16; ++i) // MAX_VIDEO_HANDLES
|
for (i = 0; i < 16; ++i) // MAX_VIDEO_HANDLES
|
||||||
|
|
|
@ -137,9 +137,6 @@ static cvar_t* r_maxpolyverts;
|
||||||
int max_polys;
|
int max_polys;
|
||||||
int max_polyverts;
|
int max_polyverts;
|
||||||
|
|
||||||
// 1.32e
|
|
||||||
cvar_t *r_clamptoedge;
|
|
||||||
int gl_clamp_mode = 0;
|
|
||||||
|
|
||||||
static void AssertCvarRange( cvar_t *cv, float minVal, float maxVal, qbool shouldBeIntegral )
|
static void AssertCvarRange( cvar_t *cv, float minVal, float maxVal, qbool shouldBeIntegral )
|
||||||
{
|
{
|
||||||
|
@ -243,11 +240,6 @@ static void InitOpenGL()
|
||||||
GfxInfo_f();
|
GfxInfo_f();
|
||||||
|
|
||||||
GL_SetDefaultState();
|
GL_SetDefaultState();
|
||||||
|
|
||||||
if (strstr(glConfig.extensions_string, "GL_ARB_vertex_buffer_object")) {
|
|
||||||
qglGenBuffersARB(1, &idVBOData);
|
|
||||||
qglGenBuffersARB(1, &idVBOIndexes);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -285,30 +277,17 @@ void GL_CheckErrors()
|
||||||
ri.Error( ERR_FATAL, "GL_CheckErrors: %s", s );
|
ri.Error( ERR_FATAL, "GL_CheckErrors: %s", s );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
qbool R_GetModeInfo(int* width, int* height, float* aspect)
|
qbool R_GetModeInfo(int* width, int* height, float* aspect)
|
||||||
{
|
{
|
||||||
if (r_mode->string && *r_mode->string)
|
if (r_fullscreen->integer && !r_mode->integer)
|
||||||
{
|
return qfalse;
|
||||||
if (r_mode->integer)
|
|
||||||
{
|
|
||||||
int w(-1), h(-1), hz(-1);
|
|
||||||
if (2 <= sscanf( r_mode->string, "%ix%i@%i", &w, &h, &hz))
|
|
||||||
{
|
|
||||||
r_width->integer = w >= 320 && w <= 2560 ? w : r_width->integer;
|
|
||||||
r_height->integer = h >= 240 && h <= 1600 ? h : r_height->integer;
|
|
||||||
r_displayRefresh->integer = hz >= 0 && hz <= 200 ? hz : r_displayRefresh->integer;
|
|
||||||
r_customaspect->value = (float)r_width->integer / r_height->integer;
|
|
||||||
}
|
|
||||||
|
|
||||||
*width = r_width->integer;
|
*width = r_width->integer;
|
||||||
*height = r_height->integer;
|
*height = r_height->integer;
|
||||||
*aspect = r_customaspect->value;
|
*aspect = r_customaspect->value;
|
||||||
return qtrue;
|
return qtrue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return qfalse;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
|
@ -338,6 +317,7 @@ static void RB_TakeScreenshotTGA( int x, int y, int width, int height, const cha
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( /*( tr.overbrightBits > 0 ) &&*/ glConfig.deviceSupportsGamma )
|
if ( /*( tr.overbrightBits > 0 ) &&*/ glConfig.deviceSupportsGamma )
|
||||||
|
if ((tr.overbrightBits > 0) && glConfig.deviceSupportsGamma)
|
||||||
R_GammaCorrect(pRGB, c);
|
R_GammaCorrect(pRGB, c);
|
||||||
|
|
||||||
ri.FS_WriteFile( fileName, p, sizeof(TargaHeader) + c );
|
ri.FS_WriteFile( fileName, p, sizeof(TargaHeader) + c );
|
||||||
|
@ -664,8 +644,6 @@ static void R_Register()
|
||||||
r_maxpolys = ri.Cvar_Get( "r_maxpolys", va("%d", DEFAULT_MAX_POLYS), 0 );
|
r_maxpolys = ri.Cvar_Get( "r_maxpolys", va("%d", DEFAULT_MAX_POLYS), 0 );
|
||||||
r_maxpolyverts = ri.Cvar_Get( "r_maxpolyverts", va("%d", DEFAULT_MAX_POLYVERTS), 0 );
|
r_maxpolyverts = ri.Cvar_Get( "r_maxpolyverts", va("%d", DEFAULT_MAX_POLYVERTS), 0 );
|
||||||
|
|
||||||
r_clamptoedge = ri.Cvar_Get( "r_clamptoedge", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
|
||||||
|
|
||||||
for (int i = 0; r_ConsoleCmds[i].cmd; ++i) {
|
for (int i = 0; r_ConsoleCmds[i].cmd; ++i) {
|
||||||
ri.Cmd_AddCommand( r_ConsoleCmds[i].cmd, r_ConsoleCmds[i].fn );
|
ri.Cmd_AddCommand( r_ConsoleCmds[i].cmd, r_ConsoleCmds[i].fn );
|
||||||
}
|
}
|
||||||
|
@ -713,11 +691,6 @@ void R_Init()
|
||||||
max_polys = max( r_maxpolys->integer, DEFAULT_MAX_POLYS );
|
max_polys = max( r_maxpolys->integer, DEFAULT_MAX_POLYS );
|
||||||
max_polyverts = max( r_maxpolyverts->integer, DEFAULT_MAX_POLYVERTS );
|
max_polyverts = max( r_maxpolyverts->integer, DEFAULT_MAX_POLYVERTS );
|
||||||
|
|
||||||
if ( r_clamptoedge && r_clamptoedge->integer > 0 )
|
|
||||||
gl_clamp_mode = GL_CLAMP_TO_EDGE;
|
|
||||||
else
|
|
||||||
gl_clamp_mode = GL_CLAMP;
|
|
||||||
|
|
||||||
byte* ptr = (byte*)ri.Hunk_Alloc( sizeof( *backEndData[0] ) + sizeof(srfPoly_t) * max_polys + sizeof(polyVert_t) * max_polyverts, h_low );
|
byte* ptr = (byte*)ri.Hunk_Alloc( sizeof( *backEndData[0] ) + sizeof(srfPoly_t) * max_polys + sizeof(polyVert_t) * max_polyverts, h_low );
|
||||||
backEndData[0] = (backEndData_t*)ptr;
|
backEndData[0] = (backEndData_t*)ptr;
|
||||||
backEndData[0]->polys = (srfPoly_t *) (ptr + sizeof( *backEndData[0] ));
|
backEndData[0]->polys = (srfPoly_t *) (ptr + sizeof( *backEndData[0] ));
|
||||||
|
@ -772,14 +745,6 @@ static void RE_Shutdown( qbool destroyWindow )
|
||||||
|
|
||||||
R_DoneFreeType();
|
R_DoneFreeType();
|
||||||
|
|
||||||
if (strstr(glConfig.extensions_string, "GL_ARB_vertex_buffer_object")) {
|
|
||||||
if(qglIsBufferARB(idVBOData))
|
|
||||||
qglDeleteBuffersARB(1, &idVBOData);
|
|
||||||
|
|
||||||
if(qglIsBufferARB(idVBOIndexes))
|
|
||||||
qglDeleteBuffersARB(1, &idVBOIndexes);
|
|
||||||
}
|
|
||||||
|
|
||||||
// shut down platform specific OpenGL stuff
|
// shut down platform specific OpenGL stuff
|
||||||
if ( destroyWindow ) {
|
if ( destroyWindow ) {
|
||||||
GLimp_Shutdown();
|
GLimp_Shutdown();
|
||||||
|
|
|
@ -277,8 +277,6 @@ typedef struct {
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ST_DIFFUSE,
|
ST_DIFFUSE,
|
||||||
ST_LIGHTMAP,
|
ST_LIGHTMAP,
|
||||||
ST_BUMPMAP,
|
|
||||||
ST_SPECULAR,
|
|
||||||
ST_MAX
|
ST_MAX
|
||||||
} stageType_t;
|
} stageType_t;
|
||||||
|
|
||||||
|
@ -459,7 +457,6 @@ typedef enum {
|
||||||
SF_TRIANGLES,
|
SF_TRIANGLES,
|
||||||
SF_POLY,
|
SF_POLY,
|
||||||
SF_MD3,
|
SF_MD3,
|
||||||
SF_MD5,
|
|
||||||
SF_FLARE,
|
SF_FLARE,
|
||||||
SF_ENTITY, // beams, rails, lightning, etc that can be determined by entity
|
SF_ENTITY, // beams, rails, lightning, etc that can be determined by entity
|
||||||
|
|
||||||
|
@ -549,7 +546,6 @@ struct srfVert_t {
|
||||||
vec2_t st; // diffuse TC
|
vec2_t st; // diffuse TC
|
||||||
vec2_t st2; // lightmap TC
|
vec2_t st2; // lightmap TC
|
||||||
color4ub_t rgba;
|
color4ub_t rgba;
|
||||||
vec4_t tangent;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct srfSurfaceFace_t {
|
struct srfSurfaceFace_t {
|
||||||
|
@ -583,80 +579,6 @@ struct srfTriangles_t {
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
typedef vec4_t quat_t;
|
|
||||||
|
|
||||||
|
|
||||||
struct md5Weight_t
|
|
||||||
{
|
|
||||||
int boneIndex;
|
|
||||||
float boneWeight;
|
|
||||||
vec3_t xyz;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct md5Vertex_t
|
|
||||||
{
|
|
||||||
vec2_t st;
|
|
||||||
int firstWeight;
|
|
||||||
int numWeights;
|
|
||||||
md5Weight_t **weights;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct md5Triangle_t
|
|
||||||
{
|
|
||||||
int indexes[3];
|
|
||||||
// int neighbors[3];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct md5Model_t;
|
|
||||||
|
|
||||||
struct md5Mesh_t
|
|
||||||
{
|
|
||||||
surfaceType_t surfaceType;
|
|
||||||
|
|
||||||
// char name[MAX_QPATH]; // polyset name
|
|
||||||
// char shader[MAX_QPATH];
|
|
||||||
int shaderIndex;
|
|
||||||
|
|
||||||
vec3_t mins, maxs;
|
|
||||||
vec3_t localOrigin;
|
|
||||||
float radius;
|
|
||||||
|
|
||||||
int numVerts;
|
|
||||||
md5Vertex_t* verts;
|
|
||||||
|
|
||||||
int numTris;
|
|
||||||
md5Triangle_t* tris;
|
|
||||||
|
|
||||||
int numWeights;
|
|
||||||
md5Weight_t* weights;
|
|
||||||
|
|
||||||
md5Model_t* model;
|
|
||||||
|
|
||||||
srfVert_t* sv;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct md5Bone_t
|
|
||||||
{
|
|
||||||
char name[MAX_QPATH];
|
|
||||||
int parentIndex; // parent index (-1 if root)
|
|
||||||
vec3_t origin;
|
|
||||||
quat_t rotation;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct md5Model_t
|
|
||||||
{
|
|
||||||
int numBones;
|
|
||||||
md5Bone_t* bones;
|
|
||||||
int numMeshes;
|
|
||||||
md5Mesh_t* meshes;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
// trRefdef_t holds everything that comes in refdef_t,
|
// trRefdef_t holds everything that comes in refdef_t,
|
||||||
// as well as the locally generated scene information
|
// as well as the locally generated scene information
|
||||||
|
|
||||||
|
@ -799,7 +721,6 @@ typedef enum {
|
||||||
MOD_BAD,
|
MOD_BAD,
|
||||||
MOD_BRUSH,
|
MOD_BRUSH,
|
||||||
MOD_MD3,
|
MOD_MD3,
|
||||||
MOD_MD5,
|
|
||||||
} modtype_t;
|
} modtype_t;
|
||||||
|
|
||||||
struct model_t {
|
struct model_t {
|
||||||
|
@ -808,7 +729,6 @@ struct model_t {
|
||||||
modtype_t type;
|
modtype_t type;
|
||||||
bmodel_t* bmodel; // type == MOD_BRUSH
|
bmodel_t* bmodel; // type == MOD_BRUSH
|
||||||
md3Header_t* md3[MD3_MAX_LODS]; // type == MOD_MD3
|
md3Header_t* md3[MD3_MAX_LODS]; // type == MOD_MD3
|
||||||
md5Model_t* md5; // type == MOD_MD5
|
|
||||||
int numLods;
|
int numLods;
|
||||||
int dataSize; // just for listing purposes
|
int dataSize; // just for listing purposes
|
||||||
};
|
};
|
||||||
|
@ -941,8 +861,6 @@ typedef struct {
|
||||||
|
|
||||||
image_t* defaultImage;
|
image_t* defaultImage;
|
||||||
image_t* whiteImage; // { 255, 255, 255, 255 }
|
image_t* whiteImage; // { 255, 255, 255, 255 }
|
||||||
image_t* flatImage; // { 128, 128, 255, 255 }, i.e. an encoded "up" normal
|
|
||||||
image_t* shinyImage; // { 64, 64, 64, 64 }, 25% specular rgb, 64 specular exponent
|
|
||||||
image_t* fogImage;
|
image_t* fogImage;
|
||||||
image_t* scratchImage[16];
|
image_t* scratchImage[16];
|
||||||
|
|
||||||
|
@ -1010,8 +928,6 @@ extern trGlobals_t tr;
|
||||||
extern glstate_t glState; // outside of TR since it shouldn't be cleared during ref re-init
|
extern glstate_t glState; // outside of TR since it shouldn't be cleared during ref re-init
|
||||||
|
|
||||||
// 1.32e
|
// 1.32e
|
||||||
extern int gl_clamp_mode;
|
|
||||||
extern cvar_t *r_customPixelAspect;
|
|
||||||
extern cvar_t *r_floatfix;
|
extern cvar_t *r_floatfix;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1126,8 +1042,6 @@ void R_RenderView( const viewParms_t* parms );
|
||||||
|
|
||||||
void R_AddMD3Surfaces( trRefEntity_t *e );
|
void R_AddMD3Surfaces( trRefEntity_t *e );
|
||||||
|
|
||||||
void R_AddMD5Surfaces( trRefEntity_t* e );
|
|
||||||
|
|
||||||
void R_AddPolygonSurfaces();
|
void R_AddPolygonSurfaces();
|
||||||
|
|
||||||
void R_AddDrawSurf( const surfaceType_t* surface, const shader_t* shader, int fogIndex );
|
void R_AddDrawSurf( const surfaceType_t* surface, const shader_t* shader, int fogIndex );
|
||||||
|
@ -1226,8 +1140,6 @@ void R_DeleteTextures();
|
||||||
void R_InitSkins();
|
void R_InitSkins();
|
||||||
const skin_t* R_GetSkinByHandle( qhandle_t hSkin );
|
const skin_t* R_GetSkinByHandle( qhandle_t hSkin );
|
||||||
|
|
||||||
int R_ComputeLOD( trRefEntity_t *ent );
|
|
||||||
|
|
||||||
const void *RB_TakeVideoFrameCmd( const void *data );
|
const void *RB_TakeVideoFrameCmd( const void *data );
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1297,7 +1209,6 @@ struct shaderCommands_t
|
||||||
ALIGN(16) glIndex_t indexes[SHADER_MAX_INDEXES];
|
ALIGN(16) glIndex_t indexes[SHADER_MAX_INDEXES];
|
||||||
vec4_t xyz[SHADER_MAX_VERTEXES];
|
vec4_t xyz[SHADER_MAX_VERTEXES];
|
||||||
vec4_t normal[SHADER_MAX_VERTEXES];
|
vec4_t normal[SHADER_MAX_VERTEXES];
|
||||||
vec4_t tangent[SHADER_MAX_VERTEXES];
|
|
||||||
vec2_t texCoords[SHADER_MAX_VERTEXES][2];
|
vec2_t texCoords[SHADER_MAX_VERTEXES][2];
|
||||||
color4ub_t vertexColors[SHADER_MAX_VERTEXES];
|
color4ub_t vertexColors[SHADER_MAX_VERTEXES];
|
||||||
|
|
||||||
|
|
|
@ -708,7 +708,6 @@ static qbool SurfIsOffscreen( const drawSurf_t* drawSurf )
|
||||||
int fogNum;
|
int fogNum;
|
||||||
vec4_t clip, eye;
|
vec4_t clip, eye;
|
||||||
int i;
|
int i;
|
||||||
//unsigned int pointOr = 0;
|
|
||||||
unsigned int pointAnd = (unsigned int)~0;
|
unsigned int pointAnd = (unsigned int)~0;
|
||||||
|
|
||||||
#ifdef USE_R_SMP
|
#ifdef USE_R_SMP
|
||||||
|
@ -744,7 +743,6 @@ static qbool SurfIsOffscreen( const drawSurf_t* drawSurf )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pointAnd &= pointFlags;
|
pointAnd &= pointFlags;
|
||||||
//pointOr |= pointFlags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// trivially reject
|
// trivially reject
|
||||||
|
@ -1194,9 +1192,6 @@ static void R_AddEntitySurfaces()
|
||||||
case MOD_MD3:
|
case MOD_MD3:
|
||||||
R_AddMD3Surfaces( ent );
|
R_AddMD3Surfaces( ent );
|
||||||
break;
|
break;
|
||||||
case MOD_MD5:
|
|
||||||
R_AddMD5Surfaces( ent );
|
|
||||||
break;
|
|
||||||
case MOD_BRUSH:
|
case MOD_BRUSH:
|
||||||
R_AddBrushModelSurfaces( ent );
|
R_AddBrushModelSurfaces( ent );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -23,7 +23,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
#include "tr_local.h"
|
#include "tr_local.h"
|
||||||
|
|
||||||
static float ProjectRadius( float r, vec3_t location )
|
|
||||||
|
static float ProjectRadius( float r, const vec3_t location )
|
||||||
{
|
{
|
||||||
float pr;
|
float pr;
|
||||||
float dist;
|
float dist;
|
||||||
|
@ -70,19 +71,14 @@ static float ProjectRadius( float r, vec3_t location )
|
||||||
return pr;
|
return pr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
static int R_CullModel( const md3Header_t* header, trRefEntity_t* ent )
|
||||||
R_CullModel
|
{
|
||||||
=============
|
const md3Frame_t *oldFrame, *newFrame;
|
||||||
*/
|
|
||||||
static int R_CullModel( md3Header_t *header, trRefEntity_t *ent ) {
|
|
||||||
vec3_t bounds[2];
|
|
||||||
md3Frame_t *oldFrame, *newFrame;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
// compute frame pointers
|
// compute frame pointers
|
||||||
newFrame = ( md3Frame_t * ) ( ( byte * ) header + header->ofsFrames ) + ent->e.frame;
|
newFrame = (const md3Frame_t*) ( ( byte * ) header + header->ofsFrames ) + ent->e.frame;
|
||||||
oldFrame = ( md3Frame_t * ) ( ( byte * ) header + header->ofsFrames ) + ent->e.oldframe;
|
oldFrame = (const md3Frame_t*) ( ( byte * ) header + header->ofsFrames ) + ent->e.oldframe;
|
||||||
|
|
||||||
// cull bounding sphere ONLY if this is not an upscaled entity
|
// cull bounding sphere ONLY if this is not an upscaled entity
|
||||||
if ( !ent->e.nonNormalizedAxes )
|
if ( !ent->e.nonNormalizedAxes )
|
||||||
|
@ -136,9 +132,10 @@ static int R_CullModel( md3Header_t *header, trRefEntity_t *ent ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate a bounding box in the current coordinate system
|
// calculate a bounding box in the current coordinate system
|
||||||
for (i = 0 ; i < 3 ; i++) {
|
vec3_t bounds[2];
|
||||||
bounds[0][i] = oldFrame->bounds[0][i] < newFrame->bounds[0][i] ? oldFrame->bounds[0][i] : newFrame->bounds[0][i];
|
for (int i = 0; i < 3; ++i) {
|
||||||
bounds[1][i] = oldFrame->bounds[1][i] > newFrame->bounds[1][i] ? oldFrame->bounds[1][i] : newFrame->bounds[1][i];
|
bounds[0][i] = min( oldFrame->bounds[0][i], newFrame->bounds[0][i] );
|
||||||
|
bounds[1][i] = max( oldFrame->bounds[1][i], newFrame->bounds[1][i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( R_CullLocalBox( bounds ) )
|
switch ( R_CullLocalBox( bounds ) )
|
||||||
|
@ -157,17 +154,11 @@ static int R_CullModel( md3Header_t *header, trRefEntity_t *ent ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
static int R_ComputeLOD( const trRefEntity_t* ent )
|
||||||
=================
|
{
|
||||||
R_ComputeLOD
|
|
||||||
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
int R_ComputeLOD( trRefEntity_t *ent ) {
|
|
||||||
float radius;
|
float radius;
|
||||||
float flod, lodscale;
|
float flod;
|
||||||
float projectedRadius;
|
float projectedRadius;
|
||||||
md3Frame_t *frame;
|
|
||||||
int lod;
|
int lod;
|
||||||
|
|
||||||
if ( tr.currentModel->numLods < 2 )
|
if ( tr.currentModel->numLods < 2 )
|
||||||
|
@ -179,13 +170,13 @@ int R_ComputeLOD( trRefEntity_t *ent ) {
|
||||||
{
|
{
|
||||||
// multiple LODs exist, so compute projected bounding sphere
|
// multiple LODs exist, so compute projected bounding sphere
|
||||||
// and use that as a criteria for selecting LOD
|
// and use that as a criteria for selecting LOD
|
||||||
frame = ( md3Frame_t * ) ( ( ( unsigned char * ) tr.currentModel->md3[0] ) + tr.currentModel->md3[0]->ofsFrames );
|
const md3Frame_t* frame = (const md3Frame_t*)(((unsigned char *)tr.currentModel->md3[0]) + tr.currentModel->md3[0]->ofsFrames);
|
||||||
frame += ent->e.frame;
|
frame += ent->e.frame;
|
||||||
radius = RadiusFromBounds( frame->bounds[0], frame->bounds[1] );
|
radius = RadiusFromBounds( frame->bounds[0], frame->bounds[1] );
|
||||||
|
|
||||||
if ( ( projectedRadius = ProjectRadius( radius, ent->e.origin ) ) != 0 )
|
if ( ( projectedRadius = ProjectRadius( radius, ent->e.origin ) ) != 0 )
|
||||||
{
|
{
|
||||||
lodscale = r_lodscale->value;
|
float lodscale = r_lodscale->value;
|
||||||
if (lodscale > 20) lodscale = 20;
|
if (lodscale > 20) lodscale = 20;
|
||||||
flod = 1.0f - projectedRadius * lodscale;
|
flod = 1.0f - projectedRadius * lodscale;
|
||||||
}
|
}
|
||||||
|
@ -218,27 +209,20 @@ int R_ComputeLOD( trRefEntity_t *ent ) {
|
||||||
return lod;
|
return lod;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
R_ComputeFogNum
|
|
||||||
|
|
||||||
=================
|
static int R_ComputeFogNum( const md3Header_t* header, const trRefEntity_t *ent )
|
||||||
*/
|
{
|
||||||
int R_ComputeFogNum( md3Header_t *header, trRefEntity_t *ent ) {
|
|
||||||
int i, j;
|
int i, j;
|
||||||
fog_t *fog;
|
|
||||||
md3Frame_t *md3Frame;
|
|
||||||
vec3_t localOrigin;
|
|
||||||
|
|
||||||
if ( tr.refdef.rdflags & RDF_NOWORLDMODEL ) {
|
if ( tr.refdef.rdflags & RDF_NOWORLDMODEL )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: non-normalized axis issues
|
// FIXME: non-normalized axis issues
|
||||||
md3Frame = ( md3Frame_t * ) ( ( byte * ) header + header->ofsFrames ) + ent->e.frame;
|
vec3_t localOrigin;
|
||||||
|
const md3Frame_t* md3Frame = (const md3Frame_t*)((byte *)header + header->ofsFrames) + ent->e.frame;
|
||||||
VectorAdd( ent->e.origin, md3Frame->localOrigin, localOrigin );
|
VectorAdd( ent->e.origin, md3Frame->localOrigin, localOrigin );
|
||||||
for ( i = 1 ; i < tr.world->numfogs ; i++ ) {
|
for ( i = 1 ; i < tr.world->numfogs ; i++ ) {
|
||||||
fog = &tr.world->fogs[i];
|
const fog_t* fog = &tr.world->fogs[i];
|
||||||
for ( j = 0 ; j < 3 ; j++ ) {
|
for ( j = 0 ; j < 3 ; j++ ) {
|
||||||
if ( localOrigin[j] - md3Frame->radius >= fog->bounds[1][j] ) {
|
if ( localOrigin[j] - md3Frame->radius >= fog->bounds[1][j] ) {
|
||||||
break;
|
break;
|
||||||
|
@ -255,25 +239,11 @@ int R_ComputeFogNum( md3Header_t *header, trRefEntity_t *ent ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
R_AddMD3Surfaces
|
|
||||||
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void R_AddMD3Surfaces( trRefEntity_t *ent ) {
|
|
||||||
int i;
|
|
||||||
md3Header_t *header = NULL;
|
|
||||||
md3Surface_t *surface = NULL;
|
|
||||||
md3Shader_t *md3Shader = NULL;
|
|
||||||
const shader_t* shader = NULL;
|
|
||||||
int cull;
|
|
||||||
int lod;
|
|
||||||
int fogNum;
|
|
||||||
qbool personalModel;
|
|
||||||
|
|
||||||
|
void R_AddMD3Surfaces( trRefEntity_t* ent )
|
||||||
|
{
|
||||||
// don't add third_person objects if not in a portal
|
// don't add third_person objects if not in a portal
|
||||||
personalModel = (ent->e.renderfx & RF_THIRD_PERSON) && !tr.viewParms.isPortal;
|
qbool personalModel = (ent->e.renderfx & RF_THIRD_PERSON) && !tr.viewParms.isPortal;
|
||||||
|
|
||||||
if ( ent->e.renderfx & RF_WRAP_FRAMES ) {
|
if ( ent->e.renderfx & RF_WRAP_FRAMES ) {
|
||||||
ent->e.frame %= tr.currentModel->md3[0]->numFrames;
|
ent->e.frame %= tr.currentModel->md3[0]->numFrames;
|
||||||
|
@ -297,49 +267,33 @@ void R_AddMD3Surfaces( trRefEntity_t *ent ) {
|
||||||
ent->e.oldframe = 0;
|
ent->e.oldframe = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
int lod = R_ComputeLOD( ent );
|
||||||
// compute LOD
|
const md3Header_t* header = tr.currentModel->md3[lod];
|
||||||
//
|
|
||||||
lod = R_ComputeLOD( ent );
|
|
||||||
|
|
||||||
header = tr.currentModel->md3[lod];
|
// cull the entire model if merged bounding box of both frames is outside the view frustum
|
||||||
|
if (R_CullModel(header, ent) == CULL_OUT)
|
||||||
//
|
|
||||||
// cull the entire model if merged bounding box of both frames
|
|
||||||
// is outside the view frustum.
|
|
||||||
//
|
|
||||||
cull = R_CullModel ( header, ent );
|
|
||||||
if ( cull == CULL_OUT ) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// set up lighting now that we know we aren't culled
|
// set up lighting now that we know we aren't culled
|
||||||
//
|
if (!personalModel)
|
||||||
if ( !personalModel ) {
|
|
||||||
R_SetupEntityLighting( &tr.refdef, ent );
|
R_SetupEntityLighting( &tr.refdef, ent );
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// see if we are in a fog volume
|
// see if we are in a fog volume
|
||||||
//
|
int fogNum = R_ComputeFogNum( header, ent );
|
||||||
fogNum = R_ComputeFogNum( header, ent );
|
|
||||||
|
|
||||||
//
|
|
||||||
// draw all surfaces
|
// draw all surfaces
|
||||||
//
|
const shader_t* shader;
|
||||||
surface = (md3Surface_t *)( (byte *)header + header->ofsSurfaces );
|
const md3Surface_t* surface = surface = (const md3Surface_t*)((byte *)header + header->ofsSurfaces);
|
||||||
for ( i = 0 ; i < header->numSurfaces ; i++ ) {
|
|
||||||
|
|
||||||
|
for (int i = 0; i < header->numSurfaces; ++i) {
|
||||||
if ( ent->e.customShader ) {
|
if ( ent->e.customShader ) {
|
||||||
shader = R_GetShaderByHandle( ent->e.customShader );
|
shader = R_GetShaderByHandle( ent->e.customShader );
|
||||||
} else if ( ent->e.customSkin > 0 && ent->e.customSkin < tr.numSkins ) {
|
} else if ( ent->e.customSkin > 0 && ent->e.customSkin < tr.numSkins ) {
|
||||||
int j;
|
// match the surface name to something in the skin file
|
||||||
const skin_t* skin = R_GetSkinByHandle(ent->e.customSkin);
|
const skin_t* skin = R_GetSkinByHandle(ent->e.customSkin);
|
||||||
|
|
||||||
// match the surface name to something in the skin file
|
|
||||||
shader = tr.defaultShader;
|
shader = tr.defaultShader;
|
||||||
for ( j = 0 ; j < skin->numSurfaces ; j++ ) {
|
for (int j = 0; j < skin->numSurfaces; ++j) {
|
||||||
// the names have both been lowercased
|
// the names have both been lowercased
|
||||||
if ( !strcmp( skin->surfaces[j]->name, surface->name ) ) {
|
if ( !strcmp( skin->surfaces[j]->name, surface->name ) ) {
|
||||||
shader = skin->surfaces[j]->shader;
|
shader = skin->surfaces[j]->shader;
|
||||||
|
@ -355,93 +309,18 @@ void R_AddMD3Surfaces( trRefEntity_t *ent ) {
|
||||||
} else if ( surface->numShaders <= 0 ) {
|
} else if ( surface->numShaders <= 0 ) {
|
||||||
shader = tr.defaultShader;
|
shader = tr.defaultShader;
|
||||||
} else {
|
} else {
|
||||||
md3Shader = (md3Shader_t *) ( (byte *)surface + surface->ofsShaders );
|
const md3Shader_t* md3Shader = (const md3Shader_t*)((byte *)surface + surface->ofsShaders);
|
||||||
md3Shader += ent->e.skinNum % surface->numShaders;
|
md3Shader += ent->e.skinNum % surface->numShaders;
|
||||||
shader = tr.shaders[ md3Shader->shaderIndex ];
|
shader = tr.shaders[ md3Shader->shaderIndex ];
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't add third_person objects if not viewing through a portal
|
// don't add third_person objects if not viewing through a portal
|
||||||
if ( !personalModel ) {
|
if ( !personalModel ) {
|
||||||
R_AddDrawSurf( (surfaceType_t*)surface, shader, fogNum );
|
R_AddDrawSurf( (const surfaceType_t*)surface, shader, fogNum );
|
||||||
}
|
}
|
||||||
|
|
||||||
surface = (md3Surface_t *)( (byte *)surface + surface->ofsEnd );
|
surface = (const md3Surface_t*)( (byte *)surface + surface->ofsEnd );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
static int R_CullMD5( const md5Mesh_t* mesh )
|
|
||||||
{
|
|
||||||
int cull = R_CullLocalPointAndRadius( vec3_origin, mesh->radius );
|
|
||||||
|
|
||||||
if (cull == CULL_OUT) {
|
|
||||||
tr.pc[RF_MD5_CULL_S_OUT]++;
|
|
||||||
return CULL_OUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
tr.pc[RF_MD5_CULL_S_IN]++;
|
|
||||||
return CULL_IN;
|
|
||||||
/*
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tr.pc[RF_MD3_CULL_S_CLIP]++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// calculate a bounding box in the current coordinate system
|
|
||||||
for (i = 0 ; i < 3 ; i++) {
|
|
||||||
bounds[0][i] = oldFrame->bounds[0][i] < newFrame->bounds[0][i] ? oldFrame->bounds[0][i] : newFrame->bounds[0][i];
|
|
||||||
bounds[1][i] = oldFrame->bounds[1][i] > newFrame->bounds[1][i] ? oldFrame->bounds[1][i] : newFrame->bounds[1][i];
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ( R_CullLocalBox( bounds ) )
|
|
||||||
{
|
|
||||||
case CULL_IN:
|
|
||||||
tr.pc[RF_MD3_CULL_B_IN]++;
|
|
||||||
return CULL_IN;
|
|
||||||
case CULL_CLIP:
|
|
||||||
tr.pc[RF_MD3_CULL_B_CLIP]++;
|
|
||||||
return CULL_CLIP;
|
|
||||||
case CULL_OUT:
|
|
||||||
default:
|
|
||||||
tr.pc[RF_MD3_CULL_B_OUT]++;
|
|
||||||
return CULL_OUT;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void R_AddMD5Surfaces( trRefEntity_t* e )
|
|
||||||
{
|
|
||||||
R_SetupEntityLighting( &tr.refdef, e );
|
|
||||||
|
|
||||||
const md5Model_t* model = tr.currentModel->md5;
|
|
||||||
const md5Mesh_t* mesh = model->meshes;
|
|
||||||
|
|
||||||
if (R_CullMD5(mesh) == CULL_OUT)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const shader_t* shader = tr.shaders[ mesh->shaderIndex ];
|
|
||||||
|
|
||||||
R_AddDrawSurf( (const surfaceType_t*)mesh, shader, 0 );
|
|
||||||
|
|
||||||
R_TransformDlights( tr.refdef.num_dlights, tr.refdef.dlights, &tr.or );
|
|
||||||
|
|
||||||
for ( int i = 0; i < tr.refdef.num_dlights; ++i ) {
|
|
||||||
dlight_t* dl = &tr.refdef.dlights[i];
|
|
||||||
if (!dl->active)
|
|
||||||
continue;
|
|
||||||
if (VectorLength(dl->transformed) > dl->radius + mesh->radius)
|
|
||||||
continue;
|
|
||||||
tr.light = dl;
|
|
||||||
R_AddLitSurf( (const surfaceType_t*)mesh, shader, 0 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -210,10 +210,6 @@ to prevent disk rescanning if they are asked for again.
|
||||||
qhandle_t RE_RegisterModel( const char* name )
|
qhandle_t RE_RegisterModel( const char* name )
|
||||||
{
|
{
|
||||||
model_t* mod;
|
model_t* mod;
|
||||||
unsigned *buf;
|
|
||||||
int lod;
|
|
||||||
qbool loaded = qfalse;
|
|
||||||
int numLoaded;
|
|
||||||
char *fext, defex[] = "md3", filename[MAX_QPATH], namebuf[MAX_QPATH+20];
|
char *fext, defex[] = "md3", filename[MAX_QPATH], namebuf[MAX_QPATH+20];
|
||||||
|
|
||||||
if ( !name || !name[0] ) {
|
if ( !name || !name[0] ) {
|
||||||
|
@ -242,9 +238,8 @@ qhandle_t RE_RegisterModel( const char* name )
|
||||||
// make sure the render thread is stopped
|
// make sure the render thread is stopped
|
||||||
R_SyncRenderThread();
|
R_SyncRenderThread();
|
||||||
|
|
||||||
// load the files
|
void* buf;
|
||||||
//
|
int lod, numLoaded = 0;
|
||||||
numLoaded = 0;
|
|
||||||
|
|
||||||
strcpy(filename, name);
|
strcpy(filename, name);
|
||||||
|
|
||||||
|
@ -275,7 +270,7 @@ qhandle_t RE_RegisterModel( const char* name )
|
||||||
ri.Printf( PRINT_WARNING, "RE_RegisterModel: unknown fileid for %s\n", name );
|
ri.Printf( PRINT_WARNING, "RE_RegisterModel: unknown fileid for %s\n", name );
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
loaded = R_LoadMD3( mod, lod, buf, name );
|
qbool loaded = R_LoadMD3( mod, lod, buf, name );
|
||||||
|
|
||||||
ri.FS_FreeFile (buf);
|
ri.FS_FreeFile (buf);
|
||||||
|
|
||||||
|
|
|
@ -54,13 +54,6 @@ enum {
|
||||||
RF_MD3_CULL_B_CLIP,
|
RF_MD3_CULL_B_CLIP,
|
||||||
RF_MD3_CULL_B_OUT,
|
RF_MD3_CULL_B_OUT,
|
||||||
|
|
||||||
RF_MD5_CULL_S_IN,
|
|
||||||
RF_MD5_CULL_S_CLIP,
|
|
||||||
RF_MD5_CULL_S_OUT,
|
|
||||||
RF_MD5_CULL_B_IN,
|
|
||||||
RF_MD5_CULL_B_CLIP,
|
|
||||||
RF_MD5_CULL_B_OUT,
|
|
||||||
|
|
||||||
RF_LIGHT_CULL_IN,
|
RF_LIGHT_CULL_IN,
|
||||||
RF_LIGHT_CULL_OUT,
|
RF_LIGHT_CULL_OUT,
|
||||||
RF_LIT_LEAFS,
|
RF_LIT_LEAFS,
|
||||||
|
|
|
@ -79,28 +79,6 @@ static void DrawNormals( const shaderCommands_t* input )
|
||||||
}
|
}
|
||||||
qglEnd();
|
qglEnd();
|
||||||
|
|
||||||
qglColor3f( 1, 0, 0 );
|
|
||||||
qglBegin( GL_LINES );
|
|
||||||
for (int i = 0; i < input->numVertexes; ++i) {
|
|
||||||
vec3_t temp;
|
|
||||||
qglVertex3fv( input->xyz[i] );
|
|
||||||
VectorMA( input->xyz[i], 2, input->tangent[i], temp );
|
|
||||||
qglVertex3fv( temp );
|
|
||||||
}
|
|
||||||
qglEnd();
|
|
||||||
|
|
||||||
qglColor3f( 0, 1, 0 );
|
|
||||||
qglBegin( GL_LINES );
|
|
||||||
for (int i = 0; i < input->numVertexes; ++i) {
|
|
||||||
vec3_t temp, bitan;
|
|
||||||
qglVertex3fv( input->xyz[i] );
|
|
||||||
CrossProduct( input->normal[i], input->tangent[i], bitan );
|
|
||||||
VectorScale( bitan, input->tangent[i][3], bitan );
|
|
||||||
VectorMA( input->xyz[i], 2, bitan, temp );
|
|
||||||
qglVertex3fv( temp );
|
|
||||||
}
|
|
||||||
qglEnd();
|
|
||||||
|
|
||||||
qglDepthRange( 0, 1 );
|
qglDepthRange( 0, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,6 +240,11 @@ void R_ComputeColors( const shaderStage_t* pStage, stageVars_t& svars )
|
||||||
case CGEN_LIGHTING_DIFFUSE:
|
case CGEN_LIGHTING_DIFFUSE:
|
||||||
RB_CalcDiffuseColor( ( unsigned char * ) svars.colors );
|
RB_CalcDiffuseColor( ( unsigned char * ) svars.colors );
|
||||||
break;
|
break;
|
||||||
|
case CGEN_CONST:
|
||||||
|
for (i = 0; i < tess.numVertexes; i++) {
|
||||||
|
*(int *)svars.colors[i] = *(int *)pStage->constantColor;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case CGEN_VERTEX:
|
case CGEN_VERTEX:
|
||||||
if ( tr.identityLight == 1 )
|
if ( tr.identityLight == 1 )
|
||||||
{
|
{
|
||||||
|
@ -269,21 +252,15 @@ void R_ComputeColors( const shaderStage_t* pStage, stageVars_t& svars )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int k;
|
|
||||||
for ( i = 0; i < tess.numVertexes; i++ )
|
for ( i = 0; i < tess.numVertexes; i++ )
|
||||||
{
|
{
|
||||||
for(k = 0; k < 3; k++)
|
svars.colors[i][0] = tess.vertexColors[i][0] * tr.identityLight;
|
||||||
svars.colors[i][k] = tess.vertexColors[i][k] * tr.identityLight;
|
svars.colors[i][1] = tess.vertexColors[i][1] * tr.identityLight;
|
||||||
|
svars.colors[i][2] = tess.vertexColors[i][2] * tr.identityLight;
|
||||||
svars.colors[i][3] = tess.vertexColors[i][3];
|
svars.colors[i][3] = tess.vertexColors[i][3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CGEN_CONST:
|
|
||||||
for ( i = 0; i < tess.numVertexes; i++ ) {
|
|
||||||
*(int *)svars.colors[i] = *(int *)pStage->constantColor;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case CGEN_EXACT_VERTEX:
|
case CGEN_EXACT_VERTEX:
|
||||||
if(r_fullbright->integer < 0) {
|
if(r_fullbright->integer < 0) {
|
||||||
for (i = 0; i < tess.numVertexes; i++) {
|
for (i = 0; i < tess.numVertexes; i++) {
|
||||||
|
|
|
@ -512,48 +512,6 @@ static qbool ParseStage( const char** text, shaderStage_t* stage )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if ( !Q_stricmp( token, "dmap" ) )
|
|
||||||
{
|
|
||||||
token = COM_ParseExt( text, qfalse );
|
|
||||||
if ( !token[0] ) {
|
|
||||||
ri.Printf( PRINT_WARNING, "WARNING: missing parameter for 'dmap' keyword in shader '%s'\n", shader.name );
|
|
||||||
return qfalse;
|
|
||||||
}
|
|
||||||
stage->bundle.image[0] = R_FindImageFile( token, shader.imgflags, GL_REPEAT );
|
|
||||||
if ( !stage->bundle.image[0] ) {
|
|
||||||
ri.Printf( PRINT_WARNING, "WARNING: R_FindImageFile could not find '%s' in shader '%s'\n", token, shader.name );
|
|
||||||
return qfalse;
|
|
||||||
}
|
|
||||||
stage->type = ST_DIFFUSE;
|
|
||||||
}
|
|
||||||
else if ( !Q_stricmp( token, "nmap" ) )
|
|
||||||
{
|
|
||||||
token = COM_ParseExt( text, qfalse );
|
|
||||||
if ( !token[0] ) {
|
|
||||||
ri.Printf( PRINT_WARNING, "WARNING: missing parameter for 'nmap' keyword in shader '%s'\n", shader.name );
|
|
||||||
return qfalse;
|
|
||||||
}
|
|
||||||
stage->bundle.image[0] = R_FindImageFile( token, IMG_NOIMANIP, GL_REPEAT );
|
|
||||||
if ( !stage->bundle.image[0] ) {
|
|
||||||
ri.Printf( PRINT_WARNING, "WARNING: R_FindImageFile could not find '%s' in shader '%s'\n", token, shader.name );
|
|
||||||
return qfalse;
|
|
||||||
}
|
|
||||||
stage->type = ST_BUMPMAP;
|
|
||||||
}
|
|
||||||
else if ( !Q_stricmp( token, "smap" ) )
|
|
||||||
{
|
|
||||||
token = COM_ParseExt( text, qfalse );
|
|
||||||
if ( !token[0] ) {
|
|
||||||
ri.Printf( PRINT_WARNING, "WARNING: missing parameter for 'smap' keyword in shader '%s'\n", shader.name );
|
|
||||||
return qfalse;
|
|
||||||
}
|
|
||||||
stage->bundle.image[0] = R_FindImageFile( token, shader.imgflags, GL_REPEAT );
|
|
||||||
if ( !stage->bundle.image[0] ) {
|
|
||||||
ri.Printf( PRINT_WARNING, "WARNING: R_FindImageFile could not find '%s' in shader '%s'\n", token, shader.name );
|
|
||||||
return qfalse;
|
|
||||||
}
|
|
||||||
stage->type = ST_SPECULAR;
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// map <name>
|
// map <name>
|
||||||
//
|
//
|
||||||
|
@ -2052,7 +2010,7 @@ static shader_t* FinishShader()
|
||||||
shader.numStages = stage;
|
shader.numStages = stage;
|
||||||
|
|
||||||
// fix up any stages that we want fullbright
|
// fix up any stages that we want fullbright
|
||||||
if ( (r_fullbright->integer > 0) && (shader.lightmapIndex == LIGHTMAP_BY_VERTEX) ) {
|
if ( r_fullbright->integer && (shader.lightmapIndex == LIGHTMAP_BY_VERTEX) ) {
|
||||||
for ( int i = 0; i < shader.numStages; ++i ) {
|
for ( int i = 0; i < shader.numStages; ++i ) {
|
||||||
if (stages[i].rgbGen == CGEN_EXACT_VERTEX) {
|
if (stages[i].rgbGen == CGEN_EXACT_VERTEX) {
|
||||||
stages[i].rgbGen = CGEN_IDENTITY;
|
stages[i].rgbGen = CGEN_IDENTITY;
|
||||||
|
@ -2194,16 +2152,14 @@ shader_t* R_FindShader( const char *name, int lightmapIndex, qbool mipRawImage )
|
||||||
}
|
}
|
||||||
|
|
||||||
// no, uploading is done by, duh, UPLOAD, so let that worry about it
|
// no, uploading is done by, duh, UPLOAD, so let that worry about it
|
||||||
|
#ifdef USE_R_SMP
|
||||||
// make sure the render thread is stopped, because we are probably
|
// make sure the render thread is stopped, because we are probably
|
||||||
// going to have to upload an image
|
// going to have to upload an image
|
||||||
// fix freez
|
|
||||||
#ifdef USE_R_SMP
|
|
||||||
if (r_smp->integer) {
|
if (r_smp->integer) {
|
||||||
R_SyncRenderThread();
|
R_SyncRenderThread();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// clear the global shader
|
// clear the global shader
|
||||||
Com_Memset( &shader, 0, sizeof( shader ) );
|
Com_Memset( &shader, 0, sizeof( shader ) );
|
||||||
Com_Memset( &stages, 0, sizeof( stages ) );
|
Com_Memset( &stages, 0, sizeof( stages ) );
|
||||||
|
@ -2407,41 +2363,41 @@ void R_ShaderList_f( void )
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for ( i = 0 ; i < tr.numShaders ; i++ ) {
|
for ( i = 0 ; i < tr.numShaders ; i++ ) {
|
||||||
const shader_t* shader_ptr = (ri.Cmd_Argc() > 1) ? tr.sortedShaders[i] : tr.shaders[i];
|
const shader_t* shader = (ri.Cmd_Argc() > 1) ? tr.sortedShaders[i] : tr.shaders[i];
|
||||||
|
|
||||||
int passes = shader_ptr->numStages;
|
int passes = shader->numStages;
|
||||||
for ( int s = 0; s < shader_ptr->numStages; ++s )
|
for ( int s = 0; s < shader->numStages; ++s )
|
||||||
passes -= shader_ptr->stages[s]->mtStages;
|
passes -= shader->stages[s]->mtStages;
|
||||||
|
|
||||||
ri.Printf( PRINT_ALL, "%i %i ", shader_ptr->numStages, passes );
|
ri.Printf( PRINT_ALL, "%i %i ", shader->numStages, passes );
|
||||||
|
|
||||||
if (shader_ptr->lightmapIndex >= 0 ) {
|
if (shader->lightmapIndex >= 0 ) {
|
||||||
ri.Printf( PRINT_ALL, "L " );
|
ri.Printf( PRINT_ALL, "L " );
|
||||||
//} else if (shader->lightmapIndex == LIGHTMAP_WHITE ) {
|
//} else if (shader->lightmapIndex == LIGHTMAP_WHITE ) {
|
||||||
// ri.Printf( PRINT_ALL, "W " );
|
// ri.Printf( PRINT_ALL, "W " );
|
||||||
} else {
|
} else {
|
||||||
ri.Printf( PRINT_ALL, " " );
|
ri.Printf( PRINT_ALL, " " );
|
||||||
}
|
}
|
||||||
if ( shader_ptr->explicitlyDefined ) {
|
if ( shader->explicitlyDefined ) {
|
||||||
ri.Printf( PRINT_ALL, "E " );
|
ri.Printf( PRINT_ALL, "E " );
|
||||||
} else {
|
} else {
|
||||||
ri.Printf( PRINT_ALL, " " );
|
ri.Printf( PRINT_ALL, " " );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( shader_ptr->siFunc == ARB_StageIterator ) {
|
if ( shader->siFunc == ARB_StageIterator ) {
|
||||||
ri.Printf( PRINT_ALL, " " );
|
ri.Printf( PRINT_ALL, " " );
|
||||||
} else if ( shader_ptr->siFunc == RB_StageIteratorSky ) {
|
} else if ( shader->siFunc == RB_StageIteratorSky ) {
|
||||||
ri.Printf( PRINT_ALL, "sky " );
|
ri.Printf( PRINT_ALL, "sky " );
|
||||||
} else if ( shader_ptr->siFunc == RB_StageIteratorGeneric ) {
|
} else if ( shader->siFunc == RB_StageIteratorGeneric ) {
|
||||||
ri.Printf( PRINT_ALL, "lgc " );
|
ri.Printf( PRINT_ALL, "lgc " );
|
||||||
} else {
|
} else {
|
||||||
ri.Printf( PRINT_ALL, "??? " );
|
ri.Printf( PRINT_ALL, "??? " );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( shader_ptr->defaultShader ) {
|
if ( shader->defaultShader ) {
|
||||||
ri.Printf( PRINT_ALL, ": %s (DEFAULTED)\n", shader_ptr->name );
|
ri.Printf( PRINT_ALL, ": %s (DEFAULTED)\n", shader->name );
|
||||||
} else {
|
} else {
|
||||||
ri.Printf( PRINT_ALL, ": %s\n", shader_ptr->name );
|
ri.Printf( PRINT_ALL, ": %s\n", shader->name );
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,7 +215,6 @@ static void RB_SurfaceTriangles( srfTriangles_t* surf )
|
||||||
VectorCopy( v->xyz, tess.xyz[ndx] );
|
VectorCopy( v->xyz, tess.xyz[ndx] );
|
||||||
if ( tess.shader->needsNormal )
|
if ( tess.shader->needsNormal )
|
||||||
VectorCopy( v->normal, tess.normal[ndx] );
|
VectorCopy( v->normal, tess.normal[ndx] );
|
||||||
Vector4Copy( v->tangent, tess.tangent[ndx] );
|
|
||||||
tess.texCoords[ndx][0][0] = v->st[0];
|
tess.texCoords[ndx][0][0] = v->st[0];
|
||||||
tess.texCoords[ndx][0][1] = v->st[1];
|
tess.texCoords[ndx][0][1] = v->st[1];
|
||||||
tess.texCoords[ndx][1][0] = v->st2[0];
|
tess.texCoords[ndx][1][0] = v->st2[0];
|
||||||
|
@ -514,37 +513,6 @@ void RB_SurfaceMesh(md3Surface_t *surface) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void RB_SurfaceMD5( const md5Mesh_t* mesh )
|
|
||||||
{
|
|
||||||
// animated models are going to need to reference the parent model for bones etc
|
|
||||||
// const md5Model_t* model = tr.currentModel->md5;
|
|
||||||
// static meshes have the bones pre-resolved and only need this
|
|
||||||
|
|
||||||
RB_CHECKOVERFLOW( mesh->numVerts, mesh->numTris*3 );
|
|
||||||
|
|
||||||
const md5Triangle_t* tri = mesh->tris;
|
|
||||||
glIndex_t* tessIndexes = tess.indexes + tess.numIndexes;
|
|
||||||
for ( int i = 0; i < mesh->numTris; ++i, ++tri, tessIndexes += 3 ) {
|
|
||||||
tessIndexes[0] = tri->indexes[0];
|
|
||||||
tessIndexes[1] = tri->indexes[1];
|
|
||||||
tessIndexes[2] = tri->indexes[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
const srfVert_t* sv = mesh->sv;
|
|
||||||
for ( int i = 0, o = tess.numVertexes; i < mesh->numVerts; ++i, ++sv, ++o ) {
|
|
||||||
VectorCopy( sv->xyz, tess.xyz[o] );
|
|
||||||
VectorCopy( sv->normal, tess.normal[o] );
|
|
||||||
tess.texCoords[o][0][0] = sv->st[0];
|
|
||||||
tess.texCoords[o][0][1] = sv->st[1];
|
|
||||||
Vector4Copy( sv->tangent, tess.tangent[o] );
|
|
||||||
*(unsigned int *)&tess.vertexColors[o] = *(unsigned int *)sv->rgba;
|
|
||||||
}
|
|
||||||
|
|
||||||
tess.numIndexes += mesh->numTris*3;
|
|
||||||
tess.numVertexes += mesh->numVerts;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void RB_SurfaceFace( srfSurfaceFace_t* surf )
|
static void RB_SurfaceFace( srfSurfaceFace_t* surf )
|
||||||
{
|
{
|
||||||
int i, ndx;
|
int i, ndx;
|
||||||
|
@ -566,7 +534,6 @@ static void RB_SurfaceFace( srfSurfaceFace_t* surf )
|
||||||
const srfVert_t* v = surf->verts;
|
const srfVert_t* v = surf->verts;
|
||||||
for ( i = 0, ndx = tess.numVertexes; i < surf->numVerts; ++i, ++v, ++ndx ) {
|
for ( i = 0, ndx = tess.numVertexes; i < surf->numVerts; ++i, ++v, ++ndx ) {
|
||||||
VectorCopy( v->xyz, tess.xyz[ndx] );
|
VectorCopy( v->xyz, tess.xyz[ndx] );
|
||||||
Vector4Copy( v->tangent, tess.tangent[ndx] );
|
|
||||||
tess.texCoords[ndx][0][0] = v->st[0];
|
tess.texCoords[ndx][0][0] = v->st[0];
|
||||||
tess.texCoords[ndx][0][1] = v->st[1];
|
tess.texCoords[ndx][0][1] = v->st[1];
|
||||||
tess.texCoords[ndx][1][0] = v->st2[0];
|
tess.texCoords[ndx][1][0] = v->st2[0];
|
||||||
|
@ -835,7 +802,6 @@ void (*rb_surfaceTable[SF_NUM_SURFACE_TYPES])( const void* ) = {
|
||||||
(void(*)( const void* ))RB_SurfaceTriangles, // SF_TRIANGLES
|
(void(*)( const void* ))RB_SurfaceTriangles, // SF_TRIANGLES
|
||||||
(void(*)( const void* ))RB_SurfacePolychain, // SF_POLY
|
(void(*)( const void* ))RB_SurfacePolychain, // SF_POLY
|
||||||
(void(*)( const void* ))RB_SurfaceMesh, // SF_MD3
|
(void(*)( const void* ))RB_SurfaceMesh, // SF_MD3
|
||||||
(void(*)( const void* ))RB_SurfaceMD5, // SF_MD5
|
|
||||||
(void(*)( const void* ))RB_SurfaceFlare, // SF_FLARE
|
(void(*)( const void* ))RB_SurfaceFlare, // SF_FLARE
|
||||||
(void(*)( const void* ))RB_SurfaceEntity, // SF_ENTITY
|
(void(*)( const void* ))RB_SurfaceEntity, // SF_ENTITY
|
||||||
};
|
};
|
||||||
|
|
12146
code/win32/glext.h
Normal file
12146
code/win32/glext.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -55,8 +55,10 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
<Message>bg_public copy...</Message>
|
<Message>
|
||||||
<Command>xcopy /Y "$(CPMA_SRC)\game\bg_public.h" "$(SolutionDir)code\game\"</Command>
|
</Message>
|
||||||
|
<Command>
|
||||||
|
</Command>
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>Full</Optimization>
|
<Optimization>Full</Optimization>
|
||||||
|
@ -104,8 +106,10 @@
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
<Message>bg_public copy...</Message>
|
<Message>
|
||||||
<Command>xcopy /Y "$(CPMA_SRC)\game\bg_public.h" "$(SolutionDir)code\game\"</Command>
|
</Message>
|
||||||
|
<Command>
|
||||||
|
</Command>
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
|
|
|
@ -43,11 +43,11 @@
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QUAKE3)\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QUAKE3DIR)\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\build\quake3_debug\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\build\quake3_debug\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</GenerateManifest>
|
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</GenerateManifest>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QUAKE3)\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QUAKE3DIR)\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\build\quake3_release\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\build\quake3_release\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</GenerateManifest>
|
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</GenerateManifest>
|
||||||
|
@ -67,8 +67,10 @@
|
||||||
</Path>
|
</Path>
|
||||||
</BuildLog>
|
</BuildLog>
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
<Message>bg_public copy...</Message>
|
<Message>
|
||||||
<Command>xcopy /Y "$(CPMA_SRC)\game\bg_public.h" "$(SolutionDir)..\..\game\"</Command>
|
</Message>
|
||||||
|
<Command>
|
||||||
|
</Command>
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
<Midl>
|
<Midl>
|
||||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
@ -114,7 +116,7 @@
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>winmm.lib;wsock32.lib;gdi32.lib;opengl32.lib;kernel32.lib;user32.lib;ole32.lib;".\build\botlib_debug\botlib.lib";".\build\renderer_debug\renderer.lib";"..\..\freetype\objs\freetype_d.lib";%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>winmm.lib;wsock32.lib;gdi32.lib;opengl32.lib;kernel32.lib;user32.lib;ole32.lib;".\build\botlib_debug\botlib.lib";".\build\renderer_debug\renderer.lib";"..\..\freetype\objs\freetype_d.lib";%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<OutputFile>$(QUAKE3)\cnq3.exe</OutputFile>
|
<OutputFile>$(QUAKE3DIR)\cnq3.exe</OutputFile>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<ProgramDatabaseFile>$(IntDir)quake3.pdb</ProgramDatabaseFile>
|
<ProgramDatabaseFile>$(IntDir)quake3.pdb</ProgramDatabaseFile>
|
||||||
|
@ -129,14 +131,18 @@
|
||||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||||
</Link>
|
</Link>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Message>Post build processing..</Message>
|
<Message>
|
||||||
<Command>rem bash -c "perl ./unix/cons -- debug"</Command>
|
</Message>
|
||||||
|
<Command>
|
||||||
|
</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
<Message>bg_public copy...</Message>
|
<Message>
|
||||||
<Command>xcopy /Y "$(CPMA_SRC)\game\bg_public.h" "$(SolutionDir)..\..\game\"</Command>
|
</Message>
|
||||||
|
<Command>
|
||||||
|
</Command>
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
<Midl>
|
<Midl>
|
||||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
@ -187,7 +193,7 @@
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>winmm.lib;wsock32.lib;gdi32.lib;opengl32.lib;kernel32.lib;user32.lib;ole32.lib;.\build\renderer_release\renderer.lib;.\build\botlib_release\botlib.lib;"..\..\freetype\objs\freetype.lib";%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>winmm.lib;wsock32.lib;gdi32.lib;opengl32.lib;kernel32.lib;user32.lib;ole32.lib;.\build\renderer_release\renderer.lib;.\build\botlib_release\botlib.lib;"..\..\freetype\objs\freetype.lib";%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<OutputFile>$(QUAKE3)\cnq3.exe</OutputFile>
|
<OutputFile>$(QUAKE3DIR)\cnq3.exe</OutputFile>
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
<ProgramDatabaseFile>$(IntDir)quake3.pdb</ProgramDatabaseFile>
|
<ProgramDatabaseFile>$(IntDir)quake3.pdb</ProgramDatabaseFile>
|
||||||
|
|
|
@ -164,7 +164,6 @@
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Default</CompileAs>
|
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Default</CompileAs>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\renderer\tr_extensions.cpp" />
|
|
||||||
<ClCompile Include="..\..\renderer\tr_flares.cpp">
|
<ClCompile Include="..\..\renderer\tr_flares.cpp">
|
||||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
@ -598,7 +597,6 @@
|
||||||
<ClInclude Include="..\..\qcommon\qcommon.h" />
|
<ClInclude Include="..\..\qcommon\qcommon.h" />
|
||||||
<ClInclude Include="..\..\qcommon\qfiles.h" />
|
<ClInclude Include="..\..\qcommon\qfiles.h" />
|
||||||
<ClInclude Include="..\..\renderer\qgl.h" />
|
<ClInclude Include="..\..\renderer\qgl.h" />
|
||||||
<ClInclude Include="..\..\renderer\qgl_ext.h" />
|
|
||||||
<ClInclude Include="..\..\qcommon\surfaceflags.h" />
|
<ClInclude Include="..\..\qcommon\surfaceflags.h" />
|
||||||
<ClInclude Include="..\..\renderer\tr_local.h" />
|
<ClInclude Include="..\..\renderer\tr_local.h" />
|
||||||
<ClInclude Include="..\..\renderer\tr_public.h" />
|
<ClInclude Include="..\..\renderer\tr_public.h" />
|
||||||
|
|
|
@ -35,9 +35,6 @@
|
||||||
<ClCompile Include="..\..\renderer\tr_curve.cpp">
|
<ClCompile Include="..\..\renderer\tr_curve.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\renderer\tr_extensions.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\renderer\tr_flares.cpp">
|
<ClCompile Include="..\..\renderer\tr_flares.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -223,9 +220,6 @@
|
||||||
<ClInclude Include="..\..\renderer\qgl.h">
|
<ClInclude Include="..\..\renderer\qgl.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\renderer\qgl_ext.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\qcommon\surfaceflags.h">
|
<ClInclude Include="..\..\qcommon\surfaceflags.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
@ -275,7 +275,6 @@ static int GLW_MakeContext( PIXELFORMATDESCRIPTOR *pPFD )
|
||||||
if ( !glw_state.pixelFormatSet )
|
if ( !glw_state.pixelFormatSet )
|
||||||
{
|
{
|
||||||
int pixelformat;
|
int pixelformat;
|
||||||
|
|
||||||
//
|
//
|
||||||
// choose, set, and describe our desired pixel format. If we're
|
// choose, set, and describe our desired pixel format. If we're
|
||||||
// using a minidriver then we need to bypass the GDI functions,
|
// using a minidriver then we need to bypass the GDI functions,
|
||||||
|
@ -649,6 +648,7 @@ static void GLW_AttemptFSAA()
|
||||||
glEnable(GL_MULTISAMPLE_ARB);
|
glEnable(GL_MULTISAMPLE_ARB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static qbool GLW_ResetMode( qbool cdsFullscreen )
|
static qbool GLW_ResetMode( qbool cdsFullscreen )
|
||||||
{
|
{
|
||||||
HDC hDC = GetDC( GetDesktopWindow() );
|
HDC hDC = GetDC( GetDesktopWindow() );
|
||||||
|
@ -659,13 +659,11 @@ static qbool GLW_ResetMode( qbool cdsFullscreen )
|
||||||
|
|
||||||
glInfo.isFullscreen = cdsFullscreen;
|
glInfo.isFullscreen = cdsFullscreen;
|
||||||
if ( !R_GetModeInfo( &glConfig.vidWidth, &glConfig.vidHeight, &glConfig.windowAspect ) ) {
|
if ( !R_GetModeInfo( &glConfig.vidWidth, &glConfig.vidHeight, &glConfig.windowAspect ) ) {
|
||||||
|
|
||||||
if (!glInfo.isFullscreen)
|
if (!glInfo.isFullscreen)
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "vid_xpos", 0 );
|
Cvar_SetValue( "vid_xpos", 0 );
|
||||||
Cvar_SetValue( "vid_ypos", 0 );
|
Cvar_SetValue( "vid_ypos", 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
glConfig.vidWidth = glw_state.desktopWidth;
|
glConfig.vidWidth = glw_state.desktopWidth;
|
||||||
glConfig.vidHeight = glw_state.desktopHeight;
|
glConfig.vidHeight = glw_state.desktopHeight;
|
||||||
glConfig.windowAspect = (float)glConfig.vidWidth / glConfig.vidHeight;
|
glConfig.windowAspect = (float)glConfig.vidWidth / glConfig.vidHeight;
|
||||||
|
@ -717,6 +715,7 @@ static qbool GLW_ResetMode( qbool cdsFullscreen )
|
||||||
return qtrue;
|
return qtrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static qbool GLW_SetMode( qbool cdsFullscreen )
|
static qbool GLW_SetMode( qbool cdsFullscreen )
|
||||||
{
|
{
|
||||||
if (GLW_ResetMode(cdsFullscreen))
|
if (GLW_ResetMode(cdsFullscreen))
|
||||||
|
@ -893,8 +892,9 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned short table[3][256];
|
unsigned short table[3][256];
|
||||||
|
int i, j;
|
||||||
|
|
||||||
for (int i = 0; i < 256; i++ ) {
|
for ( i = 0; i < 256; i++ ) {
|
||||||
table[0][i] = ( ( ( unsigned short ) red[i] ) << 8 ) | red[i];
|
table[0][i] = ( ( ( unsigned short ) red[i] ) << 8 ) | red[i];
|
||||||
table[1][i] = ( ( ( unsigned short ) green[i] ) << 8 ) | green[i];
|
table[1][i] = ( ( ( unsigned short ) green[i] ) << 8 ) | green[i];
|
||||||
table[2][i] = ( ( ( unsigned short ) blue[i] ) << 8 ) | blue[i];
|
table[2][i] = ( ( ( unsigned short ) blue[i] ) << 8 ) | blue[i];
|
||||||
|
@ -906,8 +906,8 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
|
||||||
GetVersionEx( &vinfo );
|
GetVersionEx( &vinfo );
|
||||||
if ( vinfo.dwMajorVersion >= 5 && vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) {
|
if ( vinfo.dwMajorVersion >= 5 && vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) {
|
||||||
Com_DPrintf( "performing W2K gamma clamp.\n" );
|
Com_DPrintf( "performing W2K gamma clamp.\n" );
|
||||||
for (int j = 0 ; j < 3 ; j++ ) {
|
for ( j = 0 ; j < 3 ; j++ ) {
|
||||||
for (int i = 0 ; i < 128 ; i++ ) {
|
for ( i = 0 ; i < 128 ; i++ ) {
|
||||||
if ( table[j][i] > ( (128+i) << 8 ) ) {
|
if ( table[j][i] > ( (128+i) << 8 ) ) {
|
||||||
table[j][i] = (128+i) << 8;
|
table[j][i] = (128+i) << 8;
|
||||||
}
|
}
|
||||||
|
@ -930,10 +930,11 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !SetDeviceGammaRamp( glw_state.hDC, table ) ) {
|
if ( !SetDeviceGammaRamp( glw_state.hDC, table ) ) {
|
||||||
Com_DPrintf( "SetDeviceGammaRamp failed.\n" );
|
Com_Printf( "SetDeviceGammaRamp failed.\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// drakkar
|
// drakkar
|
||||||
/*
|
/*
|
||||||
** GLimp_WindowMode
|
** GLimp_WindowMode
|
||||||
|
@ -1070,7 +1071,7 @@ void GLimp_Init()
|
||||||
GLW_InitExtensions();
|
GLW_InitExtensions();
|
||||||
GLW_CheckHardwareGamma();
|
GLW_CheckHardwareGamma();
|
||||||
|
|
||||||
if (GLW_InitARB() && QGL_InitARB() && QGL_InitExtensions())
|
if (GLW_InitARB() && QGL_InitARB())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ri.Error( ERR_FATAL, "GLimp_Init() - could not find an acceptable OpenGL subsystem\n" );
|
ri.Error( ERR_FATAL, "GLimp_Init() - could not find an acceptable OpenGL subsystem\n" );
|
||||||
|
@ -1189,7 +1190,6 @@ static int wglErrors;
|
||||||
|
|
||||||
void *GLimp_RendererSleep( void )
|
void *GLimp_RendererSleep( void )
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( !qwglMakeCurrent( glw_state.hDC, NULL ) ) {
|
if ( !qwglMakeCurrent( glw_state.hDC, NULL ) ) {
|
||||||
wglErrors++;
|
wglErrors++;
|
||||||
}
|
}
|
||||||
|
@ -1201,7 +1201,6 @@ void *GLimp_RendererSleep( void )
|
||||||
|
|
||||||
WaitForSingleObject( renderCommandsEvent, INFINITE );
|
WaitForSingleObject( renderCommandsEvent, INFINITE );
|
||||||
|
|
||||||
|
|
||||||
if ( !qwglMakeCurrent( glw_state.hDC, glw_state.hGLRC ) ) {
|
if ( !qwglMakeCurrent( glw_state.hDC, glw_state.hGLRC ) ) {
|
||||||
wglErrors++;
|
wglErrors++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
// win_local.h: Win32-specific Quake3 header file
|
// win_local.h: Win32-specific Quake3 header file
|
||||||
|
|
||||||
#define _WIN32_WINNT 0x0501
|
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glext.h>
|
#include "glext.h"
|
||||||
|
|
||||||
#include "glw_win.h"
|
#include "glw_win.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue