diff options
| author | vimene <vincent.menegaux@gmail.com> | 2025-12-24 01:38:45 +0100 |
|---|---|---|
| committer | vimene <vincent.menegaux@gmail.com> | 2025-12-24 01:38:45 +0100 |
| commit | 00370c21f107ff2a320fbdef170e24a8b5cda92a (patch) | |
| tree | 04ff3e32e88e0acdfe0783947a0f2510d0520a1f /src/shaders | |
| parent | 236b6a3160cd3d8c217a966aaa2795c779c13a91 (diff) | |
| download | engine-00370c21f107ff2a320fbdef170e24a8b5cda92a.tar.gz | |
added uniform buffers, small tweaks
- fixed aspect ratio being the inverse of what it's supposed to be
- use std::chrono::high_resolution_clock instead of system_clock
- convert ellapsed time to float representing seconds
- renamed engine::math::Matrix4::projection to perspective
- use [0,1] instead of [-1,1] for the range of z values, to be aligned
with vulkan
- added engine::math::Matrix4::{look_at,transpose}
Diffstat (limited to 'src/shaders')
| -rw-r--r-- | src/shaders/shader.slang | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/shaders/shader.slang b/src/shaders/shader.slang index 37041c6..24d9946 100644 --- a/src/shaders/shader.slang +++ b/src/shaders/shader.slang @@ -3,6 +3,12 @@ struct VertexInput { float3 col; }; +struct UniformBuffer { + float4x4 model, view, proj; +}; + +ConstantBuffer<UniformBuffer> ubo; + struct VertexOutput { float4 pos : SV_Position; float3 col; @@ -11,7 +17,8 @@ struct VertexOutput { [shader("vertex")] VertexOutput vert_main(VertexInput vi) { VertexOutput vo; - vo.pos = float4(vi.pos, 0., 1.); + // vo.pos = float4(vi.pos, 0., 1.); + vo.pos = mul(ubo.proj, mul(ubo.view, mul(ubo.model, float4(vi.pos, 0., 1.)))); vo.col = vi.col; return vo; } |
