2023-10-07 19:29:53 +02:00
|
|
|
import Common;
|
2023-11-08 23:27:21 +01:00
|
|
|
import VertexData;
|
|
|
|
|
import MaterialParameter;
|
2023-10-07 19:29:53 +02:00
|
|
|
|
2023-11-08 23:27:21 +01:00
|
|
|
struct StaticMeshVertexData : IVertexData
|
2023-10-07 19:29:53 +02:00
|
|
|
{
|
2023-11-27 21:08:27 +01:00
|
|
|
VertexAttributes getAttributes(uint index)
|
2023-10-07 19:29:53 +02:00
|
|
|
{
|
2023-11-09 22:15:51 +01:00
|
|
|
VertexAttributes attributes;
|
2023-11-27 21:08:27 +01:00
|
|
|
attributes.position_MS = float3(positions[3 * index + 0], positions[3 * index + 1], positions[3 * index + 2]);
|
2023-11-13 09:07:23 +01:00
|
|
|
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]);
|
2024-05-06 18:36:16 +02:00
|
|
|
for(uint i = 0; i < MAX_TEXCOORDS; ++i)
|
|
|
|
|
{
|
|
|
|
|
attributes.texCoords[i] = float2(texCoords[i][2 * index + 0], texCoords[i][2 * index + 1]);
|
|
|
|
|
}
|
2023-11-13 09:07:23 +01:00
|
|
|
attributes.vertexColor = float3(color[3 * index + 0], color[3 * index + 1], color[3 * index + 2]);
|
2023-11-09 22:15:51 +01:00
|
|
|
return attributes;
|
2023-10-07 19:29:53 +02:00
|
|
|
}
|
2023-11-10 19:18:09 +01:00
|
|
|
StructuredBuffer<float> positions;
|
|
|
|
|
StructuredBuffer<float> normals;
|
|
|
|
|
StructuredBuffer<float> tangents;
|
|
|
|
|
StructuredBuffer<float> biTangents;
|
2023-11-11 22:39:17 +01:00
|
|
|
StructuredBuffer<float> color;
|
2024-05-06 18:36:16 +02:00
|
|
|
StructuredBuffer<float> texCoords[MAX_TEXCOORDS];
|
2023-11-08 23:27:21 +01:00
|
|
|
};
|