mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Editor camera and Editor/Runtime scene update separation
This commit is contained in:
@@ -288,6 +288,17 @@ namespace GlitchyEngine.Renderer
|
||||
_sceneConstants.CompositionTarget = finalTarget;
|
||||
}
|
||||
|
||||
public static void BeginScene(EditorCamera camera, RenderTarget2D finalTarget)
|
||||
{
|
||||
Debug.Profiler.ProfileRendererFunction!();
|
||||
|
||||
Matrix viewProjection = camera.Projection * camera.View;
|
||||
_sceneConstants.ViewProjection = viewProjection;
|
||||
_sceneConstants.CameraPosition = camera.Position;
|
||||
_sceneConstants.CameraTarget = camera.RenderTarget;
|
||||
_sceneConstants.CompositionTarget = finalTarget;
|
||||
}
|
||||
|
||||
public static int SortMeshes(SubmittedMesh left, SubmittedMesh right)
|
||||
{
|
||||
// TODO: Once Material "inheritance" is ready we could perhaps check how similar materials are (e.g. shared textures/variables/etc...)
|
||||
|
||||
@@ -444,6 +444,48 @@ namespace GlitchyEngine.Renderer
|
||||
|
||||
s_drawOrder = drawOrder;
|
||||
|
||||
#if DEBUG
|
||||
s_sceneRunning = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void BeginScene(EditorCamera camera, DrawOrder drawOrder = .SortByTexture, Effect effect = null, Effect circleEffect = null)
|
||||
{
|
||||
Debug.Profiler.ProfileRendererFunction!();
|
||||
#if DEBUG
|
||||
Log.EngineLogger.AssertDebug(s_initialized, "Renderer2D was not initialized.");
|
||||
Log.EngineLogger.AssertDebug(!s_sceneRunning, "You have to call EndScene before you can make another call to BeginScene.");
|
||||
#endif
|
||||
|
||||
//s_textureColorEffect.Bind(Renderer._context);
|
||||
|
||||
s_currentEffect?.ReleaseRef();
|
||||
if(effect != null)
|
||||
{
|
||||
s_currentEffect = effect..AddRef();
|
||||
}
|
||||
else
|
||||
{
|
||||
s_currentEffect = s_batchEffect..AddRef();
|
||||
}
|
||||
|
||||
s_currentCircleEffect?.ReleaseRef();
|
||||
if(circleEffect != null)
|
||||
{
|
||||
s_currentCircleEffect = effect..AddRef();
|
||||
}
|
||||
else
|
||||
{
|
||||
s_currentCircleEffect = s_circleBatchEffect..AddRef();
|
||||
}
|
||||
|
||||
Matrix viewProjection = camera.Projection * camera.View;
|
||||
|
||||
s_currentEffect.Variables["ViewProjection"].SetData(viewProjection);
|
||||
s_currentCircleEffect.Variables["ViewProjection"].SetData(viewProjection);
|
||||
|
||||
s_drawOrder = drawOrder;
|
||||
|
||||
#if DEBUG
|
||||
s_sceneRunning = true;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user