Exemplo n.º 1
0
        private void LoadShaders()
        {
            //Contract.Ensures(bumpShader != null, "lightShader must be instantiated by this function");
            Contract.Ensures(colourTextureShader != null, "colourTextureShader must be instantiated by this function");

            fogShader = new FogShader(dx.D3DDevice);
            colourTextureShader = new ColourTextureShader(dx.D3DDevice);
        }
Exemplo n.º 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 virtual void Dispose(bool disposing)
        {
            //Contract.Ensures(bumpShader == null, "lightShader must be disposed by this function.");
            Contract.Ensures(colourTextureShader == null, "colourTextureShader must be disposed by this function.");
            Contract.Ensures(bitmap == null, "bitmap must be disposed by this function.");
            Contract.Ensures(fontEngine == null, "fontEngine must be disposed by this function.");
            Contract.Ensures(dx == null, "dx must be disposed by this function.");

            if (disposing)
            {
                if (fogShader != null)
                {
                    fogShader.Dispose();
                    fogShader = null;
                }
                if (colourTextureShader != null)
                {
                    colourTextureShader.Dispose();
                    colourTextureShader = null;
                }
                if(bitmap != null)
                {
                    bitmap.Dispose();
                    bitmap = null;
                }
                if(fontEngine != null)
                {
                    fontEngine.Dispose();
                    fontEngine = null;
                }
                if (dx != null)
                {
                    dx.Dispose();
                    dx = null;
                }
            }
        }