Ejemplo n.º 1
0
        ///<summary>
        ///    Create (or update) render textures for slices
        ///</summary>
        ///<param name="update">are we updating an existing texture</param>
        protected void CreateRenderTextures(bool update)
        {
            if (update)
            {
                Debug.Assert(sliceTRT.Count == depth);
                foreach (D3DRenderTexture trt in sliceTRT)
                {
                    trt.Rebind(this);
                }
                return;
            }

            DestroyRenderTextures();
            if (surface == null)
            {
                throw new Exception("Rendering to 3D slices not supported yet for Direct3D; in " +
                                    "D3D9HardwarePixelBuffer.CreateRenderTexture");
            }
            // Create render target for each slice
            sliceTRT.Clear();
            Debug.Assert(depth == 1);
            for (int zoffset = 0; zoffset < depth; ++zoffset)
            {
                string        name = "rtt/" + this.ID;
                RenderTexture trt  = new D3DRenderTexture(name, this);
                sliceTRT.Add(trt);
                Root.Instance.RenderSystem.AttachRenderTarget(trt);
            }
        }
Ejemplo n.º 2
0
		///<summary>
		///    Create (or update) render textures for slices
		///</summary>
		///<param name="update">are we updating an existing texture</param>
		protected void CreateRenderTextures( bool update )
		{
			if ( update )
			{
				Debug.Assert( sliceTRT.Count == Depth );
				foreach ( D3DRenderTexture trt in sliceTRT )
					trt.Rebind( this );
				return;
			}

			DestroyRenderTextures();
			if ( surface == null )
				throw new Exception( "Rendering to 3D slices not supported yet for Direct3D; in " +
									"D3DHardwarePixelBuffer.CreateRenderTexture" );
			// Create render target for each slice
			sliceTRT.Clear();
			Debug.Assert( Depth == 1 );
			for ( int zoffset = 0; zoffset < Depth; ++zoffset )
			{
				string name = "rtt/" + this.ID;
				RenderTexture trt = new D3DRenderTexture( name, this );
				sliceTRT.Add( trt );
				Root.Instance.RenderSystem.AttachRenderTarget( trt );
			}
		}