diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-10-19 13:24:31 +1100 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-10-19 13:24:31 +1100 |
commit | 6182860f1b1aba4128b4f66eda7977600e60d1a0 (patch) | |
tree | 388d9aff8ca19ef324633ac1bea43f1548675150 /assets/shaders/cube.metal | |
parent | 5d1750d9adfc45b53c75310c58e31dfdbd8a6e15 (diff) | |
parent | d6d742f8a24490f885e4a1ae3fea7ec46b01f58c (diff) |
fix merge
Diffstat (limited to 'assets/shaders/cube.metal')
-rw-r--r-- | assets/shaders/cube.metal | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/assets/shaders/cube.metal b/assets/shaders/cube.metal new file mode 100644 index 0000000..dc7ace1 --- /dev/null +++ b/assets/shaders/cube.metal @@ -0,0 +1,29 @@ +#include <metal_stdlib> +using namespace metal; + +struct VertexData { + float4 position; + float4 normal; + float2 texCoords; +}; + +struct VertexOut { + float4 position [[position]]; + float2 textureCoordinate; +}; + +struct TransformationData { + float4x4 modelMatrix; + float4x4 viewMatrix; + float4x4 perspectiveMatrix; +}; + +vertex VertexOut cubeVertexShader(uint vertexID [[vertex_id]], + constant VertexData* vertexData, + constant TransformationData* transformationData) +{ + VertexOut out; + out.position = transformationData->perspectiveMatrix * transformationData->viewMatrix * transformationData->modelMatrix * vertexData[vertexID].position; + out.textureCoordinate = vertexData[vertexID].texCoords; + return out; +}
\ No newline at end of file |