void UpdateBoundingFrustum() { // Update frustum BoundingFrustum.Matrix = ViewProjectionMatrix; BoundingFrustumFar.Matrix = ViewProjectionMatrixFar; // Update bounding box BoundingBox = BoundingBoxD.CreateInvalid(); BoundingBox.Include(ref BoundingFrustum); // Update bounding sphere BoundingSphere = MyUtils.GetBoundingSphereFromBoundingBox(ref BoundingBox); }
public BoundingBoxD GetAABB() { if (m_cornersTmp == null) { m_cornersTmp = new Vector3D[8]; } this.GetCorners(m_cornersTmp, 0); BoundingBoxD xd = BoundingBoxD.CreateInvalid(); for (int i = 0; i < 8; i++) { xd.Include(m_cornersTmp[i]); } return(xd); }
public unsafe BoundingBoxD Transform(ref MatrixD worldMatrix) { BoundingBoxD oobb = BoundingBoxD.CreateInvalid(); Vector3 *temporaryCorners = stackalloc Vector3[8]; GetCornersUnsafe((Vector3 *)temporaryCorners); for (int i = 0; i < 8; i++) { Vector3D vctTransformed = Vector3.Transform(temporaryCorners[i], worldMatrix); oobb = oobb.Include(ref vctTransformed); } return(oobb); }