protected void initExample() {
_canvas.setTitle("RenderEffects Example");
// Create a new sphere that rotates
final Sphere sphere = new Sphere("Sphere", new Vector3(0, 0, 0), 32, 32, 5);
sphere.setModelBound(new BoundingBox());
sphere.setTranslation(new Vector3(0, 0, -15));
sphere.addController(new SpatialController<Spatial>() {
private final Vector3 _axis = new Vector3(1, 1, 0.5f).normalizeLocal();
private final Matrix3 _rotate = new Matrix3();
private double _angle = 0;
public void update(final double time, final Spatial caller) {
// update our rotation
_angle = _angle + (_timer.getTimePerFrame() * 25);
if (_angle > 180) {
_angle = -180;
}
_rotate.fromAngleNormalAxis(_angle * MathUtils.DEG_TO_RAD, _axis);
sphere.setRotation(_rotate);
}
});
_root.attachChild(sphere);
// Add a texture to the sphere.
final TextureState ts = new TextureState();
ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
sphere.setRenderState(ts);
// Setup our manager
effectManager = new EffectManager(_settings, TextureStoreFormat.RGBA8);
effectManager.setSceneCamera(_canvas.getCanvasRenderer().getCamera());