Reducing startup time significantly

This commit is contained in:
Dynamitos
2023-11-13 09:07:23 +01:00
parent b3c9af384b
commit a545426b32
11 changed files with 134 additions and 62 deletions
+9 -11
View File
@@ -7,19 +7,17 @@ struct StaticMeshVertexData : IVertexData
VertexAttributes getAttributes(uint index, float4x4 transform)
{
VertexAttributes attributes;
MaterialParameter params;
float4 localPos = float4(positions[3 * index + 0], positions[3 * index + 1], positions[3 * index + 2], 1);
float4 worldPos = mul(transform, localPos);
float4 modelPos = float4(positions[3 * index + 0], positions[3 * index + 1], positions[3 * index + 2], 1);
float4 worldPos = mul(transform, modelPos);
float4 viewPos = mul(pViewParams.viewMatrix, worldPos);
float4 clipPos = mul(pViewParams.projectionMatrix, viewPos);
params.worldPosition = worldPos.xyz;
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]);
params.vertexColor = float3(color[3 * index + 0], color[3 * index + 1], color[3 * index + 2]);
attributes.parameter = params;
attributes.clipPosition = clipPos;
attributes.normal_MS = float3(normals[3 * index + 0], normals[3 * index + 1], normals[3 * index + 2]);
attributes.tangent_MS = float3(tangents[3 * index + 0], tangents[3 * index + 1], tangents[3 * index + 2]);
attributes.biTangent_MS = float3(biTangents[3 * index + 0], biTangents[3 * index + 1], biTangents[3 * index + 2]);
attributes.position_WS = worldPos.xyz;
attributes.position_CS = clipPos;
attributes.texCoords = float2(texCoords[2 * index + 0], texCoords[2 * index + 1]);
attributes.vertexColor = float3(color[3 * index + 0], color[3 * index + 1], color[3 * index + 2]);
return attributes;
}
StructuredBuffer<float> positions;