COSC-3P98-Assigment-3/include/shaders/vertex.vert

25 lines
507 B
GLSL
Raw Normal View History

2023-04-01 15:48:31 -04:00
#ifdef __cplusplus
#include <string>
std::string shader_vert = R"("
#version 460
layout (location = 0) in vec3 vertex;
layout (location = 1) in vec2 uv;
layout (location = 2) in vec4 pos;
layout (location = 3) in vec4 dir;
out vec2 uv_;
2023-04-02 14:52:03 -04:00
out float index;
2023-04-01 15:48:31 -04:00
uniform mat4 pvm;
void main() {
// passthough the UV (OpenGL interpolates this per fragment)
uv_ = uv;
2023-04-02 14:52:03 -04:00
index = pos.w;
2023-04-01 15:48:31 -04:00
// offset the vertex by the particle's position
gl_Position = pvm * vec4(vertex + pos.xyz, 1.0);
}
")";
#endif