Normand Briere
2019-08-12 b1d79b74514041a059b454a9f6fc3970773c0cb8
CameraPane.java
....@@ -187,6 +187,18 @@
187187 }
188188
189189 private File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory();
190
+
191
+ public void LoadSkybox(String name, String ext, boolean mipmap) throws GLException
192
+ {
193
+ try
194
+ {
195
+ cubemap = LoadCubemap(getClass().getClassLoader(), name, ext, mipmap);
196
+ } catch (IOException e)
197
+ {
198
+ System.out.println("NAME = " + name);
199
+ e.printStackTrace(); // throw new RuntimeException(e);
200
+ }
201
+ }
190202
191203 void SetAsGLRenderer(boolean b)
192204 {
....@@ -206,7 +218,8 @@
206218
207219 SetCamera(cam);
208220
209
- SetLight(new Camera(new cVector(10, 10, -20)));
221
+ // Warning: not used.
222
+ SetLight(new Camera(new cVector(15, 10, -20)));
210223
211224 object = o;
212225
....@@ -1484,6 +1497,8 @@
14841497 gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
14851498 }
14861499
1500
+ float[] colorV = new float[4];
1501
+
14871502 void SetColor(Object3D obj, Vertex p0)
14881503 {
14891504 CameraPane display = this;
....@@ -1551,8 +1566,6 @@
15511566 {
15521567 return;
15531568 }
1554
-
1555
- float[] colorV = new float[3];
15561569
15571570 if (false) // marked)
15581571 {
....@@ -8345,7 +8358,7 @@
83458358 // else
83468359 // if (!texname.startsWith("/"))
83478360 // texname = "/Users/nbriere/Textures/" + texname;
8348
- if (!FileExists(texname))
8361
+ if (!FileExists(texname) && !texname.startsWith("@"))
83498362 {
83508363 texname = fallbackTextureName;
83518364 }
....@@ -8428,6 +8441,15 @@
84288441 new Exception().printStackTrace();
84298442 } else
84308443 {
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
+ {
84318453 if (textureon)
84328454 {
84338455 String cachename = texname;
....@@ -8487,6 +8509,7 @@
84878509 texturecache = new CacheTexture(texturedata,resolution);
84888510 //texture = GetTexture(tex, bump);
84898511 }
8512
+ }
84908513 }
84918514 //}
84928515 }
....@@ -8931,7 +8954,7 @@
89318954
89328955 if (cubemap == null)
89338956 {
8934
- LoadEnvy(5);
8957
+ //LoadEnvy(1);
89358958 }
89368959
89378960 //cubemap.enable();
....@@ -9218,37 +9241,58 @@
92189241 cubemap = null;
92199242 return;
92209243 case 1:
9221
- name = "cubemaps/box_";
9222
- ext = "png";
9244
+ name = "cubemaps/rgb/";
9245
+ ext = "jpg";
92239246 reverseUP = false;
92249247 break;
92259248 case 2:
9226
- name = "cubemaps/uffizi_";
9227
- ext = "png";
9228
- break; // reverseUP = true; break;
9249
+ name = "cubemaps/uffizi/";
9250
+ ext = "jpg";
9251
+ reverseUP = false;
9252
+ break;
92299253 case 3:
9230
- name = "cubemaps/CloudyHills_";
9231
- ext = "tga";
9254
+ name = "cubemaps/CloudyHills/";
9255
+ ext = "jpg";
92329256 reverseUP = false;
92339257 break;
92349258 case 4:
9235
- name = "cubemaps/cornell_";
9259
+ name = "cubemaps/cornell/";
92369260 ext = "png";
92379261 reverseUP = false;
92389262 break;
9263
+ case 5:
9264
+ name = "cubemaps/skycube/";
9265
+ ext = "jpg";
9266
+ reverseUP = false;
9267
+ break;
9268
+ case 6:
9269
+ name = "cubemaps/SaintLazarusChurch3/";
9270
+ ext = "jpg";
9271
+ reverseUP = false;
9272
+ break;
9273
+ case 7:
9274
+ name = "cubemaps/Sodermalmsallen/";
9275
+ ext = "jpg";
9276
+ reverseUP = false;
9277
+ break;
9278
+ case 8:
9279
+ name = "cubemaps/Sodermalmsallen2/";
9280
+ ext = "jpg";
9281
+ reverseUP = false;
9282
+ break;
9283
+ case 9:
9284
+ name = "cubemaps/UnionSquare/";
9285
+ ext = "jpg";
9286
+ reverseUP = false;
9287
+ break;
92399288 default:
9240
- name = "cubemaps/rgb_";
9241
- ext = "png"; /*mipmap = true;*/ reverseUP = false;
9289
+ name = "cubemaps/box/";
9290
+ ext = "png"; /*mipmap = true;*/
9291
+ reverseUP = false;
92429292 break;
92439293 }
9244
-
9245
- try
9246
- {
9247
- cubemap = LoadCubemap(getClass().getClassLoader(), name, ext, mipmap);
9248
- } catch (IOException e)
9249
- {
9250
- throw new RuntimeException(e);
9251
- }
9294
+
9295
+ LoadSkybox(name, ext, mipmap);
92529296 }
92539297
92549298 public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height)
....@@ -9280,8 +9324,12 @@
92809324 static double[] model = new double[16];
92819325 double[] camera2light = new double[16];
92829326 double[] light2camera = new double[16];
9283
- int newenvy = -1;
9284
- boolean envyoff = true; // false;
9327
+
9328
+ //int newenvy = -1;
9329
+ //boolean envyoff = false;
9330
+
9331
+ String loadedskyboxname;
9332
+
92859333 cVector light0 = new cVector(0, 0, 0); // 1,3,2);
92869334 //float[] light0 = { 0,0,0 };
92879335 cVector dirlight = new cVector(0, 0, 1); // 1,3,2);
....@@ -9699,7 +9747,7 @@
96999747
97009748 if (renderCamera != lightCamera)
97019749 //for (int count = parentcam.GetTransformCount(); --count>=0;)
9702
- LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
9750
+ LA.matConcat(matrix, parentcam.GlobalTransformInv(), matrix);
97039751
97049752 // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix);
97059753
....@@ -9715,7 +9763,7 @@
97159763
97169764 if (renderCamera != lightCamera)
97179765 //for (int count = parentcam.GetTransformCount(); --count>=0;)
9718
- LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
9766
+ LA.matConcat(parentcam.GlobalTransform(), matrix, matrix);
97199767
97209768 // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix);
97219769
....@@ -9761,10 +9809,12 @@
97619809 rati = 1 / rati;
97629810 gl.glOrtho(-skyscale / rati, skyscale / rati, -skyscale, skyscale, 0.001, 1000);
97639811 }
9764
- assert (newenvy == -1);
9812
+
9813
+ //assert (newenvy == -1);
9814
+
97659815 gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB);
97669816 gl.glDisable(GL.GL_VERTEX_PROGRAM_ARB);
9767
- DrawSkyBox(gl);
9817
+ DrawSkyBox(gl, (float)rati);
97689818 gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB);
97699819 gl.glEnable(GL.GL_VERTEX_PROGRAM_ARB);
97709820 accPerspective(gl, renderCamera.shaper_fovy / ratio,
....@@ -10801,7 +10851,7 @@
1080110851
1080210852 if (wait)
1080310853 {
10804
- Sleep(500);
10854
+ Sleep(200); // blocks everything
1080510855
1080610856 wait = false;
1080710857 }
....@@ -10916,7 +10966,7 @@
1091610966 // if (parentcam != renderCamera) // not a light
1091710967 if (cam != lightCamera)
1091810968 //for (int count = parentcam.GetTransformCount(); --count>=0;)
10919
- LA.matConcat(matrix, parentcam.GlobalTransform(), matrix);
10969
+ LA.matConcat(matrix, parentcam.GlobalTransformInv(), matrix);
1092010970
1092110971 for (int j = 0; j < 4; j++)
1092210972 {
....@@ -10931,7 +10981,7 @@
1093110981 // if (parentcam != renderCamera) // not a light
1093210982 if (cam != lightCamera)
1093310983 //for (int count = parentcam.GetTransformCount(); --count>=0;)
10934
- LA.matConcat(parentcam.GlobalTransformInv(), matrix, matrix);
10984
+ LA.matConcat(parentcam.GlobalTransform(), matrix, matrix);
1093510985
1093610986 //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix);
1093710987
....@@ -11017,13 +11067,27 @@
1101711067 gl.glOrtho(-skyscale / ratio, skyscale / ratio, -skyscale, skyscale, 0.001, 1000);
1101811068 }
1101911069
11020
- if (newenvy > -1)
11070
+// if (newenvy > -1)
11071
+// {
11072
+// LoadEnvy(newenvy);
11073
+// }
11074
+//
11075
+// newenvy = -1;
11076
+
11077
+ if (object.skyboxname != null)
1102111078 {
11022
- LoadEnvy(newenvy);
11079
+ if (!object.skyboxname.equals(this.loadedskyboxname))
11080
+ {
11081
+ LoadSkybox(object.skyboxname + "/", object.skyboxext, false);
11082
+ loadedskyboxname = object.skyboxname;
11083
+ }
1102311084 }
11024
-
11025
- newenvy = -1;
11026
-
11085
+ else
11086
+ {
11087
+ cubemap = null;
11088
+ loadedskyboxname = null;
11089
+ }
11090
+
1102711091 ratio = ((double) getWidth()) / getHeight();
1102811092 //System.out.println("ratio = " + ratio);
1102911093
....@@ -11039,7 +11103,7 @@
1103911103
1104011104 if (!IsFrozen() && !ambientOcclusion)
1104111105 {
11042
- DrawSkyBox(gl);
11106
+ DrawSkyBox(gl, (float)ratio);
1104311107 }
1104411108
1104511109 //if (selection_view == -1)
....@@ -11325,7 +11389,7 @@
1132511389
1132611390 // if (cam != lightCamera)
1132711391 //for (int count = parentcam.GetTransformCount(); --count>=0;)
11328
- LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013
11392
+ LA.xformDir(lightposition, parentcam.GlobalTransformInv(), lightposition); // may 2013
1132911393 }
1133011394
1133111395 LA.xformDir(lightposition, cam.toScreen, lightposition);
....@@ -12399,51 +12463,74 @@
1239912463
1240012464 //gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 127, lightParams, 0);
1240112465
12402
- String program =
12466
+ String programmin =
1240312467 // Min shader
1240412468 "!!ARBfp1.0\n" +
12405
- "PARAM zero123 = { 0.0, 1.0, 2.0, 1.25 };" +
12469
+ "PARAM zero123 = { 0.0, 1.0, 2, 1.25 };" +
1240612470 "PARAM pow2 = { 0.5, 0.25, 0.125, 0.0 };" +
1240712471 "PARAM one = { 1.0, 1.0, 1.0, 1.0 };" +
1240812472 "PARAM eps = { 0.001, 0.001, 0.001, 1.0 };" +
1240912473 "PARAM infinity = { 100000000, 100000000, 100000000, 1.0 };" +
12474
+ "PARAM light2cam0 = program.env[10];" +
12475
+ "PARAM light2cam1 = program.env[11];" +
12476
+ "PARAM light2cam2 = program.env[12];" +
1241012477 "TEMP temp;" +
1241112478 "TEMP light;" +
1241212479 "TEMP ndotl;" +
1241312480 "TEMP normal;" +
1241412481 "TEMP depth;" +
12482
+ "TEMP eye;" +
12483
+ "TEMP pos;" +
1241512484
1241612485 "MAD normal, fragment.color, zero123.z, -zero123.y;" +
12417
-
12486
+ Normalize("normal") +
1241812487 "MOV light, state.light[0].position;" +
1241912488 "DP3 ndotl.x, light, normal;" +
1242012489
1242112490 // shadow
12422
- "MOV temp, fragment.texcoord[1];" +
12423
- TextureFetch("depth", "temp", "1") +
12491
+ "MOV pos, fragment.texcoord[1];" +
12492
+ "MOV temp, pos;" +
12493
+ ShadowTextureFetch("depth", "temp", "1") +
1242412494 //"TEX depth, fragment.texcoord[1], texture[1], 2D;" +
12425
- "SLT temp.x, fragment.texcoord[1].z, depth.z;" +
12426
-
12495
+ "SLT ndotl.z, fragment.texcoord[1].z, depth.z;" +
1242712496
1242812497 // No shadow when out of frustum
1242912498 //"SGE temp.y, depth.z, zero123.y;" +
1243012499 //"LRP temp.x, temp.y, zero123.y, temp.x;" +
1243112500
12432
- "MUL ndotl.x, ndotl.x, temp.x;" +
12433
- "MAX ndotl.x, ndotl.x, pow2.y;" +
12501
+ "MUL ndotl.x, ndotl.x, ndotl.z;" + // Shadow
1243412502
12503
+ // Backlit
12504
+ "MOV pos.w, zero123.y;" +
12505
+ "DP4 eye.x, pos, light2cam0;" +
12506
+ "DP4 eye.y, pos, light2cam1;" +
12507
+ "DP4 eye.z, pos, light2cam2;" +
12508
+ Normalize("eye") +
12509
+
12510
+ "DP3 ndotl.y, -eye, normal;" +
12511
+ //"MUL ndotl.y, ndotl.y, pow2.x;" +
12512
+ "POW ndotl.y, ndotl.y, pow2.z;" + // backlit
12513
+ "SUB ndotl.y, zero123.y, ndotl.y;" +
12514
+ //"SUB ndotl.y, zero123.y, ndotl.y;" +
12515
+ //"MUL ndotl.y, ndotl.y, pow2.z;" +
12516
+
12517
+ //"MAX ndotl.x, ndotl.x, ndotl.y;" + // Ambient
12518
+ //"MAX ndotl.x, ndotl.x, pow2.y;" + // Ambient
12519
+
12520
+ // Pigment
1243512521 "TEX temp, fragment.texcoord[0], texture[0], 2D;" +
1243612522 "LRP temp, zero123.w, temp, one;" + // texture proportion
1243712523 "MUL temp, temp, ndotl.x;" +
1243812524
1243912525 "MUL temp, temp, zero123.z;" +
1244012526
12441
- "MOV temp.w, zero123.y;" + // reset alpha
12527
+ //"MUL temp, temp, ndotl.y;" +
1244212528
12529
+ "MOV temp.w, zero123.y;" + // reset alpha
1244312530 "MOV result.color, temp;" +
1244412531 "END";
1244512532
12446
- String program2 =
12533
+ String programmax =
1244712534 "!!ARBfp1.0\n" +
1244812535
1244912536 //"OPTION ARB_fragment_program_shadow;" +
....@@ -12581,20 +12668,20 @@
1258112668 "MUL temp, floor, mapgrid.x;" +
1258212669 //"TEX depth0, temp, texture[1], 2D;" +
1258312670 (((mode & FP_SOFTSHADOW) == 0) ? "" :
12584
- TextureFetch("depth0", "temp", "1") +
12671
+ ShadowTextureFetch("depth0", "temp", "1") +
1258512672 "") +
1258612673 "ADD temp.x, temp.x, mapgrid.x;" +
1258712674 //"TEX depth1, temp, texture[1], 2D;" +
1258812675 (((mode & FP_SOFTSHADOW) == 0) ? "" :
12589
- TextureFetch("depth1", "temp", "1") +
12676
+ ShadowTextureFetch("depth1", "temp", "1") +
1259012677 "") +
1259112678 "ADD temp.y, temp.y, mapgrid.x;" +
1259212679 //"TEX depth2, temp, texture[1], 2D;" +
12593
- TextureFetch("depth2", "temp", "1") +
12680
+ ShadowTextureFetch("depth2", "temp", "1") +
1259412681 "SUB temp.x, temp.x, mapgrid.x;" +
1259512682 //"TEX depth3, temp, texture[1], 2D;" +
1259612683 (((mode & FP_SOFTSHADOW) == 0) ? "" :
12597
- TextureFetch("depth3", "temp", "1") +
12684
+ ShadowTextureFetch("depth3", "temp", "1") +
1259812685 "") +
1259912686 //"MUL texSamp0, texSamp0, state.material.front.diffuse;" +
1260012687 //"MOV params, material;" +
....@@ -12968,7 +13055,7 @@
1296813055 // display shadow only (fakedepth == 0)
1296913056 "SUB temp.x, half.x, shadow.x;" +
1297013057 "MOV temp.y, -params5.z;" + // params6.x;" +
12971
- "SLT temp.z, temp.y, -one2048th.x;" +
13058
+ "SLT temp.z, temp.y, -c256i.x;" +
1297213059 "SUB temp.y, one.x, temp.z;" +
1297313060 "MUL temp.x, temp.x, temp.y;" +
1297413061 "KIL temp.x;" +
....@@ -13299,6 +13386,13 @@
1329913386 //once = true;
1330013387 }
1330113388
13389
+ String program = programmax;
13390
+
13391
+ if (Globals.MINSHADER)
13392
+ {
13393
+ program = programmin;
13394
+ }
13395
+
1330213396 System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
1330313397 System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
1330413398 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
....@@ -13392,7 +13486,8 @@
1339213486 return out;
1339313487 }
1339413488
13395
- String TextureFetch(String dest, String src, String unit)
13489
+ // Also does frustum culling
13490
+ String ShadowTextureFetch(String dest, String src, String unit)
1339613491 {
1339713492 return "TEX " + dest + ", " + src + ", texture[" + unit + "], 2D;" +
1339813493 "SGE " + src + ".w, " + src + ".x, eps.x;" +
....@@ -14547,9 +14642,9 @@
1454714642 MODIFIERS |= COMMAND;
1454814643 /**/
1454914644 if((mod&SHIFT) == SHIFT)
14550
- manipCamera.RotatePosition(0, -speed);
14551
- else
1455214645 manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14646
+ else
14647
+ manipCamera.RotatePosition(0, -speed);
1455314648 /**/
1455414649 if ((mod & SHIFT) == SHIFT)
1455514650 {
....@@ -14568,9 +14663,9 @@
1456814663 MODIFIERS |= COMMAND;
1456914664 /**/
1457014665 if((mod&SHIFT) == SHIFT)
14571
- manipCamera.RotatePosition(0, speed);
14572
- else
1457314666 manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14667
+ else
14668
+ manipCamera.RotatePosition(0, speed);
1457414669 /**/
1457514670 if ((mod & SHIFT) == SHIFT)
1457614671 {
....@@ -15291,20 +15386,24 @@
1529115386 OCCLUSION_CULLING ^= true;
1529215387 System.out.println("OCCLUSION CULLING = " + OCCLUSION_CULLING);
1529315388 break;
15294
- case '0': envyoff ^= true; repaint(); break;
15389
+ //case '0': envyoff ^= true; repaint(); break;
1529515390 case '1':
1529615391 case '2':
1529715392 case '3':
1529815393 case '4':
1529915394 case '5':
15300
- newenvy = Character.getNumericValue(key);
15301
- repaint();
15302
- break;
1530315395 case '6':
1530415396 case '7':
1530515397 case '8':
1530615398 case '9':
15307
- BGcolor = (key - '6')/3.f;
15399
+ if (true) // envyoff)
15400
+ {
15401
+ BGcolor = (key - '1')/8.f;
15402
+ }
15403
+ else
15404
+ {
15405
+ //newenvy = Character.getNumericValue(key);
15406
+ }
1530815407 repaint();
1530915408 break;
1531015409 case '!':
....@@ -16009,7 +16108,7 @@
1600916108 gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
1601016109 break;
1601116110 case Object3D.hitScale: gr.setColor(Color.cyan);
16012
- gr.drawLine(X, Y, 0, 0);
16111
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
1601316112 break;
1601416113 }
1601516114
....@@ -16495,6 +16594,8 @@
1649516594 private /*static*/ boolean firstime;
1649616595 private /*static*/ cVector newView = new cVector();
1649716596 private static final String[] suffixes = {"posx", "negx", "posy", "negy", "posz", "negz"};
16597
+ private static final String[] suffixes2 = {"east", "west", "top", "bottom", "north", "south"};
16598
+ private static final String[] suffixes3 = {"ft", "bk", "up", "dn", "rt", "lf"};
1649816599 private static final int[] targets = {GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X,
1649916600 GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
1650016601 GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
....@@ -16507,29 +16608,67 @@
1650716608 {
1650816609 com.sun.opengl.util.texture.Texture cubemap = TextureIO.newTexture(GL.GL_TEXTURE_CUBE_MAP);
1650916610
16611
+ int usedsuf = 0;
16612
+
1651016613 for (int i = 0; i < suffixes.length; i++)
1651116614 {
16512
- String resourceName = basename + suffixes[i] + "." + suffix;
16513
- TextureData data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName),
16514
- mipmapped,
16515
- FileUtil.getFileSuffix(resourceName));
16516
- if (data == null)
16615
+ String[] suffixe = suffixes;
16616
+ String[] fallback = suffixes2;
16617
+ String[] fallfallback = suffixes3;
16618
+
16619
+ for (int c=usedsuf; --c>=0;)
1651716620 {
16518
- throw new IOException("Unable to load texture " + resourceName);
16621
+// String[] temp = suffixe;
16622
+// suffixe = fallback;
16623
+// fallback = fallfallback;
16624
+// fallfallback = temp;
1651916625 }
16626
+
16627
+ String resourceName = basename + suffixe[i] + "." + suffix;
16628
+ TextureData data;
16629
+
16630
+ try
16631
+ {
16632
+ data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName),
16633
+ mipmapped,
16634
+ FileUtil.getFileSuffix(resourceName));
16635
+ }
16636
+ catch (Exception e)
16637
+ {
16638
+ try
16639
+ {
16640
+ resourceName = basename + fallback[i] + "." + suffix;
16641
+ data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName),
16642
+ mipmapped,
16643
+ FileUtil.getFileSuffix(resourceName));
16644
+ }
16645
+ catch (Exception e2)
16646
+ {
16647
+ resourceName = basename + fallfallback[i] + "." + suffix;
16648
+ data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName),
16649
+ mipmapped,
16650
+ FileUtil.getFileSuffix(resourceName));
16651
+ }
16652
+ }
16653
+
1652016654 //System.out.println("Target = " + targets[i]);
1652116655 cubemap.updateImage(data, targets[i]);
1652216656 }
1652316657
1652416658 return cubemap;
1652516659 }
16660
+
1652616661 int bigsphere = -1;
1652716662
1652816663 float BGcolor = 0.5f;
1652916664
16530
- private void DrawSkyBox(GL gl)
16665
+ float ambientLight[] = {1f, 1f, 1f, 1.0f};
16666
+
16667
+ private void DrawSkyBox(GL gl, float ratio)
1653116668 {
16532
- if (envyoff || cubemap == null)
16669
+ if (//envyoff ||
16670
+ WIREFRAME ||
16671
+ cubemap == null)
1653316672 {
1653416673 gl.glClearColor(BGcolor, BGcolor, BGcolor, 1);
1653516674 gl.glClear(gl.GL_COLOR_BUFFER_BIT);
....@@ -16544,7 +16683,17 @@
1654416683 // Compensates for ExaminerViewer's modification of modelview matrix
1654516684 gl.glMatrixMode(GL.GL_MODELVIEW);
1654616685 gl.glLoadIdentity();
16686
+ gl.glScalef(1,ratio,1);
1654716687
16688
+// colorV[0] = 2;
16689
+// colorV[1] = 2;
16690
+// colorV[2] = 2;
16691
+// colorV[3] = 1;
16692
+// gl.glDisable(gl.GL_COLOR_MATERIAL);
16693
+// gl.glMaterialfv(gl.GL_FRONT_AND_BACK, gl.GL_AMBIENT, colorV, 0);
16694
+//
16695
+// gl.glLightModelfv(gl.GL_LIGHT_MODEL_AMBIENT, ambientLight, 0);
16696
+
1654816697 //gl.glActiveTexture(GL.GL_TEXTURE1);
1654916698 //gl.glDisable(GL.GL_TEXTURE_CUBE_MAP);
1655016699
....@@ -16576,6 +16725,7 @@
1657616725 {
1657716726 gl.glScalef(1.0f, -1.0f, 1.0f);
1657816727 }
16728
+ gl.glScalef(-1.0f, 1.0f, 1.0f);
1657916729 gl.glMultMatrixd(viewrot_1, 0);
1658016730 gl.glTranslatef(0, 0, 0.5f); // (float)lightCamera.Distance()); // 0.5f);
1658116731 //viewer.updateInverseRotation(gl);
....@@ -16834,7 +16984,7 @@
1683416984 //new Exception().printStackTrace();
1683516985 System.out.println("select buffer init");
1683616986 // Use debug pipeline
16837
- drawable.setGL(new DebugGL(drawable.getGL()));
16987
+ //drawable.setGL(new DebugGL(drawable.getGL()));
1683816988
1683916989 GL gl = drawable.getGL();
1684016990