public void DrawBoxLines(Matrix viewMatrix, Matrix projectionMatrix, GraphicsDevice device, BasicEffect basicEffect) { //Console.WriteLine("box num:" + buildingBoundingBoxes.Count()); foreach (BoundingBox box in buildingBoundingBoxes) { XNAUtils.DrawBoundingBox(box, device, basicEffect, Matrix.Identity, viewMatrix, projectionMatrix); } }
public void DrawBoxLines(Matrix viewMatrix, Matrix projectionMatrix, GraphicsDevice device, BasicEffect basicEffect) { foreach (OcTreeNode childNode in childList) { childNode.DrawBoxLines(viewMatrix, projectionMatrix, device, basicEffect); } if (modelList.Count > 0) { XNAUtils.DrawBoundingBox(nodeBoundingBox, device, basicEffect, Matrix.Identity, viewMatrix, projectionMatrix); } }
public Model LoadModel(ContentManager content, string asset) { _model = XNAUtils.LoadModelWithBoundingSphere(out _cubeTransforms, asset, content); _cubeTransforms = XNAUtils.AutoScale(_model, 15.0f); _cubeOriginalTransforms = new Matrix[_model.Bones.Count]; _model.CopyBoneTransformsTo(_cubeOriginalTransforms); _cubeConfiguration = new CubeConfiguration(); _cubeConfiguration.Init(_model); SelectedCubies = null; return(_model); }
/// <summary> /// Loads the bounding sphere of the model into it's tag. /// </summary> private void LoadModelBoundingSphere() { completeBoundingSphere = new BoundingSphere(); foreach (ModelMesh mesh in model.Meshes) { BoundingSphere origMeshSphere = mesh.BoundingSphere; BoundingSphere transMeshSphere = XNAUtils.TransformBoundingSphere(origMeshSphere, originalTransforms[mesh.ParentBone.Index]); completeBoundingSphere = BoundingSphere.CreateMerged(completeBoundingSphere, transMeshSphere); } model.Tag = completeBoundingSphere.Transform(Matrix.CreateScale(0.5f)); }