blob: 93fa727aafedd8331943569d3a661def1c2e5d2d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#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.position = transformationData->modelMatrix * vertexData[vertexID].position;
// out.position = vertexData[vertexID].position;
out.textureCoordinate = vertexData[vertexID].texCoords;
return out;
}
|