#pragma once #include #include #include #include #include "Runtime/CToken.hpp" #include "Runtime/Character/CSkinRules.hpp" #include "Runtime/Graphics/CModel.hpp" #include namespace urde { class CCharLayoutInfo; class CModel; class CPoseAsTransforms; class CVertexMorphEffect; class IObjectStore; class CSkinnedModel { friend class CBooModel; std::unique_ptr m_modelInst; TLockedToken x4_model; TLockedToken x10_skinRules; TLockedToken x1c_layoutInfo; std::vector> m_vertWorkspace; bool m_modifiedVBO = false; public: enum class EDataOwnership { Zero, One }; CSkinnedModel(TLockedToken model, TLockedToken skinRules, TLockedToken layoutInfo, int shaderIdx, int drawInsts); CSkinnedModel(IObjectStore& store, CAssetId model, CAssetId skinRules, CAssetId layoutInfo, int shaderIdx, int drawInsts); std::unique_ptr Clone(int shaderIdx = 0, int drawInsts = 1) const { return std::make_unique(x4_model, x10_skinRules, x1c_layoutInfo, shaderIdx, drawInsts); } const TLockedToken& GetModel() const { return x4_model; } const std::unique_ptr& GetModelInst() const { return m_modelInst; } const TLockedToken& GetSkinRules() const { return x10_skinRules; } void SetLayoutInfo(const TLockedToken& inf) { x1c_layoutInfo = inf; } const TLockedToken& GetLayoutInfo() const { return x1c_layoutInfo; } void Calculate(const CPoseAsTransforms& pose, const CModelFlags& drawFlags, const std::optional& morphEffect, const float* morphMagnitudes); void Draw(const CModelFlags& drawFlags) const; using FPointGenerator = void (*)(void* item, const std::vector>& vn); static void SetPointGeneratorFunc(void* ctx, FPointGenerator func) { g_PointGenFunc = func; g_PointGenCtx = ctx; } static void ClearPointGeneratorFunc() { g_PointGenFunc = nullptr; } static FPointGenerator g_PointGenFunc; static void* g_PointGenCtx; }; class CMorphableSkinnedModel : public CSkinnedModel { std::unique_ptr x40_morphMagnitudes; public: CMorphableSkinnedModel(IObjectStore& store, CAssetId model, CAssetId skinRules, CAssetId layoutInfo, int shaderIdx, int drawInsts); const float* GetMorphMagnitudes() const { return x40_morphMagnitudes.get(); } }; } // namespace urde