Skip to content

Instantly share code, notes, and snippets.

@patskovn
Created March 3, 2024 20:19
Show Gist options
  • Save patskovn/48f535daa91c10d55000d1751bc21b03 to your computer and use it in GitHub Desktop.
Save patskovn/48f535daa91c10d55000d1751bc21b03 to your computer and use it in GitHub Desktop.
struct SceneConstants {
simd_float4x4 viewMatrix;
simd_float4x4 projection;
};
vertex VertexOut vertex_main(uint vertexID [[vertex_id]],
constant VertexIn *vertices [[buffer(0)]],
constant ModelConstants &modelConstants [[buffer(1)]],
constant SceneConstants &sceneConstants [[buffer(2)]]) {
VertexIn in = vertices[vertexID];
VertexOut out;
out.position = sceneConstants.projection
* sceneConstants.viewMatrix
* modelConstants.modelMatrix
* in.position;
out.color = x.color;
return out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment