24 MaterialManager(manager)
30 for(
auto & SubMesh : mesh->SubMeshes)
32 auto mat_iter = Materials.find(SubMesh.Material);
33 if(mat_iter != Materials.end())
39 SubMesh.Material = new_material;
47 MaterialManager.Materials[mat_iter->second.Name] = mat_iter->second;
48 SubMesh.Material = MaterialManager.
GetMaterial(mat_iter->second.Name.getData());
59 std::map<const StdMeshMaterial*, StdMeshMaterial>::const_iterator mat_iter = Materials.find(sub_instance->
Material);
60 if(mat_iter != Materials.end())
74 for(
const auto & Material : Materials)
75 MaterialManager.Materials[Material.second.Name] = Material.second;
80 assert(Materials.find(material) == Materials.end());
81 Materials[material] = *material;
85 OldMesh(&old_mesh), BoneNamesByIndex(OldMesh->GetSkeleton().GetNumBones())
87 for (
unsigned int i = 0; i < OldMesh->
GetSkeleton().GetNumBones(); ++i)
93 assert(&instance->
GetMesh() == OldMesh);
96 instance->
Mesh = &new_mesh;
101 delete SubMeshInstance;
132 std::vector<unsigned int> Removal;
135 if(!(*iter)->SetParentBone(BoneNamesByIndex[(*iter)->ParentBone]))
139 Removal.push_back((*iter)->Number);
143 for(
unsigned int i : Removal)
148 for (
unsigned int i = instance->
AnimationStack.size(); i > 0; --i)
164 StdCopyStrBuf bone_name = BoneNamesByIndex[node->Custom.BoneIndex];
166 if(!bone)
return false;
167 node->Custom.BoneIndex = bone->
Index;
172 const bool left_result = UpdateAnimationNode(instance, node->
GetLeftChild());
173 const bool right_result = UpdateAnimationNode(instance, node->
GetRightChild());
176 if (!left_result && !right_result)
201 for (
const auto & Animation : skeleton.Animations)
203 AnimationNames[&Animation.second] = Animation.first;
212 for (
unsigned int i = instance->
AnimationStack.size(); i > 0; --i)
225 std::map<const StdMeshAnimation*, StdCopyStrBuf>::const_iterator iter = AnimationNames.find(node->Leaf.Animation);
228 assert(iter != AnimationNames.end());
232 if(!node->Leaf.Animation)
return false;
246 const bool left_result = UpdateAnimationNode(instance, node->
GetLeftChild());
247 const bool right_result = UpdateAnimationNode(instance, node->
GetRightChild());
250 if (!left_result && !right_result)
T Clamp(T bval, T lbound, T rbound)
StdMeshAnimationUpdate(const StdMeshSkeletonLoader &skeleton_loader)
void Update(StdMeshInstance *instance) const
const StdSubMesh & GetSubMesh(size_t i) const
size_t GetNumSubMeshes() const
const StdMeshSkeleton & GetSkeleton() const
bool SetChildBone(const StdStrBuf &bone)
@ LinearInterpolationNode
AnimationNode * GetLeftChild()
ValueProvider * GetPositionProvider()
const StdMeshAnimation * GetAnimation() const
AnimationNode * GetRightChild()
float GetCompletion() const
std::vector< StdSubMeshInstance * > SubMeshInstances
std::vector< StdSubMeshInstance * > SubMeshInstancesOrdered
AnimationNodeList AnimationStack
bool DetachMesh(unsigned int number)
AttachedMeshIter AttachedMeshesBegin() const
void StopAnimation(AnimationNode *node)
const StdMesh & GetMesh() const
std::vector< StdMeshMatrix > BoneTransforms
AttachedMeshIter AttachedMeshesEnd() const
AttachedMesh * AttachParent
AttachedMeshList::const_iterator AttachedMeshIter
const StdMeshMaterial * GetMaterial(const char *material_name) const
StdMeshMaterialUpdate(StdMeshMatManager &manager)
void Update(StdMesh *mesh) const
static StdMeshMatrix Identity()
const StdMeshBone * GetBoneByName(const StdStrBuf &name) const
const StdMeshBone & GetBone(size_t i) const
const StdMeshAnimation * GetAnimationByName(const StdStrBuf &name) const
size_t GetNumBones() const
skeleton_iterator skeletons_end() const
skeleton_iterator skeletons_begin() const
SkeletonMap::const_iterator skeleton_iterator
void Update(StdMeshInstance *instance, const StdMesh &new_mesh) const
StdMeshUpdate(const StdMesh &old_mesh)
void SetMaterial(const StdMeshMaterial &material)
const StdMeshMaterial * Material