-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented Index and Constant Buffers
- Loading branch information
1 parent
1da10b1
commit 90a7452
Showing
10 changed files
with
128 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <metal_stdlib> | ||
using namespace metal; | ||
|
||
struct VertexOut { | ||
float4 position [[position]]; | ||
float4 color; | ||
}; | ||
|
||
fragment float4 SpinningCubePS(VertexOut in [[stage_in]]) | ||
{ | ||
return in.color; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <metal_stdlib> | ||
using namespace metal; | ||
|
||
struct TransformationData | ||
{ | ||
float4x4 modelMatrix; | ||
float4x4 viewMatrix; | ||
float4x4 perspectiveMatrix; | ||
}; | ||
|
||
struct VertexOut | ||
{ | ||
float4 position [[position]]; | ||
float4 color; | ||
}; | ||
|
||
vertex VertexOut SpinningCubeVS(uint vertexID [[vertex_id]], constant VertexOut* vertexData, constant TransformationData* transformationData) | ||
{ | ||
VertexOut out; | ||
|
||
float4 vertexPosition = vertexData[vertexID].position; | ||
|
||
float4x4 ModelView = transformationData->viewMatrix * transformationData->modelMatrix; | ||
float4x4 ModelViewProjection = transformationData->perspectiveMatrix * ModelView; | ||
|
||
out.position = ModelViewProjection * vertexPosition; | ||
out.color = vertexData[vertexID].color; | ||
|
||
return out; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters