Beispiel #1
0
 public static void Dispose()
 {
     if (quadVerts != null && !quadVerts.Disposed)
     {
         quadVerts.Dispose();
     }
 }
Beispiel #2
0
 /// <summary>
 /// Releases unmanaged and - optionally - managed resources
 /// </summary>
 /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
 protected override void Dispose(bool disposing)
 {
     if (!IsDisposed)
     {
         //Dispose of managed resources
         if (disposing)
         {
             if (_buffer != null)
             {
                 if (_renderer != null)
                 {
                     _renderer.Resources.RemoveTrackedObject(_buffer.ComPointer);
                 }
                 _buffer.Dispose();
                 _buffer = null;
             }
             if (_staging != null)
             {
                 if (_renderer != null)
                 {
                     _renderer.Resources.RemoveTrackedObject(_staging.ComPointer);
                 }
                 _staging.Dispose();
                 _staging = null;
             }
         }
         base.Dispose(disposing);
     }
 }
Beispiel #3
0
 public static void Dispose()
 {
     if (vertices != null && !vertices.Disposed)
     {
         vertices.Dispose();
         vertices = null;
     }
 }
Beispiel #4
0
        /// <summary>
        /// Disposes of our managed resources.
        /// </summary>
        protected override void DisposeManaged()
        {
            {
                if (m_sampleVertices != null)
                {
                    m_sampleVertices.Dispose();
                    m_sampleVertices = null;
                }

                if (m_sampleLayout != null)
                {
                    m_sampleLayout.Dispose();
                    m_sampleLayout = null;
                }

                if (m_sampleStream != null)
                {
                    m_sampleStream.Dispose();
                    m_sampleStream = null;
                }
            }

            {
                if (m_boxVertices != null)
                {
                    m_boxVertices.Dispose();
                    m_boxVertices = null;
                }

                if (m_boxLayout != null)
                {
                    m_boxLayout.Dispose();
                    m_boxLayout = null;
                }

                if (m_boxStream != null)
                {
                    m_boxStream.Dispose();
                    m_boxStream = null;
                }
            }

            if (m_effect != null)
            {
                m_effect.Dispose();
                m_effect = null;
            }

            if (SharedTexture != null)
            {
                SharedTexture.Dispose();
                SharedTexture = null;
            }

            base.DisposeManaged();

            return;
        }
Beispiel #5
0
        public static void Dispose()
        {
            mieRT.Dispose();
            rayleighRT.Dispose();
            if (skyBoxCloudsMesh != null)
            {
                skyBoxCloudsMesh.Dispose();
            }

            if (moonTex != null && !moonTex.Disposed)
            {
                moonTex.Dispose();
            }
            if (glowTex != null && !glowTex.Disposed)
            {
                glowTex.Dispose();
            }
            if (starsTex != null && !starsTex.Disposed)
            {
                starsTex.Dispose();
            }
            if (skyClouds1 != null && !skyClouds1.Disposed)
            {
                skyClouds1.Dispose();
            }
            if (skyClouds2 != null && !skyClouds2.Disposed)
            {
                skyClouds2.Dispose();
            }


            if (domeVerts != null && !domeVerts.Disposed)
            {
                domeVerts.Dispose();
            }
            if (domeIndices != null && !domeIndices.Disposed)
            {
                domeIndices.Dispose();
            }
            if (moonVerts != null && !moonVerts.Disposed)
            {
                moonVerts.Dispose();
            }
            if (moonIndices != null && !moonIndices.Disposed)
            {
                moonIndices.Dispose();
            }

            if (lensFlare != null)
            {
                lensFlare.Dispose();
            }
            Rain.Dispose();
            Snow.Dispose();
        }
Beispiel #6
0
 public void Dispose()
 {
     if (_vertexBuffer != null)
     {
         _vertexBuffer.Dispose();
         _vertexBuffer = null;
     }
     if (_indexBuffer != null)
     {
         _indexBuffer.Dispose();
         _indexBuffer = null;
     }
 }
Beispiel #7
0
 public void Destroy()
 {
     if (device != null)
     {
         if (device.OutputMerger.BlendState != null)
         {
             device.OutputMerger.BlendState.Dispose();
         }
         device.Dispose();
     }
     if (vertexBuffer != null)
     {
         vertexBuffer.Dispose();
     }
     if (texture != null)
     {
         texture.Dispose();
     }
     if (renderTargetView != null)
     {
         renderTargetView.Dispose();
     }
     if (swapChain != null)
     {
         swapChain.Dispose();
     }
     if (effect != null)
     {
         effect.Dispose();
     }
     if (inputLayout != null)
     {
         inputLayout.Dispose();
     }
     if (textureView != null)
     {
         textureView.Dispose();
     }
     if (messageSprite != null)
     {
         messageSprite.Dispose();
     }
     if (charSheet != null)
     {
         charSheet.Dispose();
     }
     if (spriteView != null)
     {
         spriteView.Dispose();
     }
 }
        public void Dispose()
        {
            StopRender();
            WaitForCompletion();

            foreach (var view in views)
            {
                view.Dispose();
            }
            debugFont.Dispose();
            instanceBuffer.Dispose();
            device.Dispose();
            swapChain.Dispose();
        }
        public static void RenderMesh2(Model m, Vector3 position, string effectName, string technique, Matrix mWorld, int stride)
        {
            if (m == null || m.MeshObj == null)
            {
                return;
            }
            Shader e     = WorldData.GetObject(effectName) as Shader;
            Matrix world = Matrix.Identity + Matrix.Translation(position);

            if (mWorld != null)
            {
                world = mWorld;
            }
            ShaderHelper.UpdateCommonEffectVars(e, world);

            EffectTechnique t = e.EffectObj.GetTechniqueByName(technique);

            D3D10.Buffer indexBuffer   = m.MeshObj.GetDeviceIndexBuffer();
            D3D10.Buffer vertextBuffer = m.MeshObj.GetDeviceVertexBuffer(0);

            Game.Device.InputAssembler.SetPrimitiveTopology(PrimitiveTopology.TriangleList);
            Game.Device.InputAssembler.SetIndexBuffer(indexBuffer, Format.R16_UInt, 0);
            Game.Device.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertextBuffer, stride, 0));

            for (int p = 0; p < t.Description.PassCount; p++)
            {
                EffectPass  pass = t.GetPassByIndex(p);
                InputLayout l    = ShaderHelper.ConstructInputLayout(m.Mesh3d.inputElements, pass.Description.Signature);
                Game.Device.InputAssembler.SetInputLayout(l);

                for (int subset = 0; subset < m.Mesh3d.NumAttributes; subset++)
                {
                    EffectResourceVariable diffTex = e.GetVar(ShaderHelper.DiffTex).AsResource();
                    if (diffTex != null)
                    {
                        diffTex.SetResource(m.Mesh3d.textureViews[subset]);
                    }
                    pass.Apply();
                    MeshAttributeRange r = m.Mesh3d.attrTable[subset];
                    // * 2 cause adj data is twice as much data
                    //Game.Device.DrawIndexed((r.FaceCount * 3) * 2, (r.FaceStart * 3) * 2, 0);

                    Game.Device.DrawIndexed((r.FaceCount * 3), (r.FaceStart * 3), 0);
                }
            }

            indexBuffer.Dispose();
            vertextBuffer.Dispose();
        }
Beispiel #10
0
        private static void DrawClouds(bool renderReflection)
        {
            if (skyBoxCloudsMesh == null || skyBoxCloudsMesh.MeshObj == null)
            {
                return;
            }
            Shader          scatterEffect = WorldData.GetObject("scatter.fx") as Shader;
            EffectTechnique tech          = scatterEffect.EffectObj.GetTechniqueByName("RenderClouds");

            if (renderReflection)
            {
                tech = scatterEffect.EffectObj.GetTechniqueByName("RenderCloudsReflection");
            }

            D3D10.Buffer iBuffer = skyBoxCloudsMesh.MeshObj.GetDeviceIndexBuffer();
            D3D10.Buffer vBuffer = skyBoxCloudsMesh.MeshObj.GetDeviceVertexBuffer(0);

            Game.Device.InputAssembler.SetPrimitiveTopology(PrimitiveTopology.TriangleList);
            Game.Device.InputAssembler.SetIndexBuffer(iBuffer, Format.R16_UInt, 0);
            Game.Device.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vBuffer, 56, 0));
            EffectPass  p1     = tech.GetPassByIndex(0);
            InputLayout layout = ShaderHelper.ConstructInputLayout(MeshInputElements10.NormalMesh, p1.Description.Signature);

            Game.Device.InputAssembler.SetInputLayout(layout);

            Matrix mWorld = Matrix.Translation(Camera.Position);

            if (renderReflection)
            {
                mWorld = Matrix.Scaling(1, -1, 1) * Matrix.Translation(Camera.Position);
            }
            scatterEffect.GetVar("WorldViewProj").AsMatrix().SetMatrix(mWorld * Camera.ViewMatrix * Camera.ProjectionMatrix);
            if (settings != null && settings.SkySettings != null)
            {
                scatterEffect.GetVar("cloud1Tile").AsScalar().Set(settings.SkySettings.CloudTile.X);
                scatterEffect.GetVar("cloud2Tile").AsScalar().Set(settings.SkySettings.CloudTile.Y);
                scatterEffect.GetVar("cloudCover").AsScalar().Set(settings.SkySettings.CloudCover);
            }
            scatterEffect.GetVar("scroll").AsVector().Set(t);
            scatterEffect.GetVar("clouds1Tex").AsResource().SetResource(skyClouds1);
            scatterEffect.GetVar("clouds2Tex").AsResource().SetResource(skyClouds2);
            scatterEffect.GetVar("SunColor").AsVector().Set(SunColor);

            p1.Apply();
            Game.Device.DrawIndexed((skyBoxCloudsMesh.Mesh3d.attrTable[0].FaceCount * 3), 0, 0);

            iBuffer.Dispose();
            vBuffer.Dispose();
        }
Beispiel #11
0
 public static void Dispose()
 {
     if (g_pParticleStart != null && !g_pParticleStart.Disposed)
     {
         g_pParticleStart.Dispose();
     }
     if (g_pParticleStreamTo != null && !g_pParticleStreamTo.Disposed)
     {
         g_pParticleStreamTo.Dispose();
     }
     if (g_pParticleDrawFrom != null && !g_pParticleDrawFrom.Disposed)
     {
         g_pParticleDrawFrom.Dispose();
     }
 }
Beispiel #12
0
        /// <summary>
        /// In a derived class, implements logic to resize the buffer.
        /// During resize, the existing buffer contents need not be preserved.
        /// </summary>
        /// <param name="sizeInBytes">The new size, in bytes.</param>
        protected override void ResizeBuffer(int sizeInBytes)
        {
            if (buffer != null)
            {
                buffer.Dispose();
            }

            buffer = new D3D.Buffer(device, new D3D.BufferDescription {
                BindFlags      = D3D.BindFlags.VertexBuffer,
                CpuAccessFlags = D3D.CpuAccessFlags.Write,
                OptionFlags    = D3D.ResourceOptionFlags.None,
                SizeInBytes    = sizeInBytes,
                Usage          = D3D.ResourceUsage.Dynamic
            });
        }
Beispiel #13
0
        void UpdateOcclusion()
        {
            if (gm == null)
            {
                return;
            }
            if (occlusionQueryActive)
            {
                // If the previous query has not yet completed, wait until it does.
                if (!occQuery.IsDataAvailable)
                {
                    return;
                }

                UInt64 pixelCount = occQuery.GetData().Read <UInt64>();
                occlusionAlpha = Math.Min(pixelCount / 25000.0f, 1);
            }


            occQuery.Begin();

            Matrix          m = Matrix.Scaling(3000, 3000, 3000) * Matrix.Translation(-SkyDome.LightDirection * 25000);
            Shader          e = WorldData.GetObject("scatter.fx") as Shader;
            EffectTechnique t = e.EffectObj.GetTechniqueByName("RenderOccluder");

            D3D10.Buffer indexBuffer   = gm.MeshObj.GetDeviceIndexBuffer();
            D3D10.Buffer vertextBuffer = gm.MeshObj.GetDeviceVertexBuffer(0);
            Game.Device.InputAssembler.SetPrimitiveTopology(PrimitiveTopology.TriangleList);
            Game.Device.InputAssembler.SetIndexBuffer(indexBuffer, Format.R16_UInt, 0);
            Game.Device.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertextBuffer, 16, 0));
            EffectPass  pass = t.GetPassByIndex(0);
            InputLayout l    = ShaderHelper.ConstructInputLayout(gm.Mesh3d.inputElements, pass.Description.Signature);

            Game.Device.InputAssembler.SetInputLayout(l);
            Matrix proj = Matrix.PerspectiveFovLH(Camera.Fovx, Camera.AspectRatio, 1.0f, 1000000.0f);

            e.GetVar("WorldViewProjection").AsMatrix().SetMatrix(m * Camera.ViewMatrix * proj);
            pass.Apply();
            Game.Device.DrawIndexed((gm.Mesh3d.attrTable[0].FaceCount * 3), (gm.Mesh3d.attrTable[0].FaceStart * 3), 0);
            indexBuffer.Dispose();
            vertextBuffer.Dispose();

            occQuery.End();

            occlusionQueryActive = true;
        }
        private void renderLoop()
        {
            instanceBuffer = new SlimDX.Direct3D10.Buffer(device, new BufferDescription()
            {
                BindFlags      = BindFlags.VertexBuffer,
                CpuAccessFlags = CpuAccessFlags.Write,
                OptionFlags    = ResourceOptionFlags.None,
                SizeInBytes    = (sizeof(float) * 4 * 4 + sizeof(int)) * InstanceCount,
                Usage          = ResourceUsage.Dynamic
            });


            while (IsRendering || HandleCommands)
            {
                try
                {
                    if (HandleCommands)
                    {
                        commandQueue.TryExecute(CommandsPerFrame);
                    }

                    if (IsRendering)
                    {
                        render();
                    }
                }
                catch (SlimDX.DXGI.DXGIException)
                {
                    IsRendering = false;
                }

                if (stateChanged)
                {
                    stateChanged = false;
                    evt.Finish();
                }
            }

            instanceBuffer.Dispose();

            if (stateChanged)
            {
                stateChanged = false;
                evt.Finish();
            }
        }
        public static void DrawInstancedSpheres(GraphicsDeviceManager gdm, List <Matrix> instances)
        {
            Model sphere = WorldData.GetObject("sphereInstanced.mesh") as Model;

            D3D10.Buffer    indexBuffer   = sphere.MeshObj.GetDeviceIndexBuffer();
            D3D10.Buffer    vertextBuffer = sphere.MeshObj.GetDeviceVertexBuffer(0);
            Shader          e             = WorldData.GetObject("Instanced.fx") as Shader;
            EffectTechnique t             = e.EffectObj.GetTechniqueByName("RenderInstanced");

            InputLayout l = ShaderHelper.ConstructInputLayout(MeshInputElements10.PositionOnlyInstanced, t.GetPassByIndex(0).Description.Signature);



            BufferDescription bd = new BufferDescription();

            bd.SizeInBytes    = System.Runtime.InteropServices.Marshal.SizeOf(instances[0]) * instances.Count;
            bd.Usage          = ResourceUsage.Dynamic;
            bd.CpuAccessFlags = CpuAccessFlags.Write;
            bd.BindFlags      = BindFlags.VertexBuffer;

            D3D10.Buffer instanceData = new D3D10.Buffer(gdm.Direct3D10.Device, bd);

            DataStream ds = instanceData.Map(MapMode.WriteDiscard, SlimDX.Direct3D10.MapFlags.None);

            ds.Position = 0;
            ds.WriteRange(instances.ToArray());
            instanceData.Unmap();



            Game.Device.InputAssembler.SetInputLayout(l);
            Game.Device.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertextBuffer, 16, 0), new VertexBufferBinding(instanceData, System.Runtime.InteropServices.Marshal.SizeOf(instances[0]), 0));
            Game.Device.InputAssembler.SetIndexBuffer(indexBuffer, Format.R16_UInt, 0);
            Game.Device.InputAssembler.SetPrimitiveTopology(PrimitiveTopology.TriangleList);

            e.GetVar("WorldViewProj").AsMatrix().SetMatrix(Camera.ViewMatrix * Camera.ProjectionMatrix);

            t.GetPassByIndex(0).Apply();
            Game.Device.DrawIndexedInstanced((sphere.Mesh3d.attrTable[0].FaceCount * 3), instances.Count, 0, 0, 0);
            //Game.Device.DrawIndexed((sphere.attrTable[0].FaceCount * 3) * 2, 0, 0);

            indexBuffer.Dispose();
            vertextBuffer.Dispose();
            sphere.Dispose();
        }
        protected void Dispose(bool disposing)
        {
            if (_depthMapBuffer != null)
            {
                _depthMapBuffer.Dispose();
                _depthMapBuffer = null;
            }

            if (_depthMapBufferRV != null)
            {
                _depthMapBufferRV.Dispose();
                _depthMapBufferRV = null;
            }

            if (_imageTexture != null)
            {
                _imageTexture.Dispose();
                _imageTexture = null;
            }

            if (_imageTextureRV != null)
            {
                _imageTextureRV.Dispose();
                _imageTextureRV = null;
            }

            if (_effect != null)
            {
                _effect.Dispose();
                _effect = null;
            }

            if (_inputLayout != null)
            {
                _inputLayout.Dispose();
                _inputLayout = null;
            }

            if (_vertexBuffer != null)
            {
                _vertexBuffer.Dispose();
                _vertexBuffer = null;
            }
        }
Beispiel #17
0
        static void Main()
        {
            var form = new RenderForm("SlimDX - MiniTri Direct3D 10 Sample");
            var desc = new SwapChainDescription()
            {
                BufferCount = 1,
                ModeDescription = new ModeDescription(form.ClientSize.Width, form.ClientSize.Height, new Rational(60, 1), Format.R8G8B8A8_UNorm),
                IsWindowed = true,
                OutputHandle = form.Handle,
                SampleDescription = new SampleDescription(1, 0),
                SwapEffect = SwapEffect.Discard,
                Usage = Usage.RenderTargetOutput
            };

            Device device;
            SwapChain swapChain;
            Device.CreateWithSwapChain(null, DriverType.Hardware, DeviceCreationFlags.Debug, desc, out device, out swapChain);

            //Stops Alt+enter from causing fullscreen skrewiness.
            device.Factory.SetWindowAssociation(form.Handle, WindowAssociationFlags.IgnoreAll);

            Texture2D backBuffer = Texture2D.FromSwapChain<Texture2D>(swapChain, 0);
            var renderView = new RenderTargetView(device, backBuffer);
            var effect = Effect.FromFile(device, "MiniTri.fx", "fx_4_0");
            var technique = effect.GetTechniqueByIndex(0);
            var pass = technique.GetPassByIndex(0);
            var layout = new InputLayout(device, pass.Description.Signature, new[] {
                new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0),
                new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 16, 0) 
            });

            var stream = new DataStream(3 * 32, true, true);
            stream.WriteRange(new[] {
                new Vector4(0.0f, 0.5f, 0.5f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f),
                new Vector4(0.5f, -0.5f, 0.5f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f),
                new Vector4(-0.5f, -0.5f, 0.5f, 1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f)
            });
            stream.Position = 0;

            var vertices = new SlimDX.Direct3D10.Buffer(device, stream, new BufferDescription()
            {
                BindFlags = BindFlags.VertexBuffer,
                CpuAccessFlags = CpuAccessFlags.None,
                OptionFlags = ResourceOptionFlags.None,
                SizeInBytes = 3 * 32,
                Usage = ResourceUsage.Default
            });
            stream.Dispose();

            device.OutputMerger.SetTargets(renderView);
            device.Rasterizer.SetViewports(new Viewport(0, 0, form.ClientSize.Width, form.ClientSize.Height, 0.0f, 1.0f));

            MessagePump.Run(form, () =>
            {
                device.ClearRenderTargetView(renderView, Color.Black);

                device.InputAssembler.SetInputLayout(layout);
                device.InputAssembler.SetPrimitiveTopology(PrimitiveTopology.TriangleList);
                device.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertices, 32, 0));

                for (int i = 0; i < technique.Description.PassCount; ++i)
                {
                    pass.Apply();
                    device.Draw(3, 0);
                }

                swapChain.Present(0, PresentFlags.None);
            });

            vertices.Dispose();
            layout.Dispose();
            effect.Dispose();
            renderView.Dispose();
            backBuffer.Dispose();
            device.Dispose();
            swapChain.Dispose();
            //foreach (var item in ObjectTable.Objects)
            //    item.Dispose();
        }
Beispiel #18
0
        static void Main()
        {
            var form = new RenderForm("SlimDX - MiniTri Direct3D 10 Sample");
            var desc = new SwapChainDescription()
            {
                BufferCount       = 1,
                ModeDescription   = new ModeDescription(form.ClientSize.Width, form.ClientSize.Height, new Rational(60, 1), Format.R8G8B8A8_UNorm),
                IsWindowed        = true,
                OutputHandle      = form.Handle,
                SampleDescription = new SampleDescription(1, 0),
                SwapEffect        = SwapEffect.Discard,
                Usage             = Usage.RenderTargetOutput
            };

            Device    device;
            SwapChain swapChain;

            Device.CreateWithSwapChain(null, DriverType.Hardware, DeviceCreationFlags.Debug, desc, out device, out swapChain);

            //Stops Alt+enter from causing fullscreen skrewiness.
            Factory factory = swapChain.GetParent <Factory>();

            factory.SetWindowAssociation(form.Handle, WindowAssociationFlags.IgnoreAll);

            Texture2D backBuffer = Texture2D.FromSwapChain <Texture2D>(swapChain, 0);
            var       renderView = new RenderTargetView(device, backBuffer);
            var       effect     = Effect.FromFile(device, "MiniTri.fx", "fx_4_0");
            var       technique  = effect.GetTechniqueByIndex(0);
            var       pass       = technique.GetPassByIndex(0);
            var       layout     = new InputLayout(device, pass.Description.Signature, new[] {
                new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0),
                new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 16, 0)
            });

            var stream = new DataStream(3 * 32, true, true);

            stream.WriteRange(new[] {
                new Vector4(0.0f, 0.5f, 0.5f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f),
                new Vector4(0.5f, -0.5f, 0.5f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f),
                new Vector4(-0.5f, -0.5f, 0.5f, 1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f)
            });
            stream.Position = 0;

            var vertices = new SlimDX.Direct3D10.Buffer(device, stream, new BufferDescription()
            {
                BindFlags      = BindFlags.VertexBuffer,
                CpuAccessFlags = CpuAccessFlags.None,
                OptionFlags    = ResourceOptionFlags.None,
                SizeInBytes    = 3 * 32,
                Usage          = ResourceUsage.Default
            });

            stream.Dispose();

            device.OutputMerger.SetTargets(renderView);
            device.Rasterizer.SetViewports(new Viewport(0, 0, form.ClientSize.Width, form.ClientSize.Height, 0.0f, 1.0f));

            MessagePump.Run(form, () =>
            {
                device.ClearRenderTargetView(renderView, Color.Black);

                device.InputAssembler.SetInputLayout(layout);
                device.InputAssembler.SetPrimitiveTopology(PrimitiveTopology.TriangleList);
                device.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertices, 32, 0));

                for (int i = 0; i < technique.Description.PassCount; ++i)
                {
                    pass.Apply();
                    device.Draw(3, 0);
                }

                swapChain.Present(0, PresentFlags.None);
            });

            vertices.Dispose();
            layout.Dispose();
            effect.Dispose();
            renderView.Dispose();
            backBuffer.Dispose();
            device.Dispose();
            swapChain.Dispose();
            //foreach (var item in ObjectTable.Objects)
            //    item.Dispose();
        }
Beispiel #19
0
        void DestroyD3D()
        {
            if (SampleVertices != null)
            {
                SampleVertices.Dispose();
                SampleVertices = null;
            }

            if (SampleLayout != null)
            {
                SampleLayout.Dispose();
                SampleLayout = null;
            }

            if (SampleEffect != null)
            {
                SampleEffect.Dispose();
                SampleEffect = null;
            }

            if (SampleRenderView != null)
            {
                SampleRenderView.Dispose();
                SampleRenderView = null;
            }

            if (SampleDepthView != null)
            {
                SampleDepthView.Dispose();
                SampleDepthView = null;
            }

            if (SampleStream != null)
            {
                SampleStream.Dispose();
                SampleStream = null;
            }

            if (SampleLayout != null)
            {
                SampleLayout.Dispose();
                SampleLayout = null;
            }

            if (SharedTexture != null)
            {
                SharedTexture.Dispose();
                SharedTexture = null;
            }

            if (DepthTexture != null)
            {
                DepthTexture.Dispose();
                DepthTexture = null;
            }

            if (D3DDevice != null)
            {
                D3DDevice.Dispose();
                D3DDevice = null;
            }
        }