protected BoundingSphere CalcBoundingSphere() { BoundingSphere sphere = new BoundingSphere(); for (int iMesh = 0; iMesh < listMeshRenderObj.Count; iMesh++) { MeshRenderObj meshRenderObj = listMeshRenderObj[iMesh] as MeshRenderObj; sphere = BoundingSphere.CreateMerged(sphere, meshRenderObj.BoundingSphere); } return(sphere); }
protected BoundingBox CalcBoundingBox() { BoundingBox box = new BoundingBox(); for (int iMesh = 0; iMesh < listMeshRenderObj.Count; iMesh++) { MeshRenderObj meshRenderObj = listMeshRenderObj[iMesh] as MeshRenderObj; box = BoundingBox.CreateMerged(box, meshRenderObj.BoundingBox); } return(box); }
public void Render(Camera camera, Matrix transform, List <List <PartInfo> > listMeshPartInfos) { Debug.Assert(listMeshPartInfos == null || listMeshRenderObj.Count == listMeshPartInfos.Count); for (int iMesh = 0; iMesh < listMeshRenderObj.Count; iMesh++) { MeshRenderObj meshRenderObj = (MeshRenderObj)listMeshRenderObj[iMesh]; List <PartInfo> listPartInfo = null; if (listMeshPartInfos != null) { listPartInfo = listMeshPartInfos[iMesh]; } meshRenderObj.Render(camera, transform, listPartInfo); } }
private void RecurseBonesAndCreateRenderObjs(Model model, ModelBone bone) { foreach (ModelBone childbone in bone.Children) { ModelMesh mesh = ModelHelper.FindMatchingMeshForBone(model, childbone); if (mesh != null) { List <PartInfo> meshInfoList = new List <PartInfo>(); foreach (ModelMeshPart part in mesh.MeshParts) { PartInfo partInfo = new PartInfo(); partInfo.InitFromPart(part); meshInfoList.Add(partInfo); // create a bounding box from the mesh? } MeshRenderObj renderobj = new MeshRenderObj(mesh, meshInfoList); listMeshRenderObj.Add(renderobj); } RecurseBonesAndCreateRenderObjs(model, childbone); } }