.. | .. |
---|
110 | 110 | //private Mat4f spotlightTransform = new Mat4f(); |
---|
111 | 111 | //private Mat4f spotlightInverseTransform = new Mat4f(); |
---|
112 | 112 | static GLContext glcontext = null; |
---|
113 | | - /*static*/ com.sun.opengl.util.texture.Texture cubemap; |
---|
| 113 | + /*static*/ com.sun.opengl.util.texture.Texture cubemap; // Either custom or rgb |
---|
| 114 | + /*static*/ com.sun.opengl.util.texture.Texture cubemapcustom; |
---|
| 115 | + /*static*/ com.sun.opengl.util.texture.Texture cubemaprgb; |
---|
| 116 | + boolean transformMode; |
---|
| 117 | + |
---|
114 | 118 | boolean reverseUP = false; |
---|
115 | 119 | static boolean frozen = false; |
---|
116 | 120 | boolean enablebackspace = false; // patch for back buffer refresh |
---|
.. | .. |
---|
188 | 192 | |
---|
189 | 193 | private File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory(); |
---|
190 | 194 | |
---|
191 | | - public void LoadSkybox(String name, String ext, boolean mipmap) throws GLException |
---|
| 195 | + public com.sun.opengl.util.texture.Texture LoadSkybox(String name, String ext, boolean mipmap) throws GLException |
---|
192 | 196 | { |
---|
193 | 197 | try |
---|
194 | 198 | { |
---|
195 | | - cubemap = LoadCubemap(getClass().getClassLoader(), name, ext, mipmap); |
---|
| 199 | + return LoadCubemap(getClass().getClassLoader(), name, ext, mipmap); |
---|
196 | 200 | } catch (IOException e) |
---|
197 | 201 | { |
---|
198 | 202 | System.out.println("NAME = " + name); |
---|
199 | 203 | e.printStackTrace(); // throw new RuntimeException(e); |
---|
| 204 | + return null; |
---|
200 | 205 | } |
---|
201 | 206 | } |
---|
202 | 207 | |
---|
.. | .. |
---|
2512 | 2517 | com.sun.opengl.util.texture.TextureIO.newTextureData( |
---|
2513 | 2518 | getClass().getClassLoader().getResourceAsStream(name), |
---|
2514 | 2519 | true, |
---|
2515 | | - com.sun.opengl.util.texture.TextureIO.PNG); |
---|
| 2520 | + GetFormat(name)); // com.sun.opengl.util.texture.TextureIO.PNG); |
---|
2516 | 2521 | } catch (java.io.IOException e) |
---|
2517 | 2522 | { |
---|
2518 | 2523 | throw new javax.media.opengl.GLException(e); |
---|
.. | .. |
---|
9233 | 9238 | |
---|
9234 | 9239 | void LoadEnvy(int which) |
---|
9235 | 9240 | { |
---|
| 9241 | + assert(false); |
---|
| 9242 | + |
---|
9236 | 9243 | String name; |
---|
9237 | 9244 | String ext; |
---|
9238 | 9245 | |
---|
.. | .. |
---|
11077 | 11084 | // |
---|
11078 | 11085 | // newenvy = -1; |
---|
11079 | 11086 | |
---|
11080 | | - if (object.skyboxname != null) |
---|
| 11087 | + if (transformMode) // object.skyboxname != null && object.skyboxname.equals("cubemaps/default-skyboxes/rgb")) |
---|
11081 | 11088 | { |
---|
11082 | | - if (!object.skyboxname.equals(this.loadedskyboxname)) |
---|
| 11089 | + if (cubemaprgb == null) |
---|
11083 | 11090 | { |
---|
11084 | | - LoadSkybox(object.skyboxname + "/", object.skyboxext, false); |
---|
11085 | | - loadedskyboxname = object.skyboxname; |
---|
| 11091 | + cubemaprgb = LoadSkybox("cubemaps/default-skyboxes/rgb" + "/", "jpg", false); |
---|
11086 | 11092 | } |
---|
| 11093 | + |
---|
| 11094 | + cubemap = cubemaprgb; |
---|
11087 | 11095 | } |
---|
11088 | 11096 | else |
---|
11089 | 11097 | { |
---|
11090 | | - cubemap = null; |
---|
11091 | | - loadedskyboxname = null; |
---|
| 11098 | + if (object.skyboxname != null) |
---|
| 11099 | + { |
---|
| 11100 | + if (!object.skyboxname.equals(this.loadedskyboxname)) |
---|
| 11101 | + { |
---|
| 11102 | + if (cubemap != null && cubemap != cubemaprgb) |
---|
| 11103 | + cubemap.dispose(); |
---|
| 11104 | + cubemapcustom = LoadSkybox(object.skyboxname + "/", object.skyboxext, false); |
---|
| 11105 | + loadedskyboxname = object.skyboxname; |
---|
| 11106 | + } |
---|
| 11107 | + } |
---|
| 11108 | + else |
---|
| 11109 | + { |
---|
| 11110 | + cubemapcustom = null; |
---|
| 11111 | + loadedskyboxname = null; |
---|
| 11112 | + } |
---|
| 11113 | + |
---|
| 11114 | + cubemap = cubemapcustom; |
---|
11092 | 11115 | } |
---|
11093 | 11116 | |
---|
11094 | 11117 | ratio = ((double) getWidth()) / getHeight(); |
---|
.. | .. |
---|
16769 | 16792 | gl.glDisable(GL.GL_TEXTURE_GEN_R); |
---|
16770 | 16793 | |
---|
16771 | 16794 | cubemap.disable(); |
---|
16772 | | - ////cubemap.unbind(); |
---|
| 16795 | + //cubemap.dispose(); |
---|
| 16796 | + |
---|
16773 | 16797 | if (CULLFACE) |
---|
16774 | 16798 | { |
---|
16775 | 16799 | gl.glEnable(gl.GL_CULL_FACE); |
---|