Depth rendering of terrain works

This commit is contained in:
Dynamitos
2023-11-10 19:18:09 +01:00
parent effb0c6214
commit c30619d07d
28 changed files with 298 additions and 502 deletions
+1
View File
@@ -9,6 +9,7 @@ struct ViewParameter
float4 cameraPos_WS;
float2 screenDimensions;
}
layout(set = 0)
ParameterBlock<ViewParameter> pViewParams;
+10 -10
View File
@@ -8,22 +8,22 @@ struct StaticMeshVertexData : IVertexData
{
VertexAttributes attributes;
MaterialParameter params;
float4 localPos = float4(positions[index], 1);
float4 localPos = float4(positions[3 * index + 0], positions[3 * index + 1], positions[3 * index + 2], 1);
float4 worldPos = mul(transform, localPos);
float4 viewPos = mul(pViewParams.viewMatrix, worldPos);
float4 clipPos = mul(pViewParams.projectionMatrix, viewPos);
params.worldPosition = worldPos.xyz;
params.texCoords = texCoords[index];
params.normal = normals[index];
params.tangent = tangents[index];
params.biTangent = biTangents[index];
params.texCoords = float2(texCoords[2 * index + 0], texCoords[2 * index + 1]);
params.normal = float3(normals[3 * index + 0], normals[3 * index + 1], normals[3 * index + 2]);
params.tangent = float3(tangents[3 * index + 0], tangents[3 * index + 1], tangents[3 * index + 2]);
params.biTangent = float3(biTangents[3 * index + 0], biTangents[3 * index + 1], biTangents[3 * index + 2]);
attributes.parameter = params;
attributes.clipPosition = clipPos;
return attributes;
}
StructuredBuffer<float3> positions;
StructuredBuffer<float2> texCoords;
StructuredBuffer<float3> normals;
StructuredBuffer<float3> tangents;
StructuredBuffer<float3> biTangents;
StructuredBuffer<float> positions;
StructuredBuffer<float> texCoords;
StructuredBuffer<float> normals;
StructuredBuffer<float> tangents;
StructuredBuffer<float> biTangents;
};
+1
View File
@@ -4,4 +4,5 @@ interface IVertexData
{
VertexAttributes getAttributes(uint index, float4x4 transform);
};
layout(set = 1)
ParameterBlock<IVertexData> pVertexData;