Add a preview for 2d array textures. Bind gl textures according to texture type rather than hardcoded assumptions, making it more consistent with the other rendering APIs.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5839 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-05-09 13:01:15 +00:00
parent ff4b88dd45
commit 2538e37e28
12 changed files with 113 additions and 107 deletions

View file

@ -2262,6 +2262,11 @@ static int Con_DrawConsoleLines(console_t *con, conline_t *l, float displayscrol
pic = R_RegisterShader("tiprawimgcube", 0, "{\nprogram postproc_equirectangular\n{\nmap \"$cube:$reflectcube\"\n}\n}");
pic->defaulttextures->reflectcube = img;
}
else if (img && (img->flags & IF_TEXTYPEMASK)==IF_TEXTYPE_2D_ARRAY)
{
pic = R_RegisterShader("tiprawimgarray", 0, "{\nprogram default2danim\n{\nmap \"$2darray:$diffuse\"\n}\n}");
pic->defaulttextures->base = img;
}
else
{
pic = R2D_SafeCachePic("tiprawimg");
@ -2827,6 +2832,11 @@ static void Con_DrawMouseOver(console_t *mouseconsole)
shader = R_RegisterShader("tiprawimgcube", 0, "{\nprogram postproc_equirectangular\n{\nmap \"$cube:$reflectcube\"\n}\n}");
shader->defaulttextures->reflectcube = img;
}
else if ((img->flags & IF_TEXTYPEMASK)==IF_TEXTYPE_2D_ARRAY)
{
shader = R_RegisterShader("tiprawimgarray", 0, "{\nprogram default2danim\n{\nmap \"$2darray:$diffuse\"\n}\n}");
shader->defaulttextures->base = img;
}
else if ((img->flags&IF_TEXTYPEMASK) == IF_TEXTYPE_2D)
{
shader = R2D_SafeCachePic("tiprawimg");

View file

@ -294,7 +294,7 @@ typedef struct texid_s texid_tf;
struct pendingtextureinfo
{
enum
enum imgtype_e
{
//formats are all w*h*d (where depth has limitations according to type)
PTI_2D, //w*h*1 - depth MUST be 1
@ -376,17 +376,17 @@ typedef struct
typedef struct texnums_s {
char mapname[MAX_QPATH]; //the 'official' name of the diffusemap. used to generate filenames for other textures.
texid_t base; //regular diffuse texture. may have alpha if surface is transparent.
texid_t bump; //normalmap. height values packed in alpha.
texid_t specular; //specular lighting values. alpha contains exponent multiplier
texid_t upperoverlay; //diffuse texture for the upper body(shirt colour). no alpha channel. added to base.rgb. ideally an l8 texture
texid_t loweroverlay; //diffuse texture for the lower body(trouser colour). no alpha channel. added to base.rgb. ideally an l8 texture
texid_t paletted; //8bit paletted data, just because.
texid_t fullbright; //emissive texture. alpha should be 1.
texid_t reflectcube; //for fake reflections
texid_t reflectmask; //defines how reflective it is (for cubemap reflections)
texid_t displacement; //alternative to bump.a, eg R16[F] for offsetmapping or tessellation
texid_t occlusion; //occlusion map...
texid_t base; //2d, regular diffuse texture. may have alpha if surface is transparent.
texid_t bump; //2d, normalmap. height values packed in alpha.
texid_t specular; //2d, specular lighting values. alpha contains exponent multiplier
texid_t upperoverlay; //2d, diffuse texture for the upper body(shirt colour). no alpha channel. added to base.rgb. ideally an l8 texture
texid_t loweroverlay; //2d, diffuse texture for the lower body(trouser colour). no alpha channel. added to base.rgb. ideally an l8 texture
texid_t paletted; //2d, 8bit paletted data, just because. only red is used.
texid_t fullbright; //2d, emissive texture. alpha should be 1.
texid_t reflectcube; //cube, for fake reflections
texid_t reflectmask; //2d, defines how reflective it is (for cubemap reflections)
texid_t displacement; //2d, alternative to bump.a, eg R16[F] for offsetmapping or tessellation
texid_t occlusion; //2d, occlusion map... only red is used.
//the material's pushconstants. vulkan guarentees only 128 bytes. so 8 vec4s. note that lmscales should want 4 of them...
/*struct

View file

@ -1065,8 +1065,6 @@ static void SelectPassTexture(unsigned int tu, const shaderpass_t *pass)
case T_GEN_ANIMMAP:
BindTexture(tu, pass->anim_frames[(int)(pass->anim_fps * shaderstate.curtime) % pass->anim_numframes]);
break;
case T_GEN_3DMAP:
case T_GEN_CUBEMAP:
case T_GEN_SINGLEMAP:
BindTexture(tu, pass->anim_frames[0]);
break;

View file

@ -503,7 +503,7 @@ void GL_MTBind(int tmu, int target, texid_t texnum)
}
#if 0//def GLSLONLY
void GL_LazyBind(int tmu, int target, texid_t texnum)
static void GL_LazyBind(int tmu, texid_t texnum)
{
int glnum = texnum?texnum->num:0;
if (shaderstate.currenttextures[tmu] != glnum)
@ -513,9 +513,18 @@ void GL_LazyBind(int tmu, int target, texid_t texnum)
}
}
#else
void GL_LazyBind(int tmu, int target, texid_t texnum)
static void GL_LazyBind(int tmu, texid_t texnum)
{
int glnum = texnum?texnum->num:0;
int glnum;
GLenum target;
if (texnum)
{
static GLenum imgtab[] = {GL_TEXTURE_2D, GL_TEXTURE_3D, GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_2D_ARRAY, GL_TEXTURE_CUBE_MAP_ARRAY_ARB};
glnum = texnum->num, target = imgtab[(enum imgtype_e)((texnum->flags & IF_TEXTYPEMASK)>>IF_TEXTYPESHIFT)];
}
else
glnum = 0, target = 0;
#ifndef FORCESTATE
if (shaderstate.currenttextures[tmu] != glnum)
#endif
@ -1097,7 +1106,7 @@ qboolean GLBE_BeginShadowMap(int id, int w, int h, uploadfmt_t encoding, int *re
while(shaderstate.lastpasstmus>0)
{
GL_LazyBind(--shaderstate.lastpasstmus, 0, r_nulltex);
GL_LazyBind(--shaderstate.lastpasstmus, r_nulltex);
}
shaderstate.shaderbits &= ~SBITS_MISC_DEPTHWRITE;
@ -1246,8 +1255,7 @@ static void Shader_BindTextureForPass(int tmu, const shaderpass_t *pass)
t = shaderstate.curbatch->envmap;
else
t = shaderstate.tex_reflectcube;
GL_LazyBind(tmu, GL_TEXTURE_CUBE_MAP_ARB, t);
return;
break;
case T_GEN_REFLECTMASK:
if (shaderstate.curtexnums && TEXLOADED(shaderstate.curtexnums->reflectmask))
t = shaderstate.curtexnums->reflectmask;
@ -1273,21 +1281,11 @@ static void Shader_BindTextureForPass(int tmu, const shaderpass_t *pass)
break;
case T_GEN_LIGHTCUBEMAP:
GL_LazyBind(tmu, GL_TEXTURE_CUBE_MAP_ARB, shaderstate.lightcubemap);
return;
case T_GEN_CUBEMAP:
t = pass->anim_frames[0];
GL_LazyBind(tmu, GL_TEXTURE_CUBE_MAP_ARB, t);
return;
t = shaderstate.lightcubemap;
break;
case T_GEN_SOURCECUBE:
t = scenepp_postproc_cube;
GL_LazyBind(tmu, GL_TEXTURE_CUBE_MAP_ARB, t);
return;
case T_GEN_3DMAP:
t = pass->anim_frames[0];
GL_LazyBind(tmu, GL_TEXTURE_3D, t);
return;
break;
#ifdef HAVE_MEDIA_DECODER
case T_GEN_VIDEOMAP:
@ -1328,7 +1326,7 @@ static void Shader_BindTextureForPass(int tmu, const shaderpass_t *pass)
t = shaderstate.tex_gbuf[pass->texgen-T_GEN_GBUFFER0];
break;
}
GL_LazyBind(tmu, GL_TEXTURE_2D, t);
GL_LazyBind(tmu, t);
}
/*========================================== matrix functions =====================================*/
@ -1534,7 +1532,7 @@ void GLBE_Shutdown(void)
GL_SelectEBO(0);
for (u = 0; u < countof(shaderstate.currenttextures); u++)
GL_LazyBind(u, 0, r_nulltex);
GL_LazyBind(u, r_nulltex);
GL_SelectTexture(0);
}
@ -3326,7 +3324,7 @@ static void DrawPass(const shaderpass_t *pass)
/*make sure no textures linger*/
for (k = tmu; k < shaderstate.lastpasstmus; k++)
{
GL_LazyBind(k, 0, r_nulltex);
GL_LazyBind(k, r_nulltex);
}
shaderstate.lastpasstmus = tmu;
@ -3336,7 +3334,7 @@ static void DrawPass(const shaderpass_t *pass)
tmu = 0;
/*bind the light texture*/
GL_LazyBind(tmu, GL_TEXTURE_2D, lightmap[shaderstate.curbatch->lightmap[j]]->lightmap_texture);
GL_LazyBind(tmu, lightmap[shaderstate.curbatch->lightmap[j]]->lightmap_texture);
/*set up the colourmod for this style's lighting*/
shaderstate.pendingcolourvbo = 0;
@ -3366,7 +3364,7 @@ static void DrawPass(const shaderpass_t *pass)
{
for (k = tmu; k < shaderstate.lastpasstmus; k++)
{
GL_LazyBind(k, 0, r_nulltex);
GL_LazyBind(k, r_nulltex);
}
shaderstate.lastpasstmus = tmu;
BE_EnableShaderAttributes(attr, 0);
@ -3386,7 +3384,7 @@ static void DrawPass(const shaderpass_t *pass)
for (i = tmu; i < shaderstate.lastpasstmus; i++)
{
GL_LazyBind(i, 0, r_nulltex);
GL_LazyBind(i, r_nulltex);
}
shaderstate.lastpasstmus = tmu;
BE_EnableShaderAttributes(attr, 0);
@ -3948,16 +3946,16 @@ static void BE_RenderMeshProgram(const shader_t *shader, const shaderpass_t *pas
#if MAXRLIGHTMAPS > 1
if (perm & PERMUTATION_LIGHTSTYLES)
{
GL_LazyBind(i++, GL_TEXTURE_2D, shaderstate.curbatch->lightmap[1]>=0?lightmap[shaderstate.curbatch->lightmap[1]]->lightmap_texture:r_nulltex);
GL_LazyBind(i++, GL_TEXTURE_2D, shaderstate.curbatch->lightmap[2]>=0?lightmap[shaderstate.curbatch->lightmap[2]]->lightmap_texture:r_nulltex);
GL_LazyBind(i++, GL_TEXTURE_2D, shaderstate.curbatch->lightmap[3]>=0?lightmap[shaderstate.curbatch->lightmap[3]]->lightmap_texture:r_nulltex);
GL_LazyBind(i++, GL_TEXTURE_2D, (shaderstate.curbatch->lightmap[1]>=0&&lightmap[shaderstate.curbatch->lightmap[1]]->hasdeluxe)?lightmap[shaderstate.curbatch->lightmap[1]+1]->lightmap_texture:missing_texture_normal);
GL_LazyBind(i++, GL_TEXTURE_2D, (shaderstate.curbatch->lightmap[2]>=0&&lightmap[shaderstate.curbatch->lightmap[2]]->hasdeluxe)?lightmap[shaderstate.curbatch->lightmap[2]+1]->lightmap_texture:missing_texture_normal);
GL_LazyBind(i++, GL_TEXTURE_2D, (shaderstate.curbatch->lightmap[3]>=0&&lightmap[shaderstate.curbatch->lightmap[3]]->hasdeluxe)?lightmap[shaderstate.curbatch->lightmap[3]+1]->lightmap_texture:missing_texture_normal);
GL_LazyBind(i++, shaderstate.curbatch->lightmap[1]>=0?lightmap[shaderstate.curbatch->lightmap[1]]->lightmap_texture:r_nulltex);
GL_LazyBind(i++, shaderstate.curbatch->lightmap[2]>=0?lightmap[shaderstate.curbatch->lightmap[2]]->lightmap_texture:r_nulltex);
GL_LazyBind(i++, shaderstate.curbatch->lightmap[3]>=0?lightmap[shaderstate.curbatch->lightmap[3]]->lightmap_texture:r_nulltex);
GL_LazyBind(i++, (shaderstate.curbatch->lightmap[1]>=0&&lightmap[shaderstate.curbatch->lightmap[1]]->hasdeluxe)?lightmap[shaderstate.curbatch->lightmap[1]+1]->lightmap_texture:missing_texture_normal);
GL_LazyBind(i++, (shaderstate.curbatch->lightmap[2]>=0&&lightmap[shaderstate.curbatch->lightmap[2]]->hasdeluxe)?lightmap[shaderstate.curbatch->lightmap[2]+1]->lightmap_texture:missing_texture_normal);
GL_LazyBind(i++, (shaderstate.curbatch->lightmap[3]>=0&&lightmap[shaderstate.curbatch->lightmap[3]]->hasdeluxe)?lightmap[shaderstate.curbatch->lightmap[3]+1]->lightmap_texture:missing_texture_normal);
}
#endif
while (shaderstate.lastpasstmus > i)
GL_LazyBind(--shaderstate.lastpasstmus, 0, r_nulltex);
GL_LazyBind(--shaderstate.lastpasstmus, r_nulltex);
shaderstate.lastpasstmus = i;
BE_EnableShaderAttributes(permu->attrmask, shaderstate.sourcevbo->vao);
@ -4045,7 +4043,7 @@ void GLBE_SelectMode(backendmode_t mode)
/*BEM_DEPTHONLY does support mesh writing, but its not the only way its used... FIXME!*/
while(shaderstate.lastpasstmus>0)
{
GL_LazyBind(--shaderstate.lastpasstmus, 0, r_nulltex);
GL_LazyBind(--shaderstate.lastpasstmus, r_nulltex);
}
//we don't write or blend anything (maybe alpha test... but mneh)
@ -4075,7 +4073,7 @@ void GLBE_SelectMode(backendmode_t mode)
//disable all tmus
while(shaderstate.lastpasstmus>0)
{
GL_LazyBind(--shaderstate.lastpasstmus, 0, r_nulltex);
GL_LazyBind(--shaderstate.lastpasstmus, r_nulltex);
}
#ifndef GLSLONLY
if (!gl_config_nofixedfunc)
@ -4123,9 +4121,9 @@ void GLBE_SelectMode(backendmode_t mode)
case BEM_FOG:
while(shaderstate.lastpasstmus>0)
{
GL_LazyBind(--shaderstate.lastpasstmus, 0, r_nulltex);
GL_LazyBind(--shaderstate.lastpasstmus, r_nulltex);
}
GL_LazyBind(0, GL_TEXTURE_2D, shaderstate.fogtexture);
GL_LazyBind(0, shaderstate.fogtexture);
shaderstate.lastpasstmus = 1;
Vector4Set(shaderstate.pendingcolourflat, 1, 1, 1, 1);
@ -4379,7 +4377,7 @@ static void BE_LegacyLighting(void)
shaderstate.normalisationcubemap = GenerateNormalisationCubeMap();
//tmu0: normalmap+replace+regular tex coords
GL_LazyBind(tmu, GL_TEXTURE_2D, shaderstate.curtexnums->bump);
GL_LazyBind(tmu, shaderstate.curtexnums->bump);
BE_SetPassBlendMode(tmu, PBM_REPLACE);
shaderstate.pendingtexcoordparts[tmu] = 2;
shaderstate.pendingtexcoordvbo[tmu] = shaderstate.sourcevbo->texcoord.gl.vbo;
@ -4388,7 +4386,7 @@ static void BE_LegacyLighting(void)
tmu++;
//tmu1: normalizationcubemap+dot3+lightdir
GL_LazyBind(tmu, GL_TEXTURE_CUBE_MAP_ARB, shaderstate.normalisationcubemap);
GL_LazyBind(tmu, shaderstate.normalisationcubemap);
BE_SetPassBlendMode(tmu, PBM_DOTPRODUCT);
shaderstate.pendingtexcoordparts[tmu] = 3;
shaderstate.pendingtexcoordvbo[tmu] = 0;
@ -4397,7 +4395,7 @@ static void BE_LegacyLighting(void)
tmu++;
//tmu2: $diffuse+multiply+regular tex coords
GL_LazyBind(tmu, GL_TEXTURE_2D, shaderstate.curtexnums->base); //texture not used, its just to make sure the code leaves it enabled.
GL_LazyBind(tmu, shaderstate.curtexnums->base); //texture not used, its just to make sure the code leaves it enabled.
BE_SetPassBlendMode(tmu, PBM_MODULATE);
shaderstate.pendingtexcoordparts[tmu] = 2;
shaderstate.pendingtexcoordvbo[tmu] = shaderstate.sourcevbo->texcoord.gl.vbo;
@ -4406,7 +4404,7 @@ static void BE_LegacyLighting(void)
tmu++;
//tmu3: $any+multiply-by-colour+notc
GL_LazyBind(tmu, GL_TEXTURE_2D, shaderstate.curtexnums->base); //texture not used, its just to make sure the code leaves it enabled.
GL_LazyBind(tmu, shaderstate.curtexnums->base); //texture not used, its just to make sure the code leaves it enabled.
BE_SetPassBlendMode(tmu, PBM_MODULATE_PREV_COLOUR);
shaderstate.pendingtexcoordparts[tmu] = 0;
shaderstate.pendingtexcoordvbo[tmu] = 0;
@ -4417,7 +4415,7 @@ static void BE_LegacyLighting(void)
for (i = tmu; i < shaderstate.lastpasstmus; i++)
{
GL_LazyBind(i, 0, r_nulltex);
GL_LazyBind(i, r_nulltex);
}
shaderstate.lastpasstmus = tmu;
}
@ -4427,14 +4425,14 @@ static void BE_LegacyLighting(void)
//tmu0: $diffuse+multiply+regular tex coords
//multiplies by vertex colours
GL_LazyBind(0, GL_TEXTURE_2D, shaderstate.curtexnums->base); //texture not used, its just to make sure the code leaves it enabled.
GL_LazyBind(0, shaderstate.curtexnums->base); //texture not used, its just to make sure the code leaves it enabled.
BE_SetPassBlendMode(0, PBM_MODULATE);
shaderstate.pendingtexcoordvbo[0] = shaderstate.sourcevbo->texcoord.gl.vbo;
shaderstate.pendingtexcoordpointer[0] = shaderstate.sourcevbo->texcoord.gl.addr;
for (i = 1; i < shaderstate.lastpasstmus; i++)
{
GL_LazyBind(i, 0, r_nulltex);
GL_LazyBind(i, r_nulltex);
}
shaderstate.lastpasstmus = 1;
}
@ -4646,7 +4644,7 @@ static void DrawMeshes(void)
Vector4Set(shaderstate.pendingcolourflat, 1, 1, 1, 1);
while(shaderstate.lastpasstmus>0)
{
GL_LazyBind(--shaderstate.lastpasstmus, 0, r_nulltex);
GL_LazyBind(--shaderstate.lastpasstmus, r_nulltex);
}
BE_SendPassBlendDepthMask((shaderstate.curshader->passes[0].shaderbits & ~SBITS_BLEND_BITS) | SBITS_SRCBLEND_SRC_ALPHA | SBITS_DSTBLEND_ONE_MINUS_SRC_ALPHA | ((r_wireframe.ival == 1)?SBITS_MISC_NODEPTHTEST:0));
@ -4690,7 +4688,7 @@ static void DrawMeshes(void)
Vector4Set(shaderstate.pendingcolourflat, 0, 0, 0, 1);
while(shaderstate.lastpasstmus>0)
{
GL_LazyBind(--shaderstate.lastpasstmus, 0, r_nulltex);
GL_LazyBind(--shaderstate.lastpasstmus, r_nulltex);
}
BE_SetPassBlendMode(0, PBM_REPLACE);
@ -4843,9 +4841,9 @@ static void DrawMeshes(void)
while(shaderstate.lastpasstmus>1)
{
GL_LazyBind(--shaderstate.lastpasstmus, 0, r_nulltex);
GL_LazyBind(--shaderstate.lastpasstmus, r_nulltex);
}
GL_LazyBind(0, GL_TEXTURE_2D, shaderstate.fogtexture);
GL_LazyBind(0, shaderstate.fogtexture);
shaderstate.lastpasstmus = 1;
Vector4Scale(shaderstate.curbatch->fog->shader->fog_color, (1/255.0), shaderstate.pendingcolourflat);
@ -6285,7 +6283,7 @@ void GLBE_DrawWorld (batch_t **worldbatches)
while(shaderstate.lastpasstmus>0)
{
GL_LazyBind(--shaderstate.lastpasstmus, 0, r_nulltex);
GL_LazyBind(--shaderstate.lastpasstmus, r_nulltex);
}
#ifdef RTLIGHTS
Sh_Reset();

View file

@ -630,7 +630,7 @@ void Mod_Init (qboolean initial)
Cmd_AddCommand("version_modelformats", Mod_PrintFormats_f);
#ifndef SERVERONLY
Cmd_AddCommandD("mod_findcubemaps", Mod_FindCubemaps_f, "Scans the entities of a map to find reflection envmap sites and determines the nearest one to each surface.");
Cmd_AddCommandD("mod_findcubemaps", Mod_FindCubemaps_f, "Scans the entities of a map to find reflection env_cubemap sites and determines the nearest one to each surface.");
Cmd_AddCommandD("mod_realign", Mod_Realign_f, "Reads the named bsp and writes it back out with only alignment changes.");
Cmd_AddCommandD("mod_bspx_list", Mod_BSPX_List_f, "Lists all lumps (and their sizes) in the specified bsp.");
Cmd_AddCommandD("mod_bspx_strip", Mod_BSPX_Strip_f, "Strips a named extension lump from a bsp file.");

View file

@ -3081,22 +3081,7 @@ static void Shaderpass_Map (parsestate_t *ps, const char **ptr)
flags = Shader_SetImageFlags (ps, pass, &token, 0);
if (!Shaderpass_MapGen(ps, pass, token))
{
switch((flags & IF_TEXTYPEMASK) >> IF_TEXTYPESHIFT)
{
case PTI_2D:
pass->texgen = T_GEN_SINGLEMAP;
break;
case PTI_3D:
pass->texgen = T_GEN_3DMAP;
break;
case PTI_CUBE:
pass->texgen = T_GEN_CUBEMAP;
break;
default:
pass->texgen = T_GEN_SINGLEMAP;
break;
}
pass->texgen = T_GEN_SINGLEMAP;
if (pass->tcgen == TC_GEN_UNSPECIFIED)
pass->tcgen = TC_GEN_BASE;
if (!*shader->defaulttextures->mapname && *token != '$' && pass->tcgen == TC_GEN_BASE)
@ -3186,20 +3171,7 @@ static void Shaderpass_ClampMap (parsestate_t *ps, const char **ptr)
if (pass->tcgen == TC_GEN_UNSPECIFIED)
pass->tcgen = TC_GEN_BASE;
pass->anim_frames[0] = Shader_FindImage (ps, token, flags);
switch((flags & IF_TEXTYPEMASK) >> IF_TEXTYPESHIFT)
{
default:
case PTI_2D:
pass->texgen = T_GEN_SINGLEMAP;
break;
case PTI_3D:
pass->texgen = T_GEN_3DMAP;
break;
case PTI_CUBE:
pass->texgen = T_GEN_CUBEMAP;
break;
}
pass->texgen = T_GEN_SINGLEMAP;
if (!TEXVALID(pass->anim_frames[0]))
{
@ -3921,8 +3893,8 @@ static void Shaderpass_CubeMap(parsestate_t *ps, const char **ptr)
if (pass->tcgen == TC_GEN_UNSPECIFIED)
pass->tcgen = TC_GEN_SKYBOX;
pass->texgen = T_GEN_CUBEMAP;
pass->anim_frames[0] = Shader_FindImage(ps, token, IF_TEXTYPE_CUBE);
pass->texgen = T_GEN_SINGLEMAP;
if (!TEXVALID(pass->anim_frames[0]))
{
@ -7700,8 +7672,6 @@ static char *Shader_DecomposeSubPass(char *o, shader_t *s, shaderpass_t *p, qboo
#ifdef HAVE_MEDIA_DECODER
case T_GEN_VIDEOMAP: Shader_DecomposeSubPassMap(o, s, "videomap", Media_UpdateForShader(p->cin)); break;
#endif
case T_GEN_CUBEMAP: Shader_DecomposeSubPassMap(o, s, "map $cubemap", p->anim_frames[0]); break;
case T_GEN_3DMAP: Shader_DecomposeSubPassMap(o, s, "map $3dmap", p->anim_frames[0]); break;
case T_GEN_LIGHTMAP: sprintf(o, "map $lightmap "); break;
case T_GEN_DELUXMAP: sprintf(o, "map $deluxemap "); break;
case T_GEN_SHADOWMAP: sprintf(o, "map $shadowmap "); break;

View file

@ -323,7 +323,6 @@ void Sh_PurgeShadowMeshes(void);
#ifdef GLQUAKE
void R_TranslatePlayerSkin (int playernum);
void GL_MTBind(int tmu, int target, texid_t texnum); /*use this if you're going to change the texture object (ensures glActiveTexture(tmu))*/
void GL_LazyBind(int tmu, int target, texid_t texnum); /*use this if you don't care about the active tmu, only that it is bound on that tmu (does not guarentee glActiveTexture) (ie: no glTexImage etc)*/
void GL_CullFace(unsigned int sflags);
void GL_TexEnv(GLenum mode);

View file

@ -289,8 +289,6 @@ typedef struct shaderpass_s {
#ifdef HAVE_MEDIA_DECODER
T_GEN_VIDEOMAP, //use the media playback as an image source, updating each frame for which it is visible
#endif
T_GEN_CUBEMAP, //use a cubemap instead, otherwise like T_GEN_SINGLEMAP
T_GEN_3DMAP, //use a 3d texture instead, otherwise T_GEN_SINGLEMAP.
#define GBUFFER_COUNT 8
#define T_GEN_GBUFFERCASE T_GEN_GBUFFER0:case T_GEN_GBUFFER1:case T_GEN_GBUFFER2:case T_GEN_GBUFFER3:case T_GEN_GBUFFER4:case T_GEN_GBUFFER5:case T_GEN_GBUFFER6:case T_GEN_GBUFFER7

View file

@ -17,6 +17,7 @@ char shaders[][64] =
"crepuscular_sky",
"depthonly",
"default2d",
"default2danim",
"defaultadditivesprite",
"defaultskin",
"defaultsky",

View file

@ -1,5 +1,5 @@
!!ver 100-450
!!samps 1
!!samps img=0
//this shader is present for support for gles/gl3core contexts
//it is single-texture-with-vertex-colours, and doesn't do anything special.
@ -26,7 +26,7 @@ void main ()
#ifdef PREMUL
f.rgb *= f.a;
#endif
f *= texture2D(s_t0, tc);
f *= texture2D(s_img, tc);
gl_FragColor = f;
}
#endif

View file

@ -0,0 +1,36 @@
!!ver 300-450
!!samps anim:2DArray=0
#include "sys/defs.h"
//this shader is present for support for gles/gl3core contexts
//it is single-texture-with-vertex-colours, and doesn't do anything special.
//beware that a few things use this, including apparently fonts and bloom rescaling.
//its really not meant to do anything special.
varying vec2 tc;
varying vec4 vc;
#ifdef VERTEX_SHADER
void main ()
{
tc = v_texcoord;
vc = v_colour;
gl_Position = ftetransform();
}
#endif
#ifdef FRAGMENT_SHADER
void main ()
{
//figure out which frame to use.
ivec3 sz = textureSize(s_anim, 0);
float layer = mod(e_time*10, sz.z-1);
vec4 f = vc;
#ifdef PREMUL
f.rgb *= f.a;
#endif
f *= texture(s_anim, vec3(tc, layer));
gl_FragColor = f;
}
#endif

View file

@ -1674,11 +1674,8 @@ void VKBE_Shutdown(void)
static texid_t SelectPassTexture(const shaderpass_t *pass)
{
switch(pass->texgen)
safeswitch(pass->texgen)
{
#ifndef _DEBUG
default:
#endif
case T_GEN_DIFFUSE:
return shaderstate.curtexnums->base;
case T_GEN_NORMALMAP:
@ -1715,8 +1712,6 @@ static texid_t SelectPassTexture(const shaderpass_t *pass)
case T_GEN_ANIMMAP:
return pass->anim_frames[(int)(pass->anim_fps * shaderstate.curtime) % pass->anim_numframes];
case T_GEN_3DMAP:
case T_GEN_CUBEMAP:
case T_GEN_SINGLEMAP:
return pass->anim_frames[0];
case T_GEN_DELUXMAP:
@ -1782,6 +1777,7 @@ static texid_t SelectPassTexture(const shaderpass_t *pass)
case T_GEN_GBUFFER5:
case T_GEN_GBUFFER6:
case T_GEN_GBUFFER7:
safedefault:
return r_nulltex;
}
return r_nulltex;