mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-28 15:12:36 +00:00
b81a77c3f7
This required making the texture set accessible to the vertex shader (instead of using a dedicated palette set), which I don't particularly like, but I don't feel like dealing with the texture code's hard-coded use of the texture set. QF style particles need something mostly for the smoke puffs as they expect a texture.
33 lines
846 B
GLSL
33 lines
846 B
GLSL
#version 450
|
|
#extension GL_GOOGLE_include_directive : enable
|
|
|
|
layout (set = 0, binding = 0) uniform
|
|
#include "matrices.h"
|
|
;
|
|
layout (set = 1, binding = 0) uniform sampler2D Palette;
|
|
|
|
layout (push_constant) uniform PushConstants {
|
|
mat4 Model;
|
|
};
|
|
|
|
layout (location = 0) in vec4 position;
|
|
layout (location = 1) in vec4 velocity;
|
|
layout (location = 2) in vec4 color;
|
|
layout (location = 3) in vec4 ramp;
|
|
|
|
layout (location = 0) out vec4 o_velocity;
|
|
layout (location = 1) out vec4 o_color;
|
|
layout (location = 2) out vec4 o_ramp;
|
|
|
|
void
|
|
main (void)
|
|
{
|
|
// geometry shader will take care of Projection
|
|
gl_Position = View * (Model * position);
|
|
o_velocity = View * (Model * velocity);
|
|
uint c = floatBitsToInt (color.x);
|
|
uint x = c & 0x0f;
|
|
uint y = (c >> 4) & 0x0f;
|
|
o_color = texture (Palette, vec2 (x, y) / 15.0);
|
|
o_ramp = ramp;
|
|
}
|