Search in sources :

Example 1 with EntityOverlay

use of io.xol.chunkstories.api.entity.interfaces.EntityOverlay in project chunkstories by Hugobros3.

the class WorldRendererImplementation method blitFinalImage.

public void blitFinalImage(RenderingInterface renderingContext, boolean hideGui) {
    Texture finalBuffer = this.renderingGraph.getRenderPass("final").resolvedOutputs.get("finalBuffer");
    if (finalBuffer != null && finalBuffer instanceof Texture2D) {
        final Texture2D finalTexture = (Texture2D) (finalBuffer);
        // We render to the screen.
        renderingContext.getRenderTargetManager().setConfiguration(null);
        renderingContext.setDepthTestMode(DepthTestMode.DISABLED);
        renderingContext.setBlendMode(BlendMode.DISABLED);
        renderingContext.useShader("blit");
        renderingContext.bindTexture2D("diffuseTexture", finalTexture);
        renderingContext.drawFSQuad();
        if (!hideGui) {
            world.entitiesLock.readLock().lock();
            Iterator<Entity> ei = world.getAllLoadedEntities();
            Entity e;
            while (ei.hasNext()) {
                e = ei.next();
                if (e instanceof EntityOverlay) {
                    ((EntityOverlay) e).drawEntityOverlay(renderingContext);
                }
            }
            world.entitiesLock.readLock().unlock();
        }
    }
}
Also used : Entity(io.xol.chunkstories.api.entity.Entity) Texture2D(io.xol.chunkstories.api.rendering.textures.Texture2D) Texture(io.xol.chunkstories.api.rendering.textures.Texture) HeightmapArrayTexture(io.xol.chunkstories.renderer.terrain.HeightmapArrayTexture) EntityOverlay(io.xol.chunkstories.api.entity.interfaces.EntityOverlay)

Aggregations

Entity (io.xol.chunkstories.api.entity.Entity)1 EntityOverlay (io.xol.chunkstories.api.entity.interfaces.EntityOverlay)1 Texture (io.xol.chunkstories.api.rendering.textures.Texture)1 Texture2D (io.xol.chunkstories.api.rendering.textures.Texture2D)1 HeightmapArrayTexture (io.xol.chunkstories.renderer.terrain.HeightmapArrayTexture)1