/** Construct a Cubemap with the specified {@link TextureData}'s for the sides */ public Cubemap (TextureData positiveX, TextureData negativeX, TextureData positiveY, TextureData negativeY, TextureData positiveZ, TextureData negativeZ) { super(GL20.GL_TEXTURE_CUBE_MAP); minFilter = TextureFilter.Nearest; magFilter = TextureFilter.Nearest; uWrap = TextureWrap.ClampToEdge; vWrap = TextureWrap.ClampToEdge; data = new FacedCubemapData(positiveX, negativeX, positiveY, negativeY, positiveZ, negativeZ); load(data); }
@Override public void prepare () { if (!isComplete()) throw new GdxRuntimeException("You need to complete your cubemap data before using it"); for (int i = 0; i < data.length; i++) if (!data[i].isPrepared()) data[i].prepare(); }
public void setEnvironment (String name) { if (name == null) return; if (cubemap != null) { cubemap.dispose(); cubemap = null; } if (name.equals("<none>")) { if (environment.has(CubemapAttribute.EnvironmentMap)) { environment.remove(CubemapAttribute.EnvironmentMap); shaderProvider.clear(); } } else { FileHandle root = Gdx.files.internal("data/g3d/environment"); FacedCubemapData faces = new FacedCubemapData(root.child(name + "_PX.png"), root.child(name+"_NX.png"), root.child(name + "_PY.png"), root.child(name + "_NY.png"), root.child(name + "_PZ.png"), root.child(name + "_NZ.png"), false); // FIXME mipmapping on desktop cubemap = new Cubemap(faces); faces.load(CubemapSide.NegativeX, root.child(name + "_NX.png")); cubemap.load(faces); if (!environment.has(CubemapAttribute.EnvironmentMap)) shaderProvider.clear(); environment.set(new CubemapAttribute(CubemapAttribute.EnvironmentMap, cubemap)); } }
/** Construct a Cubemap with the specified {@link TextureData}'s for the sides */ public Cubemap (TextureData positiveX, TextureData negativeX, TextureData positiveY, TextureData negativeY, TextureData positiveZ, TextureData negativeZ) { super(GL20.GL_TEXTURE_CUBE_MAP); minFilter = TextureFilter.Nearest; magFilter = TextureFilter.Nearest; uWrap = TextureWrap.ClampToEdge; vWrap = TextureWrap.ClampToEdge; data = new FacedCubemapData(positiveX, negativeX, positiveY, negativeY, positiveZ, negativeZ); load(data); }
@Override public void prepare () { if (!isComplete()) throw new GdxRuntimeException("You need to complete your cubemap data before using it"); for (int i = 0; i < data.length; i++) if (!data[i].isPrepared()) data[i].prepare(); }
/** Construct a Cubemap with the specified {@link TextureData}'s for the sides */ public Cubemap (TextureData positiveX, TextureData negativeX, TextureData positiveY, TextureData negativeY, TextureData positiveZ, TextureData negativeZ) { super(GL20.GL_TEXTURE_CUBE_MAP); minFilter = TextureFilter.Nearest; magFilter = TextureFilter.Nearest; uWrap = TextureWrap.ClampToEdge; vWrap = TextureWrap.ClampToEdge; data = new FacedCubemapData(positiveX, negativeX, positiveY, negativeY, positiveZ, negativeZ); load(data); }
@Override public void prepare () { if (!isComplete()) throw new GdxRuntimeException("You need to complete your cubemap data before using it"); for (int i = 0; i < data.length; i++) if (!data[i].isPrepared()) data[i].prepare(); }