// Add a step to draw our scene to our scene texture.
effectManager.addEffect(new SpatialRTTEffect("*Next", null, _root));
// Add a bloom effect
final SimpleBloomEffect bloomEffect = new SimpleBloomEffect();
effectManager.addEffect(bloomEffect);
// Add a sepia tone post effect
final Texture sepiaTexture = TextureManager.load(
new URLResourceSource(ResourceLocatorTool.getClassPathResource(ColorReplaceEffect.class,
"com/ardor3d/extension/effect/sepiatone.png")), Texture.MinificationFilter.Trilinear, true);
final ColorReplaceEffect sepiaEffect = new ColorReplaceEffect(sepiaTexture);
effectManager.addEffect(sepiaEffect);
// Finally, add a step to draw the result to the framebuffer
final FrameBufferOutputEffect out = new FrameBufferOutputEffect();
final BlendState blend = new BlendState();
blend.setBlendEnabled(true);
blend.setSourceFunction(SourceFunction.SourceAlpha);
blend.setDestinationFunction(DestinationFunction.OneMinusSourceAlpha);
out.setBlend(blend);
effectManager.addEffect(out);
// setup effects
effectManager.setupEffects();
// add toggle for the effects
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.ONE), new TriggerAction() {
@Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
bloomEffect.setEnabled(!bloomEffect.isEnabled());
updateText();
}
}));
_logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.TWO), new TriggerAction() {
@Override