Introduced RGB10_A2 Image Format. It offers greater precision for RGB channels at the expense of precision for the alpha channel. This format is convenient for post processing, and especially when gamma correction is turned on.

This commit is contained in:
Nehon 2014-05-25 14:59:06 +02:00
parent 8ff6f8df24
commit 09e705dcc4
4 changed files with 18 additions and 2 deletions

View File

@ -40,6 +40,7 @@ import com.jme3.renderer.Renderer;
import com.jme3.renderer.ViewPort;
import com.jme3.renderer.queue.RenderQueue;
import com.jme3.texture.FrameBuffer;
import com.jme3.texture.Image;
import com.jme3.texture.Image.Format;
import com.jme3.texture.Texture;
import com.jme3.texture.Texture2D;
@ -201,10 +202,12 @@ public abstract class Filter implements Savable {
/**
* returns the default pass texture format
* default is {@link Format#RGB10_A2}
*
* @return
*/
protected Format getDefaultPassTextureFormat() {
return Format.RGBA8;
return Format.RGB10_A2;
}
/**

View File

@ -274,7 +274,18 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ {
* 24-bit depth with 8-bit stencil.
* Check the cap {@link Caps#PackedDepthStencilBuffer}.
*/
Depth24Stencil8(32, true, false, false);
Depth24Stencil8(32, true, false, false),
/**
* 10 bits each for RGB, 2 for Alpha. This can be a useful format for
* framebuffers, if you do not need a high-precision destination alpha
* value. It carries more color depth, thus preserving subtle
* gradations. They can also be used for normals, though there is no
* signed-normalized version, so you have to do the conversion manually.
* It is also a required format, so you can count on it
* being present.
*/
RGB10_A2(32, false);
private int bpp;
private boolean isDepth;

View File

@ -139,6 +139,7 @@ public class TextureUtil {
setFormat(Format.RGB9E5, GL2GL3.GL_RGB9_E5, GL.GL_RGB, GL2GL3.GL_UNSIGNED_INT_5_9_9_9_REV, false);
setFormat(Format.RGB16F_to_RGB111110F, GL.GL_R11F_G11F_B10F, GL.GL_RGB, GL.GL_HALF_FLOAT, false);
setFormat(Format.RGB16F_to_RGB9E5, GL2.GL_RGB9_E5, GL.GL_RGB, GL.GL_HALF_FLOAT, false);
setFormat(Format.RGB10_A2, GL.GL_RGB10_A2, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, false);
// RGBA formats
setFormat(Format.ABGR8, GL.GL_RGBA8, GL2.GL_ABGR_EXT, GL.GL_UNSIGNED_BYTE, false);

View File

@ -125,6 +125,7 @@ class TextureUtil {
setFormat(Format.RGB9E5, EXTTextureSharedExponent.GL_RGB9_E5_EXT, GL11.GL_RGB, EXTTextureSharedExponent.GL_UNSIGNED_INT_5_9_9_9_REV_EXT, false);
setFormat(Format.RGB16F_to_RGB111110F, EXTPackedFloat.GL_R11F_G11F_B10F_EXT, GL11.GL_RGB, ARBHalfFloatPixel.GL_HALF_FLOAT_ARB, false);
setFormat(Format.RGB16F_to_RGB9E5, EXTTextureSharedExponent.GL_RGB9_E5_EXT, GL11.GL_RGB, ARBHalfFloatPixel.GL_HALF_FLOAT_ARB, false);
setFormat(Format.RGB10_A2, GL11.GL_RGB10_A2, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, false);
// RGBA formats
setFormat(Format.ABGR8, GL11.GL_RGBA8, EXTAbgr.GL_ABGR_EXT, GL11.GL_UNSIGNED_BYTE, false);