private void ReadObjects(FileContext ctx) { string name = "<unnamed>"; ResetObjects(); while (ctx.ReadChunk()) { switch (ctx.chunk.id) { case kNamedObject: // (object block name = ctx.PopString(); break; case kObjMesh: { MeshObject mesh = new MeshObject(name); if (mesh.ProcessChunk(ctx)) { _meshes.Add(mesh); } } break; case kMat: // material object { Material mat = new Material(); if (mat.ProcessChunk(ctx)) { _materials.Add(mat); } } break; case kVersionMesh: _meshVersion = ctx.PopDword(); break; case kMasterScale: _masterScale = ctx.PopFloat(); break; case kChunkKeyFrame: ReadKeyFrameData(ctx); break; default: ctx.SkipChunk(); break; } } }