Texture texture = rc.getTexture(this.activeAttributes.interiorImageSource); if (texture == null) { texture = rc.retrieveTexture(this.activeAttributes.interiorImageSource, defaultInteriorImageOptions);
protected void addTileOrDescendants(RenderContext rc, ImageTile tile) { if (!tile.intersectsSector(this.levelSet.sector) || !tile.intersectsFrustum(rc, rc.frustum)) { return; // ignore the tile and its descendants if it's not needed or not visible } if (tile.level.isLastLevel() || !tile.mustSubdivide(rc, this.detailControl)) { this.addTile(rc, tile); return; // use the tile if it does not need to be subdivided } ImageTile currentAncestorTile = this.ancestorTile; Texture currentAncestorTexture = this.ancestorTexture; ImageSource tileImageSource = tile.getImageSource(); if (tileImageSource != null) { // tile has an image source; its level is not empty Texture tileTexture = rc.getTexture(tileImageSource); if (tileTexture != null) { // tile has a texture; use it as a fallback tile for descendants this.ancestorTile = tile; this.ancestorTexture = tileTexture; } } for (Tile child : tile.subdivideToCache(this.tileFactory, this.tileCache, 4)) { // each tile has a cached size of 1 this.addTileOrDescendants(rc, (ImageTile) child); // recursively process the tile's children } this.ancestorTile = currentAncestorTile; // restore the last fallback tile, even if it was null this.ancestorTexture = currentAncestorTexture; }
Texture texture = rc.getTexture(this.activeAttributes.outlineImageSource); if (texture == null) { texture = rc.retrieveTexture(this.activeAttributes.outlineImageSource, defaultOutlineImageOptions);
protected void renderGround(RenderContext rc) { if (rc.terrain.getSector().isEmpty()) { return; // no terrain surface to render on } Pool<DrawableGroundAtmosphere> pool = rc.getDrawablePool(DrawableGroundAtmosphere.class); DrawableGroundAtmosphere drawable = DrawableGroundAtmosphere.obtain(pool); drawable.program = (GroundProgram) rc.getShaderProgram(GroundProgram.KEY); if (drawable.program == null) { drawable.program = (GroundProgram) rc.putShaderProgram(GroundProgram.KEY, new GroundProgram(rc.resources)); } drawable.lightDirection.set(this.activeLightDirection); drawable.globeRadius = rc.globe.getEquatorialRadius(); // Use this layer's night image when the light location is different than the eye location. if (this.nightImageSource != null && this.lightLocation != null) { drawable.nightTexture = rc.getTexture(this.nightImageSource); if (drawable.nightTexture == null) { drawable.nightTexture = rc.retrieveTexture(this.nightImageSource, this.nightImageOptions); } } else { drawable.nightTexture = null; } rc.offerSurfaceDrawable(drawable, Double.POSITIVE_INFINITY /*z-order after all other surface drawables*/); }
protected void addTile(RenderContext rc, ImageTile tile) { ImageSource imageSource = tile.getImageSource(); if (imageSource == null) { return; // no image source indicates an empty level or an image missing from the tiled data store } Texture texture = rc.getTexture(imageSource); // try to get the texture from the cache if (texture == null) { texture = rc.retrieveTexture(imageSource, this.imageOptions); // puts retrieved textures in the cache } if (texture != null) { // use the tile's own texture Pool<DrawableSurfaceTexture> pool = rc.getDrawablePool(DrawableSurfaceTexture.class); Drawable drawable = DrawableSurfaceTexture.obtain(pool).set(this.activeProgram, tile.sector, texture, texture.getTexCoordTransform()); rc.offerSurfaceDrawable(drawable, 0 /*z-order*/); } else if (this.ancestorTile != null) { // use the ancestor tile's texture, transformed to fill the tile sector this.ancestorTexCoordMatrix.set(this.ancestorTexture.getTexCoordTransform()); this.ancestorTexCoordMatrix.multiplyByTileTransform(tile.sector, this.ancestorTile.sector); Pool<DrawableSurfaceTexture> pool = rc.getDrawablePool(DrawableSurfaceTexture.class); Drawable drawable = DrawableSurfaceTexture.obtain(pool).set(this.activeProgram, tile.sector, this.ancestorTexture, this.ancestorTexCoordMatrix); rc.offerSurfaceDrawable(drawable, 0 /*z-order*/); } }
Texture texture = rc.getTexture(this.activeAttributes.outlineImageSource); if (texture == null) { texture = rc.retrieveTexture(this.activeAttributes.outlineImageSource, defaultOutlineImageOptions);
@Override protected void doRender(RenderContext rc) { if (this.sector.isEmpty()) { return; // nothing to render } if (!rc.terrain.getSector().intersects(this.sector)) { return; // no terrain surface to render on } Texture texture = rc.getTexture(this.imageSource); // try to get the texture from the cache if (texture == null) { texture = rc.retrieveTexture(this.imageSource, this.imageOptions); // puts retrieved textures in the cache } if (texture == null) { return; // no texture to draw } // Enqueue a drawable surface texture for processing on the OpenGL thread. SurfaceTextureProgram program = this.getShaderProgram(rc); Pool<DrawableSurfaceTexture> pool = rc.getDrawablePool(DrawableSurfaceTexture.class); DrawableSurfaceTexture drawable = DrawableSurfaceTexture.obtain(pool).set(program, this.sector, texture, texture.getTexCoordTransform()); rc.offerSurfaceDrawable(drawable, 0 /*z-order*/); // Enqueue a picked object that associates the drawable surface texture with this surface image. if (rc.pickMode) { int pickedObjectId = rc.nextPickedObjectId(); PickedObject.identifierToUniqueColor(pickedObjectId, drawable.color); rc.offerPickedObject(PickedObject.fromRenderable(pickedObjectId, this, rc.currentLayer)); } }
Texture texture = rc.getTexture(this.activeAttributes.interiorImageSource); if (texture == null) { texture = rc.retrieveTexture(this.activeAttributes.interiorImageSource, defaultInteriorImageOptions);
Texture texture = rc.getTexture(this.activeAttributes.outlineImageSource); if (texture == null) { texture = rc.retrieveTexture(this.activeAttributes.outlineImageSource, defaultOutlineImageOptions);
this.activeTexture = rc.getTexture(this.activeAttributes.imageSource); // try to get the texture from the cache