mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-31 08:41:11 +00:00
Implement particles as points.
Unfortunately, the maximum point size on Intel hardwar seems to be 1, so I can't tell if the colors are right. This is largely just a hacked version of GL's particle code.
This commit is contained in:
parent
63893b6a2f
commit
5e1a80e016
6 changed files with 1752 additions and 174 deletions
42
include/QF/GLSL/qf_particles.h
Normal file
42
include/QF/GLSL/qf_particles.h
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
qf_particles.h
|
||||||
|
|
||||||
|
GLSL specific particles stuff
|
||||||
|
|
||||||
|
Copyright (C) 2012 Bill Currie <bill@taniwha.org>
|
||||||
|
|
||||||
|
Author: Bill Currie <bill@taniwha.org>
|
||||||
|
Date: 2012/1/15
|
||||||
|
|
||||||
|
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$
|
||||||
|
*/
|
||||||
|
#ifndef __QF_GLSL_qf_bsp_h
|
||||||
|
#define __QF_GLSL_qf_bsp_h
|
||||||
|
|
||||||
|
#include "QF/GLSL/types.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
float texcoord[2];
|
||||||
|
float vertex[3];
|
||||||
|
byte color[4];
|
||||||
|
} partvert_t;
|
||||||
|
|
||||||
|
#endif//__QF_GLSL_qf_bsp_h
|
|
@ -5,12 +5,12 @@ INCLUDES= -I$(top_srcdir)/include $(GLX_CFLAGS)
|
||||||
|
|
||||||
shader_src= \
|
shader_src= \
|
||||||
quake2d.frag quakebsp.frag quakebsp.vert quakeico.vert quakemdl.frag \
|
quake2d.frag quakebsp.frag quakebsp.vert quakeico.vert quakemdl.frag \
|
||||||
quakemdl.vert quakeskb.frag quakeski.frag quakesky.vert \
|
quakemdl.vert quakepnt.frag quakepnt.vert quakeskb.frag quakeski.frag \
|
||||||
quakespr.frag quakespr.vert quaketrb.frag quaketxt.vert
|
quakesky.vert quakespr.frag quakespr.vert quaketrb.frag quaketxt.vert
|
||||||
shader_gen= \
|
shader_gen= \
|
||||||
quake2d.fc quakebsp.fc quakebsp.vc quakeico.vc quakemdl.fc quakemdl.vc \
|
quake2d.fc quakebsp.fc quakebsp.vc quakeico.vc quakemdl.fc quakemdl.vc \
|
||||||
quakeskb.fc quakeski.fc quakesky.vc quakespr.fc quakespr.vc quaketrb.fc \
|
quakepnt.fc quakepnt.vc quakeskb.fc quakeski.fc quakesky.vc quakespr.fc \
|
||||||
quaketxt.vc
|
quakespr.vc quaketrb.fc quaketxt.vc
|
||||||
|
|
||||||
glsl_src = \
|
glsl_src = \
|
||||||
glsl_alias.c glsl_bsp.c glsl_draw.c glsl_lightmap.c glsl_main.c \
|
glsl_alias.c glsl_bsp.c glsl_draw.c glsl_lightmap.c glsl_main.c \
|
||||||
|
|
|
@ -218,6 +218,7 @@ R_RenderView (void)
|
||||||
R_DrawSky ();
|
R_DrawSky ();
|
||||||
R_RenderEntities ();
|
R_RenderEntities ();
|
||||||
R_DrawWaterSurfaces ();
|
R_DrawWaterSurfaces ();
|
||||||
|
R_DrawParticles ();
|
||||||
R_DrawViewModel ();
|
R_DrawViewModel ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,6 @@
|
||||||
//precision mediump float;
|
//precision mediump float;
|
||||||
|
uniform sampler2D palette;
|
||||||
|
|
||||||
varying float color;
|
varying float color;
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -6,5 +8,5 @@ main (void)
|
||||||
{
|
{
|
||||||
if (color == 1.0)
|
if (color == 1.0)
|
||||||
discard;
|
discard;
|
||||||
gl_FragColor = texture2D (palette, vec2 (pix, 0.0));
|
gl_FragColor = texture2D (palette, vec2 (color, 0.0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
uniform mat4 mvp_mat;
|
uniform mat4 mvp_mat;
|
||||||
|
attribute float vcolor;
|
||||||
/** Vertex position.
|
/** Vertex position.
|
||||||
|
|
||||||
x, y, z, c
|
x, y, z, c
|
||||||
|
|
||||||
c is the color of the point.
|
c is the color of the point.
|
||||||
*/
|
*/
|
||||||
attribute vec4 vertex;
|
attribute vec3 vertex;
|
||||||
|
|
||||||
varying float color;
|
varying float color;
|
||||||
|
|
||||||
void
|
void
|
||||||
main (void)
|
main (void)
|
||||||
{
|
{
|
||||||
gl_Position = mvp_mat * vec4 (vertex.xyz, 1.0);
|
gl_Position = mvp_mat * vec4 (vertex, 1.0);
|
||||||
gl_PointSize = max (1, 32768.0 * abs (1.0 / gl_Position.z));
|
gl_PointSize = max (1, 32768.0 * abs (1.0 / gl_Position.z));
|
||||||
color = vertex.w;
|
color = vcolor;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue