You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Gems/NvCloth/Code/Source/System/Fabric.h

57 lines
1.7 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <NvCloth/Types.h>
#include <System/NvTypes.h>
namespace NvCloth
{
//! Fabric objects are the instances of FabricCookedData.
//! There will be only one Fabric created per FabricCookedData,
//! hold by SystemComponent and identified by FabricId.
//!
//! It has a counter of how many Cloth instances have been created using this fabric,
//! the moment the counter is zero (when the last cloth using this fabric has been destroyed)
//! th fabric will be automatically destroyed.
class Fabric
{
public:
Fabric(
const FabricCookedData& cookedData,
NvFabricUniquePtr nvFabric)
: m_id(cookedData.m_id)
, m_nvFabric(AZStd::move(nvFabric))
, m_cookedData(cookedData)
{
}
//! Returns the list of phase types (horizontal, vertical, bending or shearing)
//! created for the fabric when it was cooked.
const AZStd::vector<int32_t>& GetPhaseTypes() const
{
return m_cookedData.m_internalData.m_phaseTypes;
}
//! Fabric unique id.
//! @note It is the same id from its FabricCookedData.
FabricId m_id;
//! NvCloth fabric object.
NvFabricUniquePtr m_nvFabric;
//! Fabric cooked data used to construct this fabric.
FabricCookedData m_cookedData;
//! Counter of Cloth instances created with this fabric.
int m_numClothsUsingFabric = 0;
};
} // namespace NvCloth