mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
Water texture mipmapping support
This commit is contained in:
parent
616e77dc61
commit
226a0e7463
5 changed files with 22 additions and 2 deletions
|
@ -466,6 +466,7 @@ static void Mod_LoadTextures (lump_t *l)
|
|||
byte *data;
|
||||
extern byte *hunk_base;
|
||||
//johnfitz
|
||||
unsigned int flags;
|
||||
|
||||
//johnfitz -- don't return early if no textures; still need to create dummy texture
|
||||
if (!l->filelen)
|
||||
|
@ -585,8 +586,11 @@ static void Mod_LoadTextures (lump_t *l)
|
|||
Hunk_Alloc (gl_warpimagesize*gl_warpimagesize*4); //make sure hunk is big enough so we don't reach an illegal address
|
||||
Hunk_FreeToLowMark (mark);
|
||||
q_snprintf (texturename, sizeof(texturename), "%s_warp", texturename);
|
||||
flags = TEXPREF_NOPICMIP | TEXPREF_WARPIMAGE;
|
||||
if (GL_GenerateMipmap)
|
||||
flags |= TEXPREF_MIPMAP;
|
||||
tx->warpimage = TexMgr_LoadImage (loadmodel, texturename, gl_warpimagesize,
|
||||
gl_warpimagesize, SRC_RGBA, hunk_base, "", (src_offset_t)hunk_base, TEXPREF_NOPICMIP | TEXPREF_WARPIMAGE);
|
||||
gl_warpimagesize, SRC_RGBA, hunk_base, "", (src_offset_t)hunk_base, flags);
|
||||
tx->update_warp = true;
|
||||
}
|
||||
else //regular texture
|
||||
|
|
|
@ -1051,7 +1051,7 @@ static void TexMgr_LoadImage32 (gltexture_t *glt, unsigned *data)
|
|||
glTexImage2D (GL_TEXTURE_2D, 0, internalformat, glt->width, glt->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
||||
|
||||
// upload mipmaps
|
||||
if (glt->flags & TEXPREF_MIPMAP)
|
||||
if (glt->flags & TEXPREF_MIPMAP && !(glt->flags & TEXPREF_WARPIMAGE)) // warp image mipmaps are generated later
|
||||
{
|
||||
mipwidth = glt->width;
|
||||
mipheight = glt->height;
|
||||
|
|
|
@ -143,6 +143,8 @@ QS_PFNGLUNIFORM1FPROC GL_Uniform1fFunc = NULL; //ericw
|
|||
QS_PFNGLUNIFORM3FPROC GL_Uniform3fFunc = NULL; //ericw
|
||||
QS_PFNGLUNIFORM4FPROC GL_Uniform4fFunc = NULL; //ericw
|
||||
|
||||
QS_PFNGENERATEMIPMAP GL_GenerateMipmap = NULL;
|
||||
|
||||
//====================================
|
||||
|
||||
//johnfitz -- new cvars
|
||||
|
@ -1268,6 +1270,14 @@ static void GL_CheckExtensions (void)
|
|||
{
|
||||
Con_Warning ("GLSL alias model rendering not available, using Fitz renderer\n");
|
||||
}
|
||||
|
||||
// glGenerateMipmap for warp textures
|
||||
if (COM_CheckParm("-nowarpmipmaps"))
|
||||
Con_Warning ("glGenerateMipmap disabled at command line\n");
|
||||
else if ((GL_GenerateMipmap = SDL_GL_GetProcAddress("glGenerateMipmap")))
|
||||
Con_Printf ("FOUND: glGenerateMipmap\n");
|
||||
else
|
||||
Con_Warning ("glGenerateMipmap not available, liquids won't have mipmaps\n");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -254,6 +254,8 @@ void R_UpdateWarpTextures (void)
|
|||
//copy to texture
|
||||
GL_Bind (tx->warpimage);
|
||||
glCopyTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, glx, gly+glheight-gl_warpimagesize, gl_warpimagesize, gl_warpimagesize);
|
||||
if (GL_GenerateMipmap)
|
||||
GL_GenerateMipmap (GL_TEXTURE_2D);
|
||||
|
||||
tx->update_warp = false;
|
||||
}
|
||||
|
|
|
@ -208,6 +208,7 @@ typedef void (APIENTRYP QS_PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
|
|||
typedef void (APIENTRYP QS_PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
|
||||
typedef void (APIENTRYP QS_PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
typedef void (APIENTRYP QS_PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
typedef void (APIENTRYP QS_PFNGENERATEMIPMAP) (GLenum type);
|
||||
|
||||
extern QS_PFNGLCREATESHADERPROC GL_CreateShaderFunc;
|
||||
extern QS_PFNGLDELETESHADERPROC GL_DeleteShaderFunc;
|
||||
|
@ -237,6 +238,9 @@ extern qboolean gl_glsl_gamma_able;
|
|||
extern qboolean gl_glsl_alias_able;
|
||||
// ericw --
|
||||
|
||||
//mipmapped warp textures
|
||||
extern QS_PFNGENERATEMIPMAP GL_GenerateMipmap;
|
||||
|
||||
//ericw -- NPOT texture support
|
||||
extern qboolean gl_texture_NPOT;
|
||||
|
||||
|
|
Loading…
Reference in a new issue