summaryrefslogtreecommitdiff
path: root/assets/shaders/cube.metal
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-10-19 13:24:31 +1100
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-10-19 13:24:31 +1100
commit6182860f1b1aba4128b4f66eda7977600e60d1a0 (patch)
tree388d9aff8ca19ef324633ac1bea43f1548675150 /assets/shaders/cube.metal
parent5d1750d9adfc45b53c75310c58e31dfdbd8a6e15 (diff)
parentd6d742f8a24490f885e4a1ae3fea7ec46b01f58c (diff)
fix merge
Diffstat (limited to 'assets/shaders/cube.metal')
-rw-r--r--assets/shaders/cube.metal29
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