mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
6b073ee412
# Objective Add texture sampling to the GLSL shader example, as naga does not support the commonly used sampler2d type. Fixes #5059 ## Solution - Align the shader_material_glsl example behaviour with the shader_material example, as the later includes texture sampling. - Update the GLSL shader to do texture sampling the way naga supports it, and document the way naga does not support it. ## Changelog - The shader_material_glsl example has been updated to demonstrate texture sampling using the GLSL shading language. Co-authored-by: Carter Anderson <mcanders1@gmail.com>
28 lines
591 B
GLSL
28 lines
591 B
GLSL
#version 450
|
|
|
|
layout(location = 0) in vec3 Vertex_Position;
|
|
layout(location = 1) in vec3 Vertex_Normal;
|
|
layout(location = 2) in vec2 Vertex_Uv;
|
|
|
|
layout(location = 0) out vec2 v_Uv;
|
|
|
|
layout(set = 0, binding = 0) uniform CameraViewProj {
|
|
mat4 ViewProj;
|
|
mat4 View;
|
|
mat4 InverseView;
|
|
mat4 Projection;
|
|
vec3 WorldPosition;
|
|
float width;
|
|
float height;
|
|
};
|
|
|
|
layout(set = 2, binding = 0) uniform Mesh {
|
|
mat4 Model;
|
|
mat4 InverseTransposeModel;
|
|
uint flags;
|
|
};
|
|
|
|
void main() {
|
|
v_Uv = Vertex_Uv;
|
|
gl_Position = ViewProj * Model * vec4(Vertex_Position, 1.0);
|
|
}
|