From d6124d34893dfe704a90a4b24b52c8b0d940070b Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Tue, 27 Dec 2011 21:30:28 +0000 Subject: [PATCH] Renamed AnimationHelper to AnimationFactory git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8958 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- ...ationHelper.java => AnimationFactory.java} | 6 ++-- .../jme3test/animation/TestCinematic.java | 36 +++++++++---------- ...nHelper.java => TestAnimationFactory.java} | 24 ++++++------- 3 files changed, 33 insertions(+), 33 deletions(-) rename engine/src/core/com/jme3/animation/{AnimationHelper.java => AnimationFactory.java} (99%) rename engine/src/test/jme3test/model/anim/{TestAnimationHelper.java => TestAnimationFactory.java} (74%) diff --git a/engine/src/core/com/jme3/animation/AnimationHelper.java b/engine/src/core/com/jme3/animation/AnimationFactory.java similarity index 99% rename from engine/src/core/com/jme3/animation/AnimationHelper.java rename to engine/src/core/com/jme3/animation/AnimationFactory.java index c2ae950da..b994ccb32 100644 --- a/engine/src/core/com/jme3/animation/AnimationHelper.java +++ b/engine/src/core/com/jme3/animation/AnimationFactory.java @@ -52,7 +52,7 @@ import com.jme3.math.Vector3f; * * @author Nehon */ -public class AnimationHelper { +public class AnimationFactory { /** * step for splitting rotation that have a n ange above PI/2 @@ -150,7 +150,7 @@ public class AnimationHelper { * @param duration the desired duration for the resulting animation * @param name the name of the resulting animation */ - public AnimationHelper(float duration, String name) { + public AnimationFactory(float duration, String name) { this(duration, name, 30); } @@ -160,7 +160,7 @@ public class AnimationHelper { * @param name the name of the resulting animation * @param fps the number of frames per second for this animation (default is 30) */ - public AnimationHelper(float duration, String name, int fps) { + public AnimationFactory(float duration, String name, int fps) { this.name = name; this.duration = duration; this.fps = fps; diff --git a/engine/src/test/jme3test/animation/TestCinematic.java b/engine/src/test/jme3test/animation/TestCinematic.java index 89fe94d3f..a21382827 100644 --- a/engine/src/test/jme3test/animation/TestCinematic.java +++ b/engine/src/test/jme3test/animation/TestCinematic.java @@ -32,7 +32,7 @@ package jme3test.animation; import com.jme3.animation.AnimControl; -import com.jme3.animation.AnimationHelper; +import com.jme3.animation.AnimationFactory; import com.jme3.animation.LoopMode; import com.jme3.app.SimpleApplication; import com.jme3.cinematic.Cinematic; @@ -106,30 +106,30 @@ public class TestCinematic extends SimpleApplication { stateManager.attach(cinematic); createCameraMotion(); - + //creating spatial animation for the teapot - AnimationHelper helper = new AnimationHelper(20, "teapotAnim"); - helper.addTimeTranslation(0, new Vector3f(10, 0, 10)); - helper.addTimeTranslation(20, new Vector3f(10, 0, -10)); - helper.addTimeScale(10, new Vector3f(4, 4, 4)); - helper.addTimeScale(20, new Vector3f(1, 1, 1)); - helper.addTimeRotation(20, new Quaternion().fromAngleAxis(FastMath.PI, Vector3f.UNIT_Y)); + AnimationFactory factory = new AnimationFactory(20, "teapotAnim"); + factory.addTimeTranslation(0, new Vector3f(10, 0, 10)); + factory.addTimeTranslation(20, new Vector3f(10, 0, -10)); + factory.addTimeScale(10, new Vector3f(4, 4, 4)); + factory.addTimeScale(20, new Vector3f(1, 1, 1)); + factory.addTimeRotationAngles(20, 0, 4 * FastMath.TWO_PI, 0); AnimControl control = new AnimControl(); - control.addAnim(helper.buildAnimation()); + control.addAnim(factory.buildAnimation()); teapot.addControl(control); - + //fade in - cinematic.addCinematicEvent(0, new FadeEvent(true)); - cinematic.activateCamera(0, "aroundCam"); - cinematic.addCinematicEvent(0, new AnimationTrack(teapot, "teapotAnim", LoopMode.DontLoop)); + cinematic.addCinematicEvent(0, new FadeEvent(true)); + // cinematic.activateCamera(0, "aroundCam"); + cinematic.addCinematicEvent(0, new AnimationTrack(teapot, "teapotAnim", LoopMode.DontLoop)); cinematic.addCinematicEvent(0, cameraMotionTrack); cinematic.addCinematicEvent(0, new SoundTrack("Sound/Environment/Nature.ogg", LoopMode.Loop)); cinematic.addCinematicEvent(3f, new SoundTrack("Sound/Effects/kick.wav")); cinematic.addCinematicEvent(3, new SubtitleTrack(nifty, "start", 3, "jMonkey engine really kicks A...")); cinematic.addCinematicEvent(5.1f, new SoundTrack("Sound/Effects/Beep.ogg", 1)); cinematic.addCinematicEvent(2, new AnimationTrack(model, "Walk", LoopMode.Loop)); - cinematic.activateCamera(6, "topView"); - cinematic.activateCamera(10, "aroundCam"); + cinematic.activateCamera(0, "topView"); + // cinematic.activateCamera(10, "aroundCam"); //fade out cinematic.addCinematicEvent(19, new FadeEvent(false)); @@ -184,7 +184,7 @@ public class TestCinematic extends SimpleApplication { CameraNode camNode = cinematic.bindCamera("topView", cam); camNode.setLocalTranslation(new Vector3f(0, 50, 0)); - camNode.lookAt(model.getLocalTranslation(), Vector3f.UNIT_Y); + camNode.lookAt(teapot.getLocalTranslation(), Vector3f.UNIT_Y); CameraNode camNode2 = cinematic.bindCamera("aroundCam", cam); path = new MotionPath(); @@ -282,7 +282,7 @@ public class TestCinematic extends SimpleApplication { private class FadeEvent extends AbstractCinematicEvent { boolean in = true; - float value = 0; + float value = 0; public FadeEvent(boolean in) { super(1); @@ -292,7 +292,7 @@ public class TestCinematic extends SimpleApplication { @Override public void onPlay() { - + fade.setDuration(1f / cinematic.getSpeed()); if (in) { fade.fadeIn(); diff --git a/engine/src/test/jme3test/model/anim/TestAnimationHelper.java b/engine/src/test/jme3test/model/anim/TestAnimationFactory.java similarity index 74% rename from engine/src/test/jme3test/model/anim/TestAnimationHelper.java rename to engine/src/test/jme3test/model/anim/TestAnimationFactory.java index 9ef7b6201..55768517c 100644 --- a/engine/src/test/jme3test/model/anim/TestAnimationHelper.java +++ b/engine/src/test/jme3test/model/anim/TestAnimationFactory.java @@ -1,7 +1,7 @@ package jme3test.model.anim; import com.jme3.animation.AnimControl; -import com.jme3.animation.AnimationHelper; +import com.jme3.animation.AnimationFactory; import com.jme3.app.SimpleApplication; import com.jme3.light.AmbientLight; import com.jme3.light.DirectionalLight; @@ -13,7 +13,7 @@ import com.jme3.scene.Node; import com.jme3.scene.shape.Box; import com.jme3.util.TangentBinormalGenerator; -public class TestAnimationHelper extends SimpleApplication { +public class TestAnimationFactory extends SimpleApplication { public static void main(String[] args) { TestSpatialAnim app = new TestSpatialAnim(); @@ -48,32 +48,32 @@ public class TestAnimationHelper extends SimpleApplication { //creating quite complex animation witht the AnimationHelper // animation of 6 seconds named "anim" and with 25 frames per second - AnimationHelper animationHelper = new AnimationHelper(6, "anim", 25); + AnimationFactory animationFactory = new AnimationFactory(6, "anim", 25); //creating a translation keyFrame at time = 3 with a translation on the x axis of 5 WU - animationHelper.addTimeTranslation(3, new Vector3f(5, 0, 0)); + animationFactory.addTimeTranslation(3, new Vector3f(5, 0, 0)); //reseting the translation to the start position at time = 6 - animationHelper.addTimeTranslation(6, new Vector3f(0, 0, 0)); + animationFactory.addTimeTranslation(6, new Vector3f(0, 0, 0)); //Creating a scale keyFrame at time = 2 with the unit scale. - animationHelper.addTimeScale(2, new Vector3f(1, 1, 1)); + animationFactory.addTimeScale(2, new Vector3f(1, 1, 1)); //Creating a scale keyFrame at time = 4 scaling to 1.5 - animationHelper.addTimeScale(4, new Vector3f(1.5f, 1.5f, 1.5f)); + animationFactory.addTimeScale(4, new Vector3f(1.5f, 1.5f, 1.5f)); //reseting the scale to the start value at time = 5 - animationHelper.addTimeScale(5, new Vector3f(1, 1, 1)); + animationFactory.addTimeScale(5, new Vector3f(1, 1, 1)); //Creating a rotation keyFrame at time = 0.5 of quarter PI around the Z axis - animationHelper.addTimeRotation(0.5f,new Quaternion().fromAngleAxis(FastMath.QUARTER_PI, Vector3f.UNIT_Z)); + animationFactory.addTimeRotation(0.5f,new Quaternion().fromAngleAxis(FastMath.QUARTER_PI, Vector3f.UNIT_Z)); //rotating back to initial rotation value at time = 1 - animationHelper.addTimeRotation(1,Quaternion.IDENTITY); + animationFactory.addTimeRotation(1,Quaternion.IDENTITY); //Creating a rotation keyFrame at time = 2. Note that i used the Euler angle version because the angle is higher than PI //this should result in a complete revolution of the spatial around the x axis in 1 second (from 1 to 2) - animationHelper.addTimeRotationAngles(2, FastMath.TWO_PI,0, 0); + animationFactory.addTimeRotationAngles(2, FastMath.TWO_PI,0, 0); AnimControl control = new AnimControl(); - control.addAnim(animationHelper.buildAnimation()); + control.addAnim(animationFactory.buildAnimation()); model.addControl(control);