Normand Briere
2019-08-13 0cdf3fb57ddea3226f094ba45c836c7e9b123e3a
CameraPane.java
....@@ -173,7 +173,7 @@
173173 static boolean doublesided = false; // true; // reversed normals are awful for conformance
174174 boolean anisotropy = true;
175175 boolean softshadow = true; // slower but better false;
176
- boolean opacityhalo = false;
176
+ boolean opacityhalo = false; // reverse the halo effect (e.g. glass)
177177
178178 boolean macromode = false;
179179
....@@ -8358,7 +8358,7 @@
83588358 // else
83598359 // if (!texname.startsWith("/"))
83608360 // texname = "/Users/nbriere/Textures/" + texname;
8361
- if (!FileExists(texname))
8361
+ if (!FileExists(texname) && !texname.startsWith("@"))
83628362 {
83638363 texname = fallbackTextureName;
83648364 }
....@@ -8441,6 +8441,15 @@
84418441 new Exception().printStackTrace();
84428442 } else
84438443 {
8444
+ if (texname.startsWith("@"))
8445
+ {
8446
+ // texturecache = textures.get(texname); // suspicious
8447
+ if (texturecache == null)
8448
+ texturecache = new CacheTexture(GetResourceTexture(texname.substring(1), bump),resolution);
8449
+ else
8450
+ new Exception().printStackTrace();
8451
+ } else
8452
+ {
84448453 if (textureon)
84458454 {
84468455 String cachename = texname;
....@@ -8500,6 +8509,7 @@
85008509 texturecache = new CacheTexture(texturedata,resolution);
85018510 //texture = GetTexture(tex, bump);
85028511 }
8512
+ }
85038513 }
85048514 //}
85058515 }
....@@ -8768,10 +8778,12 @@
87688778
87698779 gl.glGetIntegerv(GL.GL_MAX_TEXTURE_STACK_DEPTH, temp, 0);
87708780 MAXSTACK = temp[0];
8771
- System.out.println("GL_MAX_TEXTURE_STACK_DEPTH = " + MAXSTACK);
8781
+ if (Globals.DEBUG)
8782
+ System.out.println("GL_MAX_TEXTURE_STACK_DEPTH = " + MAXSTACK);
87728783 gl.glGetIntegerv(GL.GL_MAX_MODELVIEW_STACK_DEPTH, temp, 0);
87738784 MAXSTACK = temp[0];
8774
- System.out.println("GL_MAX_MODELVIEW_STACK_DEPTH = " + MAXSTACK);
8785
+ if (Globals.DEBUG)
8786
+ System.out.println("GL_MAX_MODELVIEW_STACK_DEPTH = " + MAXSTACK);
87758787
87768788 // Use debug pipeline
87778789 //drawable.setGL(new DebugGL(gl)); //
....@@ -8779,7 +8791,8 @@
87798791 gl = drawable.getGL(); //
87808792
87818793 GL gl3 = getGL();
8782
- System.out.println("INIT GL IS: " + gl.getClass().getName());
8794
+ if (Globals.DEBUG)
8795
+ System.out.println("INIT GL IS: " + gl.getClass().getName());
87838796
87848797
87858798 //float pos[] = { 100, 100, 100, 0 };
....@@ -10841,7 +10854,7 @@
1084110854
1084210855 if (wait)
1084310856 {
10844
- Sleep(500);
10857
+ Sleep(200); // blocks everything
1084510858
1084610859 wait = false;
1084710860 }
....@@ -11379,7 +11392,7 @@
1137911392
1138011393 // if (cam != lightCamera)
1138111394 //for (int count = parentcam.GetTransformCount(); --count>=0;)
11382
- LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013
11395
+ LA.xformDir(lightposition, parentcam.GlobalTransformInv(), lightposition); // may 2013
1138311396 }
1138411397
1138511398 LA.xformDir(lightposition, cam.toScreen, lightposition);
....@@ -14632,9 +14645,9 @@
1463214645 MODIFIERS |= COMMAND;
1463314646 /**/
1463414647 if((mod&SHIFT) == SHIFT)
14635
- manipCamera.RotatePosition(0, -speed);
14636
- else
1463714648 manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14649
+ else
14650
+ manipCamera.RotatePosition(0, -speed);
1463814651 /**/
1463914652 if ((mod & SHIFT) == SHIFT)
1464014653 {
....@@ -14653,9 +14666,9 @@
1465314666 MODIFIERS |= COMMAND;
1465414667 /**/
1465514668 if((mod&SHIFT) == SHIFT)
14656
- manipCamera.RotatePosition(0, speed);
14657
- else
1465814669 manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14670
+ else
14671
+ manipCamera.RotatePosition(0, speed);
1465914672 /**/
1466014673 if ((mod & SHIFT) == SHIFT)
1466114674 {
....@@ -16657,6 +16670,7 @@
1665716670 private void DrawSkyBox(GL gl, float ratio)
1665816671 {
1665916672 if (//envyoff ||
16673
+ WIREFRAME ||
1666016674 cubemap == null)
1666116675 {
1666216676 gl.glClearColor(BGcolor, BGcolor, BGcolor, 1);
....@@ -17519,10 +17533,14 @@
1751917533 gl.glFlush();
1752017534
1752117535 /**/
17522
- gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, occlusionsizebuffer);
17536
+ gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, occlusiondepthbuffer);
1752317537
17524
- float[] pixels = occlusionsizebuffer.array();
17538
+ float[] depths = occlusiondepthbuffer.array();
1752517539
17540
+ gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_BGRA, GL.GL_UNSIGNED_INT_8_8_8_8_REV, occlusioncolorbuffer);
17541
+
17542
+ int[] pixels = selectsizebuffer.array();
17543
+
1752617544 double r = 0, g = 0, b = 0;
1752717545
1752817546 double count = 0;
....@@ -17533,7 +17551,7 @@
1753317551
1753417552 double FACTOR = 1;
1753517553
17536
- for (int i = 0; i < pixels.length; i++)
17554
+ for (int i = 0; i < depths.length; i++)
1753717555 {
1753817556 int x = i / OCCLUSION_SIZE - OCCLUSION_SIZE / 2;
1753917557 int y = i % OCCLUSION_SIZE - OCCLUSION_SIZE / 2;
....@@ -17616,7 +17634,7 @@
1761617634
1761717635 double scale = ray.z; // 1; // cos
1761817636
17619
- float depth = pixels[newindex];
17637
+ float depth = depths[newindex];
1762017638
1762117639 /*
1762217640 int newindex2 = (x + 1) * OCCLUSION_SIZE + y;
....@@ -17813,11 +17831,14 @@
1781317831 static IntBuffer AAbuffer; // = IntBuffer.allocate(MAX_SIZE*MAX_SIZE);
1781417832 static IntBuffer bigAAbuffer;
1781517833 static java.nio.FloatBuffer histogram = BufferUtil.newFloatBuffer(HISTOGRAM_SIZE * 3);
17816
- static IntBuffer texturesizebuffer = IntBuffer.allocate(TEX_SIZE * TEX_SIZE);
17834
+ //static IntBuffer texturesizebuffer = IntBuffer.allocate(TEX_SIZE * TEX_SIZE);
1781717835 static IntBuffer selectsizebuffer = IntBuffer.allocate(SELECT_SIZE * SELECT_SIZE);
1781817836 static java.nio.FloatBuffer pointselectsizebuffer = java.nio.FloatBuffer.allocate(SELECT_SIZE * SELECT_SIZE);
1781917837 //static IntBuffer occlusionsizebuffer = IntBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE);
17820
- static java.nio.FloatBuffer occlusionsizebuffer = java.nio.FloatBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE);
17838
+ static java.nio.FloatBuffer occlusiondepthbuffer = java.nio.FloatBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE);
17839
+
17840
+ static IntBuffer occlusioncolorbuffer = IntBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE);
17841
+
1782117842 static BufferedImage bufimage = new BufferedImage(TEX_SIZE, TEX_SIZE, BufferedImage.TYPE_INT_RGB);
1782217843 static BufferedImage textest = new cBufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
1782317844 static java.util.Vector<BufferedImage> billboards = new java.util.Vector<BufferedImage>();