All palettes are gone

Removed PowerVR and Permedia special cases
This commit is contained in:
cholleme 2003-11-16 22:51:13 +00:00
parent 6c7ca2fd05
commit 45da9668bd

View file

@ -25,12 +25,9 @@ const char *gl_vendor;
const char *gl_renderer;
const char *gl_version;
const char *gl_extensions;
qboolean fullsbardraw = false;
float vid_gamma = 1.0;
qboolean isPermedia = false;
qboolean gl_mtexable = false;
qcardtype gl_cardtype = GENERIC;
qboolean gl_var = false; //PENTA: vertex array range is available
@ -79,12 +76,6 @@ occlusion_cut_meshes;
occlusion_cut_entities;
occlusion_cut_lights;
unsigned short d_8to16table[256];
unsigned d_8to24table[256];
unsigned char d_15to8table[65536];
unsigned char d_8to8graytable[256];
/*-----------------------------------------------------------------------*/
void GL_checkerror(char *file, int line)
@ -105,123 +96,8 @@ void GL_checkerror(char *file, int line)
int Q_strncasecmp (char *s1,char *s2,int count);
void VID_SetPalette (unsigned char *palette)
{
byte *pal;
unsigned r,g,b;
unsigned a;
unsigned v;
int r1,g1,b1;
int j,k,l,m;
unsigned short i;
unsigned *table;
unsigned char *shade;
int dist, bestdist;
//
// 8 8 8 encoding
//
pal = palette;
table = d_8to24table;
shade = d_8to8graytable;
for (i=0 ; i<256 ; i++)
{
r = pal[0];
g = pal[1];
b = pal[2];
pal += 3;
//PENTA: fullbright colors
//a = i;//(i >= 192) ? 255 : 0;
a = 255;
v = (a<<24) + (r<<0) + (g<<8) + (b<<16);
*table++ = v;
//PENA: Grayscale conversion for bump maps
*shade++ = ((r+g+b)/3);
}
d_8to24table[255] &= 0xffffff; // 255 is transparent
// JACK: 3D distance calcs - k is last closest, l is the distance.
// FIXME: Precalculate this and cache to disk.
for (i=0; i < (1<<15); i++) {
/* Maps
000000000000000
000000000011111 = Red = 0x1F
000001111100000 = Blue = 0x03E0
111110000000000 = Grn = 0x7C00
*/
r = ((i & 0x1F) << 3)+4;
g = ((i & 0x03E0) >> 2)+4;
b = ((i & 0x7C00) >> 7)+4;
pal = (unsigned char *)d_8to24table;
for (v=0,k=0,bestdist=10000*10000; v<256; v++,pal+=4) {
r1 = (int)r - (int)pal[0];
g1 = (int)g - (int)pal[1];
b1 = (int)b - (int)pal[2];
dist = (r1*r1)+(g1*g1)+(b1*b1);
if (dist < bestdist) {
k=v;
bestdist = dist;
}
}
d_15to8table[i]=k;
}
}
//BOOL gammaworks;
void VID_ShiftPalette (unsigned char *palette)
{
// extern byte ramps[3][256];
// VID_SetPalette (palette);
// gammaworks = SetDeviceGammaRamp (maindc, ramps);
}
/*
BINDTEXFUNCPTR bindTexFunc;
#define TEXTURE_EXT_STRING "GL_EXT_texture_object"
/*
PENTA; not used anymore
*/
/*
void CheckArrayExtensions (void)
{
char *tmp;
// check for texture extension
tmp = (unsigned char *)glGetString(GL_EXTENSIONS);
while (*tmp)
{
if (strncmp((const char*)tmp, "GL_EXT_vertex_array", strlen("GL_EXT_vertex_array")) == 0)
{
if (
((SAFE_GET_PROC (glArrayElementEXT, (void *), "glArrayElementEXT")) == NULL) ||
((SAFE_GET_PROC (glColorPointerEXT, (void *), "glColorPointerEXT")) == NULL) ||
((SAFE_GET_PROC (glTexCoordPointerEXT, (void *), "glTexCoordPointerEXT")) == NULL) ||
((SAFE_GET_PROC (glVertexPointerEXT, (void *), "glVertexPointerEXT")) == NULL) )
{
Sys_Error ("GetProcAddress for vertex extension failed");
return;
}
return;
}
tmp++;
}
Sys_Error ("Vertex array extension not present");
}
*/
void CheckMultiTextureExtensions(void)
{
if (strstr(gl_extensions, "GL_ARB_multitexture")) {
SAFE_GET_PROC (qglActiveTextureARB,PFNGLACTIVETEXTUREARBPROC,"glActiveTextureARB");
@ -305,7 +181,8 @@ void CheckGeforce3Extensions(void)
//Con_Printf("%i texture units\n",supportedTmu);
if (strstr(gl_extensions, "GL_EXT_texture3D")
&& (supportedTmu >= 4) && (!COM_CheckParm ("-forcegf2"))
&& (supportedTmu >= 4) && (!COM_CheckParm ("-forcegf2"))
&& (!COM_CheckParm ("-forcegeneric"))
&& (gl_cardtype == GEFORCE)
&& strstr(gl_extensions, "GL_NV_vertex_program1_1")
&& strstr(gl_extensions, "GL_NV_vertex_array_range")
@ -456,54 +333,55 @@ void CheckARBFragmentExtensions(void)
}
}
void CheckNV3xFragmentExtensions(void)
{
int supportedTmu;
glGetIntegerv(GL_MAX_ACTIVE_TEXTURES_ARB,&supportedTmu);
if (strstr(gl_extensions, "GL_EXT_texture3D")
&& (!COM_CheckParm ("-forcegeneric"))
&& (!COM_CheckParm ("-nonv3x"))
&& strstr(gl_extensions, "GL_NV_fragment_program")
&& strstr(gl_extensions, "GL_NV_vertex_program2"))
{
gl_cardtype = NV3x;
//get TEX3d poiters wlgGetProcAddress
SAFE_GET_PROC (qglTexImage3DEXT,PFNGLTEXIMAGE3DEXT,"glTexImage3DEXT");
//get vertex_program pointers
SAFE_GET_PROC (qglAreProgramsResidentNV,PFNGLAREPROGRAMSRESIDENTNVPROC,"glAreProgramsResidentNV");
SAFE_GET_PROC (qglBindProgramNV,PFNGLBINDPROGRAMNVPROC,"glBindProgramNV");
SAFE_GET_PROC (qglDeleteProgramsNV,PFNGLDELETEPROGRAMSNVPROC,"glDeleteProgramsNV");
SAFE_GET_PROC (qglExecuteProgramNV,PFNGLEXECUTEPROGRAMNVPROC,"glExecuteProgramNV");
SAFE_GET_PROC (qglGenProgramsNV,PFNGLGENPROGRAMSNVPROC,"glGenProgramsNV");
SAFE_GET_PROC (qglGetProgramParameterdvNV,PFNGLGETPROGRAMPARAMETERDVNVPROC,"glGetProgramParameterdvNV");
SAFE_GET_PROC (qglGetProgramParameterfvNV,PFNGLGETPROGRAMPARAMETERFVNVPROC,"glGetProgramParameterfvNV");
SAFE_GET_PROC (qglGetProgramivNV,PFNGLGETPROGRAMIVNVPROC,"glGetProgramivNV");
SAFE_GET_PROC (qglGetProgramStringNV,PFNGLGETPROGRAMSTRINGNVPROC,"glGetProgramStringNV");
SAFE_GET_PROC (qglGetTrackMatrixivNV,PFNGLGETTRACKMATRIXIVNVPROC,"glGetTrackMatrixivNV");
SAFE_GET_PROC (qglGetVertexAttribdvNV,PFNGLGETVERTEXATTRIBDVNVPROC,"glGetVertexAttribdvNV");
SAFE_GET_PROC (qglGetVertexAttribfvNV,PFNGLGETVERTEXATTRIBFVNVPROC,"glGetVertexAttribfvNV");
SAFE_GET_PROC (qglGetVertexAttribivNV,PFNGLGETVERTEXATTRIBIVNVPROC,"glGetVertexAttribivNV");
SAFE_GET_PROC (qglGetVertexAttribPointervNV,PFNGLGETVERTEXATTRIBPOINTERVNVPROC,"glGetVertexAttribPointervNV");
SAFE_GET_PROC (qglGetVertexAttribPointervNV,PFNGLGETVERTEXATTRIBPOINTERVNVPROC,"glGetVertexAttribPointerNV");
SAFE_GET_PROC (qglIsProgramNV,PFNGLISPROGRAMNVPROC,"glIsProgramNV");
SAFE_GET_PROC (qglLoadProgramNV,PFNGLLOADPROGRAMNVPROC,"glLoadProgramNV");
SAFE_GET_PROC (qglProgramParameter4dNV,PFNGLPROGRAMPARAMETER4DNVPROC,"glProgramParameter4dNV");
SAFE_GET_PROC (qglProgramParameter4dvNV,PFNGLPROGRAMPARAMETER4DVNVPROC,"glProgramParameter4dvNV");
SAFE_GET_PROC (qglProgramParameter4fNV,PFNGLPROGRAMPARAMETER4FNVPROC,"glProgramParameter4fNV");
SAFE_GET_PROC (qglProgramParameter4fvNV,PFNGLPROGRAMPARAMETER4FVNVPROC,"glProgramParameter4fvNV");
SAFE_GET_PROC (qglProgramParameters4dvNV,PFNGLPROGRAMPARAMETERS4DVNVPROC,"glProgramParameters4dvNV");
SAFE_GET_PROC (qglProgramParameters4fvNV,PFNGLPROGRAMPARAMETERS4FVNVPROC,"glProgramParameters4fvNV");
SAFE_GET_PROC (qglRequestResidentProgramsNV,PFNGLREQUESTRESIDENTPROGRAMSNVPROC,"glRequestResidentProgramsNV");
SAFE_GET_PROC (qglTrackMatrixNV,PFNGLTRACKMATRIXNVPROC,"glTrackMatrixNV");
//default to trilinear filtering
gl_filter_min = GL_LINEAR_MIPMAP_LINEAR;
gl_filter_max = GL_LINEAR;
}
}
void CheckNV3xFragmentExtensions(void) {
int supportedTmu;
glGetIntegerv(GL_MAX_ACTIVE_TEXTURES_ARB,&supportedTmu);
if (strstr(gl_extensions, "GL_EXT_texture3D")
&& (!COM_CheckParm ("-forcegeneric"))
&& (!COM_CheckParm ("-nonv3x"))
&& strstr(gl_extensions, "GL_NV_fragment_program")
&& strstr(gl_extensions, "GL_NV_vertex_program2"))
{
gl_cardtype = NV3x;
//get TEX3d poiters wlgGetProcAddress
SAFE_GET_PROC (qglTexImage3DEXT,PFNGLTEXIMAGE3DEXT,"glTexImage3DEXT");
//get vertex_program pointers
SAFE_GET_PROC (qglAreProgramsResidentNV,PFNGLAREPROGRAMSRESIDENTNVPROC,"glAreProgramsResidentNV");
SAFE_GET_PROC (qglBindProgramNV,PFNGLBINDPROGRAMNVPROC,"glBindProgramNV");
SAFE_GET_PROC (qglDeleteProgramsNV,PFNGLDELETEPROGRAMSNVPROC,"glDeleteProgramsNV");
SAFE_GET_PROC (qglExecuteProgramNV,PFNGLEXECUTEPROGRAMNVPROC,"glExecuteProgramNV");
SAFE_GET_PROC (qglGenProgramsNV,PFNGLGENPROGRAMSNVPROC,"glGenProgramsNV");
SAFE_GET_PROC (qglGetProgramParameterdvNV,PFNGLGETPROGRAMPARAMETERDVNVPROC,"glGetProgramParameterdvNV");
SAFE_GET_PROC (qglGetProgramParameterfvNV,PFNGLGETPROGRAMPARAMETERFVNVPROC,"glGetProgramParameterfvNV");
SAFE_GET_PROC (qglGetProgramivNV,PFNGLGETPROGRAMIVNVPROC,"glGetProgramivNV");
SAFE_GET_PROC (qglGetProgramStringNV,PFNGLGETPROGRAMSTRINGNVPROC,"glGetProgramStringNV");
SAFE_GET_PROC (qglGetTrackMatrixivNV,PFNGLGETTRACKMATRIXIVNVPROC,"glGetTrackMatrixivNV");
SAFE_GET_PROC (qglGetVertexAttribdvNV,PFNGLGETVERTEXATTRIBDVNVPROC,"glGetVertexAttribdvNV");
SAFE_GET_PROC (qglGetVertexAttribfvNV,PFNGLGETVERTEXATTRIBFVNVPROC,"glGetVertexAttribfvNV");
SAFE_GET_PROC (qglGetVertexAttribivNV,PFNGLGETVERTEXATTRIBIVNVPROC,"glGetVertexAttribivNV");
SAFE_GET_PROC (qglGetVertexAttribPointervNV,PFNGLGETVERTEXATTRIBPOINTERVNVPROC,"glGetVertexAttribPointervNV");
SAFE_GET_PROC (qglGetVertexAttribPointervNV,PFNGLGETVERTEXATTRIBPOINTERVNVPROC,"glGetVertexAttribPointerNV");
SAFE_GET_PROC (qglIsProgramNV,PFNGLISPROGRAMNVPROC,"glIsProgramNV");
SAFE_GET_PROC (qglLoadProgramNV,PFNGLLOADPROGRAMNVPROC,"glLoadProgramNV");
SAFE_GET_PROC (qglProgramParameter4dNV,PFNGLPROGRAMPARAMETER4DNVPROC,"glProgramParameter4dNV");
SAFE_GET_PROC (qglProgramParameter4dvNV,PFNGLPROGRAMPARAMETER4DVNVPROC,"glProgramParameter4dvNV");
SAFE_GET_PROC (qglProgramParameter4fNV,PFNGLPROGRAMPARAMETER4FNVPROC,"glProgramParameter4fNV");
SAFE_GET_PROC (qglProgramParameter4fvNV,PFNGLPROGRAMPARAMETER4FVNVPROC,"glProgramParameter4fvNV");
SAFE_GET_PROC (qglProgramParameters4dvNV,PFNGLPROGRAMPARAMETERS4DVNVPROC,"glProgramParameters4dvNV");
SAFE_GET_PROC (qglProgramParameters4fvNV,PFNGLPROGRAMPARAMETERS4FVNVPROC,"glProgramParameters4fvNV");
SAFE_GET_PROC (qglRequestResidentProgramsNV,PFNGLREQUESTRESIDENTPROGRAMSNVPROC,"glRequestResidentProgramsNV");
SAFE_GET_PROC (qglTrackMatrixNV,PFNGLTRACKMATRIXNVPROC,"glTrackMatrixNV");
//default to trilinear filtering
gl_filter_min = GL_LINEAR_MIPMAP_LINEAR;
gl_filter_max = GL_LINEAR;
}
}
void CheckAnisotropicExtension(void)
{
@ -566,12 +444,6 @@ void GL_Init (void)
Con_Printf ("%s %s\n", gl_renderer, gl_version);
if (Q_strncasecmp ((char *)gl_renderer,"PowerVR",7)==0)
fullsbardraw = true;
if (Q_strncasecmp ((char *)gl_renderer,"Permedia",8)==0)
isPermedia = true;
Con_Printf ("Checking multitexture\n");
CheckMultiTextureExtensions ();