.. | .. |
---|
8358 | 8358 | // else |
---|
8359 | 8359 | // if (!texname.startsWith("/")) |
---|
8360 | 8360 | // texname = "/Users/nbriere/Textures/" + texname; |
---|
8361 | | - if (!FileExists(texname)) |
---|
| 8361 | + if (!FileExists(texname) && !texname.startsWith("@")) |
---|
8362 | 8362 | { |
---|
8363 | 8363 | texname = fallbackTextureName; |
---|
8364 | 8364 | } |
---|
.. | .. |
---|
8441 | 8441 | new Exception().printStackTrace(); |
---|
8442 | 8442 | } else |
---|
8443 | 8443 | { |
---|
| 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 | + { |
---|
8444 | 8453 | if (textureon) |
---|
8445 | 8454 | { |
---|
8446 | 8455 | String cachename = texname; |
---|
.. | .. |
---|
8500 | 8509 | texturecache = new CacheTexture(texturedata,resolution); |
---|
8501 | 8510 | //texture = GetTexture(tex, bump); |
---|
8502 | 8511 | } |
---|
| 8512 | + } |
---|
8503 | 8513 | } |
---|
8504 | 8514 | //} |
---|
8505 | 8515 | } |
---|
.. | .. |
---|
9316 | 9326 | double[] light2camera = new double[16]; |
---|
9317 | 9327 | |
---|
9318 | 9328 | //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; |
---|
9323 | 9332 | |
---|
9324 | 9333 | cVector light0 = new cVector(0, 0, 0); // 1,3,2); |
---|
9325 | 9334 | //float[] light0 = { 0,0,0 }; |
---|
.. | .. |
---|
10842 | 10851 | |
---|
10843 | 10852 | if (wait) |
---|
10844 | 10853 | { |
---|
10845 | | - Sleep(500); |
---|
| 10854 | + Sleep(200); // blocks everything |
---|
10846 | 10855 | |
---|
10847 | 10856 | wait = false; |
---|
10848 | 10857 | } |
---|
.. | .. |
---|
11065 | 11074 | // |
---|
11066 | 11075 | // newenvy = -1; |
---|
11067 | 11076 | |
---|
11068 | | - if (!skyboxname.equals(this.loadedskyboxname)) |
---|
| 11077 | + if (object.skyboxname != null) |
---|
11069 | 11078 | { |
---|
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; |
---|
11072 | 11089 | } |
---|
11073 | 11090 | |
---|
11074 | 11091 | ratio = ((double) getWidth()) / getHeight(); |
---|
.. | .. |
---|
11372 | 11389 | |
---|
11373 | 11390 | // if (cam != lightCamera) |
---|
11374 | 11391 | //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 |
---|
11376 | 11393 | } |
---|
11377 | 11394 | |
---|
11378 | 11395 | LA.xformDir(lightposition, cam.toScreen, lightposition); |
---|
.. | .. |
---|
12446 | 12463 | |
---|
12447 | 12464 | //gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 127, lightParams, 0); |
---|
12448 | 12465 | |
---|
12449 | | - String program0 = |
---|
| 12466 | + String programmin = |
---|
12450 | 12467 | // Min shader |
---|
12451 | 12468 | "!!ARBfp1.0\n" + |
---|
12452 | 12469 | "PARAM zero123 = { 0.0, 1.0, 2, 1.25 };" + |
---|
.. | .. |
---|
12513 | 12530 | "MOV result.color, temp;" + |
---|
12514 | 12531 | "END"; |
---|
12515 | 12532 | |
---|
12516 | | - String program = |
---|
| 12533 | + String programmax = |
---|
12517 | 12534 | "!!ARBfp1.0\n" + |
---|
12518 | 12535 | |
---|
12519 | 12536 | //"OPTION ARB_fragment_program_shadow;" + |
---|
.. | .. |
---|
13369 | 13386 | //once = true; |
---|
13370 | 13387 | } |
---|
13371 | 13388 | |
---|
| 13389 | + String program = programmax; |
---|
| 13390 | + |
---|
| 13391 | + if (Globals.MINSHADER) |
---|
| 13392 | + { |
---|
| 13393 | + program = programmin; |
---|
| 13394 | + } |
---|
| 13395 | + |
---|
13372 | 13396 | System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
13373 | 13397 | System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
13374 | 13398 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
.. | .. |
---|
14618 | 14642 | MODIFIERS |= COMMAND; |
---|
14619 | 14643 | /**/ |
---|
14620 | 14644 | if((mod&SHIFT) == SHIFT) |
---|
14621 | | - manipCamera.RotatePosition(0, -speed); |
---|
14622 | | - else |
---|
14623 | 14645 | manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14646 | + else |
---|
| 14647 | + manipCamera.RotatePosition(0, -speed); |
---|
14624 | 14648 | /**/ |
---|
14625 | 14649 | if ((mod & SHIFT) == SHIFT) |
---|
14626 | 14650 | { |
---|
.. | .. |
---|
14639 | 14663 | MODIFIERS |= COMMAND; |
---|
14640 | 14664 | /**/ |
---|
14641 | 14665 | if((mod&SHIFT) == SHIFT) |
---|
14642 | | - manipCamera.RotatePosition(0, speed); |
---|
14643 | | - else |
---|
14644 | 14666 | manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14667 | + else |
---|
| 14668 | + manipCamera.RotatePosition(0, speed); |
---|
14645 | 14669 | /**/ |
---|
14646 | 14670 | if ((mod & SHIFT) == SHIFT) |
---|
14647 | 14671 | { |
---|
.. | .. |
---|
15362 | 15386 | OCCLUSION_CULLING ^= true; |
---|
15363 | 15387 | System.out.println("OCCLUSION CULLING = " + OCCLUSION_CULLING); |
---|
15364 | 15388 | break; |
---|
15365 | | - case '0': envyoff ^= true; repaint(); break; |
---|
| 15389 | + //case '0': envyoff ^= true; repaint(); break; |
---|
15366 | 15390 | case '1': |
---|
15367 | 15391 | case '2': |
---|
15368 | 15392 | case '3': |
---|
.. | .. |
---|
15372 | 15396 | case '7': |
---|
15373 | 15397 | case '8': |
---|
15374 | 15398 | case '9': |
---|
15375 | | - if (envyoff) |
---|
| 15399 | + if (true) // envyoff) |
---|
15376 | 15400 | { |
---|
15377 | 15401 | BGcolor = (key - '1')/8.f; |
---|
15378 | 15402 | } |
---|
.. | .. |
---|
16084 | 16108 | gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
16085 | 16109 | break; |
---|
16086 | 16110 | 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); |
---|
16088 | 16112 | break; |
---|
16089 | 16113 | } |
---|
16090 | 16114 | |
---|
.. | .. |
---|
16633 | 16657 | |
---|
16634 | 16658 | return cubemap; |
---|
16635 | 16659 | } |
---|
| 16660 | + |
---|
16636 | 16661 | int bigsphere = -1; |
---|
16637 | 16662 | |
---|
16638 | 16663 | float BGcolor = 0.5f; |
---|
.. | .. |
---|
16641 | 16666 | |
---|
16642 | 16667 | private void DrawSkyBox(GL gl, float ratio) |
---|
16643 | 16668 | { |
---|
16644 | | - if (envyoff || cubemap == null) |
---|
| 16669 | + if (//envyoff || |
---|
| 16670 | + cubemap == null) |
---|
16645 | 16671 | { |
---|
16646 | 16672 | gl.glClearColor(BGcolor, BGcolor, BGcolor, 1); |
---|
16647 | 16673 | gl.glClear(gl.GL_COLOR_BUFFER_BIT); |
---|
.. | .. |
---|
16658 | 16684 | gl.glLoadIdentity(); |
---|
16659 | 16685 | gl.glScalef(1,ratio,1); |
---|
16660 | 16686 | |
---|
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); |
---|
16669 | 16695 | |
---|
16670 | 16696 | //gl.glActiveTexture(GL.GL_TEXTURE1); |
---|
16671 | 16697 | //gl.glDisable(GL.GL_TEXTURE_CUBE_MAP); |
---|
.. | .. |
---|
16679 | 16705 | // GL_NORMAL_MAP texgen mode. Temporarily enabling lighting |
---|
16680 | 16706 | // causes the normals to be sent down. Thanks to Ken Dyke. |
---|
16681 | 16707 | //gl.glEnable(GL.GL_LIGHTING); |
---|
16682 | | - gl.glEnable(GL.GL_LIGHTING); |
---|
| 16708 | + gl.glDisable(GL.GL_LIGHTING); |
---|
16683 | 16709 | |
---|
16684 | 16710 | gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP); |
---|
16685 | 16711 | gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_NORMAL_MAP); |
---|