Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public class FilterPostProcessor implements SceneProcessor, Savable {
private boolean multiView = false;
private AppProfiler prof;

private Format fbFormat = Format.RGB111110F;
private Format fbFormat = null;
private Format depthFormat = Format.Depth;

/**
Expand Down Expand Up @@ -206,13 +206,16 @@ public void initialize(RenderManager rm, ViewPort vp) {
}

// Determine optimal framebuffer format based on renderer capabilities
if (!renderer.getCaps().contains(Caps.PackedFloatTexture)) {
if (renderer.getCaps().contains(Caps.FloatColorBufferRGB)) {
fbFormat = Format.RGB16F;
} else if (renderer.getCaps().contains(Caps.FloatColorBufferRGBA)) {
fbFormat = Format.RGBA16F;
} else {
fbFormat = Format.RGB8;
if (fbFormat == null) {
fbFormat = Format.RGB111110F;
if (!renderer.getCaps().contains(Caps.PackedFloatTexture)) {
if (renderer.getCaps().contains(Caps.FloatColorBufferRGB)) {
fbFormat = Format.RGB16F;
} else if (renderer.getCaps().contains(Caps.FloatColorBufferRGBA)) {
fbFormat = Format.RGBA16F;
} else {
fbFormat = Format.RGB8;
}
}
}

Expand All @@ -231,11 +234,11 @@ public void initialize(RenderManager rm, ViewPort vp) {
}

/**
* Returns the default color buffer format used for the internal rendering
* passes of the filters. This format is determined during initialization
* based on the renderer's capabilities.
* Returns the default color buffer format used for the internal rendering passes of the filters. This
* format is determined during initialization based on the renderer's capabilities.
*
* @return The default `Format` for the filter pass textures.
* @return The default `Format` for the filter pass textures or null if set to be determined
* automatically.
*/
public Format getDefaultPassTextureFormat() {
return fbFormat;
Expand Down Expand Up @@ -701,10 +704,11 @@ public void setAssetManager(AssetManager assetManager) {
}

/**
* Sets the preferred `Image.Format` to be used for the internal frame buffer's
* color buffer.
* Sets the preferred `Image.Format` to be used for the internal frame buffer's color buffer.
*
* @param fbFormat The desired `Format` for the color buffer.
* @param fbFormat
* The desired `Format` for the color buffer or null to let the processor determine the optimal
* format based on renderer capabilities.
*/
public void setFrameBufferFormat(Format fbFormat) {
this.fbFormat = fbFormat;
Expand Down