Work done during Train ride

This commit is contained in:
Comgstar 2025-04-02 20:17:10 +02:00
parent ba4fa73cad
commit 903f3f6155
3 changed files with 137 additions and 3 deletions

View File

@ -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<Matrix4f> stack = new ObjectArrayList<>();
public void push() {
stack.push(new Matrix4f(this));
}
public void pop() {
load(stack.pop());
}
public int size() {
return stack.size();
}
}

View File

@ -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<Matrix4f> 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);
}

View File

@ -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<Matrix4f> 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<Matrix4f> 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) {
}
}