private void InitializeObjects() { // Set up the primary frustum object from a D3D projection matrix // NOTE: This can also be done on your camera's projection matrix. The projection // matrix built here is somewhat contrived so it renders well. XMMatrix xmProj = XMMatrix.PerspectiveFovLH(XMMath.PIDivFour, 1.77778f, 0.5f, 10.0f); this.primaryFrustum = BoundingFrustum.CreateFromMatrix(xmProj); this.primaryFrustum.Origin = new XMFloat3(this.primaryFrustum.Origin.X, this.primaryFrustum.Origin.Y, -7.0f); this.cameraOrigins[0] = new XMVector(0, 0, 0, 0); // Set up the primary axis aligned box this.primaryAABox.Center = new XMFloat3(CameraSpacing, 0, 0); this.primaryAABox.Extents = new XMFloat3(5, 5, 5); this.cameraOrigins[1] = new XMVector(CameraSpacing, 0, 0, 0); // Set up the primary oriented box with some rotation this.primaryOrientedBox.Center = new XMFloat3(-CameraSpacing, 0, 0); this.primaryOrientedBox.Extents = new XMFloat3(5, 5, 5); this.primaryOrientedBox.Orientation = XMQuaternion.RotationRollPitchYaw(XMMath.PIDivFour, XMMath.PIDivFour, 0); this.cameraOrigins[2] = new XMVector(-CameraSpacing, 0, 0, 0); // Set up the primary ray this.primaryRay.Origin = new XMVector(0, 0, CameraSpacing, 0); this.primaryRay.Direction = new XMVector(0, 0, 1, 0); this.cameraOrigins[3] = new XMVector(0, 0, CameraSpacing, 0); // Initialize all of the secondary objects with default values for (int i = 0; i < GroupCount; i++) { this.secondarySpheres[i].Sphere = new BoundingSphere(new XMFloat3(0, 0, 0), 1.0f); this.secondarySpheres[i].Collision = ContainmentType.Disjoint; this.secondaryOrientedBoxes[i].Box = new BoundingOrientedBox(new XMFloat3(0, 0, 0), new XMFloat3(0.5f, 0.5f, 0.5f), new XMFloat4(0, 0, 0, 1)); this.secondaryOrientedBoxes[i].Collision = ContainmentType.Disjoint; this.secondaryAABoxes[i].Box = new BoundingBox(new XMFloat3(0, 0, 0), new XMFloat3(0.5f, 0.5f, 0.5f)); this.secondaryAABoxes[i].Collision = ContainmentType.Disjoint; this.secondaryTriangles[i].PointA = XMVector.Zero; this.secondaryTriangles[i].PointB = XMVector.Zero; this.secondaryTriangles[i].PointC = XMVector.Zero; this.secondaryTriangles[i].Collision = ContainmentType.Disjoint; } // Set up ray hit result box this.rayHitResultBox.Box = new BoundingBox(new XMFloat3(0, 0, 0), new XMFloat3(0.05f, 0.05f, 0.05f)); }