.. | .. |
---|
16570 | 16570 | private /*static*/ boolean firstime; |
---|
16571 | 16571 | private /*static*/ cVector newView = new cVector(); |
---|
16572 | 16572 | private static final String[] suffixes = {"posx", "negx", "posy", "negy", "posz", "negz"}; |
---|
| 16573 | + private static final String[] suffixes2 = {"east", "west", "top", "bottom", "north", "south"}; |
---|
| 16574 | + private static final String[] suffixes3 = {"ft", "bk", "up", "dn", "rt", "lf"}; |
---|
16573 | 16575 | private static final int[] targets = {GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X, |
---|
16574 | 16576 | GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X, |
---|
16575 | 16577 | GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y, |
---|
.. | .. |
---|
16582 | 16584 | { |
---|
16583 | 16585 | com.sun.opengl.util.texture.Texture cubemap = TextureIO.newTexture(GL.GL_TEXTURE_CUBE_MAP); |
---|
16584 | 16586 | |
---|
| 16587 | + int usedsuf = 0; |
---|
| 16588 | + |
---|
16585 | 16589 | for (int i = 0; i < suffixes.length; i++) |
---|
16586 | 16590 | { |
---|
16587 | | - String resourceName = basename + suffixes[i] + "." + suffix; |
---|
16588 | | - TextureData data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName), |
---|
16589 | | - mipmapped, |
---|
16590 | | - FileUtil.getFileSuffix(resourceName)); |
---|
16591 | | - if (data == null) |
---|
| 16591 | + String[] suffixe = suffixes; |
---|
| 16592 | + String[] fallback = suffixes2; |
---|
| 16593 | + String[] fallfallback = suffixes3; |
---|
| 16594 | + |
---|
| 16595 | + for (int c=usedsuf; --c>=0;) |
---|
16592 | 16596 | { |
---|
16593 | | - throw new IOException("Unable to load texture " + resourceName); |
---|
| 16597 | +// String[] temp = suffixe; |
---|
| 16598 | +// suffixe = fallback; |
---|
| 16599 | +// fallback = fallfallback; |
---|
| 16600 | +// fallfallback = temp; |
---|
16594 | 16601 | } |
---|
| 16602 | + |
---|
| 16603 | + String resourceName = basename + suffixe[i] + "." + suffix; |
---|
| 16604 | + TextureData data; |
---|
| 16605 | + |
---|
| 16606 | + try |
---|
| 16607 | + { |
---|
| 16608 | + data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName), |
---|
| 16609 | + mipmapped, |
---|
| 16610 | + FileUtil.getFileSuffix(resourceName)); |
---|
| 16611 | + } |
---|
| 16612 | + catch (Exception e) |
---|
| 16613 | + { |
---|
| 16614 | + try |
---|
| 16615 | + { |
---|
| 16616 | + resourceName = basename + fallback[i] + "." + suffix; |
---|
| 16617 | + data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName), |
---|
| 16618 | + mipmapped, |
---|
| 16619 | + FileUtil.getFileSuffix(resourceName)); |
---|
| 16620 | + } |
---|
| 16621 | + catch (Exception e2) |
---|
| 16622 | + { |
---|
| 16623 | + resourceName = basename + fallfallback[i] + "." + suffix; |
---|
| 16624 | + data = TextureIO.newTextureData(scope.getResourceAsStream(resourceName), |
---|
| 16625 | + mipmapped, |
---|
| 16626 | + FileUtil.getFileSuffix(resourceName)); |
---|
| 16627 | + } |
---|
| 16628 | + } |
---|
| 16629 | + |
---|
16595 | 16630 | //System.out.println("Target = " + targets[i]); |
---|
16596 | 16631 | cubemap.updateImage(data, targets[i]); |
---|
16597 | 16632 | } |
---|
.. | .. |
---|
16663 | 16698 | { |
---|
16664 | 16699 | gl.glScalef(1.0f, -1.0f, 1.0f); |
---|
16665 | 16700 | } |
---|
| 16701 | + gl.glScalef(-1.0f, 1.0f, 1.0f); |
---|
16666 | 16702 | gl.glMultMatrixd(viewrot_1, 0); |
---|
16667 | 16703 | gl.glTranslatef(0, 0, 0.5f); // (float)lightCamera.Distance()); // 0.5f); |
---|
16668 | 16704 | //viewer.updateInverseRotation(gl); |
---|