Popcorning Guinea Pig
Search Results for

    Show / Hide Table of Contents

    Struct AnimatedModelInstance

    Lightweight per-entity state for an animated model (Flyweight extrinsic state). Playback lives here (~20 bytes); mesh/clips live on the shared AnimatedModelData.

    Pose and draw are adjacent: Update(float) only advances the frame, Draw(Vector3, Vector3, Vector3, Color) uploads bone matrices then draws. Never call Raylib.UpdateModelAnimation on a GPU-skinned model — that writes posed vertices into the VBO, and the shader then skins them again (collapsed/exploded mesh).

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: PopcorningGuineaPig.Engine.Gameplay
    Assembly: PopcorningGuineaPig.Engine.dll
    Syntax
    public struct AnimatedModelInstance

    Constructors

    | Edit this page View Source

    AnimatedModelInstance(AnimatedModelData)

    Declaration
    public AnimatedModelInstance(AnimatedModelData data)
    Parameters
    Type Name Description
    AnimatedModelData data

    Properties

    | Edit this page View Source

    AnimationSpeed

    Playback speed multiplier (1.0 = normal speed).

    Declaration
    public float AnimationSpeed { readonly get; set; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    CurrentAnimIndex

    Index of the currently active animation.

    Declaration
    public int CurrentAnimIndex { readonly get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    CurrentFrame

    Current frame in the active animation.

    Declaration
    public int CurrentFrame { readonly get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    Data

    Reference to the shared model and animation data.

    Declaration
    public readonly AnimatedModelData Data { get; }
    Property Value
    Type Description
    AnimatedModelData
    | Edit this page View Source

    IsLooping

    Whether the animation loops or plays once.

    Declaration
    public bool IsLooping { readonly get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    IsPlaying

    Whether the animation is currently playing.

    Declaration
    public bool IsPlaying { readonly get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    IsValid

    True if the underlying shared data is valid and not disposed.

    Declaration
    public readonly bool IsValid { get; }
    Property Value
    Type Description
    bool

    Methods

    | Edit this page View Source

    ApplyPose()

    Pushes this instance's current frame onto the shared model.

    Declaration
    public void ApplyPose()
    Remarks

    Call immediately before drawing when several instances share one AnimatedModelData. The palette for a frame is built once and copied onto the model, so the last copy is the one that draws. The CPU fallback re-skins every vertex.

    | Edit this page View Source

    Draw(Vector3, Vector3, Vector3, Color)

    Renders the model with the current animation pose.

    Declaration
    public void Draw(Vector3 position, Vector3 rotationDeg, Vector3 scale, Color tint)
    Parameters
    Type Name Description
    Vector3 position

    The position to render at.

    Vector3 rotationDeg

    The rotation in degrees around each axis.

    Vector3 scale

    The scale to apply.

    Color tint

    The color tint to apply.

    | Edit this page View Source

    PlayAnimation(int)

    Starts playing the animation at the specified index.

    Declaration
    public void PlayAnimation(int animIndex)
    Parameters
    Type Name Description
    int animIndex

    The index of the animation to play.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if animIndex is invalid.

    | Edit this page View Source

    PlayAnimation(string)

    Starts playing the animation with the specified name.

    Declaration
    public void PlayAnimation(string animName)
    Parameters
    Type Name Description
    string animName

    The name of the animation to play.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the animation name is not found.

    | Edit this page View Source

    StopAnimation()

    Stops the current animation playback.

    Declaration
    public void StopAnimation()
    | Edit this page View Source

    Update(float)

    Updates the animation playback based on elapsed time.

    Declaration
    public void Update(float deltaTime)
    Parameters
    Type Name Description
    float deltaTime

    Time elapsed since the last update.

    • Edit this page
    • View Source
    In this article
    Back to top © 2024 Popcorning Guinea Pig Game Engine. A custom C# game engine for indie developers.