Search Results for

    Show / Hide Table of Contents

    Class ModelInstanceActor

    Base class for actor types that use ModelInstanceEntries for mesh rendering.

    Inheritance
    Object
    ScriptingObject
    SceneObject
    Actor
    ModelInstanceActor
    Inherited Members
    Actor::_box
    Actor::_drawCategory
    Actor::_drawNoCulling
    ScriptingObject::_gcHandle
    ScriptingObject::_id
    Actor::_isActive
    Actor::_isActiveInHierarchy
    Actor::_isEnabled
    Actor::_isHierarchyDirty
    Actor::_isPrefabRoot
    Actor::_layer
    Actor::_localTransform
    Actor::_name
    SceneObject::_parent
    Actor::_physicsScene
    SceneObject::_prefabID
    SceneObject::_prefabObjectID
    Actor::_scene
    Actor::_sphere
    Actor::_staticFlags
    Actor::_transform
    ScriptingObject::_type
    Actor::AddMovement(const Vector3& translation)
    Actor::AddMovement(const Vector3& translation, const Quaternion& rotation)
    Actor::AddScript()
    Actor::AddStaticFlags(StaticFlags flags)
    Actor::AddTag(const Tag& tag)
    Actor::AddTagRecursive(const Tag& tag)
    ModelInstanceActor
    Actor::BeginPlay(SceneBeginData* data)
    Actor::BreakPrefabLink()
    ScriptingObject::CanCast(const ScriptingTypeHandle& from, const ScriptingTypeHandle& to)
    ScriptingObject::CanCast(const MClass* from, const MClass* to)
    ScriptingObject::Cast(ScriptingObject* obj)
    ScriptingObject::ChangeID(const Guid& newId)
    Actor::ChangeScriptOrder(Script* script, int32 newIndex)
    Actor::Children
    Actor::Clone()
    ScriptingObject::CreateManaged()
    ScriptingObject::CreateManagedInternal()
    ScriptingObject::Deleted
    Object::DeleteObject(float timeToLive = 0.0f, bool useGameTime=false)
    Object::DeleteObjectNow()
    Actor::DEPRECATED("Use HasTag instead") const String& GetTag()
    Actor::DEPRECATED("Use AddTag instead") void SetTag(const StringView& value)
    Actor::Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
    ISerializable::DeserializeIfExists(DeserializeStream& stream, const char* memberName, ISerializeModifier* modifier)
    ModelInstanceActor
    Actor::DestroyChildren(float timeLeft = 0.0f)
    ScriptingObject::DestroyManaged()
    Actor::Draw(RenderContext& renderContext)
    Actor::Draw(RenderContextBatch& renderContextBatch)
    Actor::EndPlay()
    Actor::FindActor(const StringView& name)
    Actor::FindActor(const MClass* type, bool activeOnly=false)
    Actor::FindActor(const MClass* type, const StringView& name)
    Actor::FindActor(const MClass* type, const Tag& tag, bool activeOnly=false)
    Actor::FindActor()
    Actor::FindActor(const Tag& tag)
    Actor::FindScript(const MClass* type)
    Actor::FindScript()
    Object::Flags
    Actor::FromBytes(const Span<byte>& data, Array<Actor* >& output, ISerializeModifier* modifier)
    Actor::FromBytes(const Span<byte>& data)
    Actor::FromBytes(const Span<byte>& data, const Dictionary<Guid, Guid, HeapAllocation>& idsMapping)
    ScriptingObject::FromInterface(void* interfaceObj, const ScriptingTypeHandle& interfaceType)
    ScriptingObject::FromInterface(T* interfaceObj)
    Actor::FromJson(const StringAnsiView& json)
    Actor::GetBox()
    Actor::GetBoxWithChildren()
    Actor::GetChild(int32 index)
    Actor::GetChild(const StringView& name)
    Actor::GetChild(const MClass* type)
    Actor::GetChild()
    Actor::GetChildren(const MClass* type)
    Actor::GetChildren()
    Actor::GetChildrenCount()
    ScriptingObject::GetClass()
    Actor::GetDirection()
    Actor::GetEditorBox()
    Actor::GetEditorBoxChildren()
    ScriptingObject::GetID()
    Actor::GetIsActive()
    Actor::GetLayer()
    Actor::GetLayerMask()
    Actor::GetLayerName()
    Actor::GetLocalOrientation()
    Actor::GetLocalPosition()
    Actor::GetLocalScale()
    Actor::GetLocalToWorldMatrix(Matrix& localToWorld)
    Actor::GetLocalToWorldMatrix(Double4x4& localToWorld)
    Actor::GetLocalTransform()
    ScriptingObject::GetManagedInstance()
    Actor::GetName()
    SceneObject::GetNamePath(Char separatorChar='/')
    Actor::GetOrAddChild()
    ScriptingObject::GetOrCreateManagedInstance()
    Actor::GetOrderInParent()
    Actor::GetOrientation()
    SceneObject::GetParent()
    Actor::GetPerInstanceRandom()
    Actor::GetPhysicsScene()
    Actor::GetPosition()
    SceneObject::GetPrefabID()
    SceneObject::GetPrefabObjectID()
    Actor::GetPrefabRoot()
    Actor::GetRotation()
    Actor::GetScale()
    Actor::GetScene()
    Actor::GetSceneObjectId()
    Actor::GetSceneRendering()
    Actor::GetScript(int32 index)
    Actor::GetScript(const MClass* type)
    Actor::GetScript()
    Actor::GetScriptByID(const Guid& id)
    Actor::GetScripts(const MClass* type)
    Actor::GetScripts()
    Actor::GetScriptsCount()
    Actor::GetSphere()
    Actor::GetStaticFlags()
    Actor::GetTransform()
    ScriptingObject::GetType()
    ScriptingObject::GetTypeHandle()
    Actor::GetWorldToLocalMatrix(Matrix& worldToLocal)
    Actor::GetWorldToLocalMatrix(Double4x4& worldToLocal)
    Actor::HasActorInChildren(Actor* a)
    Actor::HasActorInHierarchy(Actor* a)
    Actor::HasContentLoaded()
    ScriptingObject::HasManagedInstance()
    SceneObject::HasParent()
    SceneObject::HasPrefabLink()
    Actor::HasScene()
    Actor::HasStaticFlag(StaticFlags flag)
    Actor::HasTag()
    Actor::HasTag(const Tag& tag)
    Actor::HasTag(const StringView& tag)
    Actor::HideFlags
    Actor::Initialize()
    Actor::InitializeHierarchy()
    Actor::Intersects(const Ray& ray, Real& distance, Vector3& normal)
    Actor::IntersectsItself(const Ray& ray, Real& distance, Vector3& normal)
    ScriptingObject::Is(const ScriptingTypeHandle& type)
    ScriptingObject::Is(const MClass* type)
    ScriptingObject::Is()
    Actor::IsActiveInHierarchy()
    SceneObject::IsDuringPlay()
    Actor::IsPrefabRoot()
    ScriptingObject::IsRegistered()
    Actor::IsStatic()
    Actor::IsTransformStatic()
    Actor::LinkPrefab(const Guid& prefabId, const Guid& prefabObjectId)
    Actor::LookAt(const Vector3& worldPos)
    Actor::LookAt(const Vector3& worldPos, const Vector3& worldUp)
    Actor::LookingAt(const Vector3& worldPos)
    Actor::LookingAt(const Vector3& worldPos, const Vector3& worldUp)
    ScriptingObject::NewObject(const ScriptingTypeHandle& typeHandle)
    ScriptingObject::NewObject()
    Actor::OnActiveChanged()
    Actor::OnActiveInTreeChanged()
    Actor::OnBeginPlay()
    Actor::OnDebugDraw()
    Actor::OnDebugDrawSelected()
    Actor::OnDeleteObject()
    Actor::OnEndPlay()
    ScriptingObject::OnManagedInstanceDeleted()
    Actor::OnOrderInParentChanged()
    Actor::OnParentChanged()
    Actor::OnPhysicsSceneChanged(PhysicsScene* previous)
    ScriptingObject::OnScriptingDispose()
    ScriptingObject::RegisterObject()
    Actor::RemoveStaticFlags(StaticFlags flags)
    Actor::RemoveTag(const Tag& tag)
    Actor::ResetLocalTransform()
    SceneObject::SceneObject(const SpawnParams& params)
    ScriptingObject::ScriptingObject(const SpawnParams& params)
    Actor::Scripts
    Actor::Serialize(SerializeStream& stream, const void* otherObj)
    ModelInstanceActor
    ModelInstanceActor
    Actor::SetDirection(const Float3& value)
    Actor::SetIsActive(bool value)
    Actor::SetLayer(int32 layerIndex)
    Actor::SetLayerName(const StringView& value)
    Actor::SetLayerNameRecursive(const StringView& value)
    Actor::SetLayerRecursive(int32 layerIndex)
    Actor::SetLocalOrientation(const Quaternion& value)
    Actor::SetLocalPosition(const Vector3& value)
    Actor::SetLocalScale(const Float3& value)
    Actor::SetLocalTransform(const Transform& value)
    ScriptingObject::SetManagedInstance(MObject* instance)
    Actor::SetName(String&& value)
    Actor::SetName(const StringView& value)
    Actor::SetOrderInParent(int32 index)
    Actor::SetOrientation(const Quaternion& value)
    Actor::SetParent(Actor* value, bool worldPositionsStays, bool canBreakPrefabLink)
    Actor::SetParent(Actor* value, bool canBreakPrefabLink=true)
    SceneObject::SetParent(Actor* value)
    Actor::SetPhysicsScene(PhysicsScene* scene)
    Actor::SetPosition(const Vector3& value)
    Actor::SetRotation(const Matrix& value)
    Actor::SetScale(const Float3& value)
    Actor::SetStaticFlag(StaticFlags flag, bool value)
    Actor::SetStaticFlags(StaticFlags value)
    Actor::SetTransform(const Transform& value)
    ModelInstanceActor
    Actor::Tags
    Actor::ToBytes(const Array<Actor* >& actors, MemoryWriteStream& output)
    Actor::ToBytes(const Array<Actor* >& actors)
    ScriptingObject::ToInterface(ScriptingObject* obj, const ScriptingTypeHandle& interfaceType)
    ScriptingObject::ToInterface(ScriptingObject* obj)
    Actor::ToJson()
    ScriptingObject::ToManaged(const ScriptingObject* obj)
    ScriptingObject::ToNative(MObject* obj)
    Actor::ToString()
    Actor::TreeExecute(Function<bool(Actor* , Params ...)>& action, Params ... args)
    Actor::TreeExecuteChildren(Function<bool(Actor* , Params ...)>& action, Params ... args)
    Actor::TryGetSerializedObjectsIds(const Span<byte>& data)
    ScriptingObject::UnregisterObject()
    Actor::UnregisterObjectHierarchy()
    ISerializable::~ISerializable()
    Object::~Object()
    SceneObject::~SceneObject()
    ScriptingObject::~ScriptingObject()
    Assembly: FlaxEngine.dll
    File: Engine/Level/Actors/ModelInstanceActor.h
    Syntax
    public class ModelInstanceActor : public Actor

    Fields

    _sceneRenderingKey

    Declaration
    protected int32 _sceneRenderingKey = -1
    Field Value
    int32

    Entries

    The model instance buffer.

    Declaration
    public ModelInstanceEntries Entries
    Field Value
    ModelInstanceEntries

    Methods

    CreateAndSetVirtualMaterialInstance(int32 entryIndex)

    Utility to crate a new virtual Material Instance asset, set its parent to the currently applied material, and assign it to the entry. Can be used to modify the material parameters from code.

    Declaration
    public MaterialInstance* CreateAndSetVirtualMaterialInstance(int32 entryIndex)
    Parameters
    int32 entryIndex

    The material slot entry index.

    Returns
    MaterialInstance

    The created virtual material instance.

    GetEntries()

    Gets the model entries collection. Each entry contains data how to render meshes using this entry (transformation, material, shadows casting, etc.).

    Declaration
    public Array<ModelInstanceEntry> GetEntries() const
    Returns
    Array<ModelInstanceEntry>

    GetMaterial(int32 entryIndex)

    Gets the material used to draw the meshes which are assigned to that slot (set in Entries or model's default).

    Declaration
    public virtual MaterialBase* GetMaterial(int32 entryIndex) = 0
    Parameters
    int32 entryIndex

    The material slot entry index.

    Returns
    MaterialBase

    GetMaterialSlots()

    Gets the material slots array set on the asset (eg. model or skinned model asset).

    Declaration
    public virtual Span<class MaterialSlot> GetMaterialSlots() const = 0
    Returns
    Span<class MaterialSlot>

    GetMeshData(const MeshReference& ref, MeshBufferType type, BytesContainer& result, int32& count, GPUVertexLayout* *layout=nullptr)

    Extracts mesh buffer data from CPU. Might be cached internally (eg. by Model/SkinnedModel).

    Declaration
    public virtual bool GetMeshData(const MeshReference& ref, MeshBufferType type, BytesContainer& result, int32& count, GPUVertexLayout* *layout=nullptr) const
    Parameters
    MeshReference ref

    Mesh reference.

    MeshBufferType type

    Buffer type

    BytesContainer result

    The result data

    int32 count

    The amount of items inside the result buffer.

    GPUVertexLayout layout

    The result layout of the result buffer (for vertex buffers). Optional, pass null to ignore it.

    Returns
    bool

    True if failed, otherwise false.

    GetMeshDeformation()

    Gets the mesh deformation utility for this model instance (optional).

    Declaration
    public virtual MeshDeformation* GetMeshDeformation() const
    Returns
    MeshDeformation

    Model deformation utility or null if not supported.

    IntersectsEntry(const Ray& ray, Real& distance, Vector3& normal, int32& entryIndex)

    Determines if there is an intersection between the model actor mesh entry and a ray. If mesh data is available on the CPU performs exact intersection check with the geometry. Otherwise performs simple BoundingBox vs Ray test. For more efficient collisions detection and ray casting use physics.

    Declaration
    public virtual bool IntersectsEntry(const Ray& ray, Real& distance, Vector3& normal, int32& entryIndex)
    Parameters
    Ray ray

    The ray to test.

    Real distance

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

    Vector3 normal

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

    int32 entryIndex

    When the method completes, contains the intersection entry index (if any valid).

    Returns
    bool

    True if the actor is intersected by the ray, otherwise false.

    IntersectsEntry(int32 entryIndex, const Ray& ray, Real& distance, Vector3& normal)

    Determines if there is an intersection between the model actor mesh entry and a ray. If mesh data is available on the CPU performs exact intersection check with the geometry. Otherwise performs simple BoundingBox vs Ray test. For more efficient collisions detection and ray casting use physics.

    Declaration
    public virtual bool IntersectsEntry(int32 entryIndex, const Ray& ray, Real& distance, Vector3& normal)
    Parameters
    int32 entryIndex

    The material slot entry index to test.

    Ray ray

    The ray to test.

    Real distance

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

    Vector3 normal

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

    Returns
    bool

    True if the actor is intersected by the ray, otherwise false.

    OnDisable()

    Called when actor gets removed from game systems. Occurs on EndPlay event or when actor gets inactivated in hierarchy. Use this event to unregister object from other game system (eg. audio).

    Declaration
    protected virtual void OnDisable() override
    Overrides
    Actor::OnDisable()

    OnEnable()

    Called when actor gets added to game systems. Occurs on BeginPlay event or when actor gets activated in hierarchy. Use this event to register object to other game system (eg. audio).

    Declaration
    protected virtual void OnEnable() override
    Overrides
    Actor::OnEnable()

    OnLayerChanged()

    Called when layer gets changed.

    Declaration
    public virtual void OnLayerChanged() override
    Overrides
    Actor::OnLayerChanged()

    OnStaticFlagsChanged()

    Called when actor static flag gets changed.

    Declaration
    public virtual void OnStaticFlagsChanged() override
    Overrides
    Actor::OnStaticFlagsChanged()

    OnTransformChanged()

    Called when actor transform gets changed.

    Declaration
    public virtual void OnTransformChanged() override
    Overrides
    Actor::OnTransformChanged()

    SetEntries(const Array<ModelInstanceEntry>& value)

    Sets the model entries collection. Each entry contains data how to render meshes using this entry (transformation, material, shadows casting, etc.).

    Declaration
    public void SetEntries(const Array<ModelInstanceEntry>& value)
    Parameters
    Array<ModelInstanceEntry> value

    SetMaterial(int32 entryIndex, MaterialBase* material)

    Sets the material to the entry slot. Can be used to override the material of the meshes using this slot.

    Declaration
    public void SetMaterial(int32 entryIndex, MaterialBase* material)
    Parameters
    int32 entryIndex

    The material slot entry index.

    MaterialBase material

    The material to set.

    UpdateBounds()

    Updates the model bounds (eg. when mesh has applied significant deformation).

    Declaration
    public virtual void UpdateBounds() = 0

    WaitForModelLoad()

    Declaration
    protected virtual void WaitForModelLoad()

    See Also

    Actor
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat