Normand Briere
2019-08-22 6a145f6c81dfcbe0653eda27d042efb48daa7512
CameraPane.java
....@@ -18,7 +18,10 @@
1818 import javax.imageio.ImageIO;
1919 import javax.imageio.ImageWriteParam;
2020 import javax.imageio.ImageWriter;
21
+import javax.imageio.ImageReadParam;
22
+import javax.imageio.ImageReader;
2123 import javax.imageio.plugins.jpeg.JPEGImageWriteParam;
24
+import javax.imageio.stream.ImageInputStream;
2225 import javax.imageio.stream.ImageOutputStream;
2326 import javax.imageio.ImageWriteParam;
2427
....@@ -30,6 +33,7 @@
3033 import java.nio.*;
3134
3235 import gleem.linalg.Mat4f;
36
+import javax.imageio.ImageTypeSpecifier;
3337
3438 class CameraPane extends GLCanvas implements iCameraPane, Runnable, GLEventListener, ActionListener, MouseWheelListener, MouseMotionListener, MouseListener, KeyListener
3539 {
....@@ -93,7 +97,7 @@
9397 //boolean REDUCETEXTURE = true;
9498 boolean CACHETEXTURE = true;
9599 boolean CLEANCACHE = false; // true;
96
- boolean MIPMAP = true; // false; // true;
100
+ boolean MIPMAP = false; // true; // never works...
97101 boolean COMPRESSTEXTURE = false;
98102 boolean KOMPACTTEXTURE = false; // true;
99103 boolean RESIZETEXTURE = false;
....@@ -106,7 +110,11 @@
106110 //private Mat4f spotlightTransform = new Mat4f();
107111 //private Mat4f spotlightInverseTransform = new Mat4f();
108112 static GLContext glcontext = null;
109
- /*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
+
110118 boolean reverseUP = false;
111119 static boolean frozen = false;
112120 boolean enablebackspace = false; // patch for back buffer refresh
....@@ -160,7 +168,7 @@
160168
161169
162170 // OPTIONS
163
- boolean Skinshader = true;
171
+ boolean Skinshader = false; // true;
164172 boolean cameraLight = false;
165173 boolean UVdebug = false;
166174 boolean Udebug = false;
....@@ -169,7 +177,7 @@
169177 static boolean doublesided = false; // true; // reversed normals are awful for conformance
170178 boolean anisotropy = true;
171179 boolean softshadow = true; // slower but better false;
172
- boolean opacityhalo = false;
180
+ boolean opacityhalo = false; // reverse the halo effect (e.g. glass)
173181
174182 boolean macromode = false;
175183
....@@ -183,6 +191,19 @@
183191 }
184192
185193 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
+ }
186207
187208 void SetAsGLRenderer(boolean b)
188209 {
....@@ -202,7 +223,8 @@
202223
203224 SetCamera(cam);
204225
205
- SetLight(new Camera(new cVector(10, 10, -20)));
226
+ // Warning: not used.
227
+ SetLight(new Camera(new cVector(15, 10, -20)));
206228
207229 object = o;
208230
....@@ -520,7 +542,8 @@
520542 LA.vecSub(pv/*.pos*/, rv/*.pos*/, obj.v1);
521543 LA.vecCross(obj.v0, obj.v1, obj.v2);
522544 LA.vecNormalize(obj.v2);
523
- gl.glNormal3f((float) obj.v2.x, (float) obj.v2.y, (float) obj.v2.z);
545
+
546
+ SetGLNormal(gl, (float) obj.v2.x, (float) obj.v2.y, (float) obj.v2.z);
524547 }
525548
526549 // P
....@@ -542,7 +565,7 @@
542565 y += ny * obj.NORMALPUSH;
543566 z += nz * obj.NORMALPUSH;
544567
545
- gl.glNormal3f(nx, ny, nz);
568
+ SetGLNormal(gl, nx, ny, nz);
546569 }
547570 gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
548571 SetColor(obj, pv);
....@@ -574,7 +597,7 @@
574597 y += ny * obj.NORMALPUSH;
575598 z += nz * obj.NORMALPUSH;
576599
577
- gl.glNormal3f(nx, ny, nz);
600
+ SetGLNormal(gl, nx, ny, nz);
578601 }
579602 //System.out.println("vertexq = " + qv.s + ", " + qv.t);
580603 // boolean locked = false;
....@@ -622,7 +645,7 @@
622645 y += ny * obj.NORMALPUSH;
623646 z += nz * obj.NORMALPUSH;
624647
625
- gl.glNormal3f(nx, ny, nz);
648
+ SetGLNormal(gl, nx, ny, nz);
626649 }
627650
628651 // if ((dot&4) == 0)
....@@ -1228,10 +1251,10 @@
12281251 {
12291252 if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
12301253 {
1231
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
1254
+ SetGLNormal(gl, n[count3], n[count3 + 1], n[count3 + 2]);
12321255 } else
12331256 {
1234
- gl.glNormal3f(0, 0, 1);
1257
+ SetGLNormal(gl, 0, 0, 1);
12351258 }
12361259
12371260 if (c != null)
....@@ -1255,10 +1278,10 @@
12551278 {
12561279 if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
12571280 {
1258
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
1281
+ SetGLNormal(gl, n[count3], n[count3 + 1], n[count3 + 2]);
12591282 } else
12601283 {
1261
- gl.glNormal3f(0, 0, 1);
1284
+ SetGLNormal(gl, 0, 0, 1);
12621285 }
12631286 if (c != null)
12641287 {
....@@ -1283,10 +1306,10 @@
12831306 {
12841307 if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
12851308 {
1286
- gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
1309
+ SetGLNormal(gl, n[count3], n[count3 + 1], n[count3 + 2]);
12871310 } else
12881311 {
1289
- gl.glNormal3f(0, 0, 1);
1312
+ SetGLNormal(gl, 0, 0, 1);
12901313 }
12911314 if (c != null)
12921315 {
....@@ -1468,7 +1491,7 @@
14681491 {
14691492 if (!selectmode)
14701493 {
1471
- gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
1494
+ SetGLNormal(gl, (float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
14721495 gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
14731496
14741497 if (flipV)
....@@ -1480,6 +1503,8 @@
14801503 gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
14811504 }
14821505
1506
+ float[] colorV = new float[4];
1507
+
14831508 void SetColor(Object3D obj, Vertex p0)
14841509 {
14851510 CameraPane display = this;
....@@ -1547,8 +1572,6 @@
15471572 {
15481573 return;
15491574 }
1550
-
1551
- float[] colorV = new float[3];
15521575
15531576 if (false) // marked)
15541577 {
....@@ -1797,7 +1820,7 @@
17971820
17981821 display.modelParams7[0] = 0;
17991822 display.modelParams7[1] = 1000;
1800
- display.modelParams7[2] = 0;
1823
+ display.modelParams7[2] = material.parallax;
18011824 display.modelParams7[3] = 0;
18021825
18031826 //display.modelParams6[0] = 100; // criss de bug de bump
....@@ -2030,9 +2053,9 @@
20302053 switch(viewcode)
20312054 {
20322055 case 0: return "main";
2033
- case 1: return "one";
2034
- case 2: return "two";
2035
- case 3: return "three";
2056
+ case 1: return "Red";
2057
+ case 2: return "Green";
2058
+ case 3: return "Blue";
20362059 case 4: return "light";
20372060 }
20382061
....@@ -2453,6 +2476,18 @@
24532476 return CreateBim(bytes, width, height);
24542477 }
24552478
2479
+ private void SetGLNormal(javax.media.opengl.GL gl, float nx, float ny, float nz)
2480
+ {
2481
+ gl.glNormal3f(nx, ny, nz);
2482
+
2483
+ if (ny > 0.9 || ny < -0.9)
2484
+ // Ground or ceiling
2485
+ gl.glVertexAttrib3f(4, 1, 0, 0);
2486
+ else
2487
+ // Walls
2488
+ gl.glVertexAttrib3f(4, 0, 1, 0);
2489
+ }
2490
+
24562491 /**/
24572492 class CacheTexture
24582493 {
....@@ -2495,7 +2530,7 @@
24952530 com.sun.opengl.util.texture.TextureIO.newTextureData(
24962531 getClass().getClassLoader().getResourceAsStream(name),
24972532 true,
2498
- com.sun.opengl.util.texture.TextureIO.PNG);
2533
+ GetFormat(name)); // com.sun.opengl.util.texture.TextureIO.PNG);
24992534 } catch (java.io.IOException e)
25002535 {
25012536 throw new javax.media.opengl.GLException(e);
....@@ -8341,7 +8376,7 @@
83418376 // else
83428377 // if (!texname.startsWith("/"))
83438378 // texname = "/Users/nbriere/Textures/" + texname;
8344
- if (!FileExists(texname))
8379
+ if (!FileExists(texname) && !texname.startsWith("@"))
83458380 {
83468381 texname = fallbackTextureName;
83478382 }
....@@ -8358,14 +8393,26 @@
83588393 {
83598394 TextureData texturedata = null;
83608395
8361
- if (texdata != null)
8396
+ if (texdata != null && textureon)
83628397 {
8363
- BufferedImage bim = //new BufferedImage(bump?tex.bw:tex.pw, bump?tex.bh:tex.ph, BufferedImage.TYPE_INT_RGB);
8398
+ BufferedImage bim; // = new BufferedImage(bump?tex.bw:tex.pw, bump?tex.bh:tex.ph, BufferedImage.TYPE_INT_RGB);
83648399
8365
- CreateBim(texdata, bump?tex.bw:tex.pw, bump?tex.bh:tex.ph);
8400
+ try
8401
+ {
8402
+ bim = DecompressJPEG(texdata, bump?tex.bw:tex.pw, bump?tex.bh:tex.ph);
8403
+ }
8404
+ catch (Exception e)
8405
+ {
8406
+ bim = CreateBim(texdata, bump?tex.bw:tex.pw, bump?tex.bh:tex.ph);
8407
+ }
83668408
83678409 texturecache = new CacheTexture(GetBimTexture(bim, bump), -1);
83688410 bimtextures.put(texdata, texturecache);
8411
+
8412
+ //BufferedImage bim3 = new BufferedImage(bump?tex.bw:tex.pw, bump?tex.bh:tex.ph, BufferedImage.TYPE_INT_RGB);
8413
+
8414
+ //Object bim2 = CreateBim(texturecache.texturedata);
8415
+ //bim2 = bim;
83698416 }
83708417 else
83718418 if (texname.endsWith("DEFAULT_TEXTURE")) // ||*/ tex.equals(""))
....@@ -8408,6 +8455,15 @@
84088455 // texturecache = textures.get(texname); // suspicious
84098456 if (texturecache == null)
84108457 texturecache = new CacheTexture(GetResourceTexture("whitenoise.png", bump),resolution);
8458
+ else
8459
+ new Exception().printStackTrace();
8460
+ } else
8461
+ {
8462
+ if (texname.startsWith("@"))
8463
+ {
8464
+ // texturecache = textures.get(texname); // suspicious
8465
+ if (texturecache == null)
8466
+ texturecache = new CacheTexture(GetResourceTexture(texname.substring(1), bump),resolution);
84118467 else
84128468 new Exception().printStackTrace();
84138469 } else
....@@ -8471,6 +8527,7 @@
84718527 texturecache = new CacheTexture(texturedata,resolution);
84728528 //texture = GetTexture(tex, bump);
84738529 }
8530
+ }
84748531 }
84758532 //}
84768533 }
....@@ -8560,29 +8617,32 @@
85608617 {
85618618 if (tex.pigmentdata == null)
85628619 {
8563
- String texname = Object3D.GetPigment(tex);
8620
+ //String texname = Object3D.GetPigment(tex);
85648621
85658622 CacheTexture texturecache = texturepigment.get(tex);
85668623
85678624 if (texturecache != null)
85688625 {
8569
- tex.pigmentdata = ((ByteBuffer)texturecache.texturedata.getBuffer()).array();
85708626 tex.pw = texturecache.texturedata.getWidth();
85718627 tex.ph = texturecache.texturedata.getHeight();
8628
+ tex.pigmentdata = //CompressJPEG(CreateBim
8629
+ ((ByteBuffer)texturecache.texturedata.getBuffer()).array()
8630
+ ;
8631
+ //, tex.pw, tex.ph), 0.5f);
85728632 }
85738633 }
85748634
85758635 if (tex.bumpdata == null)
85768636 {
8577
- String texname = Object3D.GetBump(tex);
8637
+ //String texname = Object3D.GetBump(tex);
85788638
85798639 CacheTexture texturecache = texturebump.get(tex);
85808640
85818641 if (texturecache != null)
85828642 {
8583
- tex.bumpdata = ((ByteBuffer)texturecache.texturedata.getBuffer()).array();
85848643 tex.bw = texturecache.texturedata.getWidth();
85858644 tex.bh = texturecache.texturedata.getHeight();
8645
+ tex.bumpdata = CompressJPEG(CreateBim(((ByteBuffer)texturecache.texturedata.getBuffer()).array(), tex.bw, tex.bh), 0.5f);
85868646 }
85878647 }
85888648 }
....@@ -8654,6 +8714,72 @@
86548714 return true; // Warning: not used.
86558715 }
86568716
8717
+ public static byte[] CompressJPEG(BufferedImage image, float quality)
8718
+ {
8719
+ try
8720
+ {
8721
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
8722
+ Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("jpg");
8723
+ ImageWriter writer = writers.next();
8724
+
8725
+ ImageWriteParam param = writer.getDefaultWriteParam();
8726
+ param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
8727
+ param.setCompressionQuality(quality);
8728
+
8729
+ ImageOutputStream ios = ImageIO.createImageOutputStream(baos);
8730
+ writer.setOutput(ios);
8731
+ writer.write(null, new IIOImage(image, null, null), param);
8732
+
8733
+ byte[] data = baos.toByteArray();
8734
+ writer.dispose();
8735
+ return data;
8736
+ }
8737
+ catch (Exception e)
8738
+ {
8739
+ e.printStackTrace();
8740
+ return null;
8741
+ }
8742
+ }
8743
+
8744
+ public static BufferedImage DecompressJPEG(byte[] image, int w, int h) throws IOException
8745
+ {
8746
+ ByteArrayInputStream baos = new ByteArrayInputStream(image);
8747
+ Iterator<ImageReader> writers = ImageIO.getImageReadersByFormatName("jpg");
8748
+ ImageReader reader = writers.next();
8749
+
8750
+ BufferedImage bim = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
8751
+
8752
+ ImageReadParam param = reader.getDefaultReadParam();
8753
+ param.setDestination(bim);
8754
+ //param.setDestinationType(ImageTypeSpecifier.createFromBufferedImageType(BufferedImage.TYPE_INT_RGB));
8755
+
8756
+ ImageInputStream ios = ImageIO.createImageInputStream(baos);
8757
+ reader.setInput(ios);
8758
+ BufferedImage bim2 = reader.read(0, param);
8759
+ reader.dispose();
8760
+
8761
+// WritableRaster raster = bim2.getRaster();
8762
+// DataBufferByte data = (DataBufferByte) raster.getDataBuffer();
8763
+// byte[] bytes = data.getData();
8764
+//
8765
+// int[] pixels = new int[bytes.length/3];
8766
+// for (int i=pixels.length; --i>=0;)
8767
+// {
8768
+// int i3 = i*3;
8769
+// pixels[i] = 0xFF;
8770
+// pixels[i] <<= 8;
8771
+// pixels[i] |= bytes[i3+2] & 0xFF;
8772
+// pixels[i] <<= 8;
8773
+// pixels[i] |= bytes[i3+1] & 0xFF;
8774
+// pixels[i] <<= 8;
8775
+// pixels[i] |= bytes[i3] & 0xFF;
8776
+// }
8777
+//
8778
+// bim.setRGB(0,0,w,h, pixels, w*(h-1),-w);
8779
+
8780
+ return bim;
8781
+ }
8782
+
86578783 ShadowBuffer shadowPBuf;
86588784 AntialiasBuffer antialiasPBuf;
86598785 int MAXSTACK;
....@@ -8670,10 +8796,12 @@
86708796
86718797 gl.glGetIntegerv(GL.GL_MAX_TEXTURE_STACK_DEPTH, temp, 0);
86728798 MAXSTACK = temp[0];
8673
- System.out.println("GL_MAX_TEXTURE_STACK_DEPTH = " + MAXSTACK);
8799
+ if (Globals.DEBUG)
8800
+ System.out.println("GL_MAX_TEXTURE_STACK_DEPTH = " + MAXSTACK);
86748801 gl.glGetIntegerv(GL.GL_MAX_MODELVIEW_STACK_DEPTH, temp, 0);
86758802 MAXSTACK = temp[0];
8676
- System.out.println("GL_MAX_MODELVIEW_STACK_DEPTH = " + MAXSTACK);
8803
+ if (Globals.DEBUG)
8804
+ System.out.println("GL_MAX_MODELVIEW_STACK_DEPTH = " + MAXSTACK);
86778805
86788806 // Use debug pipeline
86798807 //drawable.setGL(new DebugGL(gl)); //
....@@ -8681,7 +8809,8 @@
86818809 gl = drawable.getGL(); //
86828810
86838811 GL gl3 = getGL();
8684
- System.out.println("INIT GL IS: " + gl.getClass().getName());
8812
+ if (Globals.DEBUG)
8813
+ System.out.println("INIT GL IS: " + gl.getClass().getName());
86858814
86868815
86878816 //float pos[] = { 100, 100, 100, 0 };
....@@ -8846,7 +8975,7 @@
88468975
88478976 if (cubemap == null)
88488977 {
8849
- LoadEnvy(5);
8978
+ //LoadEnvy(1);
88508979 }
88518980
88528981 //cubemap.enable();
....@@ -9122,6 +9251,8 @@
91229251
91239252 void LoadEnvy(int which)
91249253 {
9254
+ assert(false);
9255
+
91259256 String name;
91269257 String ext;
91279258
....@@ -9133,37 +9264,58 @@
91339264 cubemap = null;
91349265 return;
91359266 case 1:
9136
- name = "cubemaps/box_";
9137
- ext = "png";
9267
+ name = "cubemaps/rgb/";
9268
+ ext = "jpg";
91389269 reverseUP = false;
91399270 break;
91409271 case 2:
9141
- name = "cubemaps/uffizi_";
9142
- ext = "png";
9143
- break; // reverseUP = true; break;
9272
+ name = "cubemaps/uffizi/";
9273
+ ext = "jpg";
9274
+ reverseUP = false;
9275
+ break;
91449276 case 3:
9145
- name = "cubemaps/CloudyHills_";
9146
- ext = "tga";
9277
+ name = "cubemaps/CloudyHills/";
9278
+ ext = "jpg";
91479279 reverseUP = false;
91489280 break;
91499281 case 4:
9150
- name = "cubemaps/cornell_";
9282
+ name = "cubemaps/cornell/";
91519283 ext = "png";
91529284 reverseUP = false;
91539285 break;
9286
+ case 5:
9287
+ name = "cubemaps/skycube/";
9288
+ ext = "jpg";
9289
+ reverseUP = false;
9290
+ break;
9291
+ case 6:
9292
+ name = "cubemaps/SaintLazarusChurch3/";
9293
+ ext = "jpg";
9294
+ reverseUP = false;
9295
+ break;
9296
+ case 7:
9297
+ name = "cubemaps/Sodermalmsallen/";
9298
+ ext = "jpg";
9299
+ reverseUP = false;
9300
+ break;
9301
+ case 8:
9302
+ name = "cubemaps/Sodermalmsallen2/";
9303
+ ext = "jpg";
9304
+ reverseUP = false;
9305
+ break;
9306
+ case 9:
9307
+ name = "cubemaps/UnionSquare/";
9308
+ ext = "jpg";
9309
+ reverseUP = false;
9310
+ break;
91549311 default:
9155
- name = "cubemaps/rgb_";
9156
- ext = "png"; /*mipmap = true;*/ reverseUP = false;
9312
+ name = "cubemaps/box/";
9313
+ ext = "png"; /*mipmap = true;*/
9314
+ reverseUP = false;
91579315 break;
91589316 }
9159
-
9160
- try
9161
- {
9162
- cubemap = LoadCubemap(getClass().getClassLoader(), name, ext, mipmap);
9163
- } catch (IOException e)
9164
- {
9165
- throw new RuntimeException(e);
9166
- }
9317
+
9318
+ LoadSkybox(name, ext, mipmap);
91679319 }
91689320
91699321 public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height)
....@@ -9195,8 +9347,12 @@
91959347 static double[] model = new double[16];
91969348 double[] camera2light = new double[16];
91979349 double[] light2camera = new double[16];
9198
- int newenvy = -1;
9199
- boolean envyoff = true; // false;
9350
+
9351
+ //int newenvy = -1;
9352
+ //boolean envyoff = false;
9353
+
9354
+ String loadedskyboxname;
9355
+
92009356 cVector light0 = new cVector(0, 0, 0); // 1,3,2);
92019357 //float[] light0 = { 0,0,0 };
92029358 cVector dirlight = new cVector(0, 0, 1); // 1,3,2);
....@@ -9614,7 +9770,7 @@
96149770
96159771 if (renderCamera != lightCamera)
96169772 //for (int count = parentcam.GetTransformCount(); --count>=0;)
9617
- LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
9773
+ LA.matConcat(matrix, parentcam.GlobalTransformInv(), matrix);
96189774
96199775 // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix);
96209776
....@@ -9630,7 +9786,7 @@
96309786
96319787 if (renderCamera != lightCamera)
96329788 //for (int count = parentcam.GetTransformCount(); --count>=0;)
9633
- LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
9789
+ LA.matConcat(parentcam.GlobalTransform(), matrix, matrix);
96349790
96359791 // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix);
96369792
....@@ -9676,10 +9832,12 @@
96769832 rati = 1 / rati;
96779833 gl.glOrtho(-skyscale / rati, skyscale / rati, -skyscale, skyscale, 0.001, 1000);
96789834 }
9679
- assert (newenvy == -1);
9835
+
9836
+ //assert (newenvy == -1);
9837
+
96809838 gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB);
96819839 gl.glDisable(GL.GL_VERTEX_PROGRAM_ARB);
9682
- DrawSkyBox(gl);
9840
+ DrawSkyBox(gl, (float)rati);
96839841 gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB);
96849842 gl.glEnable(GL.GL_VERTEX_PROGRAM_ARB);
96859843 accPerspective(gl, renderCamera.shaper_fovy / ratio,
....@@ -10545,9 +10703,18 @@
1054510703 static boolean init = false;
1054610704
1054710705 double[][] matrix = LA.newMatrix();
10706
+
10707
+ // This is to refresh the UI of the material panel.
10708
+ ObjEditor patchMaterial;
1054810709
1054910710 public void display(GLAutoDrawable drawable)
1055010711 {
10712
+ if (patchMaterial.patchMaterial)
10713
+ {
10714
+ patchMaterial.patchMaterial = false;
10715
+ patchMaterial.objectPanel.setSelectedIndex(1);
10716
+ }
10717
+
1055110718 if (Grafreed.savesound && Grafreed.hassound)
1055210719 {
1055310720 Grafreed.wav.save();
....@@ -10716,7 +10883,7 @@
1071610883
1071710884 if (wait)
1071810885 {
10719
- Sleep(500);
10886
+ Sleep(200); // blocks everything
1072010887
1072110888 wait = false;
1072210889 }
....@@ -10831,7 +10998,7 @@
1083110998 // if (parentcam != renderCamera) // not a light
1083210999 if (cam != lightCamera)
1083311000 //for (int count = parentcam.GetTransformCount(); --count>=0;)
10834
- LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
11001
+ LA.matConcat(matrix, parentcam.GlobalTransformInv(), matrix);
1083511002
1083611003 for (int j = 0; j < 4; j++)
1083711004 {
....@@ -10846,7 +11013,7 @@
1084611013 // if (parentcam != renderCamera) // not a light
1084711014 if (cam != lightCamera)
1084811015 //for (int count = parentcam.GetTransformCount(); --count>=0;)
10849
- LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
11016
+ LA.matConcat(parentcam.GlobalTransform(), matrix, matrix);
1085011017
1085111018 //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix);
1085211019
....@@ -10932,13 +11099,43 @@
1093211099 gl.glOrtho(-skyscale / ratio, skyscale / ratio, -skyscale, skyscale, 0.001, 1000);
1093311100 }
1093411101
10935
- if (newenvy > -1)
11102
+// if (newenvy > -1)
11103
+// {
11104
+// LoadEnvy(newenvy);
11105
+// }
11106
+//
11107
+// newenvy = -1;
11108
+
11109
+ if (transformMode) // object.skyboxname != null && object.skyboxname.equals("cubemaps/default-skyboxes/rgb"))
1093611110 {
10937
- LoadEnvy(newenvy);
11111
+ if (cubemaprgb == null)
11112
+ {
11113
+ cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb2" + "/", "jpg", false);
11114
+ }
11115
+
11116
+ cubemap = cubemaprgb;
1093811117 }
10939
-
10940
- newenvy = -1;
10941
-
11118
+ else
11119
+ {
11120
+ if (object.skyboxname != null)
11121
+ {
11122
+ if (!object.skyboxname.equals(this.loadedskyboxname))
11123
+ {
11124
+ if (cubemap != null && cubemap != cubemaprgb)
11125
+ cubemap.dispose();
11126
+ cubemapcustom = LoadSkybox(object.skyboxname + "/", object.skyboxext, false);
11127
+ loadedskyboxname = object.skyboxname;
11128
+ }
11129
+ }
11130
+ else
11131
+ {
11132
+ cubemapcustom = null;
11133
+ loadedskyboxname = null;
11134
+ }
11135
+
11136
+ cubemap = cubemapcustom;
11137
+ }
11138
+
1094211139 ratio = ((double) getWidth()) / getHeight();
1094311140 //System.out.println("ratio = " + ratio);
1094411141
....@@ -10954,7 +11151,7 @@
1095411151
1095511152 if (!IsFrozen() && !ambientOcclusion)
1095611153 {
10957
- DrawSkyBox(gl);
11154
+ DrawSkyBox(gl, (float)ratio);
1095811155 }
1095911156
1096011157 //if (selection_view == -1)
....@@ -11240,7 +11437,7 @@
1124011437
1124111438 // if (cam != lightCamera)
1124211439 //for (int count = parentcam.GetTransformCount(); --count>=0;)
11243
- LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013
11440
+ LA.xformDir(lightposition, parentcam.GlobalTransformInv(), lightposition); // may 2013
1124411441 }
1124511442
1124611443 LA.xformDir(lightposition, cam.toScreen, lightposition);
....@@ -11399,7 +11596,7 @@
1139911596 }
1140011597 }
1140111598
11402
- if (false) // fast && !IsFreezed() && DrawMode() != SELECTION && !ambientOcclusion)
11599
+ if (false) //RENDERPROGRAM > 0 && DrawMode() == DEFAULT) // fast && !IsFreezed() && DrawMode() != SELECTION && !ambientOcclusion)
1140311600 {
1140411601 //gl.glDepthFunc(GL.GL_LEQUAL);
1140511602 //gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
....@@ -11407,24 +11604,21 @@
1140711604
1140811605 boolean texon = textureon;
1140911606
11410
- if (RENDERPROGRAM > 0)
11411
- {
11412
- gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB);
11413
- textureon = false;
11414
- }
11607
+ gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB);
11608
+ textureon = false;
11609
+
1141511610 //gl.glDisable(GL.GL_VERTEX_PROGRAM_ARB);
1141611611 //System.out.println("ALLO");
1141711612 gl.glColorMask(false, false, false, false);
1141811613 DrawObject(gl);
11419
- if (RENDERPROGRAM > 0)
11420
- {
11421
- gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB);
11422
- textureon = texon;
11423
- }
11614
+
11615
+ gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB);
11616
+ textureon = texon;
11617
+
1142411618 gl.glColorMask(true, true, true, true);
1142511619
1142611620 gl.glDepthFunc(GL.GL_EQUAL);
11427
- //gl.glDepthMask(false);
11621
+ gl.glDepthMask(false);
1142811622 }
1142911623
1143011624 if (false) // DrawMode() == SHADOW)
....@@ -12317,8 +12511,76 @@
1231712511
1231812512 //gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 127, lightParams, 0);
1231912513
12320
- String program =
12514
+ String programmin =
12515
+ // Min shader
1232112516 "!!ARBfp1.0\n" +
12517
+ "PARAM zero123 = { 0.0, 1.0, 2, 1.25 };" +
12518
+ "PARAM pow2 = { 0.5, 0.25, 0.125, 0.0 };" +
12519
+ "PARAM one = { 1.0, 1.0, 1.0, 1.0 };" +
12520
+ "PARAM eps = { 0.001, 0.001, 0.001, 1.0 };" +
12521
+ "PARAM infinity = { 100000000, 100000000, 100000000, 1.0 };" +
12522
+ "PARAM light2cam0 = program.env[10];" +
12523
+ "PARAM light2cam1 = program.env[11];" +
12524
+ "PARAM light2cam2 = program.env[12];" +
12525
+ "TEMP temp;" +
12526
+ "TEMP light;" +
12527
+ "TEMP ndotl;" +
12528
+ "TEMP normal;" +
12529
+ "TEMP depth;" +
12530
+ "TEMP eye;" +
12531
+ "TEMP pos;" +
12532
+
12533
+ "MAD normal, fragment.color, zero123.z, -zero123.y;" +
12534
+ Normalize("normal") +
12535
+ "MOV light, state.light[0].position;" +
12536
+ "DP3 ndotl.x, light, normal;" +
12537
+
12538
+ // shadow
12539
+ "MOV pos, fragment.texcoord[1];" +
12540
+ "MOV temp, pos;" +
12541
+ ShadowTextureFetch("depth", "temp", "1") +
12542
+ //"TEX depth, fragment.texcoord[1], texture[1], 2D;" +
12543
+ "SLT ndotl.z, fragment.texcoord[1].z, depth.z;" +
12544
+
12545
+ // No shadow when out of frustum
12546
+ //"SGE temp.y, depth.z, zero123.y;" +
12547
+ //"LRP temp.x, temp.y, zero123.y, temp.x;" +
12548
+
12549
+ "MUL ndotl.x, ndotl.x, ndotl.z;" + // Shadow
12550
+
12551
+ // Backlit
12552
+ "MOV pos.w, zero123.y;" +
12553
+ "DP4 eye.x, pos, light2cam0;" +
12554
+ "DP4 eye.y, pos, light2cam1;" +
12555
+ "DP4 eye.z, pos, light2cam2;" +
12556
+ Normalize("eye") +
12557
+
12558
+ "DP3 ndotl.y, -eye, normal;" +
12559
+ //"MUL ndotl.y, ndotl.y, pow2.x;" +
12560
+ "POW ndotl.y, ndotl.y, pow2.z;" + // backlit
12561
+ "SUB ndotl.y, zero123.y, ndotl.y;" +
12562
+ //"SUB ndotl.y, zero123.y, ndotl.y;" +
12563
+ //"MUL ndotl.y, ndotl.y, pow2.z;" +
12564
+
12565
+ //"MAX ndotl.x, ndotl.x, ndotl.y;" + // Ambient
12566
+ //"MAX ndotl.x, ndotl.x, pow2.y;" + // Ambient
12567
+
12568
+ // Pigment
12569
+ "TEX temp, fragment.texcoord[0], texture[0], 2D;" +
12570
+ "LRP temp, zero123.w, temp, one;" + // texture proportion
12571
+ "MUL temp, temp, ndotl.x;" +
12572
+
12573
+ "MUL temp, temp, zero123.z;" +
12574
+
12575
+ //"MUL temp, temp, ndotl.y;" +
12576
+
12577
+ "MOV temp.w, zero123.y;" + // reset alpha
12578
+ "MOV result.color, temp;" +
12579
+ "END";
12580
+
12581
+ String programmax =
12582
+ "!!ARBfp1.0\n" +
12583
+
1232212584 //"OPTION ARB_fragment_program_shadow;" +
1232312585 "PARAM light2cam0 = program.env[10];" +
1232412586 "PARAM light2cam1 = program.env[11];" +
....@@ -12344,7 +12606,7 @@
1234412606 "PARAM params4 = program.env[4];" + // anisoV, cameralight, selfshadow, shadow
1234512607 "PARAM params5 = program.env[5];" + // texture, opacity, fakedepth, shadowbias
1234612608 "PARAM params6 = program.env[6];" + // bump, noise, borderfade, fog punchthrough
12347
- "PARAM params7 = program.env[7];" + // noise power, opacity power
12609
+ "PARAM params7 = program.env[7];" + // noise power, opacity power, parallax
1234812610 "PARAM options0 = program.env[63];" + // fog density, intensity, elevation
1234912611 "PARAM options1 = program.env[62];" + // fog rgb color
1235012612 "PARAM options2 = program.env[61];" + // image intensity, subsurface, lightsheen
....@@ -12433,8 +12695,7 @@
1243312695 "TEMP shininess;" +
1243412696 "\n" +
1243512697 "MOV texSamp, one;" +
12436
- //"TEX texSamp, fragment.texcoord[0], texture[0], 2D;" +
12437
-
12698
+
1243812699 "MOV mapgrid.x, one2048th.x;" +
1243912700 "MOV temp, fragment.texcoord[1];" +
1244012701 /*
....@@ -12455,20 +12716,20 @@
1245512716 "MUL temp, floor, mapgrid.x;" +
1245612717 //"TEX depth0, temp, texture[1], 2D;" +
1245712718 (((mode & FP_SOFTSHADOW) == 0) ? "" :
12458
- TextureFetch("depth0", "temp", "1") +
12719
+ ShadowTextureFetch("depth0", "temp", "1") +
1245912720 "") +
1246012721 "ADD temp.x, temp.x, mapgrid.x;" +
1246112722 //"TEX depth1, temp, texture[1], 2D;" +
1246212723 (((mode & FP_SOFTSHADOW) == 0) ? "" :
12463
- TextureFetch("depth1", "temp", "1") +
12724
+ ShadowTextureFetch("depth1", "temp", "1") +
1246412725 "") +
1246512726 "ADD temp.y, temp.y, mapgrid.x;" +
1246612727 //"TEX depth2, temp, texture[1], 2D;" +
12467
- TextureFetch("depth2", "temp", "1") +
12728
+ ShadowTextureFetch("depth2", "temp", "1") +
1246812729 "SUB temp.x, temp.x, mapgrid.x;" +
1246912730 //"TEX depth3, temp, texture[1], 2D;" +
1247012731 (((mode & FP_SOFTSHADOW) == 0) ? "" :
12471
- TextureFetch("depth3", "temp", "1") +
12732
+ ShadowTextureFetch("depth3", "temp", "1") +
1247212733 "") +
1247312734 //"MUL texSamp0, texSamp0, state.material.front.diffuse;" +
1247412735 //"MOV params, material;" +
....@@ -12590,7 +12851,7 @@
1259012851 "POW texSamp.a, texSamp.a, params6.w;" + // fog punch through shortcut
1259112852 // mar 2013 ??? "KIL alpha.a;" +
1259212853 "MOV alpha, texSamp.aaaa;" + // y;" +
12593
- "KIL alpha.a;" +
12854
+ "KIL alpha.a;" + // not sure with parallax mapping
1259412855 /*
1259512856 "MUL temp.xy, temp, two;" +
1259612857 "TXB bump, temp, texture[0], 2D;" +
....@@ -12676,11 +12937,6 @@
1267612937 "SUB bump0, bump0, half;" +
1267712938 "ADD bump, bump, bump0;" +
1267812939
12679
- "MOV temp.x, texSamp.a;" +
12680
- "LRP texSamp, params5.x, texSamp, one;" + // texture proportion
12681
- //"LRP texSamp0, params5.x, texSamp0, one;" +
12682
- "MOV texSamp.a, temp.x;" +
12683
-
1268412940 // double-sided
1268512941 /**/
1268612942 (doublesided?"DP3 temp.z, normal, eye;" +
....@@ -12697,19 +12953,62 @@
1269712953 "MOV normald, normal;" +
1269812954 "MOV normals, normal;" +
1269912955
12956
+ "MOV temp, fragment.texcoord[4];" +
12957
+
1270012958 // UV base
1270112959 //"DP3 UP.x,state.matrix.modelview.row[0],Y;" +
1270212960 //"DP3 UP.y,state.matrix.modelview.row[1],Y;" +
1270312961 //"DP3 UP.z,state.matrix.modelview.row[2],Y;" +
12704
- "DP3 UP.x,state.matrix.texture[7].row[0],Y;" +
12705
- "DP3 UP.y,state.matrix.texture[7].row[1],Y;" +
12706
- "DP3 UP.z,state.matrix.texture[7].row[2],Y;" +
12962
+ "DP3 UP.x,state.matrix.texture[7].row[0],temp;" +
12963
+ "DP3 UP.y,state.matrix.texture[7].row[1],temp;" +
12964
+ "DP3 UP.z,state.matrix.texture[7].row[2],temp;" +
12965
+ Normalize("UP") +
12966
+
1270712967 "XPD V, normal, UP;" +
1270812968 Normalize("V") +
1270912969 "XPD U, V, normal;" +
1271012970 Normalize("U") +
1271112971
1271212972 // parallax mapping
12973
+
12974
+ "DP3 temp2.x, V, eye;" +
12975
+ "DP3 temp2.y, U, eye;" +
12976
+ "DP3 temp2.z, normal, eye;" +
12977
+ "RCP temp2.z, temp2.z;" +
12978
+
12979
+ "DP3 temp2.w, texSamp, texSamp;" + // Height
12980
+ "RSQ temp2.w, temp2.w;" +
12981
+ "RCP temp2.w, temp2.w;" +
12982
+
12983
+ "SUB temp2.w, temp2.w, half;" +
12984
+// "SGE temp.x, temp2.w, eps.x;" +
12985
+// "MUL temp2.w, temp2.w, temp.x;" +
12986
+
12987
+ //"MOV texSamp, U;" +
12988
+
12989
+ "MUL temp2.z, temp2.z, temp2.w;" +
12990
+ "MUL temp2.z, temp2.z, params7.z;" + // parallax
12991
+
12992
+ "MUL temp2, temp2, temp2.z;" +
12993
+
12994
+ "MOV temp, fragment.texcoord[0];" +
12995
+
12996
+ "SUB temp, temp, temp2;" +
12997
+
12998
+ "TEX temp, temp, texture[0], 2D;" +
12999
+ "POW temp.a, temp.a, params6.w;" + // punch through
13000
+
13001
+ "ADD texSamp, temp, texSamp;" +
13002
+ "MUL texSamp.xyz, half, texSamp;" +
13003
+
13004
+ "MOV alpha, texSamp.aaaa;" +
13005
+
13006
+// parallax mapping
13007
+
13008
+ "MOV temp.x, texSamp.a;" +
13009
+ "LRP texSamp, params5.x, texSamp, one;" + // texture proportion
13010
+ //"LRP texSamp0, params5.x, texSamp0, one;" +
13011
+ "MOV texSamp.a, temp.x;" +
1271313012
1271413013 //"MOV temp, fragment.texcoord[0];" +
1271513014 //
....@@ -12839,10 +13138,10 @@
1283913138 "MAD shadow.x, buffer.x, frac.y, shadow.x;" +
1284013139 "") +
1284113140
12842
- // display shadow only (bump == 0)
13141
+ // display shadow only (fakedepth == 0)
1284313142 "SUB temp.x, half.x, shadow.x;" +
1284413143 "MOV temp.y, -params5.z;" + // params6.x;" +
12845
- "SLT temp.z, temp.y, -one2048th.x;" +
13144
+ "SLT temp.z, temp.y, -c256i.x;" +
1284613145 "SUB temp.y, one.x, temp.z;" +
1284713146 "MUL temp.x, temp.x, temp.y;" +
1284813147 "KIL temp.x;" +
....@@ -13173,8 +13472,19 @@
1317313472 //once = true;
1317413473 }
1317513474
13176
- System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
13177
- System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
13475
+ String program = programmax;
13476
+
13477
+ if (Globals.MINSHADER)
13478
+ {
13479
+ program = programmin;
13480
+ }
13481
+
13482
+ if (Globals.DEBUG)
13483
+ {
13484
+ System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
13485
+ System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
13486
+ }
13487
+
1317813488 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1317913489
1318013490 //gl.glNewList(displayListID, GL.GL_COMPILE);
....@@ -13221,7 +13531,8 @@
1322113531 "\n" +
1322213532 "END\n";
1322313533
13224
- System.out.println("Program shadow #" + 0 + "; length = " + program.length());
13534
+ if (Globals.DEBUG)
13535
+ System.out.println("Program shadow #" + 0 + "; length = " + program.length());
1322513536 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1322613537
1322713538 //gl.glNewList(displayListID, GL.GL_COMPILE);
....@@ -13266,25 +13577,26 @@
1326613577 return out;
1326713578 }
1326813579
13269
- String TextureFetch(String dest, String src, String unit)
13580
+ // Also does frustum culling
13581
+ String ShadowTextureFetch(String dest, String src, String unit)
1327013582 {
1327113583 return "TEX " + dest + ", " + src + ", texture[" + unit + "], 2D;" +
1327213584 "SGE " + src + ".w, " + src + ".x, eps.x;" +
1327313585 "SGE " + src + ".z, " + src + ".y, eps.x;" +
13586
+ "SLT " + dest + ".x, " + src + ".x, one.x;" +
13587
+ "SLT " + dest + ".y, " + src + ".y, one.x;" +
1327413588 "MUL " + src + ".w, " + src + ".z, " + src + ".w;" +
13275
- "SLT " + src + ".z, " + src + ".x, one.x;" +
13276
- "MUL " + src + ".w, " + src + ".z, " + src + ".w;" +
13277
- "SLT " + src + ".z, " + src + ".y, one.x;" +
13278
- "MUL " + src + ".w, " + src + ".z, " + src + ".w;" +
13589
+ "MUL " + src + ".w, " + dest + ".x, " + src + ".w;" +
13590
+ "MUL " + src + ".w, " + dest + ".y, " + src + ".w;" +
1327913591 //"SWZ buffer, temp, w,w,w,w;";
13280
- "MUL " + dest + ".z, " + dest + ".z, " + src + ".w;" +
13592
+ //"MUL " + dest + ".z, " + dest + ".z, " + src + ".w;" +
1328113593 "SUB " + src + ".z, " + "one.x, " + src + ".w;" +
1328213594 //"MUL " + src + ".z, " + src + ".z, infinity.x;" +
1328313595 //"ADD " + dest + ".z, " + dest + ".z, " + src + ".z;";
13284
- "MAD " + dest + ".z, " + src + ".z, infinity.x," + dest + ".z;";
13596
+ //"MAD " + dest + ".z, " + src + ".z, infinity.x," + dest + ".z;";
1328513597
13286
- //"LRP " + dest + ".z, " + src + ".w," + dest + ".z, infinity.x;";
13287
- //"LRP " + dest + ".z" + ", " + src + ".w, infinity.x," + dest + ".z;";
13598
+ //?? "LRP " + dest + ".z, " + src + ".w," + dest + ".z, infinity.x;";
13599
+ "LRP " + dest + ".z, " + src + ".z, infinity.x," + dest + ".z;";
1328813600 }
1328913601
1329013602 String Shadow(String depth, String shadow)
....@@ -13331,7 +13643,7 @@
1333113643 "SLT temp.x, temp.x, zero.x;" + // shadoweps
1333213644 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1333313645
13334
- // No shadow when out of frustrum
13646
+ // No shadow when out of frustum
1333513647 "SGE temp.x, " + depth + ".z, one.z;" +
1333613648 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1333713649 "";
....@@ -13478,7 +13790,7 @@
1347813790 /*static*/ float[] modelParams4 = new float[]{0, 0, 0, 0}; // anisoV, cameralight, selfshadow, shadow
1347913791 /*static*/ float[] modelParams5 = new float[]{0, 0, 0, 0}; // texture, opacity, fakedepth, shadowbias
1348013792 /*static*/ float[] modelParams6 = new float[]{0, 0, 0, 0}; // bump, noise, borderfade, fog punchthrough
13481
- /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power
13793
+ /*static*/ float[] modelParams7 = new float[]{0, 0, 0, 0}; // noise power, opacity power, parallax
1348213794
1348313795 //Object3D.cVector2[] vector2buffer;
1348413796
....@@ -13645,7 +13957,7 @@
1364513957 "PARAM p[4] = { state.matrix.projection }; # modelview projection matrix\n" +
1364613958 "PARAM zero = { 0.0, 0.0, 0.0, 1.0 };" +
1364713959 "PARAM half = { 0.5, 0.5, 0.5, 1.0 };" +
13648
- "PARAM one = { 1.0, 1.0, 1.0, 0.0 };" +
13960
+ "PARAM one = { 1.0, 1.0, 1.0, 1.0 };" +
1364913961 "PARAM two = { 2.0, 2.0, 2.0, 1.0 };" +
1365013962 "PARAM third = { 0.33333333333, 0.33333333333, 0.33333333333, 1.0 };" +
1365113963 //"PARAM v256 = { 256.0, 256.0, 256.0, 1.0 };" +
....@@ -13706,7 +14018,7 @@
1370614018 "DP4 temp.x,state.matrix.texture[0].inverse.row[0],vertex.texcoord;" +
1370714019 "DP4 temp.y,state.matrix.texture[0].inverse.row[1],vertex.texcoord;" +
1370814020 "DP4 temp.z,state.matrix.texture[0].inverse.row[2],vertex.texcoord;" +
13709
- //"MOV result.texcoord, vertex.texcoord;" +
14021
+ //"MOV result.texcoord, vertex.fogcoord;" +
1371014022 "MOV result.texcoord, temp;" +
1371114023 // border fade
1371214024 "MOV result.texcoord[3], vertex.texcoord;" +
....@@ -13753,7 +14065,9 @@
1375314065
1375414066 //"ADD temp.z, temp.z, one;" +
1375514067
13756
- "MOV result.color, temp;"
14068
+ "MOV result.texcoord[4], vertex.attrib[4];" + // U dir
14069
+
14070
+ "MOV result.color, temp;" // Normal
1375714071 : "MOV result.color, vertex.color;") +
1375814072 ((mode & VP_PROJECTION) != 0 ? "MOV result.color, zero;"
1375914073 : "") +
....@@ -14129,14 +14443,15 @@
1412914443 drag = false;
1413014444 //System.out.println("Mouse DOWN");
1413114445 editObj = false;
14132
- ClickInfo info = new ClickInfo();
14133
- info.bounds.setBounds(0, 0, (int) (getBounds().width * zoom), (int) (getBounds().height * zoom));
14134
- info.pane = this;
14135
- info.camera = renderCamera;
14136
- info.x = x;
14137
- info.y = y;
14138
- info.modifiers = modifiersex;
14139
- editObj = object.doEditClick(info, 0);
14446
+ //ClickInfo info = new ClickInfo();
14447
+ object.clickInfo.bounds.setBounds(0, 0, (int) (getBounds().width * zoom), (int) (getBounds().height * zoom));
14448
+ object.clickInfo.pane = this;
14449
+ object.clickInfo.camera = renderCamera;
14450
+ object.clickInfo.x = x;
14451
+ object.clickInfo.y = y;
14452
+ object.clickInfo.modifiers = modifiersex;
14453
+ editObj = object.doEditClick(//info,
14454
+ 0);
1414014455 if (!editObj)
1414114456 {
1414214457 hasMarquee = true;
....@@ -14418,11 +14733,17 @@
1441814733 void GoDown(int mod)
1441914734 {
1442014735 MODIFIERS |= COMMAND;
14736
+ boolean isVR = (mouseMode&VR)!=0;
1442114737 /**/
1442214738 if((mod&SHIFT) == SHIFT)
14423
- manipCamera.RotatePosition(0, -speed);
14739
+ {
14740
+ if (isVR)
14741
+ manipCamera.RotateInterest(0, -speed);
14742
+ else
14743
+ manipCamera.RotatePosition(0, -speed);
14744
+ }
1442414745 else
14425
- manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14746
+ manipCamera.BackForth(0, -speed*delta, isVR?1000:0); // getWidth());
1442614747 /**/
1442714748 if ((mod & SHIFT) == SHIFT)
1442814749 {
....@@ -14432,6 +14753,8 @@
1443214753 mouseMode |= BACKFORTH;
1443314754 }
1443414755
14756
+ targetLookAt.set(manipCamera.lookAt);
14757
+
1443514758 //prevX = X = anchorX;
1443614759 prevY = Y = anchorY - (int) (renderCamera.Distance());
1443714760 }
....@@ -14440,10 +14763,17 @@
1444014763 {
1444114764 MODIFIERS |= COMMAND;
1444214765 /**/
14766
+ boolean isVR = (mouseMode&VR)!=0;
14767
+
1444314768 if((mod&SHIFT) == SHIFT)
14444
- manipCamera.RotatePosition(0, speed);
14769
+ {
14770
+ if (isVR)
14771
+ manipCamera.RotateInterest(0, speed);
14772
+ else
14773
+ manipCamera.RotatePosition(0, speed);
14774
+ }
1444514775 else
14446
- manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14776
+ manipCamera.BackForth(0, speed*delta, isVR?1000:0); // getWidth());
1444714777 /**/
1444814778 if ((mod & SHIFT) == SHIFT)
1444914779 {
....@@ -14453,6 +14783,8 @@
1445314783 mouseMode |= BACKFORTH;
1445414784 }
1445514785
14786
+ targetLookAt.set(manipCamera.lookAt);
14787
+
1445614788 //prevX = X = anchorX;
1445714789 prevY = Y = anchorY + (int) (renderCamera.Distance());
1445814790 }
....@@ -14462,9 +14794,14 @@
1446214794 MODIFIERS |= COMMAND;
1446314795 /**/
1446414796 if((mod&SHIFT) == SHIFT)
14465
- manipCamera.Translate(speed*delta, 0, getWidth());
14797
+ manipCamera.Translate(speed*delta, 0, getWidth());
1446614798 else
14467
- manipCamera.RotatePosition(speed, 0);
14799
+ {
14800
+ if ((mouseMode&VR)!=0)
14801
+ manipCamera.RotateInterest(-speed, 0);
14802
+ else
14803
+ manipCamera.RotatePosition(speed, 0);
14804
+ }
1446814805 /**/
1446914806 if ((mod & SHIFT) == SHIFT)
1447014807 {
....@@ -14474,6 +14811,8 @@
1447414811 mouseMode |= ROTATE;
1447514812 } // TRANSLATE;
1447614813
14814
+ targetLookAt.set(manipCamera.lookAt);
14815
+
1447714816 prevX = X = anchorX - 10; // (int)(10*renderCamera.Distance());
1447814817 prevY = Y = anchorY;
1447914818 }
....@@ -14483,9 +14822,15 @@
1448314822 MODIFIERS |= COMMAND;
1448414823 /**/
1448514824 if((mod&SHIFT) == SHIFT)
14486
- manipCamera.Translate(-speed*delta, 0, getWidth());
14825
+ manipCamera.Translate(-speed*delta, 0, getWidth());
1448714826 else
14488
- manipCamera.RotatePosition(-speed, 0);
14827
+ {
14828
+ if ((mouseMode&VR)!=0)
14829
+ manipCamera.RotateInterest(speed, 0);
14830
+ else
14831
+ manipCamera.RotatePosition(-speed, 0);
14832
+ }
14833
+
1448914834 /**/
1449014835 if ((mod & SHIFT) == SHIFT)
1449114836 {
....@@ -14495,6 +14840,8 @@
1449514840 mouseMode |= ROTATE;
1449614841 } // TRANSLATE;
1449714842
14843
+ targetLookAt.set(manipCamera.lookAt);
14844
+
1449814845 prevX = X = anchorX + 10; // (int)(10*renderCamera.Distance());
1449914846 prevY = Y = anchorY;
1450014847 }
....@@ -14536,15 +14883,16 @@
1453614883 if (editObj)
1453714884 {
1453814885 drag = true;
14539
- ClickInfo info = new ClickInfo();
14540
- info.bounds.setBounds(0, 0,
14886
+ //ClickInfo info = new ClickInfo();
14887
+ object.clickInfo.bounds.setBounds(0, 0,
1454114888 (int) (getBounds().width * zoom), (int) (getBounds().height * zoom));
14542
- info.pane = this;
14543
- info.camera = renderCamera;
14544
- info.x = x;
14545
- info.y = y;
14546
- object.GetWindow().copy
14547
- .doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
14889
+ object.clickInfo.pane = this;
14890
+ object.clickInfo.camera = renderCamera;
14891
+ object.clickInfo.x = x;
14892
+ object.clickInfo.y = y;
14893
+ object //.GetWindow().copy
14894
+ .doEditDrag(//info,
14895
+ (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1454814896 } else
1454914897 {
1455014898 if (x < startX)
....@@ -14693,24 +15041,27 @@
1469315041 }
1469415042 }
1469515043
15044
+// ClickInfo clickInfo = new ClickInfo();
15045
+
1469615046 public void mouseMoved(MouseEvent e)
1469715047 {
1469815048 //System.out.println("mouseMoved: " + e);
1469915049 if (isRenderer)
1470015050 return;
1470115051
14702
- ClickInfo ci = new ClickInfo();
14703
- ci.x = e.getX();
14704
- ci.y = e.getY();
14705
- ci.modifiers = e.getModifiersEx();
14706
- ci.bounds.setBounds(0, 0, (int) (getBounds().width * zoom), (int) (getBounds().height * zoom));
14707
- ci.pane = this;
14708
- ci.camera = renderCamera;
15052
+ // Mouse cursor feedback
15053
+ object.clickInfo.x = e.getX();
15054
+ object.clickInfo.y = e.getY();
15055
+ object.clickInfo.modifiers = e.getModifiersEx();
15056
+ object.clickInfo.bounds.setBounds(0, 0, (int) (getBounds().width * zoom), (int) (getBounds().height * zoom));
15057
+ object.clickInfo.pane = this;
15058
+ object.clickInfo.camera = renderCamera;
1470915059 if (!isRenderer)
1471015060 {
1471115061 //ObjEditor editWindow = object.editWindow;
1471215062 //Object3D copy = editWindow.copy;
14713
- if (object.doEditClick(ci, 0))
15063
+ if (object.doEditClick(//clickInfo,
15064
+ 0))
1471415065 {
1471515066 setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
1471615067 } else
....@@ -14993,8 +15344,8 @@
1499315344 case 'K':
1499415345 KOMPACTTEXTURE ^= true;
1499515346 //textures.clear();
14996
- break;
14997
- case 'P': // Texture Projection macros
15347
+ // break;
15348
+ //case 'P': // Texture Projection macros
1499815349 // SAVETEXTURE ^= true;
1499915350 macromode = true;
1500015351 Udebug = Vdebug = NORMALdebug = false; programInitialized = false;
....@@ -15115,7 +15466,7 @@
1511515466 targetLookAt.set(manipCamera.lookAt);
1511615467 repaint();
1511715468 break;
15118
- case 'p':
15469
+ case 'P': // p':
1511915470 // c'est quoi ca au juste? spherical ^= true;
1512015471 Skinshader ^= true; programInitialized = false;
1512115472 repaint();
....@@ -15160,20 +15511,24 @@
1516015511 OCCLUSION_CULLING ^= true;
1516115512 System.out.println("OCCLUSION CULLING = " + OCCLUSION_CULLING);
1516215513 break;
15163
- case '0': envyoff ^= true; repaint(); break;
15514
+ //case '0': envyoff ^= true; repaint(); break;
1516415515 case '1':
1516515516 case '2':
1516615517 case '3':
1516715518 case '4':
1516815519 case '5':
15169
- newenvy = Character.getNumericValue(key);
15170
- repaint();
15171
- break;
1517215520 case '6':
1517315521 case '7':
1517415522 case '8':
1517515523 case '9':
15176
- BGcolor = (key - '6')/3.f;
15524
+ if (true) // envyoff)
15525
+ {
15526
+ BGcolor = (key - '1')/8.f;
15527
+ }
15528
+ else
15529
+ {
15530
+ //newenvy = Character.getNumericValue(key);
15531
+ }
1517715532 repaint();
1517815533 break;
1517915534 case '!':
....@@ -15736,8 +16091,6 @@
1573616091
1573716092 int width = getBounds().width;
1573816093 int height = getBounds().height;
15739
- ClickInfo info = new ClickInfo();
15740
- info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom));
1574116094 //Image img = CreateImage(width, height);
1574216095 //System.out.println("width = " + width + "; height = " + height + "\n");
1574316096
....@@ -15814,31 +16167,37 @@
1581416167 }
1581516168 if (object != null && !hasMarquee)
1581616169 {
16170
+ if (object.clickInfo == null)
16171
+ object.clickInfo = new ClickInfo();
16172
+ ClickInfo info = object.clickInfo;
16173
+ //ClickInfo info = new ClickInfo();
16174
+ info.bounds.setBounds(0, 0, (int) (width * zoom), (int) (height * zoom));
16175
+
1581716176 if (isRenderer)
1581816177 {
15819
- info.flags++;
16178
+ object.clickInfo.flags++;
1582016179 double frameAspect = (double) width / (double) height;
1582116180 if (frameAspect > renderCamera.aspect)
1582216181 {
1582316182 int desired = (int) ((double) height * renderCamera.aspect);
15824
- info.bounds.width -= width - desired;
15825
- info.bounds.x += (width - desired) / 2;
16183
+ object.clickInfo.bounds.width -= width - desired;
16184
+ object.clickInfo.bounds.x += (width - desired) / 2;
1582616185 } else
1582716186 {
1582816187 int desired = (int) ((double) width / renderCamera.aspect);
15829
- info.bounds.height -= height - desired;
15830
- info.bounds.y += (height - desired) / 2;
16188
+ object.clickInfo.bounds.height -= height - desired;
16189
+ object.clickInfo.bounds.y += (height - desired) / 2;
1583116190 }
1583216191 }
1583316192
15834
- info.g = gr;
15835
- info.camera = renderCamera;
16193
+ object.clickInfo.g = gr;
16194
+ object.clickInfo.camera = renderCamera;
1583616195 /*
1583716196 // Memory intensive (brep.verticescopy)
1583816197 if (!(object instanceof Composite))
1583916198 object.draw(info, 0, false); // SLOW :
1584016199 */
15841
- if (!isRenderer)
16200
+ if (!isRenderer) // && drag)
1584216201 {
1584316202 Grafreed.Assert(object != null);
1584416203 Grafreed.Assert(object.selection != null);
....@@ -15846,9 +16205,9 @@
1584616205 {
1584716206 int hitSomething = object.selection.get(0).hitSomething;
1584816207
15849
- info.DX = 0;
15850
- info.DY = 0;
15851
- info.W = 1;
16208
+ object.clickInfo.DX = 0;
16209
+ object.clickInfo.DY = 0;
16210
+ object.clickInfo.W = 1;
1585216211 if (hitSomething == Object3D.hitCenter)
1585316212 {
1585416213 info.DX = X;
....@@ -15860,13 +16219,14 @@
1586016219 info.DY -= info.bounds.height/2;
1586116220 }
1586216221
15863
- object.drawEditHandles(info, 0);
16222
+ object.drawEditHandles(//info,
16223
+ 0);
1586416224
1586516225 if (drag && (X != 0 || Y != 0))
1586616226 {
1586716227 switch (hitSomething)
1586816228 {
15869
- case Object3D.hitCenter: gr.setColor(Color.pink);
16229
+ case Object3D.hitCenter: gr.setColor(Color.white);
1587016230 gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
1587116231 break;
1587216232 case Object3D.hitRotate: gr.setColor(Color.yellow);
....@@ -15892,7 +16252,7 @@
1589216252 if (hasMarquee)
1589316253 {
1589416254 gr.setXORMode(Color.white);
15895
- gr.setColor(Color.red);
16255
+ gr.setColor(Color.white);
1589616256 if (!firstime)
1589716257 {
1589816258 gr.drawRect(prevmarqX, prevmarqY, prevmarqW, prevmarqH);
....@@ -16359,6 +16719,8 @@
1635916719 private /*static*/ boolean firstime;
1636016720 private /*static*/ cVector newView = new cVector();
1636116721 private static final String[] suffixes = {"posx", "negx", "posy", "negy", "posz", "negz"};
16722
+ private static final String[] suffixes2 = {"east", "west", "top", "bottom", "north", "south"};
16723
+ private static final String[] suffixes3 = {"ft", "bk", "up", "dn", "rt", "lf"};
1636216724 private static final int[] targets = {GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X,
1636316725 GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
1636416726 GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
....@@ -16371,29 +16733,67 @@
1637116733 {
1637216734 com.sun.opengl.util.texture.Texture cubemap = TextureIO.newTexture(GL.GL_TEXTURE_CUBE_MAP);
1637316735
16736
+ int usedsuf = 0;
16737
+
1637416738 for (int i = 0; i < suffixes.length; i++)
1637516739 {
16376
- String resourceName = basename + suffixes[i] + "." + suffix;
16377
- TextureData data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName),
16378
- mipmapped,
16379
- FileUtil.getFileSuffix(resourceName));
16380
- if (data == null)
16740
+ String[] suffixe = suffixes;
16741
+ String[] fallback = suffixes2;
16742
+ String[] fallfallback = suffixes3;
16743
+
16744
+ for (int c=usedsuf; --c>=0;)
1638116745 {
16382
- throw new IOException("Unable to load texture " + resourceName);
16746
+// String[] temp = suffixe;
16747
+// suffixe = fallback;
16748
+// fallback = fallfallback;
16749
+// fallfallback = temp;
1638316750 }
16751
+
16752
+ String resourceName = basename + suffixe[i] + "." + suffix;
16753
+ TextureData data;
16754
+
16755
+ try
16756
+ {
16757
+ data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName),
16758
+ mipmapped,
16759
+ FileUtil.getFileSuffix(resourceName));
16760
+ }
16761
+ catch (Exception e)
16762
+ {
16763
+ try
16764
+ {
16765
+ resourceName = basename + fallback[i] + "." + suffix;
16766
+ data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName),
16767
+ mipmapped,
16768
+ FileUtil.getFileSuffix(resourceName));
16769
+ }
16770
+ catch (Exception e2)
16771
+ {
16772
+ resourceName = basename + fallfallback[i] + "." + suffix;
16773
+ data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName),
16774
+ mipmapped,
16775
+ FileUtil.getFileSuffix(resourceName));
16776
+ }
16777
+ }
16778
+
1638416779 //System.out.println("Target = " + targets[i]);
1638516780 cubemap.updateImage(data, targets[i]);
1638616781 }
1638716782
1638816783 return cubemap;
1638916784 }
16785
+
1639016786 int bigsphere = -1;
1639116787
1639216788 float BGcolor = 0.5f;
1639316789
16394
- private void DrawSkyBox(GL gl)
16790
+ float ambientLight[] = {1f, 1f, 1f, 1.0f};
16791
+
16792
+ private void DrawSkyBox(GL gl, float ratio)
1639516793 {
16396
- if (envyoff || cubemap == null)
16794
+ if (//envyoff ||
16795
+ WIREFRAME ||
16796
+ cubemap == null)
1639716797 {
1639816798 gl.glClearColor(BGcolor, BGcolor, BGcolor, 1);
1639916799 gl.glClear(gl.GL_COLOR_BUFFER_BIT);
....@@ -16408,7 +16808,17 @@
1640816808 // Compensates for ExaminerViewer's modification of modelview matrix
1640916809 gl.glMatrixMode(GL.GL_MODELVIEW);
1641016810 gl.glLoadIdentity();
16811
+ gl.glScalef(1,ratio,1);
1641116812
16813
+// colorV[0] = 2;
16814
+// colorV[1] = 2;
16815
+// colorV[2] = 2;
16816
+// colorV[3] = 1;
16817
+// gl.glDisable(gl.GL_COLOR_MATERIAL);
16818
+// gl.glMaterialfv(gl.GL_FRONT_AND_BACK, gl.GL_AMBIENT, colorV, 0);
16819
+//
16820
+// gl.glLightModelfv(gl.GL_LIGHT_MODEL_AMBIENT, ambientLight, 0);
16821
+
1641216822 //gl.glActiveTexture(GL.GL_TEXTURE1);
1641316823 //gl.glDisable(GL.GL_TEXTURE_CUBE_MAP);
1641416824
....@@ -16440,6 +16850,7 @@
1644016850 {
1644116851 gl.glScalef(1.0f, -1.0f, 1.0f);
1644216852 }
16853
+ gl.glScalef(-1.0f, 1.0f, 1.0f);
1644316854 gl.glMultMatrixd(viewrot_1, 0);
1644416855 gl.glTranslatef(0, 0, 0.5f); // (float)lightCamera.Distance()); // 0.5f);
1644516856 //viewer.updateInverseRotation(gl);
....@@ -16480,7 +16891,8 @@
1648016891 gl.glDisable(GL.GL_TEXTURE_GEN_R);
1648116892
1648216893 cubemap.disable();
16483
- ////cubemap.unbind();
16894
+ //cubemap.dispose();
16895
+
1648416896 if (CULLFACE)
1648516897 {
1648616898 gl.glEnable(gl.GL_CULL_FACE);
....@@ -16536,7 +16948,7 @@
1653616948 gl.glScalef(1.0f, -1.0f, 1.0f);
1653716949 }
1653816950
16539
- gl.glNormal3f(0.0f, 0.0f, 1.0f);
16951
+ SetGLNormal(gl, 0.0f, 0.0f, 1.0f);
1654016952
1654116953 float step = 2; // 0.1666f; //0.25f;
1654216954 float stepv = 2; // step * 1652 / 998;
....@@ -16698,7 +17110,7 @@
1669817110 //new Exception().printStackTrace();
1669917111 System.out.println("select buffer init");
1670017112 // Use debug pipeline
16701
- drawable.setGL(new DebugGL(drawable.getGL()));
17113
+ //drawable.setGL(new DebugGL(drawable.getGL()));
1670217114
1670317115 GL gl = drawable.getGL();
1670417116
....@@ -17016,6 +17428,7 @@
1701617428
1701717429 public void init(GLAutoDrawable drawable)
1701817430 {
17431
+ if (Globals.DEBUG)
1701917432 System.out.println("shadow buffer init");
1702017433
1702117434 GL gl = drawable.getGL();
....@@ -17244,10 +17657,14 @@
1724417657 gl.glFlush();
1724517658
1724617659 /**/
17247
- gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, occlusionsizebuffer);
17660
+ gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, occlusiondepthbuffer);
1724817661
17249
- float[] pixels = occlusionsizebuffer.array();
17662
+ float[] depths = occlusiondepthbuffer.array();
1725017663
17664
+ gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_BGRA, GL.GL_UNSIGNED_INT_8_8_8_8_REV, occlusioncolorbuffer);
17665
+
17666
+ int[] pixels = selectsizebuffer.array();
17667
+
1725117668 double r = 0, g = 0, b = 0;
1725217669
1725317670 double count = 0;
....@@ -17258,7 +17675,7 @@
1725817675
1725917676 double FACTOR = 1;
1726017677
17261
- for (int i = 0; i < pixels.length; i++)
17678
+ for (int i = 0; i < depths.length; i++)
1726217679 {
1726317680 int x = i / OCCLUSION_SIZE - OCCLUSION_SIZE / 2;
1726417681 int y = i % OCCLUSION_SIZE - OCCLUSION_SIZE / 2;
....@@ -17341,7 +17758,7 @@
1734117758
1734217759 double scale = ray.z; // 1; // cos
1734317760
17344
- float depth = pixels[newindex];
17761
+ float depth = depths[newindex];
1734517762
1734617763 /*
1734717764 int newindex2 = (x + 1) * OCCLUSION_SIZE + y;
....@@ -17538,11 +17955,14 @@
1753817955 static IntBuffer AAbuffer; // = IntBuffer.allocate(MAX_SIZE*MAX_SIZE);
1753917956 static IntBuffer bigAAbuffer;
1754017957 static java.nio.FloatBuffer histogram = BufferUtil.newFloatBuffer(HISTOGRAM_SIZE * 3);
17541
- static IntBuffer texturesizebuffer = IntBuffer.allocate(TEX_SIZE * TEX_SIZE);
17958
+ //static IntBuffer texturesizebuffer = IntBuffer.allocate(TEX_SIZE * TEX_SIZE);
1754217959 static IntBuffer selectsizebuffer = IntBuffer.allocate(SELECT_SIZE * SELECT_SIZE);
1754317960 static java.nio.FloatBuffer pointselectsizebuffer = java.nio.FloatBuffer.allocate(SELECT_SIZE * SELECT_SIZE);
1754417961 //static IntBuffer occlusionsizebuffer = IntBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE);
17545
- static java.nio.FloatBuffer occlusionsizebuffer = java.nio.FloatBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE);
17962
+ static java.nio.FloatBuffer occlusiondepthbuffer = java.nio.FloatBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE);
17963
+
17964
+ static IntBuffer occlusioncolorbuffer = IntBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE);
17965
+
1754617966 static BufferedImage bufimage = new BufferedImage(TEX_SIZE, TEX_SIZE, BufferedImage.TYPE_INT_RGB);
1754717967 static BufferedImage textest = new cBufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
1754817968 static java.util.Vector<BufferedImage> billboards = new java.util.Vector<BufferedImage>();