mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
The matrices in the examples are given in an OpenGL-like coordinate system, while a Vulkan-like coordinate system is used by wgpu. This was previously partially corrected in the shader and by flipping the up axis of the camera, but left the x-axis mirrored in the final result. This change adds a conversion matrix to framework.rs that can be used to convert from OpenGL to wgpu. This also allows us to set the winding-order to counter-clockwise, which matches the ordering in the data.
15 lines
290 B
GLSL
15 lines
290 B
GLSL
#version 450
|
|
|
|
layout(location = 0) in vec4 a_Pos;
|
|
layout(location = 1) in vec2 a_TexCoord;
|
|
layout(location = 0) out vec2 v_TexCoord;
|
|
|
|
layout(set = 0, binding = 0) uniform Locals {
|
|
mat4 u_Transform;
|
|
};
|
|
|
|
void main() {
|
|
v_TexCoord = a_TexCoord;
|
|
gl_Position = u_Transform * a_Pos;
|
|
}
|