diff --git a/src/sig/Panel.java b/src/sig/Panel.java index 5937510..e7a81d9 100644 --- a/src/sig/Panel.java +++ b/src/sig/Panel.java @@ -80,6 +80,7 @@ public class Panel extends JPanel implements Runnable { SigRenderer.depthBuffer = new float[width*height]; SigRenderer.depthBuffer_tri = new Triangle[width*height]; SigRenderer.translucencyBuffer = new boolean[width*height]; + SigRenderer.depthBuffer_noTransparency = new float[width*height]; } /** * Do your draws in here !! @@ -101,6 +102,7 @@ public class Panel extends JPanel implements Runnable { SigRenderer.depthBuffer[x+y*width]=0; SigRenderer.depthBuffer_tri[x+y*width]=null; SigRenderer.translucencyBuffer[x+y*width]=false; + SigRenderer.depthBuffer_noTransparency[x+y*width]=0; } } @@ -223,6 +225,7 @@ public class Panel extends JPanel implements Runnable { } else { tt.unmodifiedTri.nextRenderTime2=System.currentTimeMillis()+200; } + SigRenderer.temp_request=SigRenderer.request; DrawUtils.TexturedTriangle(p, (int)tt.A.x,(int)tt.A.y,tt.T.u,tt.T.v,tt.T.w, (int)tt.B.x,(int)tt.B.y,tt.U.u,tt.U.v,tt.U.w, diff --git a/src/sig/SigRenderer.java b/src/sig/SigRenderer.java index e4f4364..ed80075 100644 --- a/src/sig/SigRenderer.java +++ b/src/sig/SigRenderer.java @@ -51,6 +51,7 @@ public class SigRenderer implements KeyListener,MouseListener,MouseMotionListene public static float[] depthBuffer; public static Triangle[] depthBuffer_tri; + public static float[] depthBuffer_noTransparency; public static boolean[] translucencyBuffer; public static HashMap blockTextures = new HashMap(); @@ -59,6 +60,7 @@ public class SigRenderer implements KeyListener,MouseListener,MouseMotionListene aHeld=false,sHeld=false,dHeld=false,wHeld=false; public static MouseEvent request; + public static MouseEvent temp_request; public static MouseHandler answer; public static MouseHandler tempAnswer = null; diff --git a/src/sig/utils/DrawUtils.java b/src/sig/utils/DrawUtils.java index 3bcfde6..0570b04 100644 --- a/src/sig/utils/DrawUtils.java +++ b/src/sig/utils/DrawUtils.java @@ -92,10 +92,15 @@ public class DrawUtils { tex_u=(1.0f-t)*tex_su+t*tex_eu; tex_v=(1.0f-t)*tex_sv+t*tex_ev; tex_w=(1.0f-t)*tex_sw+t*tex_ew; - if (tex_w>SigRenderer.depthBuffer[i*SigRenderer.SCREEN_WIDTH+j]) { - if (SigRenderer.request!=null&&j==SigRenderer.request.getX()&&i==SigRenderer.request.getY()) { - SigRenderer.tempAnswer=new MouseHandler(SigRenderer.request,ref.b); + if (SigRenderer.temp_request!=null) { + if (tex_w>SigRenderer.depthBuffer_noTransparency[i*SigRenderer.SCREEN_WIDTH+j]) { + SigRenderer.depthBuffer_noTransparency[i*SigRenderer.SCREEN_WIDTH+j]=tex_w; + if (j==SigRenderer.temp_request.getX()&&i==SigRenderer.temp_request.getY()) { + SigRenderer.tempAnswer=new MouseHandler(SigRenderer.temp_request,ref.b); + } } + } + if (tex_w>SigRenderer.depthBuffer[i*SigRenderer.SCREEN_WIDTH+j]) { int col = texture.getColor(tex_u/tex_w,tex_v/tex_w,colorMult/255f); if (((col&0xFF000000)>>>24)!=0) { if (((col&0xFF000000)>>>24)!=255) { @@ -163,10 +168,15 @@ public class DrawUtils { tex_u=(1.0f-t)*tex_su+t*tex_eu; tex_v=(1.0f-t)*tex_sv+t*tex_ev; tex_w=(1.0f-t)*tex_sw+t*tex_ew; - if (tex_w>SigRenderer.depthBuffer[i*SigRenderer.SCREEN_WIDTH+j]) { - if (SigRenderer.request!=null&&j==SigRenderer.request.getX()&&i==SigRenderer.request.getY()) { - SigRenderer.tempAnswer=new MouseHandler(SigRenderer.request,ref.b); + if (SigRenderer.temp_request!=null) { + if (tex_w>SigRenderer.depthBuffer_noTransparency[i*SigRenderer.SCREEN_WIDTH+j]) { + SigRenderer.depthBuffer_noTransparency[i*SigRenderer.SCREEN_WIDTH+j]=tex_w; + if (j==SigRenderer.temp_request.getX()&&i==SigRenderer.temp_request.getY()) { + SigRenderer.tempAnswer=new MouseHandler(SigRenderer.temp_request,ref.b); + } } + } + if (tex_w>SigRenderer.depthBuffer[i*SigRenderer.SCREEN_WIDTH+j]) { int col = texture.getColor(tex_u/tex_w,tex_v/tex_w,colorMult/255f); if (((col&0xFF000000)>>>24)!=0) { if (((col&0xFF000000)>>>24)!=255) {