pull/2/head
Joshua Sigona 3 years ago
parent 23f46a1e8b
commit 2868869bdd
  1. 8
      src/sig/Panel.java
  2. 4
      src/sig/SigRenderer.java
  3. 7
      src/sig/TestKernel.java
  4. 119
      src/sig/utils/DrawUtils.java

@ -101,7 +101,7 @@ public class Panel extends JPanel implements Runnable {
if(p.length != width * height) return; if(p.length != width * height) return;
for (int x=0;x<width;x++) { for (int x=0;x<width;x++) {
for (int y=0;y<height;y++) { for (int y=0;y<height;y++) {
p[ (int)(x*SigRenderer.RESOLUTION) + (int)(y*SigRenderer.RESOLUTION) * width] = 0; p[ x + y * width] = 0;
SigRenderer.depthBuffer[x+y*width]=0; SigRenderer.depthBuffer[x+y*width]=0;
SigRenderer.depthBuffer_tri[x+y*width]=null; SigRenderer.depthBuffer_tri[x+y*width]=null;
SigRenderer.translucencyBuffer[x+y*width]=false; SigRenderer.translucencyBuffer[x+y*width]=false;
@ -273,7 +273,7 @@ public class Panel extends JPanel implements Runnable {
(int)tt.A.x,(int)tt.A.y,tt.T.u,tt.T.v,tt.T.w, (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, (int)tt.B.x,(int)tt.B.y,tt.U.u,tt.U.v,tt.U.w,
(int)tt.C.x,(int)tt.C.y,tt.V.u,tt.V.v,tt.V.w, (int)tt.C.x,(int)tt.C.y,tt.V.u,tt.V.v,tt.V.w,
tt.tex,(tt.col&0xFF0000)>>16,tt); tt.tex,(tt.col&0xFF0000)>>16,tt,DrawUtils.NORMAL_RENDERING,SigRenderer.RESOLUTION);
} else { } else {
DrawUtils.FillTriangle(p,(int)tt.A.x,(int)tt.A.y,(int)tt.B.x,(int)tt.B.y,(int)tt.C.x,(int)tt.C.y,tt.getColor()); DrawUtils.FillTriangle(p,(int)tt.A.x,(int)tt.A.y,(int)tt.B.x,(int)tt.B.y,(int)tt.C.x,(int)tt.C.y,tt.getColor());
} }
@ -342,7 +342,7 @@ public class Panel extends JPanel implements Runnable {
(int)tt.A.x,(int)tt.A.y,tt.T.u,tt.T.v,tt.T.w, (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, (int)tt.B.x,(int)tt.B.y,tt.U.u,tt.U.v,tt.U.w,
(int)tt.C.x,(int)tt.C.y,tt.V.u,tt.V.v,tt.V.w, (int)tt.C.x,(int)tt.C.y,tt.V.u,tt.V.v,tt.V.w,
tt.tex,(tt.col&0xFF0000)>>16,tt,DrawUtils.IGNORE_TRANSLUCENT_RENDERING); tt.tex,(tt.col&0xFF0000)>>16,tt,DrawUtils.IGNORE_TRANSLUCENT_RENDERING,SigRenderer.RESOLUTION);
} else { } else {
DrawUtils.FillTriangle(p,(int)tt.A.x,(int)tt.A.y,(int)tt.B.x,(int)tt.B.y,(int)tt.C.x,(int)tt.C.y,tt.getColor()); DrawUtils.FillTriangle(p,(int)tt.A.x,(int)tt.A.y,(int)tt.B.x,(int)tt.B.y,(int)tt.C.x,(int)tt.C.y,tt.getColor());
} }
@ -388,7 +388,7 @@ public class Panel extends JPanel implements Runnable {
(int)tt.A.x,(int)tt.A.y,tt.T.u,tt.T.v,tt.T.w, (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, (int)tt.B.x,(int)tt.B.y,tt.U.u,tt.U.v,tt.U.w,
(int)tt.C.x,(int)tt.C.y,tt.V.u,tt.V.v,tt.V.w, (int)tt.C.x,(int)tt.C.y,tt.V.u,tt.V.v,tt.V.w,
tt.tex,(tt.col&0xFF0000)>>16,tt,DrawUtils.TRANSLUCENT_ONLY_RENDERING); tt.tex,(tt.col&0xFF0000)>>16,tt,DrawUtils.TRANSLUCENT_ONLY_RENDERING,SigRenderer.RESOLUTION);
} else { } else {
DrawUtils.FillTriangle(p,(int)tt.A.x,(int)tt.A.y,(int)tt.B.x,(int)tt.B.y,(int)tt.C.x,(int)tt.C.y,tt.getColor()); DrawUtils.FillTriangle(p,(int)tt.A.x,(int)tt.A.y,(int)tt.B.x,(int)tt.B.y,(int)tt.C.x,(int)tt.C.y,tt.getColor());
} }

@ -43,7 +43,7 @@ public class SigRenderer implements WindowFocusListener,KeyListener,MouseListene
public final static long TIMEPERTICK = 16666667l; public final static long TIMEPERTICK = 16666667l;
public static float DRAWTIME=0; public static float DRAWTIME=0;
public static float DRAWLOOPTIME=0; public static float DRAWLOOPTIME=0;
public static final float RESOLUTION=1; public static final int RESOLUTION=2;
public static Robot myRobot; public static Robot myRobot;
public static float rot = (float)Math.PI/4; //In radians. public static float rot = (float)Math.PI/4; //In radians.
public static ConcurrentHashMap<String,Block> blockGrid = new ConcurrentHashMap<>(); public static ConcurrentHashMap<String,Block> blockGrid = new ConcurrentHashMap<>();
@ -402,6 +402,7 @@ public class SigRenderer implements WindowFocusListener,KeyListener,MouseListene
for (int x=0;x<64;x++) { for (int x=0;x<64;x++) {
for (int z=0;z<64;z++) { for (int z=0;z<64;z++) {
addBlock(new Vector(x,0,z),Cube.class,BlockType.SOIL_WET,FacingDirection.SOUTH); addBlock(new Vector(x,0,z),Cube.class,BlockType.SOIL_WET,FacingDirection.SOUTH);
addBlock(new Vector(x,1,z),Plant.class,BlockType.valueOf("WHEAT_"+(r.nextInt(7))),FacingDirection.SOUTH);
//addBlock(new Vector(x,1,z),Staircase.class,BlockType.JUNGLE_PLANK,FacingDirection.SOUTH); //addBlock(new Vector(x,1,z),Staircase.class,BlockType.JUNGLE_PLANK,FacingDirection.SOUTH);
//addBlock(new Vector(x,2,z),Staircase.class,BlockType.SPRUCE_PLANK,FacingDirection.SOUTH); //addBlock(new Vector(x,2,z),Staircase.class,BlockType.SPRUCE_PLANK,FacingDirection.SOUTH);
/*for (int y=1;y<r.nextInt(5);y++) { /*for (int y=1;y<r.nextInt(5);y++) {
@ -428,7 +429,6 @@ public class SigRenderer implements WindowFocusListener,KeyListener,MouseListene
}*/ }*/
} }
} }
addBlock(new Vector(31,1,31),Plant.class,BlockType.valueOf("WHEAT_"+(r.nextInt(7))),FacingDirection.SOUTH);
/*addBlock(new Vector(31,2,32),Staircase.class,BlockType.PLANKS,FacingDirection.EAST); /*addBlock(new Vector(31,2,32),Staircase.class,BlockType.PLANKS,FacingDirection.EAST);
addBlock(new Vector(31,3,33),Staircase.class,BlockType.PLANKS,FacingDirection.WEST); addBlock(new Vector(31,3,33),Staircase.class,BlockType.PLANKS,FacingDirection.WEST);
addBlock(new Vector(31,4,34),Staircase.class,BlockType.PLANKS,FacingDirection.SOUTH); addBlock(new Vector(31,4,34),Staircase.class,BlockType.PLANKS,FacingDirection.SOUTH);

@ -21,7 +21,7 @@ public class TestKernel extends Kernel{
this.test2=test2; this.test2=test2;
} }
public static void main(String[] args) { /*public static void main(String[] args) {
int size = 1024; int size = 1024;
final int[] a = new int[size]; final int[] a = new int[size];
@ -42,9 +42,6 @@ public class TestKernel extends Kernel{
//size=5; //size=5;
kernel.b[0]=50; kernel.b[0]=50;
kernel.b[1]=45; kernel.b[1]=45;
/*for (int i = 0; i < size; i++) {
b[i] = (int) (Math.random() * 100);
}*/
long timer1=System.nanoTime(); long timer1=System.nanoTime();
for (int i=0;i<900;i++) { for (int i=0;i<900;i++) {
kernel.execute(Range.create(size)); kernel.execute(Range.create(size));
@ -61,7 +58,7 @@ public class TestKernel extends Kernel{
} }
} }
System.out.println((System.nanoTime()-timer1)+"ns"); System.out.println((System.nanoTime()-timer1)+"ns");
} }*/
@Override @Override
public void run() { public void run() {

@ -18,19 +18,69 @@ public class DrawUtils {
Draw(canvas,i,ny,col); Draw(canvas,i,ny,col);
} }
} }
private static boolean CheckAllTexels(float tex_w, float[] buffer, int x,int y, int texelSize) {
for (int xx=-texelSize/2;xx<(texelSize+1)/2;xx++) {
for (int yy=-texelSize/2;yy<(texelSize+1)/2;yy++) {
if (x+xx>=0&&x+xx<SigRenderer.SCREEN_WIDTH&&
y+yy>=0&&y+yy<SigRenderer.SCREEN_HEIGHT&&
tex_w<=buffer[(y+yy)*SigRenderer.SCREEN_WIDTH+(x+xx)]) {
return false;
}
}
}
return true;
}
private static void setArrayTexels(float[] buffer, int x,int y,float value,int texelSize) {
for (int xx=-texelSize/2;xx<(texelSize+1)/2;xx++) {
for (int yy=-texelSize/2;yy<(texelSize+1)/2;yy++) {
if (x+xx>=0&&x+xx<SigRenderer.SCREEN_WIDTH&&
y+yy>=0&&y+yy<SigRenderer.SCREEN_HEIGHT) {
buffer[(y+yy)*SigRenderer.SCREEN_WIDTH+(x+xx)]=value;
}
}
}
}
private static void setArrayTexels(Triangle[] buffer, int x,int y,Triangle value,int texelSize) {
for (int xx=-texelSize/2;xx<(texelSize+1)/2;xx++) {
for (int yy=-texelSize/2;yy<(texelSize+1)/2;yy++) {
if (x+xx>=0&&x+xx<SigRenderer.SCREEN_WIDTH&&
y+yy>=0&&y+yy<SigRenderer.SCREEN_HEIGHT) {
buffer[(y+yy)*SigRenderer.SCREEN_WIDTH+(x+xx)]=value;
}
}
}
}
private static void setArrayTexels(boolean[] buffer, int x,int y,boolean value,int texelSize) {
for (int xx=-texelSize/2;xx<(texelSize+1)/2;xx++) {
for (int yy=-texelSize/2;yy<(texelSize+1)/2;yy++) {
if (x+xx>=0&&x+xx<SigRenderer.SCREEN_WIDTH&&
y+yy>=0&&y+yy<SigRenderer.SCREEN_HEIGHT) {
buffer[(y+yy)*SigRenderer.SCREEN_WIDTH+(x+xx)]=value;
}
}
}
}
public static void TexturedTriangle(int[] canvas, public static void TexturedTriangle(int[] canvas,
int x1, int y1, float u1,float v1,float w1, int x1, int y1, float u1,float v1,float w1,
int x2, int y2, float u2,float v2,float w2, int x2, int y2, float u2,float v2,float w2,
int x3, int y3, float u3,float v3,float w3, int x3, int y3, float u3,float v3,float w3,
Texture texture, int colorMult,Triangle ref) { Texture texture, int colorMult,Triangle ref) {
TexturedTriangle(canvas,x1,y1,u1,v1,w1,x2,y2,u2,v2,w2,x3,y3,u3,v3,w3,texture,colorMult,ref,NORMAL_RENDERING); TexturedTriangle(canvas,x1,y1,u1,v1,w1,x2,y2,u2,v2,w2,x3,y3,u3,v3,w3,texture,colorMult,ref,NORMAL_RENDERING,1);
}
public static void TexturedTriangle(int[] canvas,
int x1, int y1, float u1,float v1,float w1,
int x2, int y2, float u2,float v2,float w2,
int x3, int y3, float u3,float v3,float w3,
Texture texture, int colorMult,Triangle ref,
int rendering_state) {
TexturedTriangle(canvas,x1,y1,u1,v1,w1,x2,y2,u2,v2,w2,x3,y3,u3,v3,w3,texture,colorMult,ref,rendering_state,1);
} }
public static void TexturedTriangle(int[] canvas, public static void TexturedTriangle(int[] canvas,
int x1, int y1, float u1,float v1,float w1, int x1, int y1, float u1,float v1,float w1,
int x2, int y2, float u2,float v2,float w2, int x2, int y2, float u2,float v2,float w2,
int x3, int y3, float u3,float v3,float w3, int x3, int y3, float u3,float v3,float w3,
Texture texture, int colorMult,Triangle ref, Texture texture, int colorMult,Triangle ref,
int rendering_state int rendering_state,int texelSize
) { ) {
if (y2<y1) {int t=y1;y1=y2;y2=t;t=x1;x1=x2;x2=t;float u=u1;u1=u2;u2=u;float v=v1;v1=v2;v2=v;float w=w1;w1=w2;w2=w;} if (y2<y1) {int t=y1;y1=y2;y2=t;t=x1;x1=x2;x2=t;float u=u1;u1=u2;u2=u;float v=v1;v1=v2;v2=v;float w=w1;w1=w2;w2=w;}
if (y3<y1) {int t=y1;y1=y3;y3=t;t=x1;x1=x3;x3=t;float u=u1;u1=u3;u3=u;float v=v1;v1=v3;v3=v;float w=w1;w1=w3;w3=w;} if (y3<y1) {int t=y1;y1=y3;y3=t;t=x1;x1=x3;x3=t;float u=u1;u1=u3;u3=u;float v=v1;v1=v3;v3=v;float w=w1;w1=w3;w3=w;}
@ -63,7 +113,7 @@ public class DrawUtils {
if (dy2!=0) {dw2_step=dw2/((float)Math.abs(dy2));} if (dy2!=0) {dw2_step=dw2/((float)Math.abs(dy2));}
if (dy1!=0) { if (dy1!=0) {
for (int i=y1;i<=y2;i+=4) { for (int i=y1;i<=y2;i+=texelSize) {
int ax=(int)(x1+((float)(i-y1))*dax_step); int ax=(int)(x1+((float)(i-y1))*dax_step);
int bx=(int)(x1+((float)(i-y1))*dbx_step); int bx=(int)(x1+((float)(i-y1))*dbx_step);
@ -88,39 +138,41 @@ public class DrawUtils {
float tstep = 1.0f/(float)(bx-ax); float tstep = 1.0f/(float)(bx-ax);
float t=0.0f; float t=0.0f;
for (int j=ax;j<=bx;j+=4) { for (int j=ax;j<=bx;j+=texelSize) {
tex_u=(1.0f-t)*tex_su+t*tex_eu; tex_u=(1.0f-t)*tex_su+t*tex_eu;
tex_v=(1.0f-t)*tex_sv+t*tex_ev; tex_v=(1.0f-t)*tex_sv+t*tex_ev;
tex_w=(1.0f-t)*tex_sw+t*tex_ew; tex_w=(1.0f-t)*tex_sw+t*tex_ew;
if (SigRenderer.temp_request!=null) { if (SigRenderer.temp_request!=null) {
if (tex_w>SigRenderer.depthBuffer_noTransparency[i*SigRenderer.SCREEN_WIDTH+j]) { if (CheckAllTexels(tex_w,SigRenderer.depthBuffer_noTransparency,j,i,texelSize)) {
SigRenderer.depthBuffer_noTransparency[i*SigRenderer.SCREEN_WIDTH+j]=tex_w; setArrayTexels(SigRenderer.depthBuffer_noTransparency,j,i,tex_w,texelSize);
if (j==SigRenderer.temp_request.getX()&&i==SigRenderer.temp_request.getY()) { if (j==SigRenderer.temp_request.getX()&&i==SigRenderer.temp_request.getY()) {
SigRenderer.tempAnswer=new MouseHandler(SigRenderer.temp_request,ref); SigRenderer.tempAnswer=new MouseHandler(SigRenderer.temp_request,ref);
} }
} }
} }
if (tex_w>SigRenderer.depthBuffer[i*SigRenderer.SCREEN_WIDTH+j]) { if (CheckAllTexels(tex_w,SigRenderer.depthBuffer,j,i,texelSize)) {
int col = texture.getColor(tex_u/tex_w,tex_v/tex_w,colorMult/255f); int col = texture.getColor(tex_u/tex_w,tex_v/tex_w,colorMult/255f);
if (((col&0xFF000000)>>>24)!=0) { if (((col&0xFF000000)>>>24)!=0) {
if (((col&0xFF000000)>>>24)!=255) { if (((col&0xFF000000)>>>24)!=255) {
if (rendering_state==TRANSLUCENT_ONLY_RENDERING|| if (rendering_state==TRANSLUCENT_ONLY_RENDERING||
rendering_state==NORMAL_RENDERING) { rendering_state==NORMAL_RENDERING) {
Draw(canvas,j,i,col,4); Draw(canvas,j,i,col,texelSize);
SigRenderer.depthBuffer[i*SigRenderer.SCREEN_WIDTH+j] = tex_w; setArrayTexels(SigRenderer.depthBuffer,j,i,tex_w,texelSize);
SigRenderer.depthBuffer_tri[i*SigRenderer.SCREEN_WIDTH+j] = ref.unmodifiedTri; if (rendering_state!=TRANSLUCENT_ONLY_RENDERING) {
SigRenderer.translucencyBuffer[i*SigRenderer.SCREEN_WIDTH+j] = true; setArrayTexels(SigRenderer.depthBuffer_tri,j,i,ref.unmodifiedTri,texelSize);
}
setArrayTexels(SigRenderer.translucencyBuffer,j,i,true,texelSize);
} }
} else { } else {
if (rendering_state!=TRANSLUCENT_ONLY_RENDERING) { if (rendering_state!=TRANSLUCENT_ONLY_RENDERING) {
Draw(canvas,j,i,col,4); Draw(canvas,j,i,col,texelSize);
SigRenderer.depthBuffer[i*SigRenderer.SCREEN_WIDTH+j] = tex_w; setArrayTexels(SigRenderer.depthBuffer,j,i,tex_w,texelSize);
SigRenderer.depthBuffer_tri[i*SigRenderer.SCREEN_WIDTH+j] = ref.unmodifiedTri; setArrayTexels(SigRenderer.depthBuffer_tri,j,i,ref.unmodifiedTri,texelSize);
} }
} }
} }
} }
t+=tstep*4; t+=tstep*texelSize;
} }
} }
} }
@ -139,7 +191,7 @@ public class DrawUtils {
if (dy1!=0) {dw1_step=dw1/((float)Math.abs(dy1));} if (dy1!=0) {dw1_step=dw1/((float)Math.abs(dy1));}
if (dy1!=0) { if (dy1!=0) {
for (int i=y2;i<=y3;i+=4) { for (int i=y2;i<=y3;i+=texelSize) {
int ax=(int)(x2+((float)(i-y2))*dax_step); int ax=(int)(x2+((float)(i-y2))*dax_step);
int bx=(int)(x1+((float)(i-y1))*dbx_step); int bx=(int)(x1+((float)(i-y1))*dbx_step);
@ -164,41 +216,42 @@ public class DrawUtils {
float tstep = 1.0f/(float)(bx-ax); float tstep = 1.0f/(float)(bx-ax);
float t=0.0f; float t=0.0f;
for (int j=ax;j<=bx;j+=4) {
for (int j=ax;j<=bx;j+=texelSize) {
tex_u=(1.0f-t)*tex_su+t*tex_eu; tex_u=(1.0f-t)*tex_su+t*tex_eu;
tex_v=(1.0f-t)*tex_sv+t*tex_ev; tex_v=(1.0f-t)*tex_sv+t*tex_ev;
tex_w=(1.0f-t)*tex_sw+t*tex_ew; tex_w=(1.0f-t)*tex_sw+t*tex_ew;
if (SigRenderer.temp_request!=null) { if (SigRenderer.temp_request!=null) {
if (tex_w>SigRenderer.depthBuffer_noTransparency[i*SigRenderer.SCREEN_WIDTH+j]) { if (CheckAllTexels(tex_w,SigRenderer.depthBuffer_noTransparency,j,i,texelSize)) {
SigRenderer.depthBuffer_noTransparency[i*SigRenderer.SCREEN_WIDTH+j]=tex_w; setArrayTexels(SigRenderer.depthBuffer_noTransparency,j,i,tex_w,texelSize);
if (j==SigRenderer.temp_request.getX()&&i==SigRenderer.temp_request.getY()) { if (j==SigRenderer.temp_request.getX()&&i==SigRenderer.temp_request.getY()) {
SigRenderer.tempAnswer=new MouseHandler(SigRenderer.temp_request,ref); SigRenderer.tempAnswer=new MouseHandler(SigRenderer.temp_request,ref);
} }
} }
} }
if (tex_w>SigRenderer.depthBuffer[i*SigRenderer.SCREEN_WIDTH+j]) { if (CheckAllTexels(tex_w,SigRenderer.depthBuffer,j,i,texelSize)) {
int col = texture.getColor(tex_u/tex_w,tex_v/tex_w,colorMult/255f); int col = texture.getColor(tex_u/tex_w,tex_v/tex_w,colorMult/255f);
if (((col&0xFF000000)>>>24)!=0) { if (((col&0xFF000000)>>>24)!=0) {
if (((col&0xFF000000)>>>24)!=255) { if (((col&0xFF000000)>>>24)!=255) {
if (rendering_state==TRANSLUCENT_ONLY_RENDERING|| if (rendering_state==TRANSLUCENT_ONLY_RENDERING||
rendering_state==NORMAL_RENDERING) { rendering_state==NORMAL_RENDERING) {
Draw(canvas,j,i,col,4); Draw(canvas,j,i,col,texelSize);
SigRenderer.depthBuffer[i*SigRenderer.SCREEN_WIDTH+j] = tex_w; setArrayTexels(SigRenderer.depthBuffer,j,i,tex_w,texelSize);
if (rendering_state!=TRANSLUCENT_ONLY_RENDERING) { if (rendering_state!=TRANSLUCENT_ONLY_RENDERING) {
SigRenderer.depthBuffer_tri[i*SigRenderer.SCREEN_WIDTH+j] = ref.unmodifiedTri; setArrayTexels(SigRenderer.depthBuffer_tri,j,i,ref.unmodifiedTri,texelSize);
} }
SigRenderer.translucencyBuffer[i*SigRenderer.SCREEN_WIDTH+j] = true; setArrayTexels(SigRenderer.translucencyBuffer,j,i,true,texelSize);
} }
} else { } else {
if (rendering_state!=TRANSLUCENT_ONLY_RENDERING) { if (rendering_state!=TRANSLUCENT_ONLY_RENDERING) {
Draw(canvas,j,i,col,4); Draw(canvas,j,i,col,texelSize);
SigRenderer.depthBuffer[i*SigRenderer.SCREEN_WIDTH+j] = tex_w; setArrayTexels(SigRenderer.depthBuffer,j,i,tex_w,texelSize);
SigRenderer.depthBuffer_tri[i*SigRenderer.SCREEN_WIDTH+j] = ref.unmodifiedTri; setArrayTexels(SigRenderer.depthBuffer_tri,j,i,ref.unmodifiedTri,texelSize);
} }
} }
} }
} }
t+=tstep*4; t+=tstep*texelSize;
} }
} }
} }
@ -409,13 +462,17 @@ public class DrawUtils {
int new_b=(int)(ratio*b+(1-ratio)*prev_b); int new_b=(int)(ratio*b+(1-ratio)*prev_b);
for (int xx=-texelSize/2;xx<(texelSize+1)/2;xx++) { for (int xx=-texelSize/2;xx<(texelSize+1)/2;xx++) {
for (int yy=-texelSize/2;yy<(texelSize+1)/2;yy++) { for (int yy=-texelSize/2;yy<(texelSize+1)/2;yy++) {
canvas[((x+xx)*texelSize)/texelSize+(((y+yy)*texelSize)/texelSize)*SigRenderer.SCREEN_WIDTH]=new_r+(new_g<<8)+(new_b<<16)+(col&0xFF000000); if (x+xx>=0&&x+xx<SigRenderer.SCREEN_WIDTH&&y+yy>=0&&y+yy<SigRenderer.SCREEN_HEIGHT) {
canvas[x+xx+(y+yy)*SigRenderer.SCREEN_WIDTH]=new_r+(new_g<<8)+(new_b<<16)+(col&0xFF000000);
}
} }
} }
} else { } else {
for (int xx=-texelSize/2;xx<(texelSize+1)/2;xx++) { for (int xx=-texelSize/2;xx<(texelSize+1)/2;xx++) {
for (int yy=-texelSize/2;yy<(texelSize+1)/2;yy++) { for (int yy=-texelSize/2;yy<(texelSize+1)/2;yy++) {
canvas[((x+xx)*texelSize)/texelSize+(((y+yy)*texelSize)/texelSize)*SigRenderer.SCREEN_WIDTH]=col; if (x+xx>=0&&x+xx<SigRenderer.SCREEN_WIDTH&&y+yy>=0&&y+yy<SigRenderer.SCREEN_HEIGHT) {
canvas[x+xx+(y+yy)*SigRenderer.SCREEN_WIDTH]=col;
}
} }
} }
} }

Loading…
Cancel
Save