Normand Briere
2019-08-15 24a2a946b35279605e645349bd6b82e9e60aac88
CameraPane.java
....@@ -110,7 +110,11 @@
110110 //private Mat4f spotlightTransform = new Mat4f();
111111 //private Mat4f spotlightInverseTransform = new Mat4f();
112112 static GLContext glcontext = null;
113
- /*static*/ com.sun.opengl.util.texture.Texture cubemap;
113
+ /*static*/ com.sun.opengl.util.texture.Texture cubemap; // Either custom or rgb
114
+ /*static*/ com.sun.opengl.util.texture.Texture cubemapcustom;
115
+ /*static*/ com.sun.opengl.util.texture.Texture cubemaprgb;
116
+ boolean transformMode;
117
+
114118 boolean reverseUP = false;
115119 static boolean frozen = false;
116120 boolean enablebackspace = false; // patch for back buffer refresh
....@@ -173,7 +177,7 @@
173177 static boolean doublesided = false; // true; // reversed normals are awful for conformance
174178 boolean anisotropy = true;
175179 boolean softshadow = true; // slower but better false;
176
- boolean opacityhalo = false;
180
+ boolean opacityhalo = false; // reverse the halo effect (e.g. glass)
177181
178182 boolean macromode = false;
179183
....@@ -187,6 +191,19 @@
187191 }
188192
189193 private File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory();
194
+
195
+ public com.sun.opengl.util.texture.Texture LoadSkybox(String name, String ext, boolean mipmap) throws GLException
196
+ {
197
+ try
198
+ {
199
+ return LoadCubemap(getClass().getClassLoader(), name, ext, mipmap);
200
+ } catch (IOException e)
201
+ {
202
+ System.out.println("NAME = " + name);
203
+ e.printStackTrace(); // throw new RuntimeException(e);
204
+ return null;
205
+ }
206
+ }
190207
191208 void SetAsGLRenderer(boolean b)
192209 {
....@@ -1485,6 +1502,8 @@
14851502 gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
14861503 }
14871504
1505
+ float[] colorV = new float[4];
1506
+
14881507 void SetColor(Object3D obj, Vertex p0)
14891508 {
14901509 CameraPane display = this;
....@@ -1552,8 +1571,6 @@
15521571 {
15531572 return;
15541573 }
1555
-
1556
- float[] colorV = new float[3];
15571574
15581575 if (false) // marked)
15591576 {
....@@ -2500,7 +2517,7 @@
25002517 com.sun.opengl.util.texture.TextureIO.newTextureData(
25012518 getClass().getClassLoader().getResourceAsStream(name),
25022519 true,
2503
- com.sun.opengl.util.texture.TextureIO.PNG);
2520
+ GetFormat(name)); // com.sun.opengl.util.texture.TextureIO.PNG);
25042521 } catch (java.io.IOException e)
25052522 {
25062523 throw new javax.media.opengl.GLException(e);
....@@ -8346,7 +8363,7 @@
83468363 // else
83478364 // if (!texname.startsWith("/"))
83488365 // texname = "/Users/nbriere/Textures/" + texname;
8349
- if (!FileExists(texname))
8366
+ if (!FileExists(texname) && !texname.startsWith("@"))
83508367 {
83518368 texname = fallbackTextureName;
83528369 }
....@@ -8429,6 +8446,15 @@
84298446 new Exception().printStackTrace();
84308447 } else
84318448 {
8449
+ if (texname.startsWith("@"))
8450
+ {
8451
+ // texturecache = textures.get(texname); // suspicious
8452
+ if (texturecache == null)
8453
+ texturecache = new CacheTexture(GetResourceTexture(texname.substring(1), bump),resolution);
8454
+ else
8455
+ new Exception().printStackTrace();
8456
+ } else
8457
+ {
84328458 if (textureon)
84338459 {
84348460 String cachename = texname;
....@@ -8488,6 +8514,7 @@
84888514 texturecache = new CacheTexture(texturedata,resolution);
84898515 //texture = GetTexture(tex, bump);
84908516 }
8517
+ }
84918518 }
84928519 //}
84938520 }
....@@ -8756,10 +8783,12 @@
87568783
87578784 gl.glGetIntegerv(GL.GL_MAX_TEXTURE_STACK_DEPTH, temp, 0);
87588785 MAXSTACK = temp[0];
8759
- System.out.println("GL_MAX_TEXTURE_STACK_DEPTH = " + MAXSTACK);
8786
+ if (Globals.DEBUG)
8787
+ System.out.println("GL_MAX_TEXTURE_STACK_DEPTH = " + MAXSTACK);
87608788 gl.glGetIntegerv(GL.GL_MAX_MODELVIEW_STACK_DEPTH, temp, 0);
87618789 MAXSTACK = temp[0];
8762
- System.out.println("GL_MAX_MODELVIEW_STACK_DEPTH = " + MAXSTACK);
8790
+ if (Globals.DEBUG)
8791
+ System.out.println("GL_MAX_MODELVIEW_STACK_DEPTH = " + MAXSTACK);
87638792
87648793 // Use debug pipeline
87658794 //drawable.setGL(new DebugGL(gl)); //
....@@ -8767,7 +8796,8 @@
87678796 gl = drawable.getGL(); //
87688797
87698798 GL gl3 = getGL();
8770
- System.out.println("INIT GL IS: " + gl.getClass().getName());
8799
+ if (Globals.DEBUG)
8800
+ System.out.println("INIT GL IS: " + gl.getClass().getName());
87718801
87728802
87738803 //float pos[] = { 100, 100, 100, 0 };
....@@ -8932,7 +8962,7 @@
89328962
89338963 if (cubemap == null)
89348964 {
8935
- LoadEnvy(5);
8965
+ //LoadEnvy(1);
89368966 }
89378967
89388968 //cubemap.enable();
....@@ -9208,6 +9238,8 @@
92089238
92099239 void LoadEnvy(int which)
92109240 {
9241
+ assert(false);
9242
+
92119243 String name;
92129244 String ext;
92139245
....@@ -9219,37 +9251,58 @@
92199251 cubemap = null;
92209252 return;
92219253 case 1:
9222
- name = "cubemaps/box_";
9223
- ext = "png";
9254
+ name = "cubemaps/rgb/";
9255
+ ext = "jpg";
92249256 reverseUP = false;
92259257 break;
92269258 case 2:
9227
- name = "cubemaps/uffizi_";
9228
- ext = "png";
9229
- break; // reverseUP = true; break;
9259
+ name = "cubemaps/uffizi/";
9260
+ ext = "jpg";
9261
+ reverseUP = false;
9262
+ break;
92309263 case 3:
9231
- name = "cubemaps/CloudyHills_";
9232
- ext = "tga";
9264
+ name = "cubemaps/CloudyHills/";
9265
+ ext = "jpg";
92339266 reverseUP = false;
92349267 break;
92359268 case 4:
9236
- name = "cubemaps/cornell_";
9269
+ name = "cubemaps/cornell/";
92379270 ext = "png";
92389271 reverseUP = false;
92399272 break;
9273
+ case 5:
9274
+ name = "cubemaps/skycube/";
9275
+ ext = "jpg";
9276
+ reverseUP = false;
9277
+ break;
9278
+ case 6:
9279
+ name = "cubemaps/SaintLazarusChurch3/";
9280
+ ext = "jpg";
9281
+ reverseUP = false;
9282
+ break;
9283
+ case 7:
9284
+ name = "cubemaps/Sodermalmsallen/";
9285
+ ext = "jpg";
9286
+ reverseUP = false;
9287
+ break;
9288
+ case 8:
9289
+ name = "cubemaps/Sodermalmsallen2/";
9290
+ ext = "jpg";
9291
+ reverseUP = false;
9292
+ break;
9293
+ case 9:
9294
+ name = "cubemaps/UnionSquare/";
9295
+ ext = "jpg";
9296
+ reverseUP = false;
9297
+ break;
92409298 default:
9241
- name = "cubemaps/rgb_";
9242
- ext = "png"; /*mipmap = true;*/ reverseUP = false;
9299
+ name = "cubemaps/box/";
9300
+ ext = "png"; /*mipmap = true;*/
9301
+ reverseUP = false;
92439302 break;
92449303 }
9245
-
9246
- try
9247
- {
9248
- cubemap = LoadCubemap(getClass().getClassLoader(), name, ext, mipmap);
9249
- } catch (IOException e)
9250
- {
9251
- throw new RuntimeException(e);
9252
- }
9304
+
9305
+ LoadSkybox(name, ext, mipmap);
92539306 }
92549307
92559308 public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height)
....@@ -9281,8 +9334,12 @@
92819334 static double[] model = new double[16];
92829335 double[] camera2light = new double[16];
92839336 double[] light2camera = new double[16];
9284
- int newenvy = -1;
9285
- boolean envyoff = true; // false;
9337
+
9338
+ //int newenvy = -1;
9339
+ //boolean envyoff = false;
9340
+
9341
+ String loadedskyboxname;
9342
+
92869343 cVector light0 = new cVector(0, 0, 0); // 1,3,2);
92879344 //float[] light0 = { 0,0,0 };
92889345 cVector dirlight = new cVector(0, 0, 1); // 1,3,2);
....@@ -9762,10 +9819,12 @@
97629819 rati = 1 / rati;
97639820 gl.glOrtho(-skyscale / rati, skyscale / rati, -skyscale, skyscale, 0.001, 1000);
97649821 }
9765
- assert (newenvy == -1);
9822
+
9823
+ //assert (newenvy == -1);
9824
+
97669825 gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB);
97679826 gl.glDisable(GL.GL_VERTEX_PROGRAM_ARB);
9768
- DrawSkyBox(gl);
9827
+ DrawSkyBox(gl, (float)rati);
97699828 gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB);
97709829 gl.glEnable(GL.GL_VERTEX_PROGRAM_ARB);
97719830 accPerspective(gl, renderCamera.shaper_fovy / ratio,
....@@ -10802,7 +10861,7 @@
1080210861
1080310862 if (wait)
1080410863 {
10805
- Sleep(500);
10864
+ Sleep(200); // blocks everything
1080610865
1080710866 wait = false;
1080810867 }
....@@ -11018,13 +11077,43 @@
1101811077 gl.glOrtho(-skyscale / ratio, skyscale / ratio, -skyscale, skyscale, 0.001, 1000);
1101911078 }
1102011079
11021
- if (newenvy > -1)
11080
+// if (newenvy > -1)
11081
+// {
11082
+// LoadEnvy(newenvy);
11083
+// }
11084
+//
11085
+// newenvy = -1;
11086
+
11087
+ if (transformMode) // object.skyboxname != null && object.skyboxname.equals("cubemaps/default-skyboxes/rgb"))
1102211088 {
11023
- LoadEnvy(newenvy);
11089
+ if (cubemaprgb == null)
11090
+ {
11091
+ cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb" + "/", "jpg", false);
11092
+ }
11093
+
11094
+ cubemap = cubemaprgb;
1102411095 }
11025
-
11026
- newenvy = -1;
11027
-
11096
+ else
11097
+ {
11098
+ if (object.skyboxname != null)
11099
+ {
11100
+ if (!object.skyboxname.equals(this.loadedskyboxname))
11101
+ {
11102
+ if (cubemap != null && cubemap != cubemaprgb)
11103
+ cubemap.dispose();
11104
+ cubemapcustom = LoadSkybox(object.skyboxname + "/", object.skyboxext, false);
11105
+ loadedskyboxname = object.skyboxname;
11106
+ }
11107
+ }
11108
+ else
11109
+ {
11110
+ cubemapcustom = null;
11111
+ loadedskyboxname = null;
11112
+ }
11113
+
11114
+ cubemap = cubemapcustom;
11115
+ }
11116
+
1102811117 ratio = ((double) getWidth()) / getHeight();
1102911118 //System.out.println("ratio = " + ratio);
1103011119
....@@ -11040,7 +11129,7 @@
1104011129
1104111130 if (!IsFrozen() && !ambientOcclusion)
1104211131 {
11043
- DrawSkyBox(gl);
11132
+ DrawSkyBox(gl, (float)ratio);
1104411133 }
1104511134
1104611135 //if (selection_view == -1)
....@@ -11326,7 +11415,7 @@
1132611415
1132711416 // if (cam != lightCamera)
1132811417 //for (int count = parentcam.GetTransformCount(); --count>=0;)
11329
- LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013
11418
+ LA.xformDir(lightposition, parentcam.GlobalTransformInv(), lightposition); // may 2013
1133011419 }
1133111420
1133211421 LA.xformDir(lightposition, cam.toScreen, lightposition);
....@@ -12400,7 +12489,7 @@
1240012489
1240112490 //gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 127, lightParams, 0);
1240212491
12403
- String program =
12492
+ String programmin =
1240412493 // Min shader
1240512494 "!!ARBfp1.0\n" +
1240612495 "PARAM zero123 = { 0.0, 1.0, 2, 1.25 };" +
....@@ -12451,7 +12540,8 @@
1245112540 //"SUB ndotl.y, zero123.y, ndotl.y;" +
1245212541 //"MUL ndotl.y, ndotl.y, pow2.z;" +
1245312542
12454
- "MAX ndotl.x, ndotl.x, ndotl.y;" + // Ambient
12543
+ //"MAX ndotl.x, ndotl.x, ndotl.y;" + // Ambient
12544
+ //"MAX ndotl.x, ndotl.x, pow2.y;" + // Ambient
1245512545
1245612546 // Pigment
1245712547 "TEX temp, fragment.texcoord[0], texture[0], 2D;" +
....@@ -12466,7 +12556,7 @@
1246612556 "MOV result.color, temp;" +
1246712557 "END";
1246812558
12469
- String program2 =
12559
+ String programmax =
1247012560 "!!ARBfp1.0\n" +
1247112561
1247212562 //"OPTION ARB_fragment_program_shadow;" +
....@@ -12991,7 +13081,7 @@
1299113081 // display shadow only (fakedepth == 0)
1299213082 "SUB temp.x, half.x, shadow.x;" +
1299313083 "MOV temp.y, -params5.z;" + // params6.x;" +
12994
- "SLT temp.z, temp.y, -one2048th.x;" +
13084
+ "SLT temp.z, temp.y, -c256i.x;" +
1299513085 "SUB temp.y, one.x, temp.z;" +
1299613086 "MUL temp.x, temp.x, temp.y;" +
1299713087 "KIL temp.x;" +
....@@ -13322,6 +13412,13 @@
1332213412 //once = true;
1332313413 }
1332413414
13415
+ String program = programmax;
13416
+
13417
+ if (Globals.MINSHADER)
13418
+ {
13419
+ program = programmin;
13420
+ }
13421
+
1332513422 System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
1332613423 System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
1332713424 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
....@@ -14571,9 +14668,9 @@
1457114668 MODIFIERS |= COMMAND;
1457214669 /**/
1457314670 if((mod&SHIFT) == SHIFT)
14574
- manipCamera.RotatePosition(0, -speed);
14575
- else
1457614671 manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14672
+ else
14673
+ manipCamera.RotatePosition(0, -speed);
1457714674 /**/
1457814675 if ((mod & SHIFT) == SHIFT)
1457914676 {
....@@ -14592,9 +14689,9 @@
1459214689 MODIFIERS |= COMMAND;
1459314690 /**/
1459414691 if((mod&SHIFT) == SHIFT)
14595
- manipCamera.RotatePosition(0, speed);
14596
- else
1459714692 manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14693
+ else
14694
+ manipCamera.RotatePosition(0, speed);
1459814695 /**/
1459914696 if ((mod & SHIFT) == SHIFT)
1460014697 {
....@@ -15315,20 +15412,24 @@
1531515412 OCCLUSION_CULLING ^= true;
1531615413 System.out.println("OCCLUSION CULLING = " + OCCLUSION_CULLING);
1531715414 break;
15318
- case '0': envyoff ^= true; repaint(); break;
15415
+ //case '0': envyoff ^= true; repaint(); break;
1531915416 case '1':
1532015417 case '2':
1532115418 case '3':
1532215419 case '4':
1532315420 case '5':
15324
- newenvy = Character.getNumericValue(key);
15325
- repaint();
15326
- break;
1532715421 case '6':
1532815422 case '7':
1532915423 case '8':
1533015424 case '9':
15331
- BGcolor = (key - '6')/3.f;
15425
+ if (true) // envyoff)
15426
+ {
15427
+ BGcolor = (key - '1')/8.f;
15428
+ }
15429
+ else
15430
+ {
15431
+ //newenvy = Character.getNumericValue(key);
15432
+ }
1533215433 repaint();
1533315434 break;
1533415435 case '!':
....@@ -16033,7 +16134,7 @@
1603316134 gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
1603416135 break;
1603516136 case Object3D.hitScale: gr.setColor(Color.cyan);
16036
- gr.drawLine(X, Y, 0, 0);
16137
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
1603716138 break;
1603816139 }
1603916140
....@@ -16519,6 +16620,8 @@
1651916620 private /*static*/ boolean firstime;
1652016621 private /*static*/ cVector newView = new cVector();
1652116622 private static final String[] suffixes = {"posx", "negx", "posy", "negy", "posz", "negz"};
16623
+ private static final String[] suffixes2 = {"east", "west", "top", "bottom", "north", "south"};
16624
+ private static final String[] suffixes3 = {"ft", "bk", "up", "dn", "rt", "lf"};
1652216625 private static final int[] targets = {GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X,
1652316626 GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
1652416627 GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
....@@ -16531,29 +16634,67 @@
1653116634 {
1653216635 com.sun.opengl.util.texture.Texture cubemap = TextureIO.newTexture(GL.GL_TEXTURE_CUBE_MAP);
1653316636
16637
+ int usedsuf = 0;
16638
+
1653416639 for (int i = 0; i < suffixes.length; i++)
1653516640 {
16536
- String resourceName = basename + suffixes[i] + "." + suffix;
16537
- TextureData data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName),
16538
- mipmapped,
16539
- FileUtil.getFileSuffix(resourceName));
16540
- if (data == null)
16641
+ String[] suffixe = suffixes;
16642
+ String[] fallback = suffixes2;
16643
+ String[] fallfallback = suffixes3;
16644
+
16645
+ for (int c=usedsuf; --c>=0;)
1654116646 {
16542
- throw new IOException("Unable to load texture " + resourceName);
16647
+// String[] temp = suffixe;
16648
+// suffixe = fallback;
16649
+// fallback = fallfallback;
16650
+// fallfallback = temp;
1654316651 }
16652
+
16653
+ String resourceName = basename + suffixe[i] + "." + suffix;
16654
+ TextureData data;
16655
+
16656
+ try
16657
+ {
16658
+ data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName),
16659
+ mipmapped,
16660
+ FileUtil.getFileSuffix(resourceName));
16661
+ }
16662
+ catch (Exception e)
16663
+ {
16664
+ try
16665
+ {
16666
+ resourceName = basename + fallback[i] + "." + suffix;
16667
+ data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName),
16668
+ mipmapped,
16669
+ FileUtil.getFileSuffix(resourceName));
16670
+ }
16671
+ catch (Exception e2)
16672
+ {
16673
+ resourceName = basename + fallfallback[i] + "." + suffix;
16674
+ data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName),
16675
+ mipmapped,
16676
+ FileUtil.getFileSuffix(resourceName));
16677
+ }
16678
+ }
16679
+
1654416680 //System.out.println("Target = " + targets[i]);
1654516681 cubemap.updateImage(data, targets[i]);
1654616682 }
1654716683
1654816684 return cubemap;
1654916685 }
16686
+
1655016687 int bigsphere = -1;
1655116688
1655216689 float BGcolor = 0.5f;
1655316690
16554
- private void DrawSkyBox(GL gl)
16691
+ float ambientLight[] = {1f, 1f, 1f, 1.0f};
16692
+
16693
+ private void DrawSkyBox(GL gl, float ratio)
1655516694 {
16556
- if (envyoff || cubemap == null)
16695
+ if (//envyoff ||
16696
+ WIREFRAME ||
16697
+ cubemap == null)
1655716698 {
1655816699 gl.glClearColor(BGcolor, BGcolor, BGcolor, 1);
1655916700 gl.glClear(gl.GL_COLOR_BUFFER_BIT);
....@@ -16568,7 +16709,17 @@
1656816709 // Compensates for ExaminerViewer's modification of modelview matrix
1656916710 gl.glMatrixMode(GL.GL_MODELVIEW);
1657016711 gl.glLoadIdentity();
16712
+ gl.glScalef(1,ratio,1);
1657116713
16714
+// colorV[0] = 2;
16715
+// colorV[1] = 2;
16716
+// colorV[2] = 2;
16717
+// colorV[3] = 1;
16718
+// gl.glDisable(gl.GL_COLOR_MATERIAL);
16719
+// gl.glMaterialfv(gl.GL_FRONT_AND_BACK, gl.GL_AMBIENT, colorV, 0);
16720
+//
16721
+// gl.glLightModelfv(gl.GL_LIGHT_MODEL_AMBIENT, ambientLight, 0);
16722
+
1657216723 //gl.glActiveTexture(GL.GL_TEXTURE1);
1657316724 //gl.glDisable(GL.GL_TEXTURE_CUBE_MAP);
1657416725
....@@ -16600,6 +16751,7 @@
1660016751 {
1660116752 gl.glScalef(1.0f, -1.0f, 1.0f);
1660216753 }
16754
+ gl.glScalef(-1.0f, 1.0f, 1.0f);
1660316755 gl.glMultMatrixd(viewrot_1, 0);
1660416756 gl.glTranslatef(0, 0, 0.5f); // (float)lightCamera.Distance()); // 0.5f);
1660516757 //viewer.updateInverseRotation(gl);
....@@ -16640,7 +16792,8 @@
1664016792 gl.glDisable(GL.GL_TEXTURE_GEN_R);
1664116793
1664216794 cubemap.disable();
16643
- ////cubemap.unbind();
16795
+ //cubemap.dispose();
16796
+
1664416797 if (CULLFACE)
1664516798 {
1664616799 gl.glEnable(gl.GL_CULL_FACE);
....@@ -16858,7 +17011,7 @@
1685817011 //new Exception().printStackTrace();
1685917012 System.out.println("select buffer init");
1686017013 // Use debug pipeline
16861
- drawable.setGL(new DebugGL(drawable.getGL()));
17014
+ //drawable.setGL(new DebugGL(drawable.getGL()));
1686217015
1686317016 GL gl = drawable.getGL();
1686417017
....@@ -17404,10 +17557,14 @@
1740417557 gl.glFlush();
1740517558
1740617559 /**/
17407
- gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, occlusionsizebuffer);
17560
+ gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, occlusiondepthbuffer);
1740817561
17409
- float[] pixels = occlusionsizebuffer.array();
17562
+ float[] depths = occlusiondepthbuffer.array();
1741017563
17564
+ gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_BGRA, GL.GL_UNSIGNED_INT_8_8_8_8_REV, occlusioncolorbuffer);
17565
+
17566
+ int[] pixels = selectsizebuffer.array();
17567
+
1741117568 double r = 0, g = 0, b = 0;
1741217569
1741317570 double count = 0;
....@@ -17418,7 +17575,7 @@
1741817575
1741917576 double FACTOR = 1;
1742017577
17421
- for (int i = 0; i < pixels.length; i++)
17578
+ for (int i = 0; i < depths.length; i++)
1742217579 {
1742317580 int x = i / OCCLUSION_SIZE - OCCLUSION_SIZE / 2;
1742417581 int y = i % OCCLUSION_SIZE - OCCLUSION_SIZE / 2;
....@@ -17501,7 +17658,7 @@
1750117658
1750217659 double scale = ray.z; // 1; // cos
1750317660
17504
- float depth = pixels[newindex];
17661
+ float depth = depths[newindex];
1750517662
1750617663 /*
1750717664 int newindex2 = (x + 1) * OCCLUSION_SIZE + y;
....@@ -17698,11 +17855,14 @@
1769817855 static IntBuffer AAbuffer; // = IntBuffer.allocate(MAX_SIZE*MAX_SIZE);
1769917856 static IntBuffer bigAAbuffer;
1770017857 static java.nio.FloatBuffer histogram = BufferUtil.newFloatBuffer(HISTOGRAM_SIZE * 3);
17701
- static IntBuffer texturesizebuffer = IntBuffer.allocate(TEX_SIZE * TEX_SIZE);
17858
+ //static IntBuffer texturesizebuffer = IntBuffer.allocate(TEX_SIZE * TEX_SIZE);
1770217859 static IntBuffer selectsizebuffer = IntBuffer.allocate(SELECT_SIZE * SELECT_SIZE);
1770317860 static java.nio.FloatBuffer pointselectsizebuffer = java.nio.FloatBuffer.allocate(SELECT_SIZE * SELECT_SIZE);
1770417861 //static IntBuffer occlusionsizebuffer = IntBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE);
17705
- static java.nio.FloatBuffer occlusionsizebuffer = java.nio.FloatBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE);
17862
+ static java.nio.FloatBuffer occlusiondepthbuffer = java.nio.FloatBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE);
17863
+
17864
+ static IntBuffer occlusioncolorbuffer = IntBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE);
17865
+
1770617866 static BufferedImage bufimage = new BufferedImage(TEX_SIZE, TEX_SIZE, BufferedImage.TYPE_INT_RGB);
1770717867 static BufferedImage textest = new cBufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
1770817868 static java.util.Vector<BufferedImage> billboards = new java.util.Vector<BufferedImage>();