From bbce363a26b4d18b51e7a6f10411952ee13a0085 Mon Sep 17 00:00:00 2001 From: Nic0Nic0Nii Date: Mon, 22 Nov 2021 07:23:57 +0000 Subject: [PATCH] Prepare for graphical transformations. Co-authored-by: sigonasr2 --- src/sig/Panel.java | 9 ++++--- src/sig/RenderKernel.java | 57 ++++++++++++++++++++++----------------- src/sig/SigKeeper.java | 1 + 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/src/sig/Panel.java b/src/sig/Panel.java index 16be325..ecd05a8 100644 --- a/src/sig/Panel.java +++ b/src/sig/Panel.java @@ -21,7 +21,8 @@ public class Panel extends JPanel implements Runnable { public int height=SigKeeper.SCREEN_HEIGHT; private Image imageBuffer; private MemoryImageSource mImageProducer; - public int[] pixel; + public static int[] pixel; + public static float[] depthBuffer; public static float[] triPoints; RenderKernel renderer; @@ -39,7 +40,7 @@ public class Panel extends JPanel implements Runnable { } public void init(){ - triPoints = new float[21*1]; + triPoints = new float[21*SigKeeper.MAX_TRIANGLE_COUNT]; cm = getCompatibleColorModel(); width = getWidth(); height = getHeight(); @@ -48,11 +49,12 @@ public class Panel extends JPanel implements Runnable { int screenSize = width * height; if(pixel == null || pixel.length < screenSize){ pixel = new int[screenSize]; + depthBuffer = new float[screenSize]; } mImageProducer = new MemoryImageSource(width, height, cm, pixel,0, width); mImageProducer.setAnimated(true); mImageProducer.setFullBufferUpdates(true); - renderer = new RenderKernel(pixel,triPoints,SigKeeper.texData,SigKeeper.SCREEN_WIDTH,SigKeeper.SCREEN_HEIGHT,256,256); + renderer = new RenderKernel(pixel,triPoints,SigKeeper.texData,SigKeeper.SCREEN_WIDTH,SigKeeper.SCREEN_HEIGHT,256,256,depthBuffer); renderer.setExplicit(true); imageBuffer = Toolkit.getDefaultToolkit().createImage(mImageProducer); if(thread.isInterrupted() || !thread.isAlive()){ @@ -67,6 +69,7 @@ public class Panel extends JPanel implements Runnable { for (int x=0;x