Search Results for

    Show / Hide Table of Contents

    Class SkinnedModel

    Skinned model asset that contains model object made of meshes that can be rendered on the GPU using skeleton bones skinning.

    Inheritance
    Object
    ScriptingObject
    ManagedScriptingObject
    Asset
    BinaryAsset
    ModelBase
    SkinnedModel
    Inherited Members
    Asset::_deleteFileOnUnload
    BinaryAsset::_dependantAssets
    ScriptingObject::_gcHandle
    StreamableResource::_group
    BinaryAsset::_header
    ScriptingObject::_id
    ModelBase::_initialized
    StreamableResource::_isDynamic
    BinaryAsset::_isSaving
    StreamableResource::_isStreaming
    Asset::_isVirtual
    ModelBase::_loadedLODs
    Asset::_loadingTask
    Asset::_loadState
    Asset::_refCount
    BinaryAsset::_storageRef
    StreamableResource::_streamingQuality
    ModelBase::_streamingTask
    ScriptingObject::_type
    BinaryAsset::AddDependency(BinaryAsset* asset)
    Asset::AddReference()
    Asset::Asset(const SpawnParams& params, const AssetInfo* info)
    ModelBase::CanBeRendered()
    ModelBase::CanBeUpdated()
    ScriptingObject::CanCast(const ScriptingTypeHandle& from, const ScriptingTypeHandle& to)
    ScriptingObject::CanCast(const MClass* from, const MClass* to)
    ModelBase::CancelStreaming()
    ModelBase::CancelStreamingTasks()
    ScriptingObject::Cast(ScriptingObject* obj)
    Asset::ChangeID(const Guid& newId)
    ModelBase::ClampLODIndex(int32 index)
    BinaryAsset::ClearDependencies()
    Asset::const
    BinaryAsset::createLoadingTask()
    Asset::CreateManaged()
    ScriptingObject::CreateManagedInternal()
    ModelBase::CreateStreamingTask(int32 residency)
    Asset::DECLARE_ENUM_7(LoadResult, Ok, Failed, MissingDataChunk, CannotLoadData, CannotLoadStorage, CannotLoadInitData, InvalidData)
    ScriptingObject::Deleted
    Asset::DeleteManaged()
    Object::DeleteObject(float timeToLive = 0.0f, bool useGameTime=false)
    Object::DeleteObjectNow()
    BinaryAsset::Dependencies
    Asset::DEPRECATED("Use GetReferences with assets and files parameter instead")
    Asset::DestroyManaged()
    SkinnedModel
    Object::Flags
    ScriptingObject::FromInterface(void* interfaceObj, const ScriptingTypeHandle& interfaceType)
    ScriptingObject::FromInterface(T* interfaceObj)
    BinaryAsset::GetChunk(int32 index)
    BinaryAsset::GetChunkData(int32 index, BytesContainer& data)
    BinaryAsset::GetChunkSize(int32 index)
    ScriptingObject::GetClass()
    ModelBase::GetCurrentResidency()
    StreamableResource::GetGroup()
    ScriptingObject::GetID()
    BinaryAsset::GetImportMetadata(String& path, String& username)
    BinaryAsset::GetImportPath()
    ModelBase::GetLoadedLODs()
    ModelBase::GetLODData(int32 lodIndex, BytesContainer& data)
    ScriptingObject::GetManagedInstance()
    ModelBase::GetMaterialSlotsCount()
    BinaryAsset::GetOrCreateChunk(int32 index)
    ScriptingObject::GetOrCreateManagedInstance()
    BinaryAsset::GetPath()
    ModelBase::GetReferences(Array<Guid>& assets, Array<String>& files)
    Asset::GetReferences(Array<Guid, HeapAllocation>& assets, Array<String, HeapAllocation>& files)
    Asset::GetReferences()
    Asset::GetReferencesCount()
    BinaryAsset::GetSerializedVersion()
    ModelBase::GetSlot(const StringView& name)
    StreamableResource::GetStreamingQuality()
    StreamableResource::GetTargetResidency()
    ScriptingObject::GetType()
    ScriptingObject::GetTypeHandle()
    Asset::GetTypeName()
    BinaryAsset::HasChunk(int32 index)
    BinaryAsset::HasChunkLoaded(int32 index)
    BinaryAsset::HasDependenciesModified()
    ScriptingObject::HasManagedInstance()
    ModelBase::HighestResidentLODIndex()
    BinaryAsset::init(AssetInitData& initData)
    BinaryAsset::Init(const FlaxStorageReference& storage, AssetHeader& header)
    BinaryAsset::Init(AssetInitData& initData)
    BinaryAsset::InitVirtual(AssetInitData& initData)
    ScriptingObject::Is(const ScriptingTypeHandle& type)
    ScriptingObject::Is(const MClass* type)
    ScriptingObject::Is()
    StreamableResource::IsAllocated()
    StreamableResource::IsDynamic()
    ModelBase::IsInitialized()
    Asset::IsInternalType()
    Asset::IsLoaded()
    ScriptingObject::IsRegistered()
    Asset::IsVirtual()
    Asset::LastLoadFailed()
    BinaryAsset::loadAsset()
    BinaryAsset::LoadChunk(int32 chunkIndex)
    BinaryAsset::LoadChunks(AssetChunksFlag chunks)
    SkinnedModel
    Asset::Locker
    ManagedScriptingObject::ManagedScriptingObject(const SpawnParams& params)
    ModelBase::MaterialSlots
    BinaryAsset::Metadata
    ModelBase::MinScreenSize
    ModelBase::ModelBase(const SpawnParams& params, const AssetInfo* info, StreamingGroup* group)
    ScriptingObject::NewObject(const ScriptingTypeHandle& typeHandle)
    ScriptingObject::NewObject()
    Asset::OnCheckSave(const StringView& path=StringView::Empty)
    BinaryAsset::OnDeleteObject()
    BinaryAsset::OnDependencyModified(BinaryAsset* asset)
    Asset::onLoad(LoadAssetTask* task)
    Asset::onLoaded()
    Asset::OnLoaded
    Asset::onLoaded_MainThread()
    Asset::OnManagedInstanceDeleted()
    Asset::OnReloading
    BinaryAsset::onRename(const StringView& newPath)
    Asset::OnScriptingDispose()
    Asset::onUnload_MainThread()
    Asset::OnUnloaded
    ScriptingObject::RegisterObject()
    BinaryAsset::Reimport()
    BinaryAsset::ReleaseChunk(int32 index)
    BinaryAsset::ReleaseChunks()
    BinaryAsset::releaseStorage()
    Asset::Reload()
    Asset::RemoveReference()
    BinaryAsset::RequestChunkDataAsync(int32 index)
    ModelBase::RequestLODDataAsync(int32 lodIndex)
    StreamableResource::RequestStreamingUpdate()
    StreamableResource::ResetStreaming(bool error=true)
    StreamableResource::ResidencyChanged
    ModelBase::Save(bool withMeshDataFromGpu=false, const StringView& path=StringView::Empty)
    ModelBase::Save(bool withMeshDataFromGpu, Function<FlaxChunk* (int32)>& getChunk)
    ModelBase::Save(const StringView& path=StringView::Empty)
    BinaryAsset::SaveAsset(AssetInitData& data, bool silentMode=false)
    BinaryAsset::SaveAsset(const StringView& path, AssetInitData& data, bool silentMode=false)
    ModelBase::SaveHeader(WriteStream& stream, const class ModelData& modelData)
    ModelBase::SaveLOD(WriteStream& stream, int32 lodIndex)
    ModelBase::SaveLOD(WriteStream& stream, const ModelData& modelData, int32 lodIndex, bool(saveMesh)(WriteStream& stream, const ModelData& modelData, int32 lodIndex, int32 meshIndex)=nullptr)
    BinaryAsset::SaveToAsset(const StringView& path, AssetInitData& data, bool silentMode=false)
    ScriptingObject::ScriptingObject(const SpawnParams& params)
    BinaryAsset::SetChunk(int32 index, const Span<byte>& data)
    ManagedScriptingObject::SetManagedInstance(MObject* instance)
    Asset::ShouldDeleteFileOnUnload()
    SkinnedModel
    Asset::startLoading()
    StreamableResource::StartStreaming(bool isDynamic)
    StreamableResource::StopStreaming()
    BinaryAsset::Storage
    StreamableResource::StreamableResource(StreamingGroup* group)
    StreamableResource::Streaming
    ScriptingObject::ToInterface(ScriptingObject* obj, const ScriptingTypeHandle& interfaceType)
    ScriptingObject::ToInterface(ScriptingObject* obj)
    ScriptingObject::ToManaged(const ScriptingObject* obj)
    ScriptingObject::ToNative(MObject* obj)
    Asset::ToString()
    ScriptingObject::UnregisterObject()
    ModelBase::UpdateAllocation(int32 residency)
    Asset::WaitForLoaded(double timeoutInMilliseconds=30000.0)
    BinaryAsset::~BinaryAsset()
    ModelBase::~ModelBase()
    Object::~Object()
    ScriptingObject::~ScriptingObject()
    StreamableResource::~StreamableResource()
    Assembly: FlaxEngine.dll
    File: Engine/Content/Assets/SkinnedModel.h
    Syntax
    public class SkinnedModel : public ModelBase

    Constructors

    ~SkinnedModel()

    Finalizes an instance of the SkinnedModel class.

    Declaration
    public ~SkinnedModel()

    Fields

    LODs

    Model level of details. The first entry is the highest quality LOD0 followed by more optimized versions.

    Declaration
    public Array<SkinnedModelLOD, FixedAllocation<MODEL_MAX_LODS>> LODs
    Field Value
    Array<SkinnedModelLOD, FixedAllocation<MODEL_MAX_LODS>>

    Skeleton

    The skeleton bones hierarchy.

    Declaration
    public SkeletonData Skeleton
    Field Value
    SkeletonData

    Methods

    Draw(const RenderContext& renderContext, const SkinnedMesh::DrawInfo& info)

    Draws the model.

    Declaration
    public void Draw(const RenderContext& renderContext, const SkinnedMesh::DrawInfo& info)
    Parameters
    RenderContext renderContext

    The rendering context.

    SkinnedMesh::DrawInfo info

    The packed drawing info data.

    Draw(const RenderContextBatch& renderContextBatch, const SkinnedMesh::DrawInfo& info)

    Draws the model.

    Declaration
    public void Draw(const RenderContextBatch& renderContextBatch, const SkinnedMesh::DrawInfo& info)
    Parameters
    RenderContextBatch renderContextBatch

    The rendering context batch.

    SkinnedMesh::DrawInfo info

    The packed drawing info data.

    FindBone(const StringView& name)

    Finds the bone with the given name.

    Declaration
    public int32 FindBone(const StringView& name) const
    Parameters
    StringView name

    The name of the node used by the bone.

    Returns
    int32

    The index of the bone or -1 if not found.

    FindBone(int32 nodeIndex)

    Finds the bone that is using a given node index.

    Declaration
    public int32 FindBone(int32 nodeIndex) const
    Parameters
    int32 nodeIndex

    The index of the node.

    Returns
    int32

    The index of the bone or -1 if not found.

    FindNode(const StringView& name)

    Finds the node with the given name.

    Declaration
    public int32 FindNode(const StringView& name) const
    Parameters
    StringView name

    The name of the node.

    Returns
    int32

    The index of the node or -1 if not found.

    GetAllocatedResidency()

    Gets resource allocated residency level.

    Declaration
    public virtual int32 GetAllocatedResidency() const override
    Returns
    int32

    Overrides
    StreamableResource::GetAllocatedResidency()

    GetBlendShapes()

    Gets the blend shapes names used by the skinned model meshes (from LOD 0 only).

    Declaration
    public Array<String> GetBlendShapes()
    Returns
    Array<String>

    GetBones()

    Gets the skeleton bones hierarchy.

    Declaration
    public Array<SkeletonBone> GetBones() const
    Returns
    Array<SkeletonBone>

    GetBox(const Matrix& world, int32 lodIndex = 0)

    Gets the model bounding box in custom matrix world space (rig pose transformed by matrix, not animated).

    Declaration
    public BoundingBox GetBox(const Matrix& world, int32 lodIndex = 0) const
    Parameters
    Matrix world

    The transformation matrix.

    int32 lodIndex

    The Level Of Detail index.

    Returns
    BoundingBox

    The bounding box.

    GetBox(int32 lodIndex = 0)

    Gets the model bounding box in local space (rig pose, not animated).

    Declaration
    public BoundingBox GetBox(int32 lodIndex = 0) const
    Parameters
    int32 lodIndex

    The Level Of Detail index.

    Returns
    BoundingBox

    The bounding box.

    getChunksToPreload()

    Gets packed chunks indices to preload before asset loading action

    Declaration
    protected virtual AssetChunksFlag getChunksToPreload() const override
    Returns
    AssetChunksFlag

    Chunks to load flags

    Overrides
    BinaryAsset::getChunksToPreload()

    GetLOD(int32 lodIndex)

    Gets the mesh for a particular LOD index.

    Declaration
    public virtual ModelLODBase* GetLOD(int32 lodIndex) const override
    Parameters
    int32 lodIndex

    Returns
    ModelLODBase

    Overrides
    ModelBase::GetLOD(int32 lodIndex)

    GetLODsCount()

    Gets amount of the level of details in the model.

    Declaration
    public virtual int32 GetLODsCount() const override
    Returns
    int32

    Overrides
    ModelBase::GetLODsCount()

    GetMaxResidency()

    Gets resource maximum residency level.

    Declaration
    public virtual int32 GetMaxResidency() const override
    Returns
    int32

    Overrides
    StreamableResource::GetMaxResidency()

    GetMemoryUsage()

    Gets amount of CPU memory used by this resource (in bytes). It's a rough estimation. Memory may be fragmented, compressed or sub-allocated so the actual memory pressure from this resource may vary.

    Declaration
    public virtual uint64 GetMemoryUsage() const override
    Returns
    uint64

    Overrides
    Asset::GetMemoryUsage()

    GetMesh(int32 meshIndex, int32 lodIndex = 0)

    Gets the mesh for a particular LOD index.

    Declaration
    public virtual MeshBase* GetMesh(int32 meshIndex, int32 lodIndex = 0) const override
    Parameters
    int32 meshIndex

    int32 lodIndex

    Returns
    MeshBase

    Overrides
    ModelBase::GetMesh(int32 meshIndex, int32 lodIndex = 0)

    GetMeshes(Array<const MeshBase* >& meshes, int32 lodIndex = 0)

    Gets the meshes for a particular LOD index.

    Declaration
    public virtual void GetMeshes(Array<const MeshBase* >& meshes, int32 lodIndex = 0) const override
    Parameters
    Array<MeshBase > meshes

    int32 lodIndex

    Overrides
    ModelBase::GetMeshes(Array<const MeshBase* >& meshes, int32 lodIndex = 0)

    GetMeshes(Array<MeshBase* >& meshes, int32 lodIndex = 0)

    Gets the meshes for a particular LOD index.

    Declaration
    public virtual void GetMeshes(Array<MeshBase* >& meshes, int32 lodIndex = 0) override
    Parameters
    Array<MeshBase > meshes

    int32 lodIndex

    Overrides
    ModelBase::GetMeshes(Array<MeshBase* >& meshes, int32 lodIndex = 0)

    GetNodes()

    Gets the skeleton nodes hierarchy.

    Declaration
    public Array<SkeletonNode> GetNodes() const
    Returns
    Array<SkeletonNode>

    GetSkeletonMapping(Asset* source, bool autoRetarget=true)

    Gets the skeleton mapping for a given asset (animation or other skinned model). Uses identity mapping or manually created retargeting setup.

    Declaration
    public SkeletonMapping GetSkeletonMapping(Asset* source, bool autoRetarget=true)
    Parameters
    Asset source

    The source asset (animation or other skinned model) to get mapping to its skeleton.

    bool autoRetarget

    Enables automatic skeleton retargeting based on nodes names. Can be disabled to query existing skeleton mapping or return null if not defined.

    Returns
    SkeletonMapping

    The skeleton mapping for the source asset into this skeleton.

    GetSkeletonRetargets()

    Declaration
    public Array<SkeletonRetarget> GetSkeletonRetargets() const
    Returns
    Array<SkeletonRetarget>

    HasAnyLODInitialized()

    Determines whether any LOD has been initialized.

    Declaration
    public bool HasAnyLODInitialized() const
    Returns
    bool

    InitAsVirtual()

    Initializes asset data as virtual asset.

    Declaration
    public virtual void InitAsVirtual() override
    Overrides
    Asset::InitAsVirtual()

    Intersects(const Ray& ray, const Matrix& world, Real& distance, Vector3& normal, SkinnedMesh* *mesh, int32 lodIndex = 0)

    Determines if there is an intersection between the SkinnedModel and a Ray in given world using given instance.

    Declaration
    public bool Intersects(const Ray& ray, const Matrix& world, Real& distance, Vector3& normal, SkinnedMesh* *mesh, int32 lodIndex = 0)
    Parameters
    Ray ray

    The ray to test

    Matrix world

    World to test

    Real distance

    When the method completes, contains the distance of the intersection (if any valid).

    Vector3 normal

    When the method completes, contains the intersection surface normal vector (if any valid).

    SkinnedMesh mesh

    Mesh, or null

    int32 lodIndex

    Level Of Detail index

    Returns
    bool

    True whether the two objects intersected

    Intersects(const Ray& ray, const Transform& transform, Real& distance, Vector3& normal, SkinnedMesh* *mesh, int32 lodIndex = 0)

    Determines if there is an intersection between the SkinnedModel and a Ray in given world using given instance.

    Declaration
    public bool Intersects(const Ray& ray, const Transform& transform, Real& distance, Vector3& normal, SkinnedMesh* *mesh, int32 lodIndex = 0)
    Parameters
    Ray ray

    The ray to test

    Transform transform

    Instance transformation

    Real distance

    When the method completes, contains the distance of the intersection (if any valid).

    Vector3 normal

    When the method completes, contains the intersection surface normal vector (if any valid).

    SkinnedMesh mesh

    Mesh, or null

    int32 lodIndex

    Level Of Detail index

    Returns
    bool

    True whether the two objects intersected

    load()

    Load data from the chunks

    Declaration
    protected virtual LoadResult load() override
    Returns
    LoadResult

    Loading result

    Overrides
    BinaryAsset::load()

    Render(GPUContext* context, int32 lodIndex = 0)

    Draws the meshes. Binds vertex and index buffers and invokes the draw calls.

    Declaration
    public void Render(GPUContext* context, int32 lodIndex = 0)
    Parameters
    GPUContext context

    The GPU context to draw with.

    int32 lodIndex

    The Level Of Detail index.

    SetSkeletonRetargets(const Array<SkeletonRetarget>& value)

    Declaration
    public void SetSkeletonRetargets(const Array<SkeletonRetarget>& value)
    Parameters
    Array<SkeletonRetarget> value

    SetupLODs(const Span<int32>& meshesCountPerLod)

    Setups the model LODs collection including meshes creation.

    Declaration
    public bool SetupLODs(const Span<int32>& meshesCountPerLod)
    Parameters
    Span<int32> meshesCountPerLod

    The meshes count per lod array (amount of meshes per LOD).

    Returns
    bool

    True if failed, otherwise false.

    SetupMaterialSlots(int32 slotsCount)

    Resizes the material slots collection. Updates meshes that were using removed slots.

    Declaration
    public virtual void SetupMaterialSlots(int32 slotsCount) override
    Parameters
    int32 slotsCount

    Overrides
    ModelBase::SetupMaterialSlots(int32 slotsCount)

    SetupSkeleton(const Array<SkeletonNode>& nodes)

    Setups the skinned model skeleton. Uses the same nodes layout for skeleton bones and calculates the offset matrix by auto.

    Declaration
    public bool SetupSkeleton(const Array<SkeletonNode>& nodes)
    Parameters
    Array<SkeletonNode> nodes

    The nodes hierarchy. The first node must be a root one (with parent index equal -1).

    Returns
    bool

    True if failed, otherwise false.

    SetupSkeleton(const Array<SkeletonNode>& nodes, const Array<SkeletonBone>& bones, bool autoCalculateOffsetMatrix)

    Setups the skinned model skeleton.

    Declaration
    public bool SetupSkeleton(const Array<SkeletonNode>& nodes, const Array<SkeletonBone>& bones, bool autoCalculateOffsetMatrix)
    Parameters
    Array<SkeletonNode> nodes

    The nodes hierarchy. The first node must be a root one (with parent index equal -1).

    Array<SkeletonBone> bones

    The bones hierarchy.

    bool autoCalculateOffsetMatrix

    If true then the OffsetMatrix for each bone will be auto-calculated by the engine, otherwise the provided values will be used.

    Returns
    bool

    True if failed, otherwise false.

    unload(bool isReloading)

    Unloads asset data

    Declaration
    protected virtual void unload(bool isReloading) override
    Parameters
    bool isReloading

    True if asset is reloading data, otherwise false.

    Overrides
    ModelBase::unload(bool isReloading)
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat