public override void Init() { if (isInitialized) { return; } MeshChunk mesh; int idx = 0; do { mesh = this.model.GetChildOfType <MeshChunk>(idx); if (mesh != null) { idx++; Mesh m = new Mesh(mesh, this.varEquip); this.meshes.Add(m); m.Init(); } } while (mesh != null); BoundingBoxContainerChunk aabbContainer = this.model.GetChildOfType <BoundingBoxContainerChunk>(); CompChunk aabbChunk = aabbContainer.GetChildOfType <CompChunk>(); this.BoundingBox = aabbChunk.BoundingBox; var aabb = this.BoundingBox; bboxOffset = new Vector4(0, 0, 0, 0); bboxScale = new Vector4(1f, 1f, 1f, 1f); bboxScale.X = (aabb.Maximum.X - aabb.Minimum.X) / 2f; bboxScale.Y = (aabb.Maximum.Y - aabb.Minimum.Y) / 2f; bboxScale.Z = (aabb.Maximum.Z - aabb.Minimum.Z) / 2f; bboxOffset.X = aabb.Maximum.X - bboxScale.X; bboxOffset.Y = aabb.Maximum.Y - bboxScale.Y; bboxOffset.Z = aabb.Maximum.Z - bboxScale.Z; isInitialized = true; }
public override void Init() { if (isInitialized) { return; } MeshChunk mesh; int idx = 0; do { mesh = this.model.GetChildOfType<MeshChunk>(idx); if (mesh != null) { idx++; Mesh m = new Mesh(mesh, this.varEquip); this.meshes.Add(m); m.Init(); } } while (mesh != null); BoundingBoxContainerChunk aabbContainer = this.model.GetChildOfType<BoundingBoxContainerChunk>(); CompChunk aabbChunk = aabbContainer.GetChildOfType<CompChunk>(); this.BoundingBox = aabbChunk.BoundingBox; var aabb = this.BoundingBox; bboxOffset = new Vector4(0, 0, 0, 0); bboxScale = new Vector4(1f, 1f, 1f, 1f); bboxScale.X = (aabb.Maximum.X - aabb.Minimum.X) / 2f; bboxScale.Y = (aabb.Maximum.Y - aabb.Minimum.Y) / 2f; bboxScale.Z = (aabb.Maximum.Z - aabb.Minimum.Z) / 2f; bboxOffset.X = aabb.Maximum.X - bboxScale.X; bboxOffset.Y = aabb.Maximum.Y - bboxScale.Y; bboxOffset.Z = aabb.Maximum.Z - bboxScale.Z; isInitialized = true; }