Lots of progress on rendering textures.

This commit is contained in:
2020-06-05 23:49:45 -05:00
parent 23597f02b1
commit 1c4ca6c97b
47 changed files with 620 additions and 246 deletions

View File

@@ -1,5 +1,8 @@
using System;
using System.Drawing;
using System.Numerics;
using SlatedGameToolkit.Framework.Exceptions;
using SlatedGameToolkit.Framework.Graphics.Programs;
using SlatedGameToolkit.Framework.Graphics.Textures;
namespace SlatedGameToolkit.Framework.Graphics.Render
@@ -13,8 +16,8 @@ namespace SlatedGameToolkit.Framework.Graphics.Render
this.batch = batch;
}
public Renderer() {
this.batch = new Batch();
public Renderer(Camera camera, GLShaderProgram program, uint BatchVertexSize = 4096) {
this.batch = new Batch(camera, program, BatchVertexSize);
}
public void Dispose()
@@ -22,14 +25,13 @@ namespace SlatedGameToolkit.Framework.Graphics.Render
batch.Dispose();
}
public void Queue(IRenderable renderable, Color color) {
public void Queue(IRenderable renderable, Matrix4x4 modelsMatrix) {
if (renderable.Texture != currentTexture) {
if (batch.Batching) batch.End();
currentTexture = renderable.Texture;
currentTexture.Use();
batch.Begin(currentTexture);
batch.Begin(currentTexture, modelsMatrix);
}
batch.Add(renderable, color);
batch.Add(renderable, renderable.Color);
}
public void Render() {