private String getWrapMode(Texture texVal, Texture.WrapAxis axis) { WrapMode mode = WrapMode.EdgeClamp; try{ mode = texVal.getWrap(axis); }catch (IllegalArgumentException e){ //this axis doesn't exist on the texture return ""; } if(mode != WrapMode.EdgeClamp){ return"Wrap"+ mode.name() + "_" + axis.name() + " "; } return ""; }
protected static String formatWrapMode(Texture texVal, Texture.WrapAxis axis) { WrapMode mode; try { mode = texVal.getWrap(axis); } catch (IllegalArgumentException e) { //this axis doesn't exist on the texture return ""; } if (mode != WrapMode.EdgeClamp) { return "Wrap" + mode.name() + "_" + axis.name() + " "; } return ""; }
case CubeMap: case ThreeDimensional: if (tex.getWrap(WrapAxis.R) != Texture.WrapMode.EdgeClamp) { throw new RendererException("repeating non-power-of-2 textures " + "are not supported by the video hardware"); if (tex.getWrap(WrapAxis.S) != Texture.WrapMode.EdgeClamp || tex.getWrap(WrapAxis.T) != Texture.WrapMode.EdgeClamp) { throw new RendererException("repeating non-power-of-2 textures " + "are not supported by the video hardware");
case ThreeDimensional: case CubeMap: // cubemaps use 3D coords if (gl2 != null && curState.rWrap != tex.getWrap(WrapAxis.R)) { bindTextureAndUnit(target, image, unit); gl2.glTexParameteri(target, GL2.GL_TEXTURE_WRAP_R, convertWrapMode(tex.getWrap(WrapAxis.R))); curState.rWrap = tex.getWrap(WrapAxis.R); if (curState.tWrap != tex.getWrap(WrapAxis.T)) { bindTextureAndUnit(target, image, unit); gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_T, convertWrapMode(tex.getWrap(WrapAxis.T))); image.getLastTextureState().tWrap = tex.getWrap(WrapAxis.T); if (curState.sWrap != tex.getWrap(WrapAxis.S)) { bindTextureAndUnit(target, image, unit); gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_S, convertWrapMode(tex.getWrap(WrapAxis.S))); curState.sWrap = tex.getWrap(WrapAxis.S);
private String getWrapMode(Texture texVal, Texture.WrapAxis axis) { WrapMode mode = WrapMode.EdgeClamp; try{ mode = texVal.getWrap(axis); }catch (IllegalArgumentException e){ //this axis doesn't exist on the texture return ""; } if(mode != WrapMode.EdgeClamp){ return"Wrap"+ mode.name() + "_" + axis.name() + " "; } return ""; }
protected static String formatWrapMode(Texture texVal, Texture.WrapAxis axis) { WrapMode mode; try { mode = texVal.getWrap(axis); } catch (IllegalArgumentException e) { //this axis doesn't exist on the texture return ""; } if (mode != WrapMode.EdgeClamp) { return "Wrap" + mode.name() + "_" + axis.name() + " "; } return ""; }
case CubeMap: case ThreeDimensional: if (tex.getWrap(WrapAxis.R) != Texture.WrapMode.EdgeClamp) { throw new RendererException("repeating non-power-of-2 textures " + "are not supported by the video hardware"); if (tex.getWrap(WrapAxis.S) != Texture.WrapMode.EdgeClamp || tex.getWrap(WrapAxis.T) != Texture.WrapMode.EdgeClamp) { throw new RendererException("repeating non-power-of-2 textures " + "are not supported by the video hardware");
private Texture generateNormalMap(Texture texture) { BufferedImage image = ImageToAwt.convert(texture.getImage(), false, false, 0); BufferedImage normal = NormalMapFilter.create().filter(image, 0.01f); Image jme = new AWTLoader().load(normal, false); Texture2D jmeTexture = new Texture2D(jme); jmeTexture.setWrap(Texture.WrapAxis.S, texture.getWrap(Texture.WrapAxis.S)); jmeTexture.setWrap(Texture.WrapAxis.T, texture.getWrap(Texture.WrapAxis.T)); jmeTexture.setMagFilter(texture.getMagFilter()); jmeTexture.setMinFilter(texture.getMinFilter()); return jmeTexture; } }
case ThreeDimensional: case CubeMap: // cubemaps use 3D coords if (gl2 != null && curState.rWrap != tex.getWrap(WrapAxis.R)) { bindTextureAndUnit(target, image, unit); gl2.glTexParameteri(target, GL2.GL_TEXTURE_WRAP_R, convertWrapMode(tex.getWrap(WrapAxis.R))); curState.rWrap = tex.getWrap(WrapAxis.R); if (curState.tWrap != tex.getWrap(WrapAxis.T)) { bindTextureAndUnit(target, image, unit); gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_T, convertWrapMode(tex.getWrap(WrapAxis.T))); image.getLastTextureState().tWrap = tex.getWrap(WrapAxis.T); if (curState.sWrap != tex.getWrap(WrapAxis.S)) { bindTextureAndUnit(target, image, unit); gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_S, convertWrapMode(tex.getWrap(WrapAxis.S))); curState.sWrap = tex.getWrap(WrapAxis.S);
case ThreeDimensional: case CubeMap: // cubemaps use 3D coords glTexParameteri(target, GL_TEXTURE_WRAP_R, convertWrapMode(tex.getWrap(WrapAxis.R))); glTexParameteri(target, GL_TEXTURE_WRAP_T, convertWrapMode(tex.getWrap(WrapAxis.T))); glTexParameteri(target, GL_TEXTURE_WRAP_S, convertWrapMode(tex.getWrap(WrapAxis.S))); break; default:
ret += "Flip "; if (texVal.getWrap(Texture.WrapAxis.S) == WrapMode.Repeat) { ret += "Repeat ";