25 struct StdMeshFaceOrderHelper
32 static int StdMeshFaceCmp(
const StdMeshFaceOrderHelper& h1,
const StdMeshFaceOrderHelper& h2)
34 if(h1.z < h2.z)
return -1;
35 else if(h1.z > h2.z)
return +1;
39 #define SORT_NAME StdMesh
40 #define SORT_TYPE StdMeshFaceOrderHelper
41 #define SORT_CMP StdMeshFaceCmp
42 #include "timsort/sort.h"
44 std::vector<StdMeshInstance::SerializableValueProvider::IDBase*>* StdMeshInstance::SerializableValueProvider::IDs =
nullptr;
50 struct StdMeshSubMeshVisibilityCmpPred
60 struct StdMeshSubMeshInstanceVisibilityCmpPred
78 return trans(2,0)*vtx.
x + trans(2,1)*vtx.
y + trans(2,2)*vtx.
z + trans(2,3);
83 const float z1 = StdMeshFaceOrderGetVertexZ(vertices[face.
Vertices[0]], trans);
84 const float z2 = StdMeshFaceOrderGetVertexZ(vertices[face.
Vertices[1]], trans);
85 const float z3 = StdMeshFaceOrderGetVertexZ(vertices[face.
Vertices[2]], trans);
86 return std::max(std::max(z1,
z2), z3);
91 if(faces.empty())
return;
93 std::vector<StdMeshFaceOrderHelper> helpers(faces.size());
94 for(
unsigned int i = 0; i < faces.size(); ++i)
97 helpers[i].z = StdMeshFaceOrderGetFaceZ(vertices, faces[i], trans);
119 StdMesh_tim_sort(&helpers[0], helpers.size());
121 std::vector<StdMeshFace> new_faces(faces.size());
122 switch(face_ordering)
128 for(
unsigned int i = 0; i < faces.size(); ++i)
129 new_faces[i] = faces[helpers[i].i];
132 for(
unsigned int i = 0; i < faces.size(); ++i)
133 new_faces[i] = faces[helpers[faces.size() - i - 1].i];
140 faces.swap(new_faces);
145 struct ValueProviderAdapt
148 ValueProvider(Provider) {}
168 if(!svp) pComp->
excCorrupt(
"Value provider cannot be compiled");
170 if(!
id) pComp->
excCorrupt(
"No ID for value provider registered");
181 *ValueProvider = svp;
212 for(
unsigned int i = 0; i < 3; ++i)
214 for(
unsigned int j = 0; j < 4; ++j)
217 CompileFloat(pComp, Matrix(i, j));
225 struct TransformAdapt
236 CompileFloat(pComp, Trans.
rotate.
w);
237 CompileFloat(pComp, Trans.
rotate.
x);
238 CompileFloat(pComp, Trans.
rotate.
y);
239 CompileFloat(pComp, Trans.
rotate.
z);
240 CompileFloat(pComp, Trans.
scale.
x);
241 CompileFloat(pComp, Trans.
scale.
y);
242 CompileFloat(pComp, Trans.
scale.
z);
247 MatrixAdapt mkMatrixAdapt(
StdMeshMatrix& Matrix) {
return MatrixAdapt(Matrix); }
257 ClearAnimationListRecursively(list, node->
GetLeftChild());
282 else if(buf.
Compare_(
".L", len-2) == 0)
293 std::map<float, StdMeshKeyFrame>::const_iterator iter = Frames.lower_bound(time);
298 if (iter == Frames.begin())
299 return iter->second.Transformation;
301 std::map<float, StdMeshKeyFrame>::const_iterator prev_iter = iter;
305 if (iter == Frames.end())
310 iter = Frames.begin();
315 iter_pos = iter->first;
319 assert(iter_pos > prev_iter->first);
322 assert(time >= prev_iter->first);
323 assert(iter_pos >= time);
325 float dt = iter_pos - prev_iter->first;
326 float weight1 = (time - prev_iter->first) / dt;
327 float weight2 = (iter_pos - time) / dt;
330 assert(weight1 >= 0 && weight2 >= 0 && weight1 <= 1 && weight2 <= 1);
331 assert(fabs(weight1 + weight2 - 1) < 1e-6);
337 Name(other.Name), Length(other.Length), Tracks(other.Tracks.size())
340 for (
unsigned int i = 0; i < Tracks.size(); ++i)
344 OriginSkeleton = other.OriginSkeleton;
349 for (
auto & Track : Tracks)
355 if (
this == &other)
return *
this;
360 for (
auto & Track : Tracks)
363 Tracks.resize(other.Tracks.size());
365 for (
unsigned int i = 0; i < Tracks.size(); ++i)
372 StdMeshSkeleton::StdMeshSkeleton() =
default;
376 for (
auto & Bone : Bones)
380 void StdMeshSkeleton::AddMasterBone(
StdMeshBone *bone)
382 bone->
Index = Bones.size();
383 Bones.push_back(bone);
384 for (
auto & i : bone->Children)
391 for (
const auto & Bone : Bones)
392 if (Bone->Name == name)
401 std::map<StdCopyStrBuf, StdMeshAnimation>::const_iterator iter = Animations.find(name2);
402 if (iter == Animations.end())
return nullptr;
403 return &iter->second;
408 std::vector<const StdMeshAnimation*> result;
409 result.reserve(Animations.size());
410 for (
const auto & Animation : Animations)
411 result.push_back(&Animation.second);
421 if (!MirrorName(name) || Animations.find(name) != Animations.end())
426 StdMeshAnimation& new_anim = Animations.insert(std::make_pair(name, animation)).first->second;
427 new_anim.
Name = name;
434 if (MirrorName(other_bone_name))
438 throw std::runtime_error(std::string(
"No counterpart for bone ") + bone.
Name.
getData() +
" found");
441 if ((animation.Tracks[i] !=
nullptr || animation.Tracks[other_bone->
Index] !=
nullptr) &&
444 std::swap(new_anim.Tracks[i], new_anim.Tracks[other_bone->
Index]);
450 if (new_anim.Tracks[i] !=
nullptr)
451 for (
auto & Frame : new_anim.Tracks[i]->Frames)
454 if (new_anim.Tracks[other_bone->
Index] !=
nullptr)
455 for (
auto & Frame : new_anim.Tracks[other_bone->
Index]->Frames)
461 if (new_anim.Tracks[i] !=
nullptr)
466 for (
auto & Frame : new_anim.Tracks[i]->Frames)
475 assert(Animations.find(animation.
Name) == Animations.end());
477 Animations.insert(std::make_pair(animation.
Name, animation));
482 assert(Animations.find(animation.
Name) == Animations.end());
492 anim.OriginSkeleton = &source;
495 for (
unsigned int i = 0; i < anim.Tracks.size(); ++i)
497 if (bone_index_source[i] > -1 && animation.Tracks[bone_index_source[i]] !=
nullptr)
499 anim.Tracks[i] =
new StdMeshTrack(*animation.Tracks[bone_index_source[i]]);
504 Animations.insert(std::make_pair(animation.
Name, anim));
510 for (
auto & Animation : Animations)
523 std::vector<int> MatchedBoneInParentSkeleton;
526 for (
unsigned int i = 0; i < child_skeleton.
GetNumBones(); ++i)
528 int parent_bone_index = -1;
537 parent_bone_index = sample_index;
543 MatchedBoneInParentSkeleton.push_back(parent_bone_index);
546 return MatchedBoneInParentSkeleton;
552 BoundingBox.x1 = BoundingBox.y1 = BoundingBox.z1 = 0.0f;
553 BoundingBox.x2 = BoundingBox.y2 = BoundingBox.z2 = 0.0f;
554 BoundingRadius = 0.0f;
561 glDeleteBuffers(1, &ibo);
563 glDeleteBuffers(1, &vbo);
573 std::sort(SubMeshes.begin(), SubMeshes.end(), StdMeshSubMeshVisibilityCmpPred());
584 void StdMesh::UpdateVBO()
589 glDeleteBuffers(1, &vbo);
590 glGenBuffers(1, &vbo);
593 size_t total_vertices = SharedVertices.size();
594 for (
auto &submesh : SubMeshes)
596 total_vertices += submesh.GetNumVertices();
599 glBindBuffer(GL_ARRAY_BUFFER, vbo);
607 glBufferData(GL_ARRAY_BUFFER, total_vertices *
sizeof(
StdMeshVertex),
nullptr, GL_STATIC_DRAW);
608 void *map = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
609 uint8_t *buffer =
static_cast<uint8_t*
>(map);
610 uint8_t *cursor = buffer;
613 if (!SharedVertices.empty())
615 size_t shared_vertices_size = SharedVertices.size() *
sizeof(SharedVertices[0]);
616 std::memcpy(cursor, &SharedVertices[0], shared_vertices_size);
617 cursor += shared_vertices_size;
621 for (
auto &submesh : SubMeshes)
624 submesh.vertex_buffer_offset = cursor - buffer;
626 if (submesh.Vertices.empty())
continue;
627 size_t vertices_size =
sizeof(submesh.Vertices[0]) * submesh.Vertices.size();
628 std::memcpy(cursor, &submesh.Vertices[0], vertices_size);
629 cursor += vertices_size;
631 }
while (glUnmapBuffer(GL_ARRAY_BUFFER) == GL_FALSE);
633 glBindBuffer(GL_ARRAY_BUFFER, 0);
636 void StdMesh::UpdateIBO()
640 glDeleteBuffers(1, &ibo);
641 glGenBuffers(1, &ibo);
642 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
645 size_t total_faces = 0;
646 for (
auto &submesh : SubMeshes)
647 total_faces += submesh.GetNumFaces();
648 glBufferData(GL_ELEMENT_ARRAY_BUFFER, total_faces * 3 *
sizeof(GLuint),
nullptr, GL_STATIC_DRAW);
650 for (
auto &submesh : SubMeshes)
652 submesh.index_buffer_offset = offset * 3 *
sizeof(GLuint);
653 glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, submesh.index_buffer_offset, submesh.GetNumFaces() * 3 *
sizeof(GLuint), &submesh.Faces[0]);
654 offset += submesh.GetNumFaces();
656 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
661 base(&submesh), Material(nullptr), CurrentFaceOrdering(FO_Fixed)
675 for (
unsigned int i = 0; i < submesh.
GetNumFaces(); ++i)
678 if(completion < 1.0f)
707 for (
unsigned int i = 0; i <
PassData.size(); ++i)
713 for (
unsigned int j = 0; j < pass.
TextureUnits.size(); ++j)
719 PassData[i].TexUnits.push_back(unit);
748 else if( ((clrmod >> 24) & 0xff) != 0xff)
768 buf.
Format(R
"(There is no such material with name "%s")", material_name.getData());
789 Leaf.Animation =
nullptr;
790 Leaf.Position =
nullptr;
795 Leaf.Animation = animation;
796 Leaf.Position = position;
800 Type(CustomNode), Parent(nullptr)
802 Custom.BoneIndex = bone->
Index;
807 Type(LinearInterpolationNode), Parent(nullptr)
809 LinearInterpolation.ChildLeft = child_left;
810 LinearInterpolation.ChildRight = child_right;
811 LinearInterpolation.Weight = weight;
819 delete Leaf.Position;
822 delete Custom.Transformation;
825 delete LinearInterpolation.ChildLeft;
826 delete LinearInterpolation.ChildRight;
827 delete LinearInterpolation.Weight;
840 track = Leaf.Animation->Tracks[bone];
841 if (!track)
return false;
845 if(bone == Custom.BoneIndex)
846 transformation = *Custom.Transformation;
851 if (!LinearInterpolation.ChildLeft->GetBoneTransform(bone, transformation))
852 return LinearInterpolation.ChildRight->GetBoneTransform(bone, transformation);
853 if (!LinearInterpolation.ChildRight->GetBoneTransform(bone, combine_with))
872 {
nullptr,
static_cast<NodeType>(0) }
887 if(!Leaf.Animation) pComp->
excCorrupt(R
"(No such animation: "%s")", anim_name.getData());
903 Custom.BoneIndex = bone->Index;
911 pComp->
Value(
mkNamingAdapt(mkTransformAdapt(*Custom.Transformation),
"Transformation"));
916 pComp->
Value(
mkNamingAdapt(mkValueProviderAdapt(&LinearInterpolation.Weight),
"Weight"));
919 if(LinearInterpolation.ChildLeft->Slot !=
Slot)
920 pComp->
excCorrupt(
"Slot of left child does not match parent slot");
921 if(LinearInterpolation.ChildRight->Slot !=
Slot)
922 pComp->
excCorrupt(
"Slof of right child does not match parent slot");
923 LinearInterpolation.ChildLeft->Parent =
this;
924 LinearInterpolation.ChildRight->Parent =
this;
928 pComp->
excCorrupt(
"Invalid animation node type");
942 value_provider =
nullptr;
962 value_provider =
nullptr;
976 unsigned int parent_bone,
unsigned int child_bone,
const StdMeshMatrix& transform, uint32_t flags):
977 Number(number), Parent(parent), Child(child), OwnChild(own_child), ChildDenumerator(denumerator),
978 ParentBone(parent_bone), ChildBone(child_bone), AttachTrans(transform), Flags(flags),
979 FinalTransformDirty(true)
988 delete ChildDenumerator;
993 const StdMeshBone* bone_obj = Parent->GetMesh().GetSkeleton().GetBoneByName(bone);
994 if (!bone_obj)
return false;
995 ParentBone = bone_obj->
Index;
997 FinalTransformDirty =
true;
1003 const StdMeshBone* bone_obj = Child->GetMesh().GetSkeleton().GetBoneByName(bone);
1004 if (!bone_obj)
return false;
1005 ChildBone = bone_obj->
Index;
1007 FinalTransformDirty =
true;
1013 AttachTrans = transformation;
1014 FinalTransformDirty =
true;
1021 FinalTransformDirty =
true;
1022 ChildDenumerator = Factory();
1037 uint8_t dwSyncFlags =
static_cast<uint8_t
>(Flags);
1046 ChildDenumerator->DenumeratePointers(
this);
1048 assert(Child !=
nullptr);
1049 Child->AttachParent =
this;
1051 MapBonesOfChildToParent(Parent->GetMesh().GetSkeleton(), Child->GetMesh().GetSkeleton());
1054 Child->DenumeratePointers();
1059 return ChildDenumerator->ClearPointers(pObj);
1068 MatchedBoneInParentSkeleton.clear();
1069 MatchedBoneInParentSkeleton = parent_skeleton.
GetMatchingBones(child_skeleton);
1095 if (
ibo) glDeleteBuffers(1, &
ibo);
1114 delete SubMeshInstance;
1130 if ((*iter)->OwnChild)
1131 (*iter)->Child->SetFaceOrdering(ordering);
1147 if ((*iter)->OwnChild)
1148 (*iter)->Child->SetFaceOrderingForClrModulation(clrmod);
1170 if (!animation) {
delete position;
delete weight;
return nullptr; }
1172 return PlayAnimation(*animation, slot, sibling, position, weight, stop_previous_animation);
1195 if (parent ==
nullptr)
1208 if (parent->LinearInterpolation.ChildLeft == node)
1210 other_child = parent->LinearInterpolation.ChildRight;
1211 parent->LinearInterpolation.ChildRight =
nullptr;
1215 other_child = parent->LinearInterpolation.ChildLeft;
1216 parent->LinearInterpolation.ChildLeft =
nullptr;
1222 if (parent->
Parent->LinearInterpolation.ChildLeft == parent)
1223 parent->
Parent->LinearInterpolation.ChildLeft = other_child;
1225 parent->
Parent->LinearInterpolation.ChildRight = other_child;
1232 *iter = other_child;
1234 other_child->
Parent =
nullptr;
1263 delete node->Leaf.Position;
1264 node->Leaf.Position = position;
1274 *node->Custom.Transformation = trans;
1281 delete node->LinearInterpolation.Weight; node->LinearInterpolation.Weight = weight;
1302 for (
unsigned int j = 0; j < submesh.
PassData.size(); ++j)
1305 for (
unsigned int k = 0; k < pass.
TexUnits.size(); ++k)
1312 const float PhaseDuration = texunit.
Duration / NumPhases;
1314 const float Position = texunit_instance.
PhaseDelay + dt;
1315 const unsigned int AddPhases =
static_cast<unsigned int>(Position / PhaseDuration);
1317 texunit_instance.
Phase = (texunit_instance.
Phase + AddPhases) % NumPhases;
1318 texunit_instance.
PhaseDelay = Position - AddPhases * PhaseDuration;
1330 iter->Child->ExecuteAnimation(dt);
1335 std::unique_ptr<AttachedMesh::Denumerator> auto_denumerator(denumerator);
1338 AttachedMesh* attach =
AttachMesh(*instance, auto_denumerator.release(), parent_bone, child_bone, transformation, flags,
true, attach_number);
1339 if (!attach) {
delete instance;
return nullptr; }
1345 std::unique_ptr<AttachedMesh::Denumerator> auto_denumerator(denumerator);
1352 unsigned int number = 0;
1357 if (attach_number != 0)
1360 if (attach ==
nullptr)
return nullptr;
1361 direct_parent = attach->
Child;
1364 return direct_parent->
AttachMeshImpl(instance, auto_denumerator.release(), parent_bone, child_bone, transformation, flags, own_child, number);
1369 std::unique_ptr<AttachedMesh::Denumerator> auto_denumerator(denumerator);
1376 if (Parent == &instance)
1381 if (!parent_bone_obj || !child_bone_obj)
return nullptr;
1383 AttachedMesh* attach =
new AttachedMesh(new_attach_number,
this, &instance, own_child, auto_denumerator.release(), parent_bone_obj->
Index, child_bone_obj->
Index, transformation, flags);
1399 if ((*iter)->Number == number)
1401 AttachedMesh* attached = *iter;
1405 attached->Child->AttachParent = nullptr;
1406 attached->Parent->AttachChildren.erase(iter);
1425 if ((*iter)->Number == number)
1450 assert(i < AttachParent->MatchedBoneInParentSkeleton.size());
1452 int parent_bone_index =
AttachParent->MatchedBoneInParentSkeleton[i];
1454 if (parent_bone_index > -1)
1466 return AttachParent->MatchedBoneInParentSkeleton.size();
1485 assert(!parent || parent->
Index < i);
1487 bool have_transform =
false;
1493 if (j->GetBoneTransform(i, other))
1498 have_transform = j->GetBoneTransform(i, Transformation);
1502 if (!have_transform)
1520 const bool ChildBoneTransformsDirty = attach->Child->BoneTransformsDirty;
1521 attach->Child->UpdateBoneTransforms();
1540 * attach->AttachTrans
1544 attach->FinalTransformDirty =
false;
1558 assert((inst.
Faces.size() > 0) &&
"StdMeshInstance sub-mesh instance has zero faces");
1590 if(!valid) pComp->
excCorrupt(
"Mesh instance is invalid");
1592 int32_t iSubMeshCnt;
1595 pComp->
excCorrupt(
"Invalid number of submeshes");
1596 for(int32_t i = 0; i < iSubMeshCnt; ++i)
1606 for(int32_t i = 0; i < iAnimCnt; ++i)
1611 if(*iter !=
nullptr) {
delete node; pComp->
excCorrupt(
"Duplicate animation slot index"); }
1615 std::vector<AnimationNode*> nodes(1, node);
1616 while(!nodes.empty())
1618 node = nodes.back();
1619 nodes.erase(nodes.end()-1);
1628 nodes.push_back(node->LinearInterpolation.ChildLeft);
1629 nodes.push_back(node->LinearInterpolation.ChildRight);
1634 int32_t iAttachedCnt;
1637 for(int32_t i = 0; i < iAttachedCnt; ++i)
1657 for(int32_t i = 0; i < iSubMeshCnt; ++i)
1682 i->DenumeratePointers();
1692 std::vector<unsigned int> Removal;
1694 if(!i->ClearPointers(pObj))
1695 Removal.push_back(i->Number);
1697 for(
unsigned int i : Removal)
1701 template<
typename IteratorType,
typename FuncObj>
1704 for (IteratorType iter = begin; iter != end; ++iter)
1706 if (!obj(iter))
return false;
1710 if( (*iter)->OwnChild)
1711 if (!
ScanAttachTree((*iter)->Child->AttachChildren.begin(), (*iter)->Child->AttachChildren.end(), obj))
1723 if ((*iter)->Slot == slot)
1727 else if ((*iter)->Slot > slot)
1744 assert(!sibling || !stop_previous_animation);
1747 assert(!sibling || sibling->
Slot == slot);
1750 if (sibling && stop_previous_animation)
1758 unsigned int Number1, Number2;
1765 Number2 = Number1 + 1;
1780 parent->
Number = Number2;
1781 parent->
Slot = slot;
1785 parent->LinearInterpolation.ChildLeft = sibling;
1786 parent->LinearInterpolation.ChildRight = node;
1789 if (sibling->
Parent->LinearInterpolation.ChildLeft == sibling)
1790 sibling->
Parent->LinearInterpolation.ChildLeft = parent;
1792 sibling->
Parent->LinearInterpolation.ChildRight = parent;
1803 sibling->
Parent = parent;
1867 if (provider->
Value != old_value)
1879 if (!left_result && !right_result)
1905 attach->Child->SetBoneTransformsDirty(value);
1915 bool all_submeshes_fixed =
true;
1919 if (!all_submeshes_fixed)
break;
1922 all_submeshes_fixed = inst->GetNumFaces() == inst->GetSubMesh().GetNumFaces();
1923 if (!all_submeshes_fixed)
break;
1929 if (all_submeshes_fixed)
1931 if (
ibo) glDeleteBuffers(1, &
ibo);
1948 size_t total_faces = 0;
1952 glGenBuffers(1, &
ibo);
1953 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,
ibo);
1956 glBufferData(GL_ELEMENT_ARRAY_BUFFER, total_faces * 3 *
sizeof(GLuint),
nullptr, GL_STREAM_DRAW);
1960 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,
ibo);
1965 assert(inst->GetNumFaces() <= inst->GetSubMesh().GetNumFaces());
1966 glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, inst->GetSubMesh().GetOffsetInIBO(), inst->GetNumFaces() * 3 *
sizeof(GLuint), &inst->Faces[0]);
1969 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
void CompileFunc(C4Real &rValue, StdCompiler *pComp)
float fixtof(const C4Fixed &x)
C4Fixed itofix(int32_t x)
T Clamp(T bval, T lbound, T rbound)
StdBitfieldAdapt< T > mkBitfieldAdapt(T &rVal, const StdBitfieldEntry< T > *pNames)
StdDecompileAdapt< T > mkDecompileAdapt(const T &rValue)
StdContextPtrAdapt< T, ContextT > mkContextPtrAdapt(T *&rpObj, const ContextT &ctx, bool fAllowNull=true)
StdPtrAdapt< T > mkNamingPtrAdapt(T *&rpObj, const char *szNaming)
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
StdNamingCountAdapt< int_t > mkNamingCountAdapt(int_t &iCount, const char *szName)
#define toC4CStrBuf(rBuf)
StdNamingAdapt< T > mkNamingAdapt(T &&rValue, const char *szName)
StdMeshTransformation Transformation
StdMeshMatManager MeshMaterialManager
void ObjectLabel(uint32_t identifier, uint32_t name, int32_t length, const char *label)
void FreeVAOID(unsigned int vaoid)
virtual bool Separator(Sep eSep=SEP_SEP)
void excCorrupt(const char *szMessage,...)
void Value(const T &rStruct)
virtual bool isDeserializer()
StdMeshAnimation & operator=(const StdMeshAnimation &other)
StdMeshAnimation()=default
StdMeshTransformation InverseTransformation
StdMeshTransformation Transformation
const StdMeshBone * GetParent() const
const StdSubMesh & GetSubMesh(size_t i) const
size_t GetNumSubMeshes() const
const StdMeshSkeleton & GetSkeleton() const
bool SetChildBone(const StdStrBuf &bone)
void DenumeratePointers()
void SetAttachTransformation(const StdMeshMatrix &transformation)
uint32_t GetFlags() const
void CompileFunc(StdCompiler *pComp, DenumeratorFactoryFunc Factory)
bool SetParentBone(const StdStrBuf &bone)
bool ClearPointers(class C4Object *pObj)
virtual void DenumeratePointers()
virtual void ClearPointers(class C4Object *pObj)
static const IDBase * Lookup(const char *name)
virtual void CompileFunc(StdCompiler *pComp)
ValueProvider * GetWeightProvider()
void CompileFunc(StdCompiler *pComp, const StdMesh *Mesh)
void ClearPointers(class C4Object *pObj)
~StdMeshInstanceAnimationNode()
bool GetBoneTransform(unsigned int bone, StdMeshTransformation &transformation)
@ LinearInterpolationNode
StdMeshInstanceAnimationNode()
AnimationNode * GetLeftChild()
void DenumeratePointers()
unsigned int GetNumber() const
ValueProvider * GetPositionProvider()
const StdMeshAnimation * GetAnimation() const
AnimationNode * GetRightChild()
float GetCompletion() const
static bool ScanAttachTree(IteratorType begin, IteratorType end, const FuncObj &obj)
void SetCompletion(float completion)
void SetMaterial(size_t i, const StdMeshMaterial &material)
std::vector< StdSubMeshInstance * > SubMeshInstances
std::vector< StdSubMeshInstance * > SubMeshInstancesOrdered
StdMeshInstanceAnimationNode AnimationNode
void ReorderFaces(StdMeshMatrix *global_trans)
AnimationNodeList AnimationNodes
void InsertAnimationNode(AnimationNode *node, int slot, AnimationNode *sibling, ValueProvider *weight, bool stop_previous_animation)
AnimationNodeList AnimationStack
bool DetachMesh(unsigned int number)
AnimationNode * GetRootAnimationForSlot(int slot)
size_t GetBoneCount() const
bool UpdateBoneTransforms()
AnimationNode * PlayAnimation(const StdStrBuf &animation_name, int slot, AnimationNode *sibling, ValueProvider *position, ValueProvider *weight, bool stop_previous_animation)
void ClearPointers(class C4Object *pObj)
void SetFaceOrderingForClrModulation(uint32_t clrmod)
void StopAnimation(AnimationNode *node)
AttachedMesh * GetAttachedMeshByNumber(unsigned int number) const
const StdMesh & GetMesh() const
std::vector< StdMeshMatrix > BoneTransforms
AttachedMesh * AttachMeshImpl(StdMeshInstance &instance, AttachedMesh::Denumerator *denumerator, const StdStrBuf &parent_bone, const StdStrBuf &child_bone, const StdMeshMatrix &transformation, uint32_t flags, bool own_child, unsigned int new_attach_number)
void DenumeratePointers()
const std::vector< StdMeshVertex > & GetSharedVertices() const
StdMeshInstance(const StdMesh &mesh, float completion=1.0f)
void SetAnimationPosition(AnimationNode *node, ValueProvider *position)
AnimationNode * GetAnimationNodeByNumber(unsigned int number)
void ExecuteAnimation(float dt)
AnimationNodeList::iterator GetStackIterForSlot(int slot, bool create)
AttachedMesh * AttachParent
AttachedMeshList::const_iterator AttachedMeshIter
void SetBoneTransformsDirty(bool value)
void SetAnimationBoneTransform(AnimationNode *node, const StdMeshTransformation &trans)
AttachedMesh * AttachMesh(const StdMesh &mesh, AttachedMesh::Denumerator *denumerator, const StdStrBuf &parent_bone, const StdStrBuf &child_bone, const StdMeshMatrix &transformation=StdMeshMatrix::Identity(), uint32_t flags=AM_None, unsigned int attach_number=0)
void SetFaceOrdering(FaceOrdering ordering)
size_t GetNumSubMeshes() const
const StdMeshMatrix & GetBoneTransform(size_t i) const
bool ExecuteAnimationNode(AnimationNode *node)
void CompileFunc(StdCompiler *pComp, AttachedMesh::DenumeratorFactoryFunc Factory)
std::vector< AttachedMesh * > AttachChildren
void SetAnimationWeight(AnimationNode *node, ValueProvider *weight)
const StdMeshMaterial * GetMaterial(const char *material_name) const
std::vector< StdMeshMaterialTechnique > Techniques
std::vector< StdMeshMaterialTextureUnit > TextureUnits
std::vector< StdMeshMaterialPass > Passes
size_t GetNumTextures() const
bool HasFrameAnimation() const
bool HasTexCoordAnimation() const
static StdMeshMatrix Identity()
static StdMeshMatrix Inverse(const StdMeshMatrix &mat)
static StdMeshMatrix Transform(const StdMeshTransformation &transform)
std::vector< int > GetMatchingBones(const StdMeshSkeleton &skeleton) const
const StdMeshBone * GetBoneByName(const StdStrBuf &name) const
std::vector< const StdMeshAnimation * > GetAnimations() const
void InsertAnimation(const StdMeshAnimation &animation)
const StdMeshBone & GetBone(size_t i) const
const StdMeshAnimation * GetAnimationByName(const StdStrBuf &name) const
void MirrorAnimation(const StdMeshAnimation &animation)
size_t GetNumBones() const
StdMeshTransformation GetTransformAt(float time, float length) const
int Compare_(const char *pCData, size_t iAt=0) const
const char * getData() const
void Format(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
const StdMeshMaterial & GetMaterial() const
const StdMeshFace & GetFace(size_t i) const
size_t GetNumVertices() const
const std::vector< Vertex > & GetVertices() const
size_t GetNumFaces() const
void SetFaceOrdering(class StdMeshInstance &instance, const StdSubMesh &submesh, FaceOrdering ordering)
std::vector< TexUnit > TexUnits
void SetMaterial(const StdMeshMaterial &material)
const StdMeshMaterial * Material
std::vector< StdMeshFace > Faces
StdSubMeshInstance(class StdMeshInstance &instance, const StdSubMesh &submesh, float completion)
const StdSubMesh & GetSubMesh() const
std::vector< Pass > PassData
FaceOrdering CurrentFaceOrdering
void SetFaceOrderingForClrModulation(class StdMeshInstance &instance, const StdSubMesh &submesh, uint32_t clrmod)
const StdMeshMaterial & GetMaterial() const
void LoadFacesForCompletion(class StdMeshInstance &instance, const StdSubMesh &submesh, float completion)
void CompileFunc(StdCompiler *pComp)