mirror of
https://github.com/GayPizzaSpecifications/voxelotl-engine.git
synced 2025-08-03 13:11:33 +00:00
cube defender of the polyverse
This commit is contained in:
@ -6,7 +6,8 @@ using namespace metal;
|
||||
|
||||
struct FragmentInput {
|
||||
float4 position [[position]];
|
||||
float4 color;
|
||||
float4 normal;
|
||||
float2 texCoord;
|
||||
};
|
||||
|
||||
vertex FragmentInput vertexMain(
|
||||
@ -14,11 +15,18 @@ vertex FragmentInput vertexMain(
|
||||
device const ShaderVertex* vtx [[buffer(ShaderInputIdxVertices)]]
|
||||
) {
|
||||
FragmentInput out;
|
||||
out.position = vtx[vertexID].position;
|
||||
out.color = vtx[vertexID].color;
|
||||
out.position = vtx[vertexID].position * float4(0.5, 0.5, 0.5, 1.0);
|
||||
out.normal = vtx[vertexID].normal;
|
||||
out.texCoord = vtx[vertexID].texCoord;
|
||||
return out;
|
||||
}
|
||||
|
||||
fragment float4 fragmentMain(FragmentInput in [[stage_in]]) {
|
||||
return in.color;
|
||||
fragment half4 fragmentMain(
|
||||
FragmentInput in [[stage_in]],
|
||||
texture2d<half, access::sample> tex [[texture(0)]]
|
||||
) {
|
||||
constexpr sampler s(address::repeat, filter::nearest);
|
||||
half4 albedo = tex.sample(s, in.texCoord);
|
||||
|
||||
return half4(albedo.rgb, 1.0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user