Add MeshDeformation utility for generic meshes vertices morphing (eg. via Blend Shapes or Cloth)

This commit is contained in:
Wojtek Figat
2023-07-03 09:49:23 +02:00
parent 60181a29a3
commit 99ee0b1bfe
26 changed files with 600 additions and 368 deletions

View File

@@ -16,6 +16,7 @@ API_CLASS(NoSpawn) class FLAXENGINE_API SkinnedModelLOD : public ScriptingObject
friend SkinnedModel;
private:
SkinnedModel* _model = nullptr;
int32 _lodIndex = 0;
public:
/// <summary>
@@ -28,10 +29,22 @@ public:
/// </summary>
API_FIELD(ReadOnly) Array<SkinnedMesh> Meshes;
/// <summary>
/// Gets the model LOD index.
/// </summary>
API_PROPERTY() FORCE_INLINE int32 GetLODIndex() const
{
return _lodIndex;
}
/// <summary>
/// Determines whether any mesh has been initialized.
/// </summary>
bool HasAnyMeshInitialized() const;
bool HasAnyMeshInitialized() const
{
// Note: we initialize all meshes at once so the last one can be used to check it.
return Meshes.HasItems() && Meshes.Last().IsInitialized();
}
public:
/// <summary>
@@ -81,6 +94,14 @@ public:
/// <returns>Bounding box</returns>
BoundingBox GetBox(const Matrix& world) const;
/// <summary>
/// Get model bounding box in transformed world.
/// </summary>
/// <param name="transform">The instance transformation.</param>
/// <param name="deformation">The meshes deformation container (optional).</param>
/// <returns>Bounding box</returns>
BoundingBox GetBox(const Transform& transform, const MeshDeformation* deformation = nullptr) const;
/// <summary>
/// Get model bounding box in transformed world for given instance buffer for only one mesh
/// </summary>