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:
arQon 2016-12-18 03:05:45 -08:00
parent 97db9f2314
commit 1afbf12d80
27 changed files with 12304 additions and 905 deletions

View file

@ -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
add: backported another bunch of dlight stuff from the pmx branch

View file

@ -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("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("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 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;

View file

@ -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.
// 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 CONSOLE_WINDOW_TITLE "CNQ3 Console"
@ -72,20 +72,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#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)
extern "C" {
#endif
// 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)
#define assert(x) { if (!(x)) Com_Error(ERR_FATAL, "ASSERT "__FILE__"(%d): %s", __LINE__, #x); }
typedef enum { qfalse, qtrue } qbool;

View file

@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <windows.h>
#include <GL/gl.h>
#include <GL/glext.h>
#include "../win32/glext.h"
#elif defined(MACOS_X)
@ -80,9 +80,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define WINAPI
#endif
// Quake OpenGL Extensions
#include "qgl_ext.h"
///////////////////////////////////////////////////////////////
extern "C" {

View file

@ -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_

View file

@ -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 {
GLuint vs;
GLuint fs;
GLuint p;
};
@ -90,36 +61,12 @@ static GLSL_Program progDynamic;
static void ARB_Lighting_Setup()
{
const shaderStage_t* pStage;
// 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 );
const shaderStage_t* pStage = tess.xstages[tess.shader->lightingStages[ST_DIFFUSE]];
GL_SelectTexture(0);
R_BindAnimatedImage( &pStage->bundle );
}
// things that are already set up:
// geom, normals, tangents, and ST0 are all in CVA
static void ARB_Lighting()
{
backEnd.pc[RB_LIT_VERTICES_LATECULLTEST] += tess.numVertexes;
@ -131,15 +78,12 @@ static void ARB_Lighting()
for ( i = 0; i < tess.numVertexes; ++i ) {
vec3_t 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 ) {
clipBits[i] = (byte)-1;
continue;
}
*/
int clip = 0;
if ( dist[0] > dl->radius ) {
clip |= 1;
@ -221,8 +165,6 @@ static void ARB_LightingPass()
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] ];
R_ComputeTexCoords( pStage, tess.svars );
@ -236,9 +178,6 @@ static void ARB_LightingPass()
qglEnableClientState( GL_NORMAL_ARRAY );
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 );
qglLockArraysEXT( 0, tess.numVertexes );
@ -247,7 +186,6 @@ static void ARB_LightingPass()
qglUnlockArraysEXT();
qglDisableClientState( GL_NORMAL_ARRAY );
GL_Arrays( 0 );
}
@ -308,10 +246,6 @@ void ARB_StageIterator()
for ( int stage = 0; stage < tess.shader->numStages; ++stage ) {
const shaderStage_t* pStage = tess.xstages[stage];
if ( (pStage->type == ST_BUMPMAP) || (pStage->type == ST_SPECULAR) )
continue;
R_ComputeColors( pStage, tess.svars );
R_ComputeTexCoords( pStage, tess.svars );
R_BindAnimatedImage( &pStage->bundle );
@ -343,42 +277,25 @@ void ARB_StageIterator()
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;
qglGenPrograms(1, &prog.vs);
qglBindProgram(GL_VERTEX_PROGRAM_ARB, prog.vs);
qglProgramString(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(vp), vp);
s = va( "glsl/%s.vp", name );
len = FS_ReadFile( s, (void**)&sp );
if ( !sp )
Com_Error( ERR_FATAL, "Couldn't load %s", s );
if (qglGetError() != GL_NO_ERROR)
ri.Error(ERR_FATAL, "VP Compile Error: %s", qglGetString(GL_PROGRAM_ERROR_STRING_ARB));
qglGenPrograms( 1, &prog.vs );
qglBindProgram( GL_VERTEX_PROGRAM_ARB, prog.vs );
qglProgramString( GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, len, sp );
FS_FreeFile( sp );
qglGenPrograms(1, &prog.fs);
qglBindProgram(GL_FRAGMENT_PROGRAM_ARB, prog.fs);
qglProgramString(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(fp), fp);
if (glGetError() != GL_NO_ERROR) {
ri.Error( ERR_FATAL, "VP Compile Error: %s : %s", s, glGetString(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 );
qglBindProgram( GL_FRAGMENT_PROGRAM_ARB, prog.fs );
qglProgramString( GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, len, sp );
FS_FreeFile( sp );
if (glGetError() != GL_NO_ERROR) {
ri.Error( ERR_FATAL, "FP Compile Error: %s : %s", s, glGetString(GL_PROGRAM_ERROR_STRING_ARB) );
}
if (qglGetError() != GL_NO_ERROR)
ri.Error(ERR_FATAL, "FP Compile Error: %s", qglGetString(GL_PROGRAM_ERROR_STRING_ARB));
return qtrue;
}
@ -440,9 +357,7 @@ static const char* legacyFP =
qbool QGL_InitARB()
{
GL_Arrays( 0 );
ARB_LoadProgram( progDynamic, "dynamic" );
ARB_LoadProgram( progDynamic, legacyVP, legacyFP );
GL_Program();

View file

@ -429,7 +429,7 @@ static void RB_BeginDrawingView()
static void RB_RenderDrawSurfList( const drawSurf_t* drawSurfs, int numDrawSurfs )
{
int i;
int i;
const shader_t* shader = NULL;
unsigned int sort = (unsigned int)-1;
@ -457,7 +457,7 @@ static void RB_RenderDrawSurfList( const drawSurf_t* drawSurfs, int numDrawSurfs
int fogNum;
const shader_t* shaderPrev = shader;
int entityNum;
int entityNum;
R_DecomposeSort( drawSurf->sort, &entityNum, &shader, &fogNum );
// "entityMergable" shaders can have surfaces from multiple refentities
@ -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 );
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_WRAP_S, gl_clamp_mode );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gl_clamp_mode );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
} else {
if (dirty) {
// 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 );
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_WRAP_S, gl_clamp_mode );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gl_clamp_mode );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
} else {
if (dirty) {
// otherwise, just subimage upload it so that drivers can tell we are going to be changing

View file

@ -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 )
{
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 );
SetPlaneSignbits( &cv->plane );
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 )
{
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" );
}
}
CalcTangents_TriSurf( tri );
}

View file

@ -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;
}

View file

@ -1018,13 +1018,6 @@ static void R_CreateBuiltinImages()
Com_Memset( data, 255, 4 );
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)
// these are just placeholders: RE_StretchRaw will regenerate them when it wants them
for (i = 0; i < 16; ++i) // MAX_VIDEO_HANDLES

View file

@ -137,9 +137,6 @@ static cvar_t* r_maxpolyverts;
int max_polys;
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 )
{
@ -243,11 +240,6 @@ static void InitOpenGL()
GfxInfo_f();
GL_SetDefaultState();
if (strstr(glConfig.extensions_string, "GL_ARB_vertex_buffer_object")) {
qglGenBuffersARB(1, &idVBOData);
qglGenBuffersARB(1, &idVBOIndexes);
}
}
@ -285,29 +277,16 @@ void GL_CheckErrors()
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_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;
*height = r_height->integer;
*aspect = r_customaspect->value;
return qtrue;
}
}
return qfalse;
if (r_fullscreen->integer && !r_mode->integer)
return qfalse;
*width = r_width->integer;
*height = r_height->integer;
*aspect = r_customaspect->value;
return qtrue;
}
@ -338,7 +317,8 @@ static void RB_TakeScreenshotTGA( int x, int y, int width, int height, const cha
}
if ( /*( tr.overbrightBits > 0 ) &&*/ glConfig.deviceSupportsGamma )
R_GammaCorrect( pRGB, c );
if ((tr.overbrightBits > 0) && glConfig.deviceSupportsGamma)
R_GammaCorrect(pRGB, 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_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) {
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_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 );
backEndData[0] = (backEndData_t*)ptr;
backEndData[0]->polys = (srfPoly_t *) (ptr + sizeof( *backEndData[0] ));
@ -772,14 +745,6 @@ static void RE_Shutdown( qbool destroyWindow )
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
if ( destroyWindow ) {
GLimp_Shutdown();

View file

@ -277,8 +277,6 @@ typedef struct {
typedef enum {
ST_DIFFUSE,
ST_LIGHTMAP,
ST_BUMPMAP,
ST_SPECULAR,
ST_MAX
} stageType_t;
@ -459,7 +457,6 @@ typedef enum {
SF_TRIANGLES,
SF_POLY,
SF_MD3,
SF_MD5,
SF_FLARE,
SF_ENTITY, // beams, rails, lightning, etc that can be determined by entity
@ -483,7 +480,7 @@ struct litSurf_t {
struct dlight_t {
vec3_t origin;
vec3_t color; // range from 0.0 to 1.0, should be color normalized
vec3_t color; // range from 0.0 to 1.0, should be color normalized
float radius;
vec3_t transformed; // origin in local coordinate system
qbool active; // actually shines into the frustum rather than just pvs
@ -549,7 +546,6 @@ struct srfVert_t {
vec2_t st; // diffuse TC
vec2_t st2; // lightmap TC
color4ub_t rgba;
vec4_t tangent;
};
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,
// as well as the locally generated scene information
@ -799,7 +721,6 @@ typedef enum {
MOD_BAD,
MOD_BRUSH,
MOD_MD3,
MOD_MD5,
} modtype_t;
struct model_t {
@ -808,7 +729,6 @@ struct model_t {
modtype_t type;
bmodel_t* bmodel; // type == MOD_BRUSH
md3Header_t* md3[MD3_MAX_LODS]; // type == MOD_MD3
md5Model_t* md5; // type == MOD_MD5
int numLods;
int dataSize; // just for listing purposes
};
@ -941,8 +861,6 @@ typedef struct {
image_t* defaultImage;
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* 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
// 1.32e
extern int gl_clamp_mode;
extern cvar_t *r_customPixelAspect;
extern cvar_t *r_floatfix;
//
@ -1126,8 +1042,6 @@ void R_RenderView( const viewParms_t* parms );
void R_AddMD3Surfaces( trRefEntity_t *e );
void R_AddMD5Surfaces( trRefEntity_t* e );
void R_AddPolygonSurfaces();
void R_AddDrawSurf( const surfaceType_t* surface, const shader_t* shader, int fogIndex );
@ -1226,8 +1140,6 @@ void R_DeleteTextures();
void R_InitSkins();
const skin_t* R_GetSkinByHandle( qhandle_t hSkin );
int R_ComputeLOD( trRefEntity_t *ent );
const void *RB_TakeVideoFrameCmd( const void *data );
//
@ -1297,7 +1209,6 @@ struct shaderCommands_t
ALIGN(16) glIndex_t indexes[SHADER_MAX_INDEXES];
vec4_t xyz[SHADER_MAX_VERTEXES];
vec4_t normal[SHADER_MAX_VERTEXES];
vec4_t tangent[SHADER_MAX_VERTEXES];
vec2_t texCoords[SHADER_MAX_VERTEXES][2];
color4ub_t vertexColors[SHADER_MAX_VERTEXES];

View file

@ -708,7 +708,6 @@ static qbool SurfIsOffscreen( const drawSurf_t* drawSurf )
int fogNum;
vec4_t clip, eye;
int i;
//unsigned int pointOr = 0;
unsigned int pointAnd = (unsigned int)~0;
#ifdef USE_R_SMP
@ -744,7 +743,6 @@ static qbool SurfIsOffscreen( const drawSurf_t* drawSurf )
}
}
pointAnd &= pointFlags;
//pointOr |= pointFlags;
}
// trivially reject
@ -1194,9 +1192,6 @@ static void R_AddEntitySurfaces()
case MOD_MD3:
R_AddMD3Surfaces( ent );
break;
case MOD_MD5:
R_AddMD5Surfaces( ent );
break;
case MOD_BRUSH:
R_AddBrushModelSurfaces( ent );
break;

View file

@ -23,7 +23,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "tr_local.h"
static float ProjectRadius( float r, vec3_t location )
static float ProjectRadius( float r, const vec3_t location )
{
float pr;
float dist;
@ -70,19 +71,14 @@ static float ProjectRadius( float r, vec3_t location )
return pr;
}
/*
=============
R_CullModel
=============
*/
static int R_CullModel( md3Header_t *header, trRefEntity_t *ent ) {
vec3_t bounds[2];
md3Frame_t *oldFrame, *newFrame;
int i;
static int R_CullModel( const md3Header_t* header, trRefEntity_t* ent )
{
const md3Frame_t *oldFrame, *newFrame;
// compute frame pointers
newFrame = ( md3Frame_t * ) ( ( byte * ) header + header->ofsFrames ) + ent->e.frame;
oldFrame = ( md3Frame_t * ) ( ( byte * ) header + header->ofsFrames ) + ent->e.oldframe;
newFrame = (const md3Frame_t*) ( ( byte * ) header + header->ofsFrames ) + ent->e.frame;
oldFrame = (const md3Frame_t*) ( ( byte * ) header + header->ofsFrames ) + ent->e.oldframe;
// cull bounding sphere ONLY if this is not an upscaled entity
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
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];
vec3_t bounds[2];
for (int i = 0; i < 3; ++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 ) )
@ -157,17 +154,11 @@ static int R_CullModel( md3Header_t *header, trRefEntity_t *ent ) {
}
/*
=================
R_ComputeLOD
=================
*/
int R_ComputeLOD( trRefEntity_t *ent ) {
static int R_ComputeLOD( const trRefEntity_t* ent )
{
float radius;
float flod, lodscale;
float flod;
float projectedRadius;
md3Frame_t *frame;
int lod;
if ( tr.currentModel->numLods < 2 )
@ -179,13 +170,13 @@ int R_ComputeLOD( trRefEntity_t *ent ) {
{
// multiple LODs exist, so compute projected bounding sphere
// 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;
radius = RadiusFromBounds( frame->bounds[0], frame->bounds[1] );
if ( ( projectedRadius = ProjectRadius( radius, ent->e.origin ) ) != 0 )
{
lodscale = r_lodscale->value;
float lodscale = r_lodscale->value;
if (lodscale > 20) lodscale = 20;
flod = 1.0f - projectedRadius * lodscale;
}
@ -218,27 +209,20 @@ int R_ComputeLOD( trRefEntity_t *ent ) {
return lod;
}
/*
=================
R_ComputeFogNum
=================
*/
int R_ComputeFogNum( md3Header_t *header, trRefEntity_t *ent ) {
int i, j;
fog_t *fog;
md3Frame_t *md3Frame;
vec3_t localOrigin;
static int R_ComputeFogNum( const md3Header_t* header, const trRefEntity_t *ent )
{
int i, j;
if ( tr.refdef.rdflags & RDF_NOWORLDMODEL ) {
if ( tr.refdef.rdflags & RDF_NOWORLDMODEL )
return 0;
}
// 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 );
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++ ) {
if ( localOrigin[j] - md3Frame->radius >= fog->bounds[1][j] ) {
break;
@ -255,25 +239,11 @@ int R_ComputeFogNum( md3Header_t *header, trRefEntity_t *ent ) {
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
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 ) {
ent->e.frame %= tr.currentModel->md3[0]->numFrames;
@ -297,49 +267,33 @@ void R_AddMD3Surfaces( trRefEntity_t *ent ) {
ent->e.oldframe = 0;
}
//
// compute LOD
//
lod = R_ComputeLOD( ent );
int lod = R_ComputeLOD( ent );
const md3Header_t* header = tr.currentModel->md3[lod];
header = tr.currentModel->md3[lod];
//
// 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 ) {
// cull the entire model if merged bounding box of both frames is outside the view frustum
if (R_CullModel(header, ent) == CULL_OUT)
return;
}
//
// set up lighting now that we know we aren't culled
//
if ( !personalModel ) {
if (!personalModel)
R_SetupEntityLighting( &tr.refdef, ent );
}
//
// see if we are in a fog volume
//
fogNum = R_ComputeFogNum( header, ent );
int fogNum = R_ComputeFogNum( header, ent );
//
// draw all surfaces
//
surface = (md3Surface_t *)( (byte *)header + header->ofsSurfaces );
for ( i = 0 ; i < header->numSurfaces ; i++ ) {
const shader_t* shader;
const md3Surface_t* surface = surface = (const md3Surface_t*)((byte *)header + header->ofsSurfaces);
for (int i = 0; i < header->numSurfaces; ++i) {
if ( ent->e.customShader ) {
shader = R_GetShaderByHandle( ent->e.customShader );
} else if ( ent->e.customSkin > 0 && ent->e.customSkin < tr.numSkins ) {
int j;
const skin_t* skin = R_GetSkinByHandle( ent->e.customSkin );
// match the surface name to something in the skin file
const skin_t* skin = R_GetSkinByHandle(ent->e.customSkin);
shader = tr.defaultShader;
for ( j = 0 ; j < skin->numSurfaces ; j++ ) {
for (int j = 0; j < skin->numSurfaces; ++j) {
// the names have both been lowercased
if ( !strcmp( skin->surfaces[j]->name, surface->name ) ) {
shader = skin->surfaces[j]->shader;
@ -355,93 +309,18 @@ void R_AddMD3Surfaces( trRefEntity_t *ent ) {
} else if ( surface->numShaders <= 0 ) {
shader = tr.defaultShader;
} 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;
shader = tr.shaders[ md3Shader->shaderIndex ];
}
// don't add third_person objects if not viewing through a portal
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 );
}
}

View file

@ -210,10 +210,6 @@ to prevent disk rescanning if they are asked for again.
qhandle_t RE_RegisterModel( const char* name )
{
model_t* mod;
unsigned *buf;
int lod;
qbool loaded = qfalse;
int numLoaded;
char *fext, defex[] = "md3", filename[MAX_QPATH], namebuf[MAX_QPATH+20];
if ( !name || !name[0] ) {
@ -242,9 +238,8 @@ qhandle_t RE_RegisterModel( const char* name )
// make sure the render thread is stopped
R_SyncRenderThread();
// load the files
//
numLoaded = 0;
void* buf;
int lod, numLoaded = 0;
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 );
goto fail;
}
loaded = R_LoadMD3( mod, lod, buf, name );
qbool loaded = R_LoadMD3( mod, lod, buf, name );
ri.FS_FreeFile (buf);

View file

@ -54,13 +54,6 @@ enum {
RF_MD3_CULL_B_CLIP,
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_OUT,
RF_LIT_LEAFS,

View file

@ -79,28 +79,6 @@ static void DrawNormals( const shaderCommands_t* input )
}
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 );
}
@ -262,6 +240,11 @@ void R_ComputeColors( const shaderStage_t* pStage, stageVars_t& svars )
case CGEN_LIGHTING_DIFFUSE:
RB_CalcDiffuseColor( ( unsigned char * ) svars.colors );
break;
case CGEN_CONST:
for (i = 0; i < tess.numVertexes; i++) {
*(int *)svars.colors[i] = *(int *)pStage->constantColor;
}
break;
case CGEN_VERTEX:
if ( tr.identityLight == 1 )
{
@ -269,21 +252,15 @@ void R_ComputeColors( const shaderStage_t* pStage, stageVars_t& svars )
}
else
{
int k;
for ( i = 0; i < tess.numVertexes; i++ )
{
for(k = 0; k < 3; k++)
svars.colors[i][k] = tess.vertexColors[i][k] * tr.identityLight;
svars.colors[i][0] = tess.vertexColors[i][0] * 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];
}
}
break;
case CGEN_CONST:
for ( i = 0; i < tess.numVertexes; i++ ) {
*(int *)svars.colors[i] = *(int *)pStage->constantColor;
}
break;
case CGEN_EXACT_VERTEX:
if(r_fullbright->integer < 0) {
for (i = 0; i < tess.numVertexes; i++) {

View file

@ -512,48 +512,6 @@ static qbool ParseStage( const char** text, shaderStage_t* stage )
{
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>
//
@ -2052,7 +2010,7 @@ static shader_t* FinishShader()
shader.numStages = stage;
// 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 ) {
if (stages[i].rgbGen == CGEN_EXACT_VERTEX) {
stages[i].rgbGen = CGEN_IDENTITY;
@ -2193,17 +2151,15 @@ 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
// going to have to upload an image
// fix freez
#ifdef USE_R_SMP
if (r_smp->integer) {
R_SyncRenderThread();
}
#endif
// clear the global shader
Com_Memset( &shader, 0, sizeof( shader ) );
Com_Memset( &stages, 0, sizeof( stages ) );
@ -2407,41 +2363,41 @@ void R_ShaderList_f( void )
int count = 0;
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;
for ( int s = 0; s < shader_ptr->numStages; ++s )
passes -= shader_ptr->stages[s]->mtStages;
int passes = shader->numStages;
for ( int s = 0; s < shader->numStages; ++s )
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 " );
//} else if (shader->lightmapIndex == LIGHTMAP_WHITE ) {
// ri.Printf( PRINT_ALL, "W " );
} else {
ri.Printf( PRINT_ALL, " " );
}
if ( shader_ptr->explicitlyDefined ) {
if ( shader->explicitlyDefined ) {
ri.Printf( PRINT_ALL, "E " );
} else {
ri.Printf( PRINT_ALL, " " );
}
if ( shader_ptr->siFunc == ARB_StageIterator ) {
if ( shader->siFunc == ARB_StageIterator ) {
ri.Printf( PRINT_ALL, " " );
} else if ( shader_ptr->siFunc == RB_StageIteratorSky ) {
} else if ( shader->siFunc == RB_StageIteratorSky ) {
ri.Printf( PRINT_ALL, "sky " );
} else if ( shader_ptr->siFunc == RB_StageIteratorGeneric ) {
} else if ( shader->siFunc == RB_StageIteratorGeneric ) {
ri.Printf( PRINT_ALL, "lgc " );
} else {
ri.Printf( PRINT_ALL, "??? " );
}
if ( shader_ptr->defaultShader ) {
ri.Printf( PRINT_ALL, ": %s (DEFAULTED)\n", shader_ptr->name );
if ( shader->defaultShader ) {
ri.Printf( PRINT_ALL, ": %s (DEFAULTED)\n", shader->name );
} else {
ri.Printf( PRINT_ALL, ": %s\n", shader_ptr->name );
ri.Printf( PRINT_ALL, ": %s\n", shader->name );
}
count++;
}

View file

@ -215,7 +215,6 @@ static void RB_SurfaceTriangles( srfTriangles_t* surf )
VectorCopy( v->xyz, tess.xyz[ndx] );
if ( tess.shader->needsNormal )
VectorCopy( v->normal, tess.normal[ndx] );
Vector4Copy( v->tangent, tess.tangent[ndx] );
tess.texCoords[ndx][0][0] = v->st[0];
tess.texCoords[ndx][0][1] = v->st[1];
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 )
{
int i, ndx;
@ -566,7 +534,6 @@ static void RB_SurfaceFace( srfSurfaceFace_t* surf )
const srfVert_t* v = surf->verts;
for ( i = 0, ndx = tess.numVertexes; i < surf->numVerts; ++i, ++v, ++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][1] = v->st[1];
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_SurfacePolychain, // SF_POLY
(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_SurfaceEntity, // SF_ENTITY
};

12146
code/win32/glext.h Normal file

File diff suppressed because it is too large Load diff

View file

@ -55,8 +55,10 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Message>bg_public copy...</Message>
<Command>xcopy /Y "$(CPMA_SRC)\game\bg_public.h" "$(SolutionDir)code\game\"</Command>
<Message>
</Message>
<Command>
</Command>
</PreBuildEvent>
<ClCompile>
<Optimization>Full</Optimization>
@ -104,8 +106,10 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Message>bg_public copy...</Message>
<Command>xcopy /Y "$(CPMA_SRC)\game\bg_public.h" "$(SolutionDir)code\game\"</Command>
<Message>
</Message>
<Command>
</Command>
</PreBuildEvent>
<ClCompile>
<Optimization>Disabled</Optimization>

View file

@ -43,11 +43,11 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_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>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<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>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</GenerateManifest>
@ -67,8 +67,10 @@
</Path>
</BuildLog>
<PreBuildEvent>
<Message>bg_public copy...</Message>
<Command>xcopy /Y "$(CPMA_SRC)\game\bg_public.h" "$(SolutionDir)..\..\game\"</Command>
<Message>
</Message>
<Command>
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -114,7 +116,7 @@
</ResourceCompile>
<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>
<OutputFile>$(QUAKE3)\cnq3.exe</OutputFile>
<OutputFile>$(QUAKE3DIR)\cnq3.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)quake3.pdb</ProgramDatabaseFile>
@ -129,14 +131,18 @@
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
</Link>
<PostBuildEvent>
<Message>Post build processing..</Message>
<Command>rem bash -c "perl ./unix/cons -- debug"</Command>
<Message>
</Message>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Message>bg_public copy...</Message>
<Command>xcopy /Y "$(CPMA_SRC)\game\bg_public.h" "$(SolutionDir)..\..\game\"</Command>
<Message>
</Message>
<Command>
</Command>
</PreBuildEvent>
<Midl>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -187,7 +193,7 @@
</ResourceCompile>
<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>
<OutputFile>$(QUAKE3)\cnq3.exe</OutputFile>
<OutputFile>$(QUAKE3DIR)\cnq3.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>false</GenerateDebugInformation>
<ProgramDatabaseFile>$(IntDir)quake3.pdb</ProgramDatabaseFile>

View file

@ -164,7 +164,6 @@
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Default</CompileAs>
</ClCompile>
<ClCompile Include="..\..\renderer\tr_extensions.cpp" />
<ClCompile Include="..\..\renderer\tr_flares.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -598,7 +597,6 @@
<ClInclude Include="..\..\qcommon\qcommon.h" />
<ClInclude Include="..\..\qcommon\qfiles.h" />
<ClInclude Include="..\..\renderer\qgl.h" />
<ClInclude Include="..\..\renderer\qgl_ext.h" />
<ClInclude Include="..\..\qcommon\surfaceflags.h" />
<ClInclude Include="..\..\renderer\tr_local.h" />
<ClInclude Include="..\..\renderer\tr_public.h" />

View file

@ -35,9 +35,6 @@
<ClCompile Include="..\..\renderer\tr_curve.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\renderer\tr_extensions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\renderer\tr_flares.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -223,9 +220,6 @@
<ClInclude Include="..\..\renderer\qgl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\renderer\qgl_ext.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\qcommon\surfaceflags.h">
<Filter>Header Files</Filter>
</ClInclude>

View file

@ -274,8 +274,7 @@ static int GLW_MakeContext( PIXELFORMATDESCRIPTOR *pPFD )
//
if ( !glw_state.pixelFormatSet )
{
int pixelformat;
int pixelformat;
//
// choose, set, and describe our desired pixel format. If we're
// using a minidriver then we need to bypass the GDI functions,
@ -649,6 +648,7 @@ static void GLW_AttemptFSAA()
glEnable(GL_MULTISAMPLE_ARB);
}
static qbool GLW_ResetMode( qbool cdsFullscreen )
{
HDC hDC = GetDC( GetDesktopWindow() );
@ -659,13 +659,11 @@ static qbool GLW_ResetMode( qbool cdsFullscreen )
glInfo.isFullscreen = cdsFullscreen;
if ( !R_GetModeInfo( &glConfig.vidWidth, &glConfig.vidHeight, &glConfig.windowAspect ) ) {
if (!glInfo.isFullscreen)
{
Cvar_SetValue( "vid_xpos", 0 );
Cvar_SetValue( "vid_ypos", 0 );
}
glConfig.vidWidth = glw_state.desktopWidth;
glConfig.vidHeight = glw_state.desktopHeight;
glConfig.windowAspect = (float)glConfig.vidWidth / glConfig.vidHeight;
@ -717,6 +715,7 @@ static qbool GLW_ResetMode( qbool cdsFullscreen )
return qtrue;
}
static qbool GLW_SetMode( qbool cdsFullscreen )
{
if (GLW_ResetMode(cdsFullscreen))
@ -892,9 +891,10 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
if( g_wv.hWnd != GetFocus() )
return;
unsigned short table[3][256];
for (int i = 0; i < 256; i++ ) {
unsigned short table[3][256];
int i, j;
for ( i = 0; i < 256; i++ ) {
table[0][i] = ( ( ( unsigned short ) red[i] ) << 8 ) | red[i];
table[1][i] = ( ( ( unsigned short ) green[i] ) << 8 ) | green[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 );
if ( vinfo.dwMajorVersion >= 5 && vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) {
Com_DPrintf( "performing W2K gamma clamp.\n" );
for (int j = 0 ; j < 3 ; j++ ) {
for (int i = 0 ; i < 128 ; i++ ) {
for ( j = 0 ; j < 3 ; j++ ) {
for ( i = 0 ; i < 128 ; i++ ) {
if ( table[j][i] > ( (128+i) << 8 ) ) {
table[j][i] = (128+i) << 8;
}
@ -919,7 +919,7 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
} else {
Com_DPrintf( "skipping W2K gamma clamp.\n" );
}
// enforce constantly increasing
for (int j = 0 ; j < 3 ; j++ ) {
for (int i = 1 ; i < 256 ; i++ ) {
@ -930,10 +930,11 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
}
if ( !SetDeviceGammaRamp( glw_state.hDC, table ) ) {
Com_DPrintf( "SetDeviceGammaRamp failed.\n" );
Com_Printf( "SetDeviceGammaRamp failed.\n" );
}
}
// drakkar
/*
** GLimp_WindowMode
@ -942,8 +943,8 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
*/
void GLimp_WindowMode( windowMode_t wmode )
{
if( !windowModeLock )
return;
if( !windowModeLock )
return;
Cvar_Get( "in_keyboardShortcuts", "", 0 )->modified = qtrue;
@ -953,7 +954,7 @@ void GLimp_WindowMode( windowMode_t wmode )
windowModeLock = qfalse;
glw_state.cdsFullscreen = qfalse;
ChangeDisplaySettings( 0, 0 );
ShowWindow( g_wv.hWnd, SW_SHOWMINIMIZED );
ShowWindow( g_wv.hWnd, SW_SHOWMINIMIZED );
g_wv.isMinimized = qtrue;
GLimp_WindowFocus( qfalse );
windowModeLock = qtrue;
@ -974,7 +975,7 @@ void GLimp_WindowMode( windowMode_t wmode )
case WMODE_SET_FULLSCREEN:
windowModeLock = qfalse;
GLW_SetMode( qtrue );
ShowWindow( g_wv.hWnd, SW_SHOWMAXIMIZED );
ShowWindow( g_wv.hWnd, SW_SHOWMAXIMIZED );
g_wv.isMinimized = qfalse;
GLimp_WindowFocus( qtrue );
windowModeLock = qtrue;
@ -1070,7 +1071,7 @@ void GLimp_Init()
GLW_InitExtensions();
GLW_CheckHardwareGamma();
if (GLW_InitARB() && QGL_InitARB() && QGL_InitExtensions())
if (GLW_InitARB() && QGL_InitARB())
return;
ri.Error( ERR_FATAL, "GLimp_Init() - could not find an acceptable OpenGL subsystem\n" );
@ -1090,8 +1091,8 @@ void GLimp_Shutdown()
GLW_RestoreGamma();
const char* success[] = { "failed", "success" };
int retVal;
const char* success[] = { "failed", "success" };
int retVal;
// set current context to NULL
if ( qwglMakeCurrent )
@ -1179,7 +1180,7 @@ qbool GLimp_SpawnRenderThread( void (*function)( void ) )
0, // LPVOID lpvThreadParm,
0, // DWORD fdwCreate,
&renderThreadId );
return (renderThreadHandle != NULL);
}
@ -1187,9 +1188,8 @@ qbool GLimp_SpawnRenderThread( void (*function)( void ) )
static void *smpData;
static int wglErrors;
void *GLimp_RendererSleep( void )
void *GLimp_RendererSleep( void )
{
if ( !qwglMakeCurrent( glw_state.hDC, NULL ) ) {
wglErrors++;
}
@ -1198,9 +1198,8 @@ void *GLimp_RendererSleep( void )
// after this, the front end can exit GLimp_FrontEndSleep
SetEvent( renderCompletedEvent );
WaitForSingleObject( renderCommandsEvent, INFINITE );
WaitForSingleObject( renderCommandsEvent, INFINITE );
if ( !qwglMakeCurrent( glw_state.hDC, glw_state.hGLRC ) ) {
wglErrors++;

View file

@ -21,8 +21,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// win_local.h: Win32-specific Quake3 header file
#define _WIN32_WINNT 0x0501
#include <windows.h>

View file

@ -35,7 +35,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <GL/gl.h>
#include <GL/glext.h>
#include "glext.h"
#include "glw_win.h"