diff options
author | ricardolpd <[email protected]> | 2012-11-28 22:22:37 +0000 |
---|---|---|
committer | ricardolpd <[email protected]> | 2012-11-28 22:22:37 +0000 |
commit | 239778d8569db28c3713516afe03a5516984460e (patch) | |
tree | 01eafc5a237da1d4bd875375b05e422538a98b0a | |
parent | c896e51a67873939bec3e2c9d9a424b32241c56e (diff) |
- Updated AnimationStateExample to allow automatic reset when current state is the stop state.
- Updated AnimationStateExample with JOGL2.0rc11.
-rw-r--r-- | trunk/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationStateExample.java | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/trunk/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationStateExample.java b/trunk/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationStateExample.java index 10a6002..ee705bc 100644 --- a/trunk/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationStateExample.java +++ b/trunk/ardor3d-examples/src/main/java/com/ardor3d/example/pipeline/AnimationStateExample.java @@ -13,6 +13,7 @@ package com.ardor3d.example.pipeline; import java.io.IOException; import java.util.EnumSet; import java.util.List; +import java.util.concurrent.Callable; import com.ardor3d.example.ExampleBase; import com.ardor3d.example.Purpose; @@ -45,11 +46,13 @@ import com.ardor3d.extension.ui.event.ActionListener; import com.ardor3d.extension.ui.layout.AnchorLayout; import com.ardor3d.extension.ui.layout.AnchorLayoutData; import com.ardor3d.extension.ui.util.Alignment; +import com.ardor3d.framework.CanvasRenderer; import com.ardor3d.framework.NativeCanvas; import com.ardor3d.light.DirectionalLight; import com.ardor3d.math.ColorRGBA; import com.ardor3d.math.Vector3; import com.ardor3d.renderer.Camera; +import com.ardor3d.renderer.RenderContext; import com.ardor3d.renderer.Renderer; import com.ardor3d.renderer.state.CullState; import com.ardor3d.renderer.state.CullState.Face; @@ -59,6 +62,8 @@ import com.ardor3d.scenegraph.Node; import com.ardor3d.scenegraph.Spatial; import com.ardor3d.scenegraph.hint.DataMode; import com.ardor3d.scenegraph.visitor.Visitor; +import com.ardor3d.util.GameTaskQueue; +import com.ardor3d.util.GameTaskQueueManager; import com.ardor3d.util.ReadOnlyTimer; import com.ardor3d.util.geom.MeshCombiner; import com.ardor3d.util.resource.ResourceLocatorTool; @@ -98,7 +103,16 @@ public class AnimationStateExample extends ExampleBase { @Override protected void initExample() { _canvas.setTitle("Ardor3D - Animation State Example"); - _canvas.getCanvasRenderer().getRenderer().setBackgroundColor(ColorRGBA.GRAY); + final CanvasRenderer canvasRenderer = _canvas.getCanvasRenderer(); + final RenderContext renderContext = canvasRenderer.getRenderContext(); + final Renderer renderer = canvasRenderer.getRenderer(); + GameTaskQueueManager.getManager(renderContext).getQueue(GameTaskQueue.RENDER).enqueue(new Callable<Void>() { + @Override + public Void call() throws Exception { + renderer.setBackgroundColor(ColorRGBA.GRAY); + return null; + } + }); // set camera final Camera cam = _canvas.getCanvasRenderer().getCamera(); @@ -201,9 +215,21 @@ public class AnimationStateExample extends ExampleBase { }); basePanel.add(stopButton); + final UICheckBox resetAnimCheck = new UICheckBox("Reset Animation On Stop"); + resetAnimCheck + .setLayoutData(new AnchorLayoutData(Alignment.TOP_LEFT, stopButton, Alignment.BOTTOM_LEFT, 0, -5)); + resetAnimCheck.setSelected(false); + resetAnimCheck.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent event) { + manager.setResetClipsOnStop(resetAnimCheck.isSelected()); + + } + }); + basePanel.add(resetAnimCheck); + final UICheckBox gpuSkinningCheck = new UICheckBox("Use GPU skinning"); - gpuSkinningCheck.setLayoutData(new AnchorLayoutData(Alignment.TOP_LEFT, stopButton, Alignment.BOTTOM_LEFT, 0, - -5)); + gpuSkinningCheck.setLayoutData(new AnchorLayoutData(Alignment.TOP_LEFT, resetAnimCheck, Alignment.BOTTOM_LEFT, + 0, -5)); gpuSkinningCheck.setSelected(false); gpuSkinningCheck.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { |