mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-24 20:51:35 +00:00
[glsl] Apply an old debug stash for trails
The code is mostly disabled, but this should prevent too much bitrot.
This commit is contained in:
parent
5311f9906a
commit
4554ea47b0
2 changed files with 27 additions and 6 deletions
|
@ -81,8 +81,15 @@ static const char *particle_trail_frag_effects[] =
|
|||
0
|
||||
};
|
||||
|
||||
static const char *particle_trail_debug_frag_effects[] =
|
||||
{
|
||||
"QuakeForge.Fragment.barycentric",
|
||||
0
|
||||
};
|
||||
|
||||
static struct {
|
||||
int program;
|
||||
int debug_program;
|
||||
shaderparam_t proj;
|
||||
shaderparam_t view;
|
||||
shaderparam_t viewport;
|
||||
|
@ -95,7 +102,7 @@ static struct {
|
|||
shaderparam_t colora;
|
||||
shaderparam_t colorb;
|
||||
} trail = {
|
||||
0,
|
||||
0, 0,
|
||||
{"projection_mat", 1},
|
||||
{"view_mat", 1},
|
||||
{"viewport", 1},
|
||||
|
@ -199,15 +206,21 @@ glsl_R_ShutdownParticles (void)
|
|||
void
|
||||
glsl_R_InitParticles (void)
|
||||
{
|
||||
shader_t *vert_shader, *frag_shader;
|
||||
shader_t *vert_shader, *frag_shader, *debug_shader;
|
||||
int vert;
|
||||
int frag;
|
||||
int debug;
|
||||
|
||||
vert_shader = GLSL_BuildShader (particle_trail_vert_effects);
|
||||
frag_shader = GLSL_BuildShader (particle_trail_frag_effects);
|
||||
debug_shader = GLSL_BuildShader (particle_trail_debug_frag_effects);
|
||||
vert = GLSL_CompileShader ("trail.vert", vert_shader, GL_VERTEX_SHADER);
|
||||
frag = GLSL_CompileShader ("trail.frag", frag_shader, GL_FRAGMENT_SHADER);
|
||||
debug = GLSL_CompileShader ("trail.frag.debug", debug_shader,
|
||||
GL_FRAGMENT_SHADER);
|
||||
trail.program = GLSL_LinkProgram ("trail", vert, frag);
|
||||
trail.debug_program = GLSL_LinkProgram ("trail.debug", vert, debug);
|
||||
|
||||
GLSL_ResolveShaderParam (trail.program, &trail.proj);
|
||||
GLSL_ResolveShaderParam (trail.program, &trail.view);
|
||||
GLSL_ResolveShaderParam (trail.program, &trail.viewport);
|
||||
|
@ -254,7 +267,7 @@ new_trail_point (vec4f_t origin, float pscale, float percent)
|
|||
.p.vel = {},
|
||||
.p.live = 2.0 - percent * 2.0,
|
||||
// .p.ramp = ramp,XXX
|
||||
// .p.physics = R_ParticlePhysics ("pt_float"),XXX
|
||||
// .p.physics = R_ParticlePhysics ("pt_float"),XXX pt_static for debug
|
||||
};
|
||||
|
||||
return point;
|
||||
|
@ -310,7 +323,7 @@ set_vertex (trailvtx_t *v, const point_t *point, float w, const vec3_t bary,
|
|||
{
|
||||
VectorCopy (point->p.pos, v->vertex);
|
||||
VectorCopy (bary, v->bary);
|
||||
v->vertex[3] = w * point->p.scale;
|
||||
v->vertex[3] = w * point->p.scale;// just w for debug
|
||||
v->texoff = off;
|
||||
VectorCopy (point->p.color, v->colora);
|
||||
v->colora[3] = point->p.alpha * 1.2;
|
||||
|
|
|
@ -728,18 +728,23 @@ main (void)
|
|||
//gl_FragColor = texture2D (smoke, texcoord) * vec4 (1.0, 1.0, 1.0, 0.7);
|
||||
vec3 tex3 = vec3 (texcoord, 0.5);
|
||||
float n = abs(snoise(tex3));
|
||||
float a = sqrt(1.0 - texcoord.y * texcoord.y);
|
||||
n += 0.5 * abs(snoise(tex3 * 2.0));
|
||||
n += 0.25 * abs(snoise(tex3 * 4.0));
|
||||
n += 0.125 * abs(snoise(tex3 * 8.0));
|
||||
vec4 c = colora + colorb * n;
|
||||
#if 1
|
||||
float a = sqrt(1.0 - texcoord.y * texcoord.y);
|
||||
c.a *= a;
|
||||
#else
|
||||
c.a *= 1.0 - exp (-2.0 * (1.0 - sqrt(texcoord.y * texcoord.y)));
|
||||
#endif
|
||||
gl_FragColor = c;
|
||||
}
|
||||
|
||||
-- Fragment.barycentric
|
||||
|
||||
varying vec3 vbarycentric;
|
||||
varying vec2 texcoord;
|
||||
|
||||
float
|
||||
edgeFactor (void)
|
||||
|
@ -752,7 +757,10 @@ edgeFactor (void)
|
|||
void
|
||||
main (void)
|
||||
{
|
||||
gl_FragColor = vec4 (vec3 (edgeFactor ()), 0.5);
|
||||
//gl_FragColor = vec4 (vec3 (edgeFactor ()), 0.5);
|
||||
vec4 c = vec4 (vec3 (edgeFactor ()), 0.5);
|
||||
c.a *= 1.0 - exp (-4.0 * (1.0 - texcoord.y * texcoord.y));
|
||||
gl_FragColor = c;
|
||||
}
|
||||
-- version.130
|
||||
#version 130
|
||||
|
|
Loading…
Reference in a new issue