Add normals computing to cloth mesh

This commit is contained in:
Wojtek Figat
2023-07-16 12:02:33 +02:00
parent f0496d53e8
commit 31943ca9bd
5 changed files with 107 additions and 12 deletions

View File

@@ -127,7 +127,7 @@ void MeshDeformation::RunDeformers(const MeshBase* mesh, MeshBufferType type, GP
}
if (!deformation)
{
deformation = New<MeshDeformationData>(key, vertexStride);
deformation = New<MeshDeformationData>(key, type, vertexStride);
deformation->VertexBuffer.Data.Resize(vertexBuffer->GetSize());
deformation->Bounds = mesh->GetBox();
_deformations.Add(deformation);

View File

@@ -13,14 +13,16 @@
struct MeshDeformationData
{
uint64 Key;
MeshBufferType Type;
uint32 DirtyMinIndex = 0;
uint32 DirtyMaxIndex = MAX_uint32 - 1;
bool Dirty = true;
BoundingBox Bounds;
DynamicVertexBuffer VertexBuffer;
MeshDeformationData(uint64 key, uint32 stride)
MeshDeformationData(uint64 key, MeshBufferType type, uint32 stride)
: Key(key)
, Type(type)
, VertexBuffer(0, stride, TEXT("MeshDeformation"))
{
}