com.threed.jpct.procs
Class BloomGLProcessor

java.lang.Object
  extended bycom.threed.jpct.procs.BloomGLProcessor
All Implemented Interfaces:
IPostProcessor

public class BloomGLProcessor
extends java.lang.Object
implements IPostProcessor

An implementation of an IPostProcessor which implements a bloom effect (kind of pseudo-HDR) for the OpenGL renderer. When run on a software renderer's framebuffer, it's giving a warning once and does nothing afterwards.
The bloom effect can be configured by various variables in the constructor.


Constructor Summary
BloomGLProcessor()
          Creates a bloom effect with default settings.
BloomGLProcessor(int darkening, int blur, int strength, int quality)
          Creates a bloom effect on the framebuffer's content.
 
Method Summary
 void dispose()
          Will be called when a post processor gets removed from a framebuffer and should be called, when the processor gets garbage collected.
 void init(FrameBuffer buffer)
          Initialize the processor.
 boolean isDelayed()
          Is the rendering delayed?
 boolean isInitialized()
          Has to return true if the init()-method has run correctly and should return false after the processor has been disposed (but doesn't have to, if an implementation requires something else...no problem).
 void process()
          Does the actual processing.
 void render()
          Should be called to apply a delayed processor to the current framebuffer.
 void setCombining(boolean comb)
          If set to false, only the blured version of the image will be shown, not the final result.
 void setDelayed(boolean delayed)
          Sets the processor to delayed.
 void snapshot()
          Takes a snapshot of the current scene.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BloomGLProcessor

public BloomGLProcessor()
Creates a bloom effect with default settings.


BloomGLProcessor

public BloomGLProcessor(int darkening,
                        int blur,
                        int strength,
                        int quality)
Creates a bloom effect on the framebuffer's content.

Parameters:
darkening - The higher this value, the more the bright areas will be affected only. The lower it is, the more bloom effect even not so bright areas of the screen will get. Increasing this value slows down the process.
blur - Increasing this values leads to a higher blur but slower performance. Increasing it to very high values leads to strange artifacts.
strength - This controls the "strength" of the effect, i.e. how much the "bloomed" image affects the actual rendering. Increasing it slows down the processs.
quality - Increasing this value lowers(!) the quality of the texture map used to do the post processing. 0 means that the texture has the same size as the framebuffer, 1 means it's a quarter of that size, 2 an eighth...Reasonable value are 1 and 2. The higher the value, the higher the demand for fillrate, i.e. the slower.
Method Detail

init

public void init(FrameBuffer buffer)
Description copied from interface: IPostProcessor
Initialize the processor. Because it has to work on the framebuffer, it should be bound to it. I.e. you shouldn't write a post processor which can be run on multiple framebuffers at a time albeit it's up the actual implementation to ensure this. All the framework does, is to check if isInitialized() returns true, so this method has to ensure that this is the case to prevent all kinds of strange bugs and multi initialization calls.
This method will be called on the first call of the post processor, not when adding it to a framebuffer.

Specified by:
init in interface IPostProcessor
Parameters:
buffer - the FrameBuffer

isInitialized

public boolean isInitialized()
Description copied from interface: IPostProcessor
Has to return true if the init()-method has run correctly and should return false after the processor has been disposed (but doesn't have to, if an implementation requires something else...no problem).

Specified by:
isInitialized in interface IPostProcessor
Returns:
boolean is it initialized?

setCombining

public void setCombining(boolean comb)
If set to false, only the blured version of the image will be shown, not the final result. Useful for finding a good blur setting or for special effects.

Parameters:
comb - boolean do the final step, or leave it out...

process

public void process()
Description copied from interface: IPostProcessor
Does the actual processing. It's totally up to the implementation what happens here.

Specified by:
process in interface IPostProcessor

dispose

public void dispose()
Description copied from interface: IPostProcessor
Will be called when a post processor gets removed from a framebuffer and should be called, when the processor gets garbage collected. A processor will implicitly be removed from a framebuffer if a renderer gets enabled or disabled on it.

Specified by:
dispose in interface IPostProcessor

snapshot

public void snapshot()
Takes a snapshot of the current scene. This snapshot will be used to render to bloom effect onto once you call render() on a delayed processor. On a normal processor, this will have no effect.


render

public void render()
Should be called to apply a delayed processor to the current framebuffer. If the processor isn't delayed, this method will have no effect.


setDelayed

public void setDelayed(boolean delayed)
Sets the processor to delayed. That means that the actual rendering to the framebuffer will be delayed until one calls the render()-method.

Parameters:
delayed - should the rendering be delayed? Default is false.

isDelayed

public boolean isDelayed()
Is the rendering delayed?

Returns: