Ejemplo n.º 1
0
        protected override void dispose(bool disposeManagedResources)
        {
            // this causes infinite recursions in axiom
            //Shutdown();

            // Deleting the HLSL program factory
            if ( _hlslProgramFactory != null )
            {
                // Remove from manager safely
                if ( HighLevelGpuProgramManager.Instance != null )
                    HighLevelGpuProgramManager.Instance.RemoveFactory( _hlslProgramFactory );
                _hlslProgramFactory.Dispose();
                _hlslProgramFactory = null;
            }

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

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

            LogManager.Instance.Write( "D3D9 : {0} destroyed.", Name );

            _D3D9RenderSystem = null;

            base.dispose( disposeManagedResources );
        }
Ejemplo n.º 2
0
        public D3DRenderSystem()
        {
            LogManager.Instance.Write("D3D9 : {0} created.", Name);

            // update singleton access pointer.
            _D3D9RenderSystem = this;

            // set pointers to NULL
            _pD3D = null;
            _driverList = null;
            _activeD3DDriver = null;
            textureManager = null;
            _hardwareBufferManager = null;
            _gpuProgramManager = null;
            _useNVPerfHUD = false;
            _hlslProgramFactory = null;
            _deviceManager = null;
            //_perStageConstantSupport = false;

            // Create the resource manager.
            _resourceManager = new D3D9ResourceManager();

            // init lights
            for (var i = 0; i < MaxLights; i++)
                lights[i] = null;
            
            // Create our Direct3D object
            _pD3D = new Direct3D();
            if (_pD3D == null)
                throw new AxiomException( "Failed to create Direct3D9 object" );

            InitConfigOptions();

            // fsaa options
            _fsaaHint = "";
            _fsaaSamples = 0;

            // init the texture stage descriptions
            for ( var i = 0; i < Config.MaxTextureLayers; i++ )
            {
                _texStageDesc[ i ].autoTexCoordType = TexCoordCalcMethod.None;
                _texStageDesc[ i ].coordIndex = 0;
                _texStageDesc[ i ].texType = D3DTextureType.Normal;
                _texStageDesc[ i ].tex = null;
                _texStageDesc[ i ].vertexTex = null;
            }
        }