Exemplo n.º 1
0
        public void TestRenderSkybox()
        {
            MockedGraphicsDeviceService mockGraphicsDeviceService =
                new MockedGraphicsDeviceService(DeviceType.Reference);

            using (IDisposable keeper = mockGraphicsDeviceService.CreateDevice()) {
                using (
                    BasicEffect effect = new BasicEffect(mockGraphicsDeviceService.GraphicsDevice)
                    ) {
                    using (
                        SkyboxCube skyboxCube = new SkyboxCube(
                            mockGraphicsDeviceService.GraphicsDevice
                            )
                        ) {
                        skyboxCube.AssignVertexBuffer();

                        EffectTechnique technique = effect.CurrentTechnique;
                        for (int pass = 0; pass < technique.Passes.Count; ++pass)
                        {
                            technique.Passes[pass].Apply();

                            skyboxCube.DrawNorthernFace();
                            skyboxCube.DrawEasternFace();
                            skyboxCube.DrawSouthernFace();
                            skyboxCube.DrawWesternFace();
                            skyboxCube.DrawUpperFace();
                            skyboxCube.DrawLowerFace();
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
    public void TestRenderSkybox() {
      MockedGraphicsDeviceService mockGraphicsDeviceService =
        new MockedGraphicsDeviceService(DeviceType.Reference);

      using(IDisposable keeper = mockGraphicsDeviceService.CreateDevice()) {
        using(
          BasicEffect effect = new BasicEffect(
#if XNA_4
            mockGraphicsDeviceService.GraphicsDevice
#else
            mockGraphicsDeviceService.GraphicsDevice, new EffectPool()
#endif
          )
        ) {
          using(
            SkyboxCube skyboxCube = new SkyboxCube(
              mockGraphicsDeviceService.GraphicsDevice
            )
          ) {
            skyboxCube.AssignVertexBuffer();
#if XNA_4
            EffectTechnique technique = effect.CurrentTechnique;
            for(int pass = 0; pass < technique.Passes.Count; ++pass) {
              technique.Passes[pass].Apply();

              skyboxCube.DrawNorthernFace();
              skyboxCube.DrawEasternFace();
              skyboxCube.DrawSouthernFace();
              skyboxCube.DrawWesternFace();
              skyboxCube.DrawUpperFace();
              skyboxCube.DrawLowerFace();
            }
#else
            effect.Begin();
            try {
              EffectTechnique technique = effect.CurrentTechnique;
              for(int pass = 0; pass < technique.Passes.Count; ++pass) {
                technique.Passes[pass].Begin();
                try {
                  skyboxCube.DrawNorthernFace();
                  skyboxCube.DrawEasternFace();
                  skyboxCube.DrawSouthernFace();
                  skyboxCube.DrawWesternFace();
                  skyboxCube.DrawUpperFace();
                  skyboxCube.DrawLowerFace();
                }
                finally {
                  technique.Passes[pass].End();
                }
              }
            }
            finally {
              effect.End();
            }
#endif
          }
        }
      }
    }
Exemplo n.º 3
0
    public void TestConstructor() {
      MockedGraphicsDeviceService mockGraphicsDeviceService =
        new MockedGraphicsDeviceService();

      using(IDisposable keeper = mockGraphicsDeviceService.CreateDevice()) {
        SkyboxCube theSkybox = new SkyboxCube(mockGraphicsDeviceService.GraphicsDevice);
        theSkybox.Dispose();
      }
    }
Exemplo n.º 4
0
        public void TestConstructor()
        {
            MockedGraphicsDeviceService mockGraphicsDeviceService =
                new MockedGraphicsDeviceService();

            using (IDisposable keeper = mockGraphicsDeviceService.CreateDevice()) {
                SkyboxCube theSkybox = new SkyboxCube(mockGraphicsDeviceService.GraphicsDevice);
                theSkybox.Dispose();
            }
        }
Exemplo n.º 5
0
        public void TestRenderSkybox()
        {
            MockedGraphicsDeviceService mockGraphicsDeviceService =
                new MockedGraphicsDeviceService(DeviceType.Reference);

            using (IDisposable keeper = mockGraphicsDeviceService.CreateDevice()) {
                using (
                    BasicEffect effect = new BasicEffect(
#if XNA_4
                        mockGraphicsDeviceService.GraphicsDevice
#else
                        mockGraphicsDeviceService.GraphicsDevice, new EffectPool()
#endif
                        )
                    ) {
                    using (
                        SkyboxCube skyboxCube = new SkyboxCube(
                            mockGraphicsDeviceService.GraphicsDevice
                            )
                        ) {
                        skyboxCube.AssignVertexBuffer();
#if XNA_4
                        EffectTechnique technique = effect.CurrentTechnique;
                        for (int pass = 0; pass < technique.Passes.Count; ++pass)
                        {
                            technique.Passes[pass].Apply();

                            skyboxCube.DrawNorthernFace();
                            skyboxCube.DrawEasternFace();
                            skyboxCube.DrawSouthernFace();
                            skyboxCube.DrawWesternFace();
                            skyboxCube.DrawUpperFace();
                            skyboxCube.DrawLowerFace();
                        }
#else
                        effect.Begin();
                        try {
                            EffectTechnique technique = effect.CurrentTechnique;
                            for (int pass = 0; pass < technique.Passes.Count; ++pass)
                            {
                                technique.Passes[pass].Begin();
                                try {
                                    skyboxCube.DrawNorthernFace();
                                    skyboxCube.DrawEasternFace();
                                    skyboxCube.DrawSouthernFace();
                                    skyboxCube.DrawWesternFace();
                                    skyboxCube.DrawUpperFace();
                                    skyboxCube.DrawLowerFace();
                                }
                                finally {
                                    technique.Passes[pass].End();
                                }
                            }
                        }
                        finally {
                            effect.End();
                        }
#endif
                    }
                }
            }
        }