diff --git a/src/main/java/speiger/src/coreengine/math/vector/matrix/Matrix4fStack.java b/src/main/java/speiger/src/coreengine/math/vector/matrix/Matrix4fStack.java new file mode 100644 index 0000000..f992a78 --- /dev/null +++ b/src/main/java/speiger/src/coreengine/math/vector/matrix/Matrix4fStack.java @@ -0,0 +1,20 @@ +package speiger.src.coreengine.math.vector.matrix; + +import speiger.src.collections.objects.lists.ObjectArrayList; +import speiger.src.collections.utils.Stack; + +public class Matrix4fStack extends Matrix4f { + Stack stack = new ObjectArrayList<>(); + + public void push() { + stack.push(new Matrix4f(this)); + } + + public void pop() { + load(stack.pop()); + } + + public int size() { + return stack.size(); + } +} diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/renderer/IUIRenderer.java b/src/main/java/speiger/src/coreengine/rendering/gui/renderer/IUIRenderer.java index 6e0f7e1..7de4463 100644 --- a/src/main/java/speiger/src/coreengine/rendering/gui/renderer/IUIRenderer.java +++ b/src/main/java/speiger/src/coreengine/rendering/gui/renderer/IUIRenderer.java @@ -6,6 +6,7 @@ import speiger.src.coreengine.math.misc.Facing; import speiger.src.coreengine.math.vector.matrix.Matrix4f; import speiger.src.coreengine.math.vector.quaternion.Quaternion; import speiger.src.coreengine.rendering.guiOld.helper.box.IGuiBox; +import speiger.src.coreengine.rendering.models.DrawCall; import speiger.src.coreengine.rendering.textures.base.ITexture; public interface IUIRenderer { @@ -30,7 +31,7 @@ public interface IUIRenderer { public void rotate(Quaternion rotation); public void drawCustom(Consumer matrix); - + public void drawCustom(DrawCall drawcall); public void drawLine(float minX, float minY, float maxX, float maxY, float zLevel, int color); @@ -52,6 +53,4 @@ public interface IUIRenderer { public default void drawTexturedRect(float minX, float minY, float maxX, float maxY, float zLevel, ITexture texture, int color) { drawTexturedRect(minX, minY, maxX, maxY, zLevel, texture.id(), texture.minU(), texture.minV(), texture.maxU(), texture.maxV(), color); } public default void drawTexturedRect(IGuiBox box, float zLevel, ITexture texture, float minU, float minV, float maxU, float maxV, int color) { drawTexturedRect(box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY(), zLevel, texture.id(), minU, minV, maxU, maxV, color); } public void drawTexturedRect(float minX, float minY, float maxX, float maxY, float zLevel, int texture, float minU, float minV, float maxU, float maxV, int color); - - } diff --git a/src/main/java/speiger/src/coreengine/rendering/gui/renderer/SimpleUIRenderer.java b/src/main/java/speiger/src/coreengine/rendering/gui/renderer/SimpleUIRenderer.java new file mode 100644 index 0000000..5757574 --- /dev/null +++ b/src/main/java/speiger/src/coreengine/rendering/gui/renderer/SimpleUIRenderer.java @@ -0,0 +1,115 @@ +package speiger.src.coreengine.rendering.gui.renderer; + +import java.util.function.Consumer; + +import speiger.src.collections.objects.lists.ObjectArrayList; +import speiger.src.collections.utils.Stack; +import speiger.src.coreengine.math.misc.Facing; +import speiger.src.coreengine.math.vector.matrix.Matrix4f; +import speiger.src.coreengine.math.vector.quaternion.Quaternion; +import speiger.src.coreengine.rendering.guiOld.helper.box.IGuiBox; +import speiger.src.coreengine.rendering.models.DrawCall; + +public class SimpleUIRenderer implements IUIRenderer { + TexturedRect cachedRect = new TexturedRect(); + Stack transformCache = ObjectArrayList.wrap(new Matrix4f()); + + @Override + public boolean isInScissors(IGuiBox box) { + return false; + } + + @Override + public void pushScissors(IGuiBox box) { + + } + + @Override + public void popScissors() { + + } + + @Override + public TexturedRect getCachedRect() { return cachedRect; } + + @Override + public void flush() { + + } + + @Override + public void pushTransform() { + transformCache.push(new Matrix4f(transformCache.top())); + } + + @Override + public void popTransform() { + + } + + @Override + public void translate(float z) { + + } + + @Override + public void translate(float x, float y) { + + } + + @Override + public void translate(float x, float y, float z) { + + } + + @Override + public void scale(float scale) { + + } + + @Override + public void scale(float x, float y) { + + } + + @Override + public void rotate(Quaternion rotation) { + + } + + @Override + public void drawCustom(Consumer matrix) { + + } + + @Override + public void drawCustom(DrawCall drawcall) { + + } + + @Override + public void drawLine(float minX, float minY, float maxX, float maxY, float zLevel, int color) { + + } + + @Override + public void drawFrame(float minX, float minY, float maxX, float maxY, float zLevel, int color) { + + } + + @Override + public void drawRect(float minX, float minY, float maxX, float maxY, float zLevel, int color) { + + } + + @Override + public void drawGradientRect(float minX, float minY, float maxX, float maxY, float zLevel, int startColor, int endColor, Facing facing) { + + } + + @Override + public void drawTexturedRect(float minX, float minY, float maxX, float maxY, float zLevel, int texture, float minU, float minV, float maxU, float maxV, int color) { + + } + +}