.. | .. |
---|
187 | 187 | } |
---|
188 | 188 | |
---|
189 | 189 | 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 | + } |
---|
190 | 202 | |
---|
191 | 203 | void SetAsGLRenderer(boolean b) |
---|
192 | 204 | { |
---|
.. | .. |
---|
1485 | 1497 | gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z); |
---|
1486 | 1498 | } |
---|
1487 | 1499 | |
---|
| 1500 | + float[] colorV = new float[4]; |
---|
| 1501 | + |
---|
1488 | 1502 | void SetColor(Object3D obj, Vertex p0) |
---|
1489 | 1503 | { |
---|
1490 | 1504 | CameraPane display = this; |
---|
.. | .. |
---|
1552 | 1566 | { |
---|
1553 | 1567 | return; |
---|
1554 | 1568 | } |
---|
1555 | | - |
---|
1556 | | - float[] colorV = new float[3]; |
---|
1557 | 1569 | |
---|
1558 | 1570 | if (false) // marked) |
---|
1559 | 1571 | { |
---|
.. | .. |
---|
8346 | 8358 | // else |
---|
8347 | 8359 | // if (!texname.startsWith("/")) |
---|
8348 | 8360 | // texname = "/Users/nbriere/Textures/" + texname; |
---|
8349 | | - if (!FileExists(texname)) |
---|
| 8361 | + if (!FileExists(texname) && !texname.startsWith("@")) |
---|
8350 | 8362 | { |
---|
8351 | 8363 | texname = fallbackTextureName; |
---|
8352 | 8364 | } |
---|
.. | .. |
---|
8429 | 8441 | new Exception().printStackTrace(); |
---|
8430 | 8442 | } else |
---|
8431 | 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 | + { |
---|
8432 | 8453 | if (textureon) |
---|
8433 | 8454 | { |
---|
8434 | 8455 | String cachename = texname; |
---|
.. | .. |
---|
8488 | 8509 | texturecache = new CacheTexture(texturedata,resolution); |
---|
8489 | 8510 | //texture = GetTexture(tex, bump); |
---|
8490 | 8511 | } |
---|
| 8512 | + } |
---|
8491 | 8513 | } |
---|
8492 | 8514 | //} |
---|
8493 | 8515 | } |
---|
.. | .. |
---|
8756 | 8778 | |
---|
8757 | 8779 | gl.glGetIntegerv(GL.GL_MAX_TEXTURE_STACK_DEPTH, temp, 0); |
---|
8758 | 8780 | MAXSTACK = temp[0]; |
---|
8759 | | - System.out.println("GL_MAX_TEXTURE_STACK_DEPTH = " + MAXSTACK); |
---|
| 8781 | + if (Globals.DEBUG) |
---|
| 8782 | + System.out.println("GL_MAX_TEXTURE_STACK_DEPTH = " + MAXSTACK); |
---|
8760 | 8783 | gl.glGetIntegerv(GL.GL_MAX_MODELVIEW_STACK_DEPTH, temp, 0); |
---|
8761 | 8784 | MAXSTACK = temp[0]; |
---|
8762 | | - System.out.println("GL_MAX_MODELVIEW_STACK_DEPTH = " + MAXSTACK); |
---|
| 8785 | + if (Globals.DEBUG) |
---|
| 8786 | + System.out.println("GL_MAX_MODELVIEW_STACK_DEPTH = " + MAXSTACK); |
---|
8763 | 8787 | |
---|
8764 | 8788 | // Use debug pipeline |
---|
8765 | 8789 | //drawable.setGL(new DebugGL(gl)); // |
---|
.. | .. |
---|
8767 | 8791 | gl = drawable.getGL(); // |
---|
8768 | 8792 | |
---|
8769 | 8793 | GL gl3 = getGL(); |
---|
8770 | | - System.out.println("INIT GL IS: " + gl.getClass().getName()); |
---|
| 8794 | + if (Globals.DEBUG) |
---|
| 8795 | + System.out.println("INIT GL IS: " + gl.getClass().getName()); |
---|
8771 | 8796 | |
---|
8772 | 8797 | |
---|
8773 | 8798 | //float pos[] = { 100, 100, 100, 0 }; |
---|
.. | .. |
---|
8932 | 8957 | |
---|
8933 | 8958 | if (cubemap == null) |
---|
8934 | 8959 | { |
---|
8935 | | - LoadEnvy(5); |
---|
| 8960 | + //LoadEnvy(1); |
---|
8936 | 8961 | } |
---|
8937 | 8962 | |
---|
8938 | 8963 | //cubemap.enable(); |
---|
.. | .. |
---|
9219 | 9244 | cubemap = null; |
---|
9220 | 9245 | return; |
---|
9221 | 9246 | case 1: |
---|
9222 | | - name = "cubemaps/box_"; |
---|
9223 | | - ext = "png"; |
---|
| 9247 | + name = "cubemaps/rgb/"; |
---|
| 9248 | + ext = "jpg"; |
---|
9224 | 9249 | reverseUP = false; |
---|
9225 | 9250 | break; |
---|
9226 | 9251 | case 2: |
---|
9227 | | - name = "cubemaps/uffizi_"; |
---|
9228 | | - ext = "png"; |
---|
9229 | | - break; // reverseUP = true; break; |
---|
| 9252 | + name = "cubemaps/uffizi/"; |
---|
| 9253 | + ext = "jpg"; |
---|
| 9254 | + reverseUP = false; |
---|
| 9255 | + break; |
---|
9230 | 9256 | case 3: |
---|
9231 | | - name = "cubemaps/CloudyHills_"; |
---|
9232 | | - ext = "tga"; |
---|
| 9257 | + name = "cubemaps/CloudyHills/"; |
---|
| 9258 | + ext = "jpg"; |
---|
9233 | 9259 | reverseUP = false; |
---|
9234 | 9260 | break; |
---|
9235 | 9261 | case 4: |
---|
9236 | | - name = "cubemaps/cornell_"; |
---|
| 9262 | + name = "cubemaps/cornell/"; |
---|
9237 | 9263 | ext = "png"; |
---|
9238 | 9264 | reverseUP = false; |
---|
9239 | 9265 | break; |
---|
| 9266 | + case 5: |
---|
| 9267 | + name = "cubemaps/skycube/"; |
---|
| 9268 | + ext = "jpg"; |
---|
| 9269 | + reverseUP = false; |
---|
| 9270 | + break; |
---|
| 9271 | + case 6: |
---|
| 9272 | + name = "cubemaps/SaintLazarusChurch3/"; |
---|
| 9273 | + ext = "jpg"; |
---|
| 9274 | + reverseUP = false; |
---|
| 9275 | + break; |
---|
| 9276 | + case 7: |
---|
| 9277 | + name = "cubemaps/Sodermalmsallen/"; |
---|
| 9278 | + ext = "jpg"; |
---|
| 9279 | + reverseUP = false; |
---|
| 9280 | + break; |
---|
| 9281 | + case 8: |
---|
| 9282 | + name = "cubemaps/Sodermalmsallen2/"; |
---|
| 9283 | + ext = "jpg"; |
---|
| 9284 | + reverseUP = false; |
---|
| 9285 | + break; |
---|
| 9286 | + case 9: |
---|
| 9287 | + name = "cubemaps/UnionSquare/"; |
---|
| 9288 | + ext = "jpg"; |
---|
| 9289 | + reverseUP = false; |
---|
| 9290 | + break; |
---|
9240 | 9291 | default: |
---|
9241 | | - name = "cubemaps/rgb_"; |
---|
9242 | | - ext = "png"; /*mipmap = true;*/ reverseUP = false; |
---|
| 9292 | + name = "cubemaps/box/"; |
---|
| 9293 | + ext = "png"; /*mipmap = true;*/ |
---|
| 9294 | + reverseUP = false; |
---|
9243 | 9295 | break; |
---|
9244 | 9296 | } |
---|
9245 | | - |
---|
9246 | | - try |
---|
9247 | | - { |
---|
9248 | | - cubemap = LoadCubemap(getClass().getClassLoader(), name, ext, mipmap); |
---|
9249 | | - } catch (IOException e) |
---|
9250 | | - { |
---|
9251 | | - throw new RuntimeException(e); |
---|
9252 | | - } |
---|
| 9297 | + |
---|
| 9298 | + LoadSkybox(name, ext, mipmap); |
---|
9253 | 9299 | } |
---|
9254 | 9300 | |
---|
9255 | 9301 | public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) |
---|
.. | .. |
---|
9281 | 9327 | static double[] model = new double[16]; |
---|
9282 | 9328 | double[] camera2light = new double[16]; |
---|
9283 | 9329 | double[] light2camera = new double[16]; |
---|
9284 | | - int newenvy = -1; |
---|
9285 | | - boolean envyoff = true; // false; |
---|
| 9330 | + |
---|
| 9331 | + //int newenvy = -1; |
---|
| 9332 | + //boolean envyoff = false; |
---|
| 9333 | + |
---|
| 9334 | + String loadedskyboxname; |
---|
| 9335 | + |
---|
9286 | 9336 | cVector light0 = new cVector(0, 0, 0); // 1,3,2); |
---|
9287 | 9337 | //float[] light0 = { 0,0,0 }; |
---|
9288 | 9338 | cVector dirlight = new cVector(0, 0, 1); // 1,3,2); |
---|
.. | .. |
---|
9762 | 9812 | rati = 1 / rati; |
---|
9763 | 9813 | gl.glOrtho(-skyscale / rati, skyscale / rati, -skyscale, skyscale, 0.001, 1000); |
---|
9764 | 9814 | } |
---|
9765 | | - assert (newenvy == -1); |
---|
| 9815 | + |
---|
| 9816 | + //assert (newenvy == -1); |
---|
| 9817 | + |
---|
9766 | 9818 | gl.glDisable(GL.GL_FRAGMENT_PROGRAM_ARB); |
---|
9767 | 9819 | gl.glDisable(GL.GL_VERTEX_PROGRAM_ARB); |
---|
9768 | | - DrawSkyBox(gl); |
---|
| 9820 | + DrawSkyBox(gl, (float)rati); |
---|
9769 | 9821 | gl.glEnable(GL.GL_FRAGMENT_PROGRAM_ARB); |
---|
9770 | 9822 | gl.glEnable(GL.GL_VERTEX_PROGRAM_ARB); |
---|
9771 | 9823 | accPerspective(gl, renderCamera.shaper_fovy / ratio, |
---|
.. | .. |
---|
10802 | 10854 | |
---|
10803 | 10855 | if (wait) |
---|
10804 | 10856 | { |
---|
10805 | | - Sleep(500); |
---|
| 10857 | + Sleep(200); // blocks everything |
---|
10806 | 10858 | |
---|
10807 | 10859 | wait = false; |
---|
10808 | 10860 | } |
---|
.. | .. |
---|
11018 | 11070 | gl.glOrtho(-skyscale / ratio, skyscale / ratio, -skyscale, skyscale, 0.001, 1000); |
---|
11019 | 11071 | } |
---|
11020 | 11072 | |
---|
11021 | | - if (newenvy > -1) |
---|
| 11073 | +// if (newenvy > -1) |
---|
| 11074 | +// { |
---|
| 11075 | +// LoadEnvy(newenvy); |
---|
| 11076 | +// } |
---|
| 11077 | +// |
---|
| 11078 | +// newenvy = -1; |
---|
| 11079 | + |
---|
| 11080 | + if (object.skyboxname != null) |
---|
11022 | 11081 | { |
---|
11023 | | - LoadEnvy(newenvy); |
---|
| 11082 | + if (!object.skyboxname.equals(this.loadedskyboxname)) |
---|
| 11083 | + { |
---|
| 11084 | + LoadSkybox(object.skyboxname + "/", object.skyboxext, false); |
---|
| 11085 | + loadedskyboxname = object.skyboxname; |
---|
| 11086 | + } |
---|
11024 | 11087 | } |
---|
11025 | | - |
---|
11026 | | - newenvy = -1; |
---|
11027 | | - |
---|
| 11088 | + else |
---|
| 11089 | + { |
---|
| 11090 | + cubemap = null; |
---|
| 11091 | + loadedskyboxname = null; |
---|
| 11092 | + } |
---|
| 11093 | + |
---|
11028 | 11094 | ratio = ((double) getWidth()) / getHeight(); |
---|
11029 | 11095 | //System.out.println("ratio = " + ratio); |
---|
11030 | 11096 | |
---|
.. | .. |
---|
11040 | 11106 | |
---|
11041 | 11107 | if (!IsFrozen() && !ambientOcclusion) |
---|
11042 | 11108 | { |
---|
11043 | | - DrawSkyBox(gl); |
---|
| 11109 | + DrawSkyBox(gl, (float)ratio); |
---|
11044 | 11110 | } |
---|
11045 | 11111 | |
---|
11046 | 11112 | //if (selection_view == -1) |
---|
.. | .. |
---|
11326 | 11392 | |
---|
11327 | 11393 | // if (cam != lightCamera) |
---|
11328 | 11394 | //for (int count = parentcam.GetTransformCount(); --count>=0;) |
---|
11329 | | - LA.xformDir(lightposition, parentcam.GlobalTransform(), lightposition); // may 2013 |
---|
| 11395 | + LA.xformDir(lightposition, parentcam.GlobalTransformInv(), lightposition); // may 2013 |
---|
11330 | 11396 | } |
---|
11331 | 11397 | |
---|
11332 | 11398 | LA.xformDir(lightposition, cam.toScreen, lightposition); |
---|
.. | .. |
---|
12400 | 12466 | |
---|
12401 | 12467 | //gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 127, lightParams, 0); |
---|
12402 | 12468 | |
---|
12403 | | - String program = |
---|
| 12469 | + String programmin = |
---|
12404 | 12470 | // Min shader |
---|
12405 | 12471 | "!!ARBfp1.0\n" + |
---|
12406 | 12472 | "PARAM zero123 = { 0.0, 1.0, 2, 1.25 };" + |
---|
.. | .. |
---|
12451 | 12517 | //"SUB ndotl.y, zero123.y, ndotl.y;" + |
---|
12452 | 12518 | //"MUL ndotl.y, ndotl.y, pow2.z;" + |
---|
12453 | 12519 | |
---|
12454 | | - "MAX ndotl.x, ndotl.x, ndotl.y;" + // Ambient |
---|
| 12520 | + //"MAX ndotl.x, ndotl.x, ndotl.y;" + // Ambient |
---|
| 12521 | + //"MAX ndotl.x, ndotl.x, pow2.y;" + // Ambient |
---|
12455 | 12522 | |
---|
12456 | 12523 | // Pigment |
---|
12457 | 12524 | "TEX temp, fragment.texcoord[0], texture[0], 2D;" + |
---|
.. | .. |
---|
12466 | 12533 | "MOV result.color, temp;" + |
---|
12467 | 12534 | "END"; |
---|
12468 | 12535 | |
---|
12469 | | - String program2 = |
---|
| 12536 | + String programmax = |
---|
12470 | 12537 | "!!ARBfp1.0\n" + |
---|
12471 | 12538 | |
---|
12472 | 12539 | //"OPTION ARB_fragment_program_shadow;" + |
---|
.. | .. |
---|
12991 | 13058 | // display shadow only (fakedepth == 0) |
---|
12992 | 13059 | "SUB temp.x, half.x, shadow.x;" + |
---|
12993 | 13060 | "MOV temp.y, -params5.z;" + // params6.x;" + |
---|
12994 | | - "SLT temp.z, temp.y, -one2048th.x;" + |
---|
| 13061 | + "SLT temp.z, temp.y, -c256i.x;" + |
---|
12995 | 13062 | "SUB temp.y, one.x, temp.z;" + |
---|
12996 | 13063 | "MUL temp.x, temp.x, temp.y;" + |
---|
12997 | 13064 | "KIL temp.x;" + |
---|
.. | .. |
---|
13322 | 13389 | //once = true; |
---|
13323 | 13390 | } |
---|
13324 | 13391 | |
---|
| 13392 | + String program = programmax; |
---|
| 13393 | + |
---|
| 13394 | + if (Globals.MINSHADER) |
---|
| 13395 | + { |
---|
| 13396 | + program = programmin; |
---|
| 13397 | + } |
---|
| 13398 | + |
---|
13325 | 13399 | System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length()); |
---|
13326 | 13400 | System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : "")); |
---|
13327 | 13401 | loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program); |
---|
.. | .. |
---|
14571 | 14645 | MODIFIERS |= COMMAND; |
---|
14572 | 14646 | /**/ |
---|
14573 | 14647 | if((mod&SHIFT) == SHIFT) |
---|
14574 | | - manipCamera.RotatePosition(0, -speed); |
---|
14575 | | - else |
---|
14576 | 14648 | manipCamera.BackForth(0, -speed*delta, 0); // getWidth()); |
---|
| 14649 | + else |
---|
| 14650 | + manipCamera.RotatePosition(0, -speed); |
---|
14577 | 14651 | /**/ |
---|
14578 | 14652 | if ((mod & SHIFT) == SHIFT) |
---|
14579 | 14653 | { |
---|
.. | .. |
---|
14592 | 14666 | MODIFIERS |= COMMAND; |
---|
14593 | 14667 | /**/ |
---|
14594 | 14668 | if((mod&SHIFT) == SHIFT) |
---|
14595 | | - manipCamera.RotatePosition(0, speed); |
---|
14596 | | - else |
---|
14597 | 14669 | manipCamera.BackForth(0, speed*delta, 0); // getWidth()); |
---|
| 14670 | + else |
---|
| 14671 | + manipCamera.RotatePosition(0, speed); |
---|
14598 | 14672 | /**/ |
---|
14599 | 14673 | if ((mod & SHIFT) == SHIFT) |
---|
14600 | 14674 | { |
---|
.. | .. |
---|
15315 | 15389 | OCCLUSION_CULLING ^= true; |
---|
15316 | 15390 | System.out.println("OCCLUSION CULLING = " + OCCLUSION_CULLING); |
---|
15317 | 15391 | break; |
---|
15318 | | - case '0': envyoff ^= true; repaint(); break; |
---|
| 15392 | + //case '0': envyoff ^= true; repaint(); break; |
---|
15319 | 15393 | case '1': |
---|
15320 | 15394 | case '2': |
---|
15321 | 15395 | case '3': |
---|
15322 | 15396 | case '4': |
---|
15323 | 15397 | case '5': |
---|
15324 | | - newenvy = Character.getNumericValue(key); |
---|
15325 | | - repaint(); |
---|
15326 | | - break; |
---|
15327 | 15398 | case '6': |
---|
15328 | 15399 | case '7': |
---|
15329 | 15400 | case '8': |
---|
15330 | 15401 | case '9': |
---|
15331 | | - BGcolor = (key - '6')/3.f; |
---|
| 15402 | + if (true) // envyoff) |
---|
| 15403 | + { |
---|
| 15404 | + BGcolor = (key - '1')/8.f; |
---|
| 15405 | + } |
---|
| 15406 | + else |
---|
| 15407 | + { |
---|
| 15408 | + //newenvy = Character.getNumericValue(key); |
---|
| 15409 | + } |
---|
15332 | 15410 | repaint(); |
---|
15333 | 15411 | break; |
---|
15334 | 15412 | case '!': |
---|
.. | .. |
---|
16033 | 16111 | gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
16034 | 16112 | break; |
---|
16035 | 16113 | case Object3D.hitScale: gr.setColor(Color.cyan); |
---|
16036 | | - gr.drawLine(X, Y, 0, 0); |
---|
| 16114 | + gr.drawLine(X, Y, info.bounds.width/2, info.bounds.height/2); |
---|
16037 | 16115 | break; |
---|
16038 | 16116 | } |
---|
16039 | 16117 | |
---|
.. | .. |
---|
16519 | 16597 | private /*static*/ boolean firstime; |
---|
16520 | 16598 | private /*static*/ cVector newView = new cVector(); |
---|
16521 | 16599 | private static final String[] suffixes = {"posx", "negx", "posy", "negy", "posz", "negz"}; |
---|
| 16600 | + private static final String[] suffixes2 = {"east", "west", "top", "bottom", "north", "south"}; |
---|
| 16601 | + private static final String[] suffixes3 = {"ft", "bk", "up", "dn", "rt", "lf"}; |
---|
16522 | 16602 | private static final int[] targets = {GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X, |
---|
16523 | 16603 | GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X, |
---|
16524 | 16604 | GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y, |
---|
.. | .. |
---|
16531 | 16611 | { |
---|
16532 | 16612 | com.sun.opengl.util.texture.Texture cubemap = TextureIO.newTexture(GL.GL_TEXTURE_CUBE_MAP); |
---|
16533 | 16613 | |
---|
| 16614 | + int usedsuf = 0; |
---|
| 16615 | + |
---|
16534 | 16616 | for (int i = 0; i < suffixes.length; i++) |
---|
16535 | 16617 | { |
---|
16536 | | - String resourceName = basename + suffixes[i] + "." + suffix; |
---|
16537 | | - TextureData data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName), |
---|
16538 | | - mipmapped, |
---|
16539 | | - FileUtil.getFileSuffix(resourceName)); |
---|
16540 | | - if (data == null) |
---|
| 16618 | + String[] suffixe = suffixes; |
---|
| 16619 | + String[] fallback = suffixes2; |
---|
| 16620 | + String[] fallfallback = suffixes3; |
---|
| 16621 | + |
---|
| 16622 | + for (int c=usedsuf; --c>=0;) |
---|
16541 | 16623 | { |
---|
16542 | | - throw new IOException("Unable to load texture " + resourceName); |
---|
| 16624 | +// String[] temp = suffixe; |
---|
| 16625 | +// suffixe = fallback; |
---|
| 16626 | +// fallback = fallfallback; |
---|
| 16627 | +// fallfallback = temp; |
---|
16543 | 16628 | } |
---|
| 16629 | + |
---|
| 16630 | + String resourceName = basename + suffixe[i] + "." + suffix; |
---|
| 16631 | + TextureData data; |
---|
| 16632 | + |
---|
| 16633 | + try |
---|
| 16634 | + { |
---|
| 16635 | + data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName), |
---|
| 16636 | + mipmapped, |
---|
| 16637 | + FileUtil.getFileSuffix(resourceName)); |
---|
| 16638 | + } |
---|
| 16639 | + catch (Exception e) |
---|
| 16640 | + { |
---|
| 16641 | + try |
---|
| 16642 | + { |
---|
| 16643 | + resourceName = basename + fallback[i] + "." + suffix; |
---|
| 16644 | + data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName), |
---|
| 16645 | + mipmapped, |
---|
| 16646 | + FileUtil.getFileSuffix(resourceName)); |
---|
| 16647 | + } |
---|
| 16648 | + catch (Exception e2) |
---|
| 16649 | + { |
---|
| 16650 | + resourceName = basename + fallfallback[i] + "." + suffix; |
---|
| 16651 | + data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName), |
---|
| 16652 | + mipmapped, |
---|
| 16653 | + FileUtil.getFileSuffix(resourceName)); |
---|
| 16654 | + } |
---|
| 16655 | + } |
---|
| 16656 | + |
---|
16544 | 16657 | //System.out.println("Target = " + targets[i]); |
---|
16545 | 16658 | cubemap.updateImage(data, targets[i]); |
---|
16546 | 16659 | } |
---|
16547 | 16660 | |
---|
16548 | 16661 | return cubemap; |
---|
16549 | 16662 | } |
---|
| 16663 | + |
---|
16550 | 16664 | int bigsphere = -1; |
---|
16551 | 16665 | |
---|
16552 | 16666 | float BGcolor = 0.5f; |
---|
16553 | 16667 | |
---|
16554 | | - private void DrawSkyBox(GL gl) |
---|
| 16668 | + float ambientLight[] = {1f, 1f, 1f, 1.0f}; |
---|
| 16669 | + |
---|
| 16670 | + private void DrawSkyBox(GL gl, float ratio) |
---|
16555 | 16671 | { |
---|
16556 | | - if (envyoff || cubemap == null) |
---|
| 16672 | + if (//envyoff || |
---|
| 16673 | + WIREFRAME || |
---|
| 16674 | + cubemap == null) |
---|
16557 | 16675 | { |
---|
16558 | 16676 | gl.glClearColor(BGcolor, BGcolor, BGcolor, 1); |
---|
16559 | 16677 | gl.glClear(gl.GL_COLOR_BUFFER_BIT); |
---|
.. | .. |
---|
16568 | 16686 | // Compensates for ExaminerViewer's modification of modelview matrix |
---|
16569 | 16687 | gl.glMatrixMode(GL.GL_MODELVIEW); |
---|
16570 | 16688 | gl.glLoadIdentity(); |
---|
| 16689 | + gl.glScalef(1,ratio,1); |
---|
16571 | 16690 | |
---|
| 16691 | +// colorV[0] = 2; |
---|
| 16692 | +// colorV[1] = 2; |
---|
| 16693 | +// colorV[2] = 2; |
---|
| 16694 | +// colorV[3] = 1; |
---|
| 16695 | +// gl.glDisable(gl.GL_COLOR_MATERIAL); |
---|
| 16696 | +// gl.glMaterialfv(gl.GL_FRONT_AND_BACK, gl.GL_AMBIENT, colorV, 0); |
---|
| 16697 | +// |
---|
| 16698 | +// gl.glLightModelfv(gl.GL_LIGHT_MODEL_AMBIENT, ambientLight, 0); |
---|
| 16699 | + |
---|
16572 | 16700 | //gl.glActiveTexture(GL.GL_TEXTURE1); |
---|
16573 | 16701 | //gl.glDisable(GL.GL_TEXTURE_CUBE_MAP); |
---|
16574 | 16702 | |
---|
.. | .. |
---|
16600 | 16728 | { |
---|
16601 | 16729 | gl.glScalef(1.0f, -1.0f, 1.0f); |
---|
16602 | 16730 | } |
---|
| 16731 | + gl.glScalef(-1.0f, 1.0f, 1.0f); |
---|
16603 | 16732 | gl.glMultMatrixd(viewrot_1, 0); |
---|
16604 | 16733 | gl.glTranslatef(0, 0, 0.5f); // (float)lightCamera.Distance()); // 0.5f); |
---|
16605 | 16734 | //viewer.updateInverseRotation(gl); |
---|
.. | .. |
---|
16858 | 16987 | //new Exception().printStackTrace(); |
---|
16859 | 16988 | System.out.println("select buffer init"); |
---|
16860 | 16989 | // Use debug pipeline |
---|
16861 | | - drawable.setGL(new DebugGL(drawable.getGL())); |
---|
| 16990 | + //drawable.setGL(new DebugGL(drawable.getGL())); |
---|
16862 | 16991 | |
---|
16863 | 16992 | GL gl = drawable.getGL(); |
---|
16864 | 16993 | |
---|