From b871f3a4718c42a33920f63a96ccc554ba2bfc2b Mon Sep 17 00:00:00 2001 From: Lightling Date: Sat, 5 Feb 2022 21:59:53 -0500 Subject: [PATCH] shader changes for world matrices --- BufferStructs.h | 2 +- VertexShader.hlsl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BufferStructs.h b/BufferStructs.h index a7bda48..a8951ce 100644 --- a/BufferStructs.h +++ b/BufferStructs.h @@ -5,5 +5,5 @@ struct VertexShaderExternalData { DirectX::XMFLOAT4 colorTint; - DirectX::XMFLOAT3 offset; + DirectX::XMFLOAT4X4 world; }; diff --git a/VertexShader.hlsl b/VertexShader.hlsl index 5c13cc8..17d8b36 100644 --- a/VertexShader.hlsl +++ b/VertexShader.hlsl @@ -1,7 +1,7 @@ cbuffer ExternalData : register(b0) { float4 colorTint; - float3 offset; + matrix world; } // Struct representing a single vertex worth of data @@ -56,7 +56,7 @@ VertexToPixel main( VertexShaderInput input ) // - Each of these components is then automatically divided by the W component, // which we're leaving at 1.0 for now (this is more useful when dealing with // a perspective projection matrix, which we'll get to in the future). - output.screenPosition = float4(input.localPosition + offset, 1.0f); + output.screenPosition = mul(world, float4(input.localPosition, 1.0f)); // Pass the color through // - The values will be interpolated per-pixel by the rasterizer