/** * @return Cubemap used for the environmental cubemap */ public Cubemap getCubeMap() { if (mCubemap == null) { Texture back = mAssetManager.get("3D/cubemap/background_back.jpg", Texture.class); Texture front = mAssetManager.get("3D/cubemap/background_front.jpg", Texture.class); Texture up = mAssetManager.get("3D/cubemap/background_up.jpg", Texture.class); Texture down = mAssetManager.get("3D/cubemap/background_down.jpg", Texture.class); Texture left = mAssetManager.get("3D/cubemap/background_left.jpg", Texture.class); Texture right = mAssetManager.get("3D/cubemap/background_right.jpg", Texture.class); FacedCubemapData data = new FacedCubemapData(right.getTextureData(), left.getTextureData(), up.getTextureData(), down.getTextureData(), front.getTextureData(), back.getTextureData()); return new Cubemap(data); } else { return mCubemap; } }
@Override public void onSurfaceCreated (javax.microedition.khronos.opengles.GL10 gl, EGLConfig config) { eglContext = ((EGL10)EGLContext.getEGL()).eglGetCurrentContext(); setupGL(gl); logConfig(config); updatePpi(); Mesh.invalidateAllMeshes(app); Texture.invalidateAllTextures(app); Cubemap.invalidateAllCubemaps(app); ShaderProgram.invalidateAllShaderPrograms(app); FrameBuffer.invalidateAllFrameBuffers(app); logManagedCachesStatus(); Display display = app.getWindowManager().getDefaultDisplay(); this.width = display.getWidth(); this.height = display.getHeight(); this.mean = new WindowedMean(5); this.lastFrameTime = System.nanoTime(); gl.glViewport(0, 0, this.width, this.height); }
@Override public void onSurfaceCreated (EGLConfig config) { eglContext = ((EGL10)EGLContext.getEGL()).eglGetCurrentContext(); setupGL(); logConfig(config); updatePpi(); Mesh.invalidateAllMeshes(app); Texture.invalidateAllTextures(app); Cubemap.invalidateAllCubemaps(app); ShaderProgram.invalidateAllShaderPrograms(app); FrameBuffer.invalidateAllFrameBuffers(app); logManagedCachesStatus(); Point outSize = new Point(); Display display = app.getWindowManager().getDefaultDisplay(); display.getSize(outSize); this.width = outSize.x; this.height = outSize.y; this.mean = new WindowedMean(5); this.lastFrameTime = System.nanoTime(); gl20.glViewport(0, 0, this.width, this.height); }
public void clearManagedCaches () { Mesh.clearAllMeshes(app); Texture.clearAllTextures(app); Cubemap.clearAllCubemaps(app); ShaderProgram.clearAllShaderPrograms(app); FrameBuffer.clearAllFrameBuffers(app); logManagedCachesStatus(); }
protected void logManagedCachesStatus () { Gdx.app.log(LOG_TAG, Mesh.getManagedStatus()); Gdx.app.log(LOG_TAG, Texture.getManagedStatus()); Gdx.app.log(LOG_TAG, Cubemap.getManagedStatus()); Gdx.app.log(LOG_TAG, ShaderProgram.getManagedStatus()); Gdx.app.log(LOG_TAG, FrameBuffer.getManagedStatus()); }
public void loadReflection(String refl){ ref=new Cubemap(Gdx.files.internal("cubemaps/" + refl + "_c00.bmp"), Gdx.files.internal("cubemaps/" + refl + "_c01.bmp"), Gdx.files.internal("cubemaps/" + refl + "_c02.bmp"), Gdx.files.internal("cubemaps/" + refl + "_c03.bmp"), Gdx.files.internal("cubemaps/" + refl + "_c04.bmp"), Gdx.files.internal("cubemaps/" + refl + "_c05.bmp")); ref.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); ref.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge); }
@Override protected Cubemap loadObject(FileHandle file) { Array<TextureData> textures = new Array<TextureData>(); for(String sideName : SIDES) { FileHandle sideHandle = Gdx.files.internal(file.pathWithoutExtension() + sideName + "." + file.extension()); if (sideHandle.exists()) { TextureAsset sideAsset = manager.getTexture(sideHandle.file().getAbsolutePath()); Texture texture = sideAsset.get(); addDependency(sideAsset); textures.add(texture.getTextureData()); } else { throw new GdxRuntimeException("Could not find " + sideHandle.path()); } } Cubemap cm = new Cubemap( textures.get(0), textures.get(1), textures.get(2), textures.get(3), textures.get(4), textures.get(5) ); cm.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge); cm.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); return cm; }
public static IBLAttribute createIrradiance(final Cubemap cubemap) { return new IBLAttribute(IrradianceType, cubemap); }
public static IBLAttribute createPrefilter(final Cubemap cubemap) { return new IBLAttribute(PrefilterType, cubemap); }
public <T extends Cubemap> IBLAttribute(final long type, final TextureDescriptor<T> textureDescription) { this(type); this.textureDescription.set(textureDescription); }
public <T extends Cubemap> IBLAttribute(final long type, final TextureDescriptor<T> textureDescription, int uvIndex) { this(type, textureDescription); this.uvIndex = uvIndex; }
public IBLAttribute(final long type, final Cubemap texture) { this(type); textureDescription.texture = texture; }
public void set(final Cubemap cubemap) { textureDescription.texture = cubemap; }
public Cubemap getSkyboxCubemap() { if (skyboxCubemap == null) { skyboxCubemap = skyboxAsset.get(); } return skyboxCubemap; }
public CubemapAttribute (final long type) { super(type); if (!is(type)) throw new GdxRuntimeException("Invalid type specified"); textureDescription = new TextureDescriptor<Cubemap>(); }
public <T extends Cubemap> CubemapAttribute (final long type, final TextureDescriptor<T> textureDescription) { this(type); this.textureDescription.set(textureDescription); }
public CubemapAttribute (final long type, final Cubemap texture) { this(type); textureDescription.texture = texture; }