Normand Briere
2019-08-09 912749d2520afedd9b56458d771400c261fe2b88
CameraPane.java
....@@ -8358,7 +8358,7 @@
83588358 // else
83598359 // if (!texname.startsWith("/"))
83608360 // texname = "/Users/nbriere/Textures/" + texname;
8361
- if (!FileExists(texname))
8361
+ if (!FileExists(texname) && !texname.startsWith("@"))
83628362 {
83638363 texname = fallbackTextureName;
83648364 }
....@@ -8441,6 +8441,15 @@
84418441 new Exception().printStackTrace();
84428442 } else
84438443 {
8444
+ if (texname.startsWith("@"))
8445
+ {
8446
+ // texturecache = textures.get(texname); // suspicious
8447
+ if (texturecache == null)
8448
+ texturecache = new CacheTexture(GetResourceTexture(texname.substring(1), bump),resolution);
8449
+ else
8450
+ new Exception().printStackTrace();
8451
+ } else
8452
+ {
84448453 if (textureon)
84458454 {
84468455 String cachename = texname;
....@@ -8500,6 +8509,7 @@
85008509 texturecache = new CacheTexture(texturedata,resolution);
85018510 //texture = GetTexture(tex, bump);
85028511 }
8512
+ }
85038513 }
85048514 //}
85058515 }
....@@ -9316,10 +9326,9 @@
93169326 double[] light2camera = new double[16];
93179327
93189328 //int newenvy = -1;
9319
- boolean envyoff = true; // false;
9320
- String skyboxname = "";
9321
- String skyboxext;
9322
- String loadedskyboxname = "";
9329
+ //boolean envyoff = false;
9330
+
9331
+ String loadedskyboxname;
93239332
93249333 cVector light0 = new cVector(0, 0, 0); // 1,3,2);
93259334 //float[] light0 = { 0,0,0 };
....@@ -10842,7 +10851,7 @@
1084210851
1084310852 if (wait)
1084410853 {
10845
- Sleep(500);
10854
+ Sleep(200); // blocks everything
1084610855
1084710856 wait = false;
1084810857 }
....@@ -11065,10 +11074,18 @@
1106511074 //
1106611075 // newenvy = -1;
1106711076
11068
- if (!skyboxname.equals(this.loadedskyboxname))
11077
+ if (object.skyboxname != null)
1106911078 {
11070
- LoadSkybox(skyboxname + "/", skyboxext, false);
11071
- loadedskyboxname = skyboxname;
11079
+ if (!object.skyboxname.equals(this.loadedskyboxname))
11080
+ {
11081
+ LoadSkybox(object.skyboxname + "/", object.skyboxext, false);
11082
+ loadedskyboxname = object.skyboxname;
11083
+ }
11084
+ }
11085
+ else
11086
+ {
11087
+ cubemap = null;
11088
+ loadedskyboxname = null;
1107211089 }
1107311090
1107411091 ratio = ((double) getWidth()) / getHeight();
....@@ -11372,7 +11389,7 @@
1137211389
1137311390 // if (cam != lightCamera)
1137411391 //for (int count = parentcam.GetTransformCount(); --count>=0;)
11375
- LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013
11392
+ LA.xformDir(lightposition, parentcam.GlobalTransformInv(), lightposition); // may 2013
1137611393 }
1137711394
1137811395 LA.xformDir(lightposition, cam.toScreen, lightposition);
....@@ -12446,7 +12463,7 @@
1244612463
1244712464 //gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 127, lightParams, 0);
1244812465
12449
- String program0 =
12466
+ String programmin =
1245012467 // Min shader
1245112468 "!!ARBfp1.0\n" +
1245212469 "PARAM zero123 = { 0.0, 1.0, 2, 1.25 };" +
....@@ -12513,7 +12530,7 @@
1251312530 "MOV result.color, temp;" +
1251412531 "END";
1251512532
12516
- String program =
12533
+ String programmax =
1251712534 "!!ARBfp1.0\n" +
1251812535
1251912536 //"OPTION ARB_fragment_program_shadow;" +
....@@ -13369,6 +13386,13 @@
1336913386 //once = true;
1337013387 }
1337113388
13389
+ String program = programmax;
13390
+
13391
+ if (Globals.MINSHADER)
13392
+ {
13393
+ program = programmin;
13394
+ }
13395
+
1337213396 System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
1337313397 System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
1337413398 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
....@@ -14618,9 +14642,9 @@
1461814642 MODIFIERS |= COMMAND;
1461914643 /**/
1462014644 if((mod&SHIFT) == SHIFT)
14621
- manipCamera.RotatePosition(0, -speed);
14622
- else
1462314645 manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14646
+ else
14647
+ manipCamera.RotatePosition(0, -speed);
1462414648 /**/
1462514649 if ((mod & SHIFT) == SHIFT)
1462614650 {
....@@ -14639,9 +14663,9 @@
1463914663 MODIFIERS |= COMMAND;
1464014664 /**/
1464114665 if((mod&SHIFT) == SHIFT)
14642
- manipCamera.RotatePosition(0, speed);
14643
- else
1464414666 manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14667
+ else
14668
+ manipCamera.RotatePosition(0, speed);
1464514669 /**/
1464614670 if ((mod & SHIFT) == SHIFT)
1464714671 {
....@@ -15362,7 +15386,7 @@
1536215386 OCCLUSION_CULLING ^= true;
1536315387 System.out.println("OCCLUSION CULLING = " + OCCLUSION_CULLING);
1536415388 break;
15365
- case '0': envyoff ^= true; repaint(); break;
15389
+ //case '0': envyoff ^= true; repaint(); break;
1536615390 case '1':
1536715391 case '2':
1536815392 case '3':
....@@ -15372,7 +15396,7 @@
1537215396 case '7':
1537315397 case '8':
1537415398 case '9':
15375
- if (envyoff)
15399
+ if (true) // envyoff)
1537615400 {
1537715401 BGcolor = (key - '1')/8.f;
1537815402 }
....@@ -16084,7 +16108,7 @@
1608416108 gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
1608516109 break;
1608616110 case Object3D.hitScale: gr.setColor(Color.cyan);
16087
- gr.drawLine(X, Y, 0, 0);
16111
+ gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2);
1608816112 break;
1608916113 }
1609016114
....@@ -16633,6 +16657,7 @@
1663316657
1663416658 return cubemap;
1663516659 }
16660
+
1663616661 int bigsphere = -1;
1663716662
1663816663 float BGcolor = 0.5f;
....@@ -16641,7 +16666,8 @@
1664116666
1664216667 private void DrawSkyBox(GL gl, float ratio)
1664316668 {
16644
- if (envyoff || cubemap == null)
16669
+ if (//envyoff ||
16670
+ cubemap == null)
1664516671 {
1664616672 gl.glClearColor(BGcolor, BGcolor, BGcolor, 1);
1664716673 gl.glClear(gl.GL_COLOR_BUFFER_BIT);
....@@ -16658,14 +16684,14 @@
1665816684 gl.glLoadIdentity();
1665916685 gl.glScalef(1,ratio,1);
1666016686
16661
- colorV[0] = 2;
16662
- colorV[1] = 2;
16663
- colorV[2] = 2;
16664
- colorV[3] = 1;
16665
- gl.glDisable(gl.GL_COLOR_MATERIAL);
16666
- gl.glMaterialfv(gl.GL_FRONT_AND_BACK, gl.GL_AMBIENT, colorV, 0);
16667
-
16668
- gl.glLightModelfv(gl.GL_LIGHT_MODEL_AMBIENT, ambientLight, 0);
16687
+// colorV[0] = 2;
16688
+// colorV[1] = 2;
16689
+// colorV[2] = 2;
16690
+// colorV[3] = 1;
16691
+// gl.glDisable(gl.GL_COLOR_MATERIAL);
16692
+// gl.glMaterialfv(gl.GL_FRONT_AND_BACK, gl.GL_AMBIENT, colorV, 0);
16693
+//
16694
+// gl.glLightModelfv(gl.GL_LIGHT_MODEL_AMBIENT, ambientLight, 0);
1666916695
1667016696 //gl.glActiveTexture(GL.GL_TEXTURE1);
1667116697 //gl.glDisable(GL.GL_TEXTURE_CUBE_MAP);
....@@ -16679,7 +16705,7 @@
1667916705 // GL_NORMAL_MAP texgen mode. Temporarily enabling lighting
1668016706 // causes the normals to be sent down. Thanks to Ken Dyke.
1668116707 //gl.glEnable(GL.GL_LIGHTING);
16682
- gl.glEnable(GL.GL_LIGHTING);
16708
+ gl.glDisable(GL.GL_LIGHTING);
1668316709
1668416710 gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP);
1668516711 gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP);