void MeshLoader_v1::Load(MeshPtr mesh, DataStreamPtr stream) { bool hasBound = false; chunk ck; while (ReadChunk(ck, stream)) { switch (ck.id) { case MC_SUBMESH: ReadSubMesh(mesh->CreateSubMesh(), stream); break; case MC_BOUNDS: ReadBounds(mesh, stream); hasBound = TRUE; break; case MC_SKELETON: ReadSkeleton(mesh, stream); break; case MC_SKELANIM: ReadSkelAnim(mesh, stream); break; } } if (!hasBound) mesh->CalcuBounds(); }
void MeshLoader_v0::Load(MeshPtr mesh, DataStreamPtr stream) { bool hasBound = false; chunk ck; while (ReadChunk(ck, stream) && (ck.id == MC_SUBMESH || ck.id == MC_BOUNDS || ck.id == MC_SKELETON)) { switch (ck.id) { case MC_SUBMESH: ReadSubMesh(mesh->CreateSubMesh(), stream); break; case MC_BOUNDS: ReadBounds(mesh, stream); hasBound = TRUE; break; case MC_SKELETON: ReadSkeleton(mesh, stream); break; } } if (!hasBound) mesh->CalcuBounds(); TString128 mtlSource = File::RemoveExternName(mesh->GetSourceName()) + ".material"; DataStreamPtr mtlStream = ResourceManager::Instance()->OpenResource(mtlSource.c_str()); if (mtlStream.NotNull()) { MaterialLoader loader; loader.Load(mesh.c_ptr(), mtlStream); } }