mirror of
https://git.code.sf.net/p/quake/nuq
synced 2024-11-25 13:31:19 +00:00
preparations for giving bmodels fullbrights. Fullbright detection has been
moved from gl_model_alias.c to fl_model_fullbright.c and Mod_LoadMMNearest has been renamed to Mod_ProcessTexture.
This commit is contained in:
parent
60afa90414
commit
4b67ed54c4
6 changed files with 96 additions and 48 deletions
|
@ -190,7 +190,8 @@ nuq_x11_DEPENDENCIES=libqfsys.a libqfsnd.a libqfcd.a libqfnet.a
|
|||
#
|
||||
ogl_SOURCES= gl_draw.c gl_mesh.c gl_part.c gl_refrag.c gl_rlight.c \
|
||||
gl_rmain.c gl_rmisc.c gl_rsurf.c gl_screen.c gl_view.c \
|
||||
gl_warp.c gl_model_alias.c gl_model_brush.c gl_model_sprite.c
|
||||
gl_warp.c gl_model_alias.c gl_model_brush.c gl_model_fullbright.c \
|
||||
gl_model_sprite.c
|
||||
|
||||
#
|
||||
# ... 3Dfx Voodoo 1 and 2 SVGAlib-based console GL
|
||||
|
|
|
@ -139,56 +139,24 @@ void Mod_FloodFillSkin( byte *skin, int skinwidth, int skinheight )
|
|||
}
|
||||
}
|
||||
|
||||
int Mod_Fullbright(byte *skin, int width, int height, char *name);
|
||||
|
||||
void *Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum, qboolean group)
|
||||
{
|
||||
int j;
|
||||
char name[32];
|
||||
int fbtexnum;
|
||||
|
||||
Mod_FloodFillSkin( skin, pheader->mdl.skinwidth, pheader->mdl.skinheight );
|
||||
|
||||
// This block is GL fullbright support for objects...
|
||||
{
|
||||
int pixels;
|
||||
byte *ptexel;
|
||||
|
||||
// Check for fullbright pixels..
|
||||
pixels = pheader->mdl.skinwidth * pheader->mdl.skinheight;
|
||||
ptexel = (byte *)(skin + 1);
|
||||
|
||||
for (j=0 ; j<pixels ; j++) {
|
||||
if (ptexel[j] >= 256-32) {
|
||||
loadmodel->hasfullbrights = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (loadmodel->hasfullbrights) {
|
||||
byte *ptexels;
|
||||
|
||||
//ptexels = Hunk_Alloc(s);
|
||||
ptexels = malloc(pixels);
|
||||
|
||||
if (group) {
|
||||
snprintf(name, sizeof(name), "fb_%s_%i_%i", loadmodel->name,snum,gnum);
|
||||
} else {
|
||||
snprintf(name, sizeof(name), "fb_%s_%i", loadmodel->name,snum);
|
||||
}
|
||||
Con_DPrintf("FB Model ID: '%s'\n", name);
|
||||
for (j=0 ; j<pixels ; j++) {
|
||||
if (ptexel[j] >= 256-32) {
|
||||
ptexels[j] = ptexel[j];
|
||||
} else {
|
||||
ptexels[j] = 255;
|
||||
fbtexnum = Mod_Fullbright(skin+1, pheader->mdl.skinwidth, pheader->mdl.skinheight, name);
|
||||
if ((loadmodel->hasfullbrights=(fbtexnum!=-1))) {
|
||||
pheader->gl_fb_texturenum[snum][gnum] = fbtexnum;
|
||||
}
|
||||
}
|
||||
pheader->gl_fb_texturenum[snum][gnum] =
|
||||
GL_LoadTexture (name, pheader->mdl.skinwidth,
|
||||
pheader->mdl.skinheight, ptexels, true, true, 1);
|
||||
|
||||
free(ptexels);
|
||||
}
|
||||
}
|
||||
|
||||
if (group) {
|
||||
snprintf(name, sizeof(name), "%s_%i_%i", loadmodel->name,snum,gnum);
|
||||
} else {
|
||||
|
|
|
@ -48,7 +48,7 @@ extern byte *mod_base;
|
|||
const int mod_lightmap_bytes = 3;
|
||||
|
||||
void
|
||||
Mod_LoadMMNearest(miptex_t *mt, texture_t *tx)
|
||||
Mod_ProcessTexture(miptex_t *mt, texture_t *tx)
|
||||
{
|
||||
texture_mode = GL_LINEAR_MIPMAP_NEAREST; //_LINEAR;
|
||||
tx->gl_texturenum = GL_LoadTexture (mt->name, tx->width, tx->height, (byte *)(tx+1), true, false, 1);
|
||||
|
|
79
source/gl_model_fullbright.c
Normal file
79
source/gl_model_fullbright.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
gl_model_fullbright.c
|
||||
|
||||
model loading and caching
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
// models are the only shared resource between a client and server running
|
||||
// on the same machine.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "r_local.h"
|
||||
#include "sys.h"
|
||||
#include "console.h"
|
||||
#include "qendian.h"
|
||||
#include "checksum.h"
|
||||
#include "glquake.h"
|
||||
|
||||
int Mod_Fullbright (byte *skin, int width, int height, char *name)
|
||||
{
|
||||
int j;
|
||||
int pixels;
|
||||
qboolean hasfullbrights = false;
|
||||
int texnum;
|
||||
|
||||
// Check for fullbright pixels..
|
||||
pixels = width * height;
|
||||
|
||||
for (j=0 ; j<pixels ; j++) {
|
||||
if (skin[j] >= 256-32) {
|
||||
hasfullbrights = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasfullbrights) {
|
||||
byte *ptexels;
|
||||
|
||||
//ptexels = Hunk_Alloc(s);
|
||||
ptexels = malloc(pixels);
|
||||
|
||||
Con_DPrintf("FB Model ID: '%s'\n", name);
|
||||
for (j=0 ; j<pixels ; j++) {
|
||||
if (skin[j] >= 256-32) {
|
||||
ptexels[j] = skin[j];
|
||||
} else {
|
||||
ptexels[j] = 255;
|
||||
}
|
||||
}
|
||||
texnum = GL_LoadTexture (name, width, height, ptexels, true, true, 1);
|
||||
free(ptexels);
|
||||
return texnum;
|
||||
}
|
||||
return -1;
|
||||
}
|
|
@ -48,7 +48,7 @@ extern byte mod_novis[];
|
|||
|
||||
extern const int mod_lightmap_bytes;
|
||||
|
||||
void Mod_LoadMMNearest(miptex_t *mt, texture_t *tx);
|
||||
void Mod_ProcessTexture (miptex_t *mt, texture_t *tx);
|
||||
void Mod_LoadLighting (lump_t *l);
|
||||
|
||||
/*
|
||||
|
@ -196,7 +196,7 @@ void Mod_LoadTextures (lump_t *l)
|
|||
R_InitSky (tx);
|
||||
else
|
||||
{
|
||||
Mod_LoadMMNearest(mt, tx);
|
||||
Mod_ProcessTexture(mt, tx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ GL_SubdivideSurface (msurface_t *fa)
|
|||
}
|
||||
|
||||
void
|
||||
Mod_LoadMMNearest(miptex_t *mt, texture_t *tx)
|
||||
Mod_ProcessTexture (miptex_t *mt, texture_t *tx)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue