diff --git a/source/graphics/Model.cpp b/source/graphics/Model.cpp
index da8d3c1..df81fda 100644
a
|
b
|
void CModel::CalcAnimatedObjectBounds(CSkeletonAnimDef* anim, CBoundingBoxAligne
|
177 | 177 | ValidatePosition(); |
178 | 178 | |
179 | 179 | // extend bounds by vertex positions at the frame |
180 | | for (size_t i=0;i<numverts;i++) |
181 | | { |
182 | | result += CModelDef::SkinPoint(verts[i], GetAnimatedBoneMatrices()); |
183 | | } |
| 180 | result += CModelDef::SkinPoints(numverts, verts, GetAnimatedBoneMatrices()); |
184 | 181 | // advance to next frame |
185 | 182 | m_AnimTime += anim->GetFrameTime(); |
186 | 183 | } |
diff --git a/source/graphics/ModelDef.cpp b/source/graphics/ModelDef.cpp
index d2891f1..1e135bb 100644
a
|
b
|
CVector3D CModelDef::SkinPoint(const SModelVertex& vtx,
|
43 | 43 | return result; |
44 | 44 | } |
45 | 45 | |
| 46 | CVector3D CModelDef::SkinPoints( |
| 47 | size_t numVertices, |
| 48 | const SModelVertex* vertices, |
| 49 | const CMatrix3D newPoseMatrices[]) |
| 50 | { |
| 51 | CVector3D result (0, 0, 0); |
| 52 | |
| 53 | for (size_t j = 0; j < numVertices; ++j) |
| 54 | { |
| 55 | const SModelVertex& vtx = vertices[j]; |
| 56 | |
| 57 | for (int i = 0; i < SVertexBlend::SIZE && vtx.m_Blend.m_Bone[i] != 0xff; ++i) |
| 58 | result += newPoseMatrices[vtx.m_Blend.m_Bone[i]].Transform(vtx.m_Coords) * vtx.m_Blend.m_Weight[i]; |
| 59 | } |
| 60 | return result; |
| 61 | } |
| 62 | |
46 | 63 | CVector3D CModelDef::SkinNormal(const SModelVertex& vtx, |
47 | 64 | const CMatrix3D newPoseMatrices[]) |
48 | 65 | { |
diff --git a/source/graphics/ModelDef.h b/source/graphics/ModelDef.h
index 0cd1c05..1e071bc 100644
a
|
b
|
public:
|
194 | 194 | */ |
195 | 195 | static CVector3D SkinPoint(const SModelVertex& vtx, |
196 | 196 | const CMatrix3D newPoseMatrices[]); |
197 | | |
| 197 | /** |
| 198 | * Add up all results of SkinPoint over vertices. |
| 199 | */ |
| 200 | static CVector3D SkinPoints( |
| 201 | size_t numVertices, |
| 202 | const SModelVertex* vertices, |
| 203 | const CMatrix3D newPoseMatrices[]); |
198 | 204 | /** |
199 | 205 | * Transform the given vertex's normal from the bind pose into the new pose. |
200 | 206 | * |