|
|
|
@ -103,10 +103,11 @@ public class Panel extends JPanel implements Runnable { |
|
|
|
|
Matrix matCamera = Matrix.PointAt(SigRenderer.vCamera, vTarget, vUp); |
|
|
|
|
Matrix matView = Matrix.QuickInverse(matCamera); |
|
|
|
|
|
|
|
|
|
for (Triangle t : SigRenderer.cube.triangles) { |
|
|
|
|
for (Block b : SigRenderer.blocks) { |
|
|
|
|
for (Triangle t : b.block.triangles) { |
|
|
|
|
Triangle triProjected = new Triangle(),triTransformed=new Triangle(),triViewed=new Triangle(); |
|
|
|
|
|
|
|
|
|
//matWorld = Matrix.MakeTranslation(10,0,0);
|
|
|
|
|
matWorld = Matrix.MakeTranslation(b.pos.x,b.pos.y,b.pos.z); |
|
|
|
|
|
|
|
|
|
triTransformed.A = Matrix.MultiplyVector(matWorld,t.A); |
|
|
|
|
triTransformed.B = Matrix.MultiplyVector(matWorld,t.B); |
|
|
|
@ -131,11 +132,14 @@ public class Panel extends JPanel implements Runnable { |
|
|
|
|
|
|
|
|
|
//System.out.println(-Vector.dotProduct(normal,Vector.normalize(cameraRay)));
|
|
|
|
|
//float dp = Math.max(0.1f,Math.min(1,-1/Vector.dotProduct(normal,cameraRay)));
|
|
|
|
|
Vector center = Vector.divide(Vector.add(triTransformed.A,Vector.add(triTransformed.B,triTransformed.C)),3); |
|
|
|
|
/*Vector center = Vector.divide(Vector.add(triTransformed.A,Vector.add(triTransformed.B,triTransformed.C)),3); |
|
|
|
|
Vector cameraRay2 = Vector.subtract(center,SigRenderer.vCamera); |
|
|
|
|
float dp = Math.max(0.1f,Math.min(1,(1f/((cameraRay2.x-center.x)*(cameraRay2.x-center.x)+ |
|
|
|
|
(cameraRay2.y-center.y)*(cameraRay2.y-center.y)+ |
|
|
|
|
(cameraRay2.z-center.z)*(cameraRay2.z-center.z))*4))); |
|
|
|
|
(cameraRay2.z-center.z)*(cameraRay2.z-center.z))*4)));*/ |
|
|
|
|
float dp = Math.max(0.1f,Math.min(1,(1f/((b.pos.x-SigRenderer.vCamera.x)+ |
|
|
|
|
(b.pos.y-SigRenderer.vCamera.y)*(b.pos.y-SigRenderer.vCamera.y)+ |
|
|
|
|
(b.pos.z-SigRenderer.vCamera.z)*(b.pos.z-SigRenderer.vCamera.z))*4))); |
|
|
|
|
|
|
|
|
|
triViewed.A = Matrix.MultiplyVector(matView,triTransformed.A); |
|
|
|
|
triViewed.B = Matrix.MultiplyVector(matView,triTransformed.B); |
|
|
|
@ -200,6 +204,7 @@ public class Panel extends JPanel implements Runnable { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*Collections.sort(accumulatedTris, new Comparator<Triangle>() { |
|
|
|
|
@Override |
|
|
|
|