UltimateZoneBuilder/Source/Rendering/Renderer.cs

98 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
{
2008-01-02 21:49:43 +00:00
internal abstract class Renderer : ID3DResource
2007-09-24 19:54:47 +00:00
{
#region ================== Constants
#endregion
#region ================== Variables
// Graphics
protected D3DDevice 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
2008-01-02 21:49:43 +00:00
internal Renderer(D3DDevice 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);
}
2008-01-02 21:49:43 +00:00
// Disposer
internal virtual void Dispose()
2007-09-24 19:54:47 +00:00
{
// Not already disposed?
if(!isdisposed)
{
// Clean up
// Unregister resource
graphics.UnregisterResource(this);
2007-09-24 19:54:47 +00:00
// Done
2007-11-04 22:19:30 +00:00
graphics = null;
2007-09-24 19:54:47 +00:00
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
}
}