Engine barely starts again

This commit is contained in:
Simon Lübeß
2024-11-21 18:16:41 +01:00
parent ad73abd4ea
commit bcf75bf8cb
32 changed files with 299 additions and 161 deletions
+26 -11
View File
@@ -522,10 +522,10 @@ namespace GlitchyEngine.Renderer
s_currentLineEffect = s_lineBatchEffect;
Matrix viewProjection = camera.Projection * Matrix.Invert(transform);
s_currentQuadEffect.Variables["ViewProjection"].SetData(viewProjection);
s_currentCircleEffect.Variables["ViewProjection"].SetData(viewProjection);
s_currentLineEffect.Variables["ViewProjection"].SetData(viewProjection);
s_currentQuadEffect.Get()?.Variables["ViewProjection"].SetData(viewProjection);
s_currentCircleEffect.Get()?.Variables["ViewProjection"].SetData(viewProjection);
s_currentLineEffect.Get()?.Variables["ViewProjection"].SetData(viewProjection);
s_drawOrder = drawOrder;
@@ -564,9 +564,9 @@ namespace GlitchyEngine.Renderer
Matrix viewProjection = camera.Projection * camera.View;
s_currentQuadEffect.Variables["ViewProjection"].SetData(viewProjection);
s_currentCircleEffect.Variables["ViewProjection"].SetData(viewProjection);
s_currentLineEffect.Variables["ViewProjection"].SetData(viewProjection);
s_currentQuadEffect.Get()?.Variables["ViewProjection"].SetData(viewProjection);
s_currentCircleEffect.Get()?.Variables["ViewProjection"].SetData(viewProjection);
s_currentLineEffect.Get()?.Variables["ViewProjection"].SetData(viewProjection);
s_drawOrder = drawOrder;
@@ -778,8 +778,13 @@ namespace GlitchyEngine.Renderer
// TODO: per object blendstate
RenderCommand.SetBlendState(s_transparentBlendState);
let quadEffect = s_currentQuadEffect.Get();
if (quadEffect == null)
return;
Texture texture = s_QuadinstanceQueue[0].Texture;
s_currentQuadEffect.SetTexture("Texture", texture);
quadEffect.SetTexture("Texture", texture);
s_setQuadInstances = 0;
@@ -793,7 +798,7 @@ namespace GlitchyEngine.Renderer
FlushQuadInstances();
texture = quad.Texture;
s_currentQuadEffect.SetTexture("Texture", texture);
quadEffect.SetTexture("Texture", texture);
}
s_rawQuadInstances[s_setQuadInstances++] = .(quad.Transform, quad.Color, quad.uvTransform, quad.entityId);
@@ -818,9 +823,14 @@ namespace GlitchyEngine.Renderer
// TODO: per object blendstate
RenderCommand.SetBlendState(s_transparentBlendState);
let effect = s_currentCircleEffect.Get();
if (effect == null)
return;
Texture texture = s_circleInstanceQueue[0].Texture;
s_currentCircleEffect.SetTexture("Texture", texture);
effect.SetTexture("Texture", texture);
s_setCircleInstances = 0;
@@ -834,7 +844,7 @@ namespace GlitchyEngine.Renderer
FlushCircleInstances();
texture = circle.Texture;
s_currentCircleEffect.SetTexture("Texture", texture);
effect.SetTexture("Texture", texture);
}
s_rawCircleInstances[s_setCircleInstances++] = .(circle.Transform, circle.Color, circle.uvTransform, circle.InnerRadius, circle.entityId);
@@ -857,6 +867,11 @@ namespace GlitchyEngine.Renderer
if(s_lineInstanceQueue.IsEmpty)
return;
let effect = s_currentLineEffect.Get();
if (effect == null)
return;
// TODO: per object blendstate
RenderCommand.SetBlendState(s_transparentBlendState);