|
@@ -56,6 +56,7 @@ import com.jme3.math.FastMath;
|
|
import com.jme3.math.Vector3f;
|
|
import com.jme3.math.Vector3f;
|
|
import com.jme3.post.FilterPostProcessor;
|
|
import com.jme3.post.FilterPostProcessor;
|
|
import com.jme3.post.filters.FadeFilter;
|
|
import com.jme3.post.filters.FadeFilter;
|
|
|
|
+import com.jme3.renderer.Caps;
|
|
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
|
|
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
|
|
import com.jme3.scene.CameraNode;
|
|
import com.jme3.scene.CameraNode;
|
|
import com.jme3.scene.Geometry;
|
|
import com.jme3.scene.Geometry;
|
|
@@ -94,7 +95,7 @@ public class TestCinematic extends SimpleApplication {
|
|
createScene();
|
|
createScene();
|
|
|
|
|
|
cinematic = new Cinematic(rootNode, 20);
|
|
cinematic = new Cinematic(rootNode, 20);
|
|
- cinematic.bindUi("jme3test/animation/subtitle.xml");
|
|
|
|
|
|
+ cinematic.bindUi("Interface/Nifty/CinematicTest.xml");
|
|
stateManager.attach(cinematic);
|
|
stateManager.attach(cinematic);
|
|
|
|
|
|
createCameraMotion();
|
|
createCameraMotion();
|
|
@@ -158,7 +159,6 @@ public class TestCinematic extends SimpleApplication {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onPause() {
|
|
public void onPause() {
|
|
-
|
|
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
@@ -175,9 +175,9 @@ public class TestCinematic extends SimpleApplication {
|
|
}
|
|
}
|
|
|
|
|
|
public void onStop(CinematicEvent cinematic) {
|
|
public void onStop(CinematicEvent cinematic) {
|
|
- chaseCam.setEnabled(true);
|
|
|
|
- fade.setValue(1);
|
|
|
|
- System.out.println("stop");
|
|
|
|
|
|
+ chaseCam.setEnabled(true);
|
|
|
|
+ fade.setValue(1);
|
|
|
|
+ System.out.println("stop");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
@@ -215,7 +215,6 @@ public class TestCinematic extends SimpleApplication {
|
|
model.setShadowMode(ShadowMode.CastAndReceive);
|
|
model.setShadowMode(ShadowMode.CastAndReceive);
|
|
rootNode.attachChild(model);
|
|
rootNode.attachChild(model);
|
|
|
|
|
|
-
|
|
|
|
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
|
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
|
mat.setColor("Color", ColorRGBA.Cyan);
|
|
mat.setColor("Color", ColorRGBA.Cyan);
|
|
|
|
|
|
@@ -225,8 +224,6 @@ public class TestCinematic extends SimpleApplication {
|
|
teapot.setShadowMode(ShadowMode.CastAndReceive);
|
|
teapot.setShadowMode(ShadowMode.CastAndReceive);
|
|
rootNode.attachChild(teapot);
|
|
rootNode.attachChild(teapot);
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
|
|
Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
|
|
matSoil.setBoolean("UseMaterialColors", true);
|
|
matSoil.setBoolean("UseMaterialColors", true);
|
|
matSoil.setColor("Ambient", ColorRGBA.Gray);
|
|
matSoil.setColor("Ambient", ColorRGBA.Gray);
|
|
@@ -242,24 +239,22 @@ public class TestCinematic extends SimpleApplication {
|
|
light.setColor(ColorRGBA.White.mult(1.5f));
|
|
light.setColor(ColorRGBA.White.mult(1.5f));
|
|
rootNode.addLight(light);
|
|
rootNode.addLight(light);
|
|
|
|
|
|
- PssmShadowRenderer pssm = new PssmShadowRenderer(assetManager, 512, 1);
|
|
|
|
- pssm.setDirection(new Vector3f(0, -1, -1).normalizeLocal());
|
|
|
|
- pssm.setShadowIntensity(0.4f);
|
|
|
|
- viewPort.addProcessor(pssm);
|
|
|
|
-
|
|
|
|
fpp = new FilterPostProcessor(assetManager);
|
|
fpp = new FilterPostProcessor(assetManager);
|
|
- //fpp.setNumSamples(4);
|
|
|
|
fade = new FadeFilter();
|
|
fade = new FadeFilter();
|
|
fpp.addFilter(fade);
|
|
fpp.addFilter(fade);
|
|
- viewPort.addProcessor(fpp);
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ if (renderer.getCaps().contains(Caps.GLSL100)){
|
|
|
|
+ PssmShadowRenderer pssm = new PssmShadowRenderer(assetManager, 512, 1);
|
|
|
|
+ pssm.setDirection(new Vector3f(0, -1, -1).normalizeLocal());
|
|
|
|
+ pssm.setShadowIntensity(0.4f);
|
|
|
|
+ viewPort.addProcessor(pssm);
|
|
|
|
+ viewPort.addProcessor(fpp);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
private void initInputs() {
|
|
private void initInputs() {
|
|
inputManager.addMapping("togglePause", new KeyTrigger(keyInput.KEY_RETURN));
|
|
inputManager.addMapping("togglePause", new KeyTrigger(keyInput.KEY_RETURN));
|
|
-
|
|
|
|
ActionListener acl = new ActionListener() {
|
|
ActionListener acl = new ActionListener() {
|
|
-
|
|
|
|
public void onAction(String name, boolean keyPressed, float tpf) {
|
|
public void onAction(String name, boolean keyPressed, float tpf) {
|
|
if (name.equals("togglePause") && keyPressed) {
|
|
if (name.equals("togglePause") && keyPressed) {
|
|
if (cinematic.getPlayState() == PlayState.Playing) {
|
|
if (cinematic.getPlayState() == PlayState.Playing) {
|
|
@@ -271,8 +266,6 @@ public class TestCinematic extends SimpleApplication {
|
|
|
|
|
|
}
|
|
}
|
|
};
|
|
};
|
|
-
|
|
|
|
inputManager.addListener(acl, "togglePause");
|
|
inputManager.addListener(acl, "togglePause");
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|