public void Init()
        {
            {
                XMFloat3 vecEye = new XMFloat3(100.0f, 5.0f, 5.0f);
                XMFloat3 vecAt  = new XMFloat3(0.0f, 0.0f, 0.0f);
                XMFloat3 vecUp  = new XMFloat3(0.0f, 1.0f, 0.0f);

                this.ViewerCameraView       = XMMatrix.LookAtLH(vecEye, vecAt, vecUp);
                this.ViewerCameraProjection = XMMatrix.PerspectiveFovLH(XMMath.PIDivFour, 1.0f, 0.05f, 1.0f);
                this.ViewerCameraNearClip   = 0.05f;
                this.ViewerCameraFarClip    = 1.0f;
            }

            {
                XMFloat3 vecEye = new XMFloat3(-320.0f, 300.0f, -220.3f);
                XMFloat3 vecAt  = new XMFloat3(0.0f, 0.0f, 0.0f);
                XMFloat3 vecUp  = new XMFloat3(0.0f, 1.0f, 0.0f);

                this.LightCameraWorld       = XMMatrix.Identity;
                this.LightCameraView        = XMMatrix.LookAtLH(vecEye, vecAt, vecUp);
                this.LightCameraProjection  = XMMatrix.PerspectiveFovLH(XMMath.PIDivFour, 1.0f, 0.1f, 1000.0f);
                this.LightCameraEyePoint    = vecEye;
                this.LightCameraLookAtPoint = vecAt;
            }

            this.ActiveCameraView       = this.ViewerCameraView;
            this.ActiveCameraProjection = this.ViewerCameraProjection;

            this.MeshLength = 1.0f;
        }
Пример #2
0
        public void CreateWindowSizeDependentResources()
        {
            this.scene.CreateWindowSizeDependentResources();
            this.oit.CreateWindowSizeDependentResources();

            this.projectionMatrix = XMMatrix.PerspectiveFovLH(XMMath.PIDivFour, (float)this.deviceResources.BackBufferWidth / (float)this.deviceResources.BackBufferHeight, 0.1f, 5000.0f);
        }
        public void CreateWindowSizeDependentResources()
        {
            // Setup the camera's projection parameters
            float fAspectRatio = (float)this.deviceResources.BackBufferWidth / (float)this.deviceResources.BackBufferHeight;

            this.projectionMatrix = XMMatrix.PerspectiveFovLH(XMMath.PIDivFour, fAspectRatio, 0.1f, 1000.0f);
        }
Пример #4
0
        public void CreateWindowSizeDependentResources()
        {
            float fAspectRatio = (float)this.deviceResources.BackBufferWidth / (float)this.deviceResources.BackBufferHeight;

            this.ProjectionMatrix      = XMMatrix.PerspectiveFovLH(XMMath.PIDivFour, fAspectRatio, 0.5f, 100.0f);
            this.LightProjectionMatrix = XMMatrix.PerspectiveFovLH(XMMath.PIDivFour, fAspectRatio, 10.0f, 100.0f);
        }
        public void CreateWindowSizeDependentResources()
        {
            this.projectionMatrix = XMMatrix.PerspectiveFovLH(XMMath.PIDivFour, (float)this.deviceResources.BackBufferWidth / (float)this.deviceResources.BackBufferHeight, 0.01f, 100.0f);

            ConstantBufferChangesOnResizeData cbChangesOnResize;

            cbChangesOnResize.Projection = this.projectionMatrix.Transpose();
            this.deviceResources.D3DContext.UpdateSubresource(this.constantBufferChangesOnResize, 0, null, cbChangesOnResize, 0, 0);
        }
Пример #6
0
        public void CreateWindowSizeDependentResources()
        {
            float fAspectRatio = (float)this.deviceResources.BackBufferWidth / this.deviceResources.BackBufferHeight;

            this.Settings.ViewerCameraProjection = XMMatrix.PerspectiveFovLH(XMMath.PIDivFour, fAspectRatio, 0.05f, this.Settings.MeshLength);
            this.Settings.ViewerCameraNearClip   = 0.05f;
            this.Settings.ViewerCameraFarClip    = this.Settings.MeshLength;

            this.Settings.ActiveCameraProjection = this.Settings.ViewerCameraProjection;
        }
Пример #7
0
        public virtual void SetProjParams(float fFOV, float fAspect, float fNearPlane, float fFarPlane)
        {
            // Set attributes for the projection matrix
            m_fFOV       = fFOV;
            m_fAspect    = fAspect;
            m_fNearPlane = fNearPlane;
            m_fFarPlane  = fFarPlane;

            XMMatrix mProj = XMMatrix.PerspectiveFovLH(fFOV, fAspect, fNearPlane, fFarPlane);

            m_mProj = mProj;
        }
        public void CreateWindowSizeDependentResources()
        {
            this.tessellator.CreateWindowSizeDependentResources();

            XMMatrix mWorld               = XMMatrix.Identity;
            XMFloat3 vecEye               = new XMFloat3(0.0f, 0.0f, -300.0f);
            XMFloat3 vecAt                = new XMFloat3(10.0f, 20.0f, 0.0f);
            XMFloat3 vecUp                = new XMFloat3(0.0f, 1.0f, 0.0f);
            XMMatrix mView                = XMMatrix.LookAtLH(vecEye, vecAt, vecUp);
            float    fAspectRatio         = (float)this.deviceResources.BackBufferWidth / (float)this.deviceResources.BackBufferHeight;
            XMMatrix mProj                = XMMatrix.PerspectiveFovLH(XMMath.PIDivFour, fAspectRatio, 1.0f, 500000.0f);
            XMMatrix mWorldViewProjection = mWorld * mView * mProj;

            this.WorldViewProjectionMatrix = mWorldViewProjection;
        }
        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));
        }
Пример #10
0
 public void CreateWindowSizeDependentResources()
 {
     this.projectionMatrix = XMMatrix.PerspectiveFovLH(XMMath.PIDivTwo, (float)this.deviceResources.BackBufferWidth / (float)this.deviceResources.BackBufferHeight, 0.01f, 100.0f);
 }