mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 17:12:25 -05:00
49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
using System;
|
|
using ClassicalSharp.GraphicsAPI;
|
|
|
|
namespace ClassicalSharp.Renderers {
|
|
|
|
public abstract class EnvRenderer : IDisposable {
|
|
|
|
public Map Map;
|
|
public Game Window;
|
|
public OpenGLApi Graphics;
|
|
|
|
public virtual void Init() {
|
|
Graphics = Window.Graphics;
|
|
Window.OnNewMap += OnNewMap;
|
|
Window.OnNewMapLoaded += OnNewMapLoaded;
|
|
Window.EnvVariableChanged += EnvVariableChanged;
|
|
}
|
|
|
|
public virtual void OnNewMap( object sender, EventArgs e ) {
|
|
}
|
|
|
|
public virtual void OnNewMapLoaded( object sender, EventArgs e ) {
|
|
}
|
|
|
|
public virtual void Dispose() {
|
|
Window.OnNewMap -= OnNewMap;
|
|
Window.OnNewMapLoaded -= OnNewMapLoaded;
|
|
Window.EnvVariableChanged -= EnvVariableChanged;
|
|
}
|
|
|
|
public abstract void Render( double deltaTime );
|
|
|
|
void EnvVariableChanged( object sender, EnvVariableEventArgs e ) {
|
|
if( e.Variable == EnvVariable.SkyColour ) {
|
|
SkyColourChanged();
|
|
} else if( e.Variable == EnvVariable.FogColour ) {
|
|
FogColourChanged();
|
|
} else if( e.Variable == EnvVariable.CloudsColour ) {
|
|
CloudsColourChanged();
|
|
}
|
|
}
|
|
|
|
protected abstract void SkyColourChanged();
|
|
|
|
protected abstract void FogColourChanged();
|
|
|
|
protected abstract void CloudsColourChanged();
|
|
}
|
|
}
|