Normand Briere
2019-07-29 c6c3f0948bd31603547ef8ce47a7784a9a4d55c2
CameraPane.java
....@@ -16570,6 +16570,8 @@
1657016570 private /*static*/ boolean firstime;
1657116571 private /*static*/ cVector newView = new cVector();
1657216572 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"};
1657316575 private static final int[] targets = {GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X,
1657416576 GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
1657516577 GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
....@@ -16582,16 +16584,49 @@
1658216584 {
1658316585 com.sun.opengl.util.texture.Texture cubemap = TextureIO.newTexture(GL.GL_TEXTURE_CUBE_MAP);
1658416586
16587
+ int usedsuf = 0;
16588
+
1658516589 for (int i = 0; i < suffixes.length; i++)
1658616590 {
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;)
1659216596 {
16593
- throw new IOException("Unable to load texture " + resourceName);
16597
+// String[] temp = suffixe;
16598
+// suffixe = fallback;
16599
+// fallback = fallfallback;
16600
+// fallfallback = temp;
1659416601 }
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
+
1659516630 //System.out.println("Target = " + targets[i]);
1659616631 cubemap.updateImage(data, targets[i]);
1659716632 }
....@@ -16663,6 +16698,7 @@
1666316698 {
1666416699 gl.glScalef(1.0f, -1.0f, 1.0f);
1666516700 }
16701
+ gl.glScalef(-1.0f, 1.0f, 1.0f);
1666616702 gl.glMultMatrixd(viewrot_1, 0);
1666716703 gl.glTranslatef(0, 0, 0.5f); // (float)lightCamera.Distance()); // 0.5f);
1666816704 //viewer.updateInverseRotation(gl);