Class AnimationController

Synopsis

#include <Source/Falcor/Scene/Animation/AnimationController.h>

class dlldecl AnimationController

Description

No description yet.

Methods

~AnimationController
addAnimationAdd an animation
animateRun the animation
createCreate a new object
didMatrixChangedCheck if a matrix changed
getGlobalMatricesGet the global matrices
hasAnimationsReturns true if controller contains animations.
isEnabledReturns true if animations are enabled.
setEnabledEnable/disable animations.

Source

Lines 51-128 in Source/Falcor/Scene/Animation/AnimationController.h.

class dlldecl AnimationController
{
public:
    using UniquePtr = std::unique_ptr<AnimationController>;
    using UniqueConstPtr = std::unique_ptr<const AnimationController>;
    static const uint32_t kInvalidBoneID = -1;
    ~AnimationController() = default;
    using StaticVertexVector = std::vector<PackedStaticVertexData>;
    using DynamicVertexVector = std::vector<DynamicVertexData>;
    /** Create a new object
    */
    static UniquePtr create(Scene* pScene, const StaticVertexVector& staticVertexData, const DynamicVertexVector& dynamicVertexData);
    /** Add an animation
    */
    void addAnimation(const Animation::SharedPtr& pAnimation);
    /** Returns true if controller contains animations.
    */
    bool hasAnimations() const { return mAnimations.size() > 0; }
    /** Enable/disable animations.
    */
    void setEnabled(bool enabled);
    /** Returns true if animations are enabled.
    */
    bool isEnabled() const { return mEnabled; };
    /** Run the animation
        \return true if a change occurred, otherwise false
    */
    bool animate(RenderContext* pContext, double currentTime);
    /** Check if a matrix changed
    */
    bool didMatrixChanged(size_t matrixID) const { return mMatricesChanged[matrixID]; }
    /** Get the global matrices
    */
    const std::vector<glm::mat4>& getGlobalMatrices() const { return mGlobalMatrices; }
private:
    friend class SceneBuilder;
    AnimationController(Scene* pScene, const StaticVertexVector& staticVertexData, const DynamicVertexVector& dynamicVertexData);
    void bindBuffers();
    void updateMatrices();
    std::vector<Animation::SharedPtr> mAnimations;
    std::vector<glm::mat4> mLocalMatrices;
    std::vector<glm::mat4> mGlobalMatrices;
    std::vector<glm::mat4> mInvTransposeGlobalMatrices;
    std::vector<bool> mMatricesChanged;
    bool mEnabled = true;
    bool mAnimationChanged = true;
    double mLastAnimationTime = 0;
    Scene* mpScene = nullptr;
    Buffer::SharedPtr mpWorldMatricesBuffer;
    Buffer::SharedPtr mpPrevWorldMatricesBuffer;
    Buffer::SharedPtr mpInvTransposeWorldMatricesBuffer;
    // Skinning
    ComputePass::SharedPtr mpSkinningPass;
    std::vector<glm::mat4> mSkinningMatrices;
    std::vector<glm::mat4> mInvTransposeSkinningMatrices;
    uint32_t mSkinningDispatchSize = 0;
    void createSkinningPass(const std::vector<PackedStaticVertexData>& staticVertexData, const std::vector<DynamicVertexData>& dynamicVertexData);
    void executeSkinningPass(RenderContext* pContext);
    Buffer::SharedPtr mpSkinningMatricesBuffer;
    Buffer::SharedPtr mpInvTransposeSkinningMatricesBuffer;
    void initLocalMatrices();
};





Add Discussion as Guest

Log in to DocsForge