wren
Vulkan-based game engine
Loading...
Searching...
No Matches
wren::shaders Namespace Reference

Variables

const std::string_view kEditorVertShader
 
const std::string_view kEditorFragShader
 
const std::string_view kMeshVertShader
 
const std::string_view kMeshFragShader
 
std::string_view const TRIANGLE_VERT_SHADER
 
std::string_view const TRIANGLE_FRAG_SHADER
 

Variable Documentation

◆ kEditorFragShader

const std::string_view wren::shaders::kEditorFragShader
Initial value:
= R"(
#version 450
layout(location = 0) out vec4 out_colour;
layout(location = 1) in vec3 near_point;
layout(location = 2) in vec3 far_point;
void main() {
float t = -near_point.y / (far_point.y - near_point.y);
// out_colour = vec4(1.0, 0.0, 0.0, 1.0 * float(t > 0));
out_colour = vec4(1.0, 0.0, 0.0, t);
}
)"

◆ kEditorVertShader

const std::string_view wren::shaders::kEditorVertShader

◆ kMeshFragShader

const std::string_view wren::shaders::kMeshFragShader
Initial value:
= R"(
#version 450
layout(location = 0) in vec3 in_color;
layout(location = 0) out vec4 out_color;
void main() {
out_color = vec4(in_color, 1.0);
}
)"

◆ kMeshVertShader

const std::string_view wren::shaders::kMeshVertShader
Initial value:
= R"(
#version 450
layout(location = 0) in vec3 in_position;
layout(location = 1) in vec3 in_color;
layout(binding = 0) uniform GLOBALS {
mat4 view;
mat4 proj;
} globals;
layout(binding = 1) uniform LOCALS {
mat4 model;
} locals;
layout(location = 0) out vec3 out_color;
void main() {
gl_Position = globals.proj * globals.view * locals.model * vec4(in_position, 1.0);
out_color = in_color;
}
)"

◆ TRIANGLE_FRAG_SHADER

std::string_view const wren::shaders::TRIANGLE_FRAG_SHADER
Initial value:
= R"(
#version 450
layout(location = 0) in vec3 fragColor;
layout(location = 0) out vec4 outColor;
void main() {
outColor = vec4(fragColor, 1.0);
}
)"

◆ TRIANGLE_VERT_SHADER

std::string_view const wren::shaders::TRIANGLE_VERT_SHADER
Initial value:
= R"(
#version 450
layout(location = 0) out vec3 fragColor;
vec2 positions[3] = vec2[](
vec2(0.0, -0.5),
vec2(0.5, 0.5),
vec2(-0.5, 0.5)
);
vec3 colors[3] = vec3[](
vec3(1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0),
vec3(0.0, 0.0, 1.0)
);
void main() {
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
fragColor = colors[gl_VertexIndex];
}
)"