diff --git a/jme3-core/src/main/java/com/jme3/renderer/Renderer.java b/jme3-core/src/main/java/com/jme3/renderer/Renderer.java index 0d53c15871..17dda4f8f5 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/Renderer.java +++ b/jme3-core/src/main/java/com/jme3/renderer/Renderer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2019 jMonkeyEngine + * Copyright (c) 2009-2021 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -467,4 +467,19 @@ public interface Renderer { */ public int getDefaultAnisotropicFilter(); + /** + * Test whether images with the sRGB flag will be linearized when read by a + * shader. + * + * @return true for linearization, false for no linearization + */ + public boolean isLinearizeSrgbImages(); + + /** + * Test whether colors rendered to the main framebuffer undergo + * linear-to-sRGB conversion. + * + * @return true for conversion, false for no conversion + */ + public boolean isMainFrameBufferSrgb(); } diff --git a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java index daccf3c5cc..7e330167d6 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java +++ b/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2020 jMonkeyEngine + * Copyright (c) 2009-2021 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -3286,4 +3286,30 @@ public boolean getAlphaToCoverage() { public int getDefaultAnisotropicFilter() { return this.defaultAnisotropicFilter; } + + /** + * Test whether images with the sRGB flag will be linearized when read by a + * shader. + * + * @return true for linearization, false for no linearization + */ + @Override + public boolean isLinearizeSrgbImages() { + return linearizeSrgbImages; + } + + /** + * Test whether colors rendered to the main framebuffer undergo + * linear-to-sRGB conversion. + * + * @return true for conversion, false for no conversion + */ + @Override + public boolean isMainFrameBufferSrgb() { + if (!caps.contains(Caps.Srgb)) { + return false; + } else { + return gl.glIsEnabled(GLExt.GL_FRAMEBUFFER_SRGB_EXT); + } + } } diff --git a/jme3-core/src/main/java/com/jme3/system/NullRenderer.java b/jme3-core/src/main/java/com/jme3/system/NullRenderer.java index 12281a00a5..0651938e2f 100644 --- a/jme3-core/src/main/java/com/jme3/system/NullRenderer.java +++ b/jme3-core/src/main/java/com/jme3/system/NullRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2020 jMonkeyEngine + * Copyright (c) 2009-2021 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -259,4 +259,26 @@ public boolean getAlphaToCoverage() { public int getDefaultAnisotropicFilter() { return 0; } + + /** + * Test whether images with the sRGB flag will be linearized when read by a + * shader. + * + * @return true for linearization, false for no linearization + */ + @Override + public boolean isLinearizeSrgbImages() { + return false; + } + + /** + * Test whether colors rendered to the main framebuffer undergo + * linear-to-sRGB conversion. + * + * @return true for conversion, false for no conversion + */ + @Override + public boolean isMainFrameBufferSrgb() { + return false; + } }