UltimateZoneBuilder/Source/Rendering/Renderer.cs

97 lines
1.9 KiB
C#
Raw Normal View History

#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
2007-09-24 19:54:47 +00:00
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
#endregion
2007-09-24 19:54:47 +00:00
namespace CodeImp.DoomBuilder.Rendering
{
2007-10-24 17:25:03 +00:00
public abstract class Renderer : IDisposable, ID3DResource
2007-09-24 19:54:47 +00:00
{
#region ================== Constants
#endregion
#region ================== Variables
// Graphics
protected D3DGraphics graphics;
2007-09-24 19:54:47 +00:00
// Disposing
protected bool isdisposed = false;
#endregion
#region ================== Properties
// Disposing
public bool IsDisposed { get { return isdisposed; } }
#endregion
#region ================== Constructor / Disposer
// Constructor
public Renderer(D3DGraphics g)
2007-09-24 19:54:47 +00:00
{
// Initialize
this.graphics = g;
2007-09-24 19:54:47 +00:00
// Register as resource
g.RegisterResource(this);
2007-09-24 19:54:47 +00:00
// We have no destructor
GC.SuppressFinalize(this);
}
// Diposer
public virtual void Dispose()
{
// Not already disposed?
if(!isdisposed)
{
// Clean up
// Unregister resource
graphics.UnregisterResource(this);
2007-09-24 19:54:47 +00:00
// Done
isdisposed = true;
}
}
#endregion
#region ================== Methods
// This is called when the graphics need to be reset
public virtual void Reset() { }
// For DirectX resources
public virtual void UnloadResource() { }
public virtual void ReloadResource() { }
2007-10-20 12:34:27 +00:00
#endregion
2007-09-24 19:54:47 +00:00
}
}