in examples, replace deprecated methods and classes
This commit is contained in:
parent
e536699d9e
commit
d3f0c2002a
jme3-examples/src/main/java/jme3test
TestChooser.java
animation
audio
bullet
effect
helloworld
light
model/anim
post
TestBloom.javaTestBloomAlphaThreshold.javaTestCrossHatch.javaTestDepthOfField.javaTestFog.javaTestLightScattering.javaTestMultiViewsFilters.javaTestMultiplesFilters.javaTestPostFilters.javaTestRenderToCubemap.java
scene
water
@ -76,7 +76,7 @@ public class TestChooser extends JDialog {
|
||||
/**
|
||||
* Only accessed from EDT
|
||||
*/
|
||||
private Object[] selectedClass = null;
|
||||
private java.util.List selectedClass = null;
|
||||
private boolean showSetting = true;
|
||||
|
||||
/**
|
||||
@ -246,7 +246,7 @@ public class TestChooser extends JDialog {
|
||||
};
|
||||
}
|
||||
|
||||
private void startApp(final Object[] appClass){
|
||||
private void startApp(final java.util.List appClass){
|
||||
if (appClass == null){
|
||||
JOptionPane.showMessageDialog(rootPane,
|
||||
"Please select a test from the list",
|
||||
@ -257,8 +257,8 @@ public class TestChooser extends JDialog {
|
||||
|
||||
new Thread(new Runnable(){
|
||||
public void run(){
|
||||
for (int i = 0; i < appClass.length; i++) {
|
||||
Class<?> clazz = (Class)appClass[i];
|
||||
for (int i = 0; i < appClass.size(); i++) {
|
||||
Class<?> clazz = (Class)appClass.get(i);
|
||||
try {
|
||||
if (LegacyApplication.class.isAssignableFrom(clazz)) {
|
||||
Object app = clazz.newInstance();
|
||||
@ -333,7 +333,7 @@ public class TestChooser extends JDialog {
|
||||
list.getSelectionModel().addListSelectionListener(
|
||||
new ListSelectionListener() {
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
selectedClass = list.getSelectedValues();
|
||||
selectedClass = list.getSelectedValuesList();
|
||||
}
|
||||
});
|
||||
list.addMouseListener(new MouseAdapter() {
|
||||
@ -485,7 +485,7 @@ public class TestChooser extends JDialog {
|
||||
});
|
||||
jtf.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
selectedClass = classes.getSelectedValues();
|
||||
selectedClass = classes.getSelectedValuesList();
|
||||
startApp(selectedClass);
|
||||
}
|
||||
});
|
||||
|
@ -31,7 +31,7 @@
|
||||
*/
|
||||
package jme3test.animation;
|
||||
|
||||
import com.jme3.cinematic.events.GuiTrack;
|
||||
import com.jme3.cinematic.events.GuiEvent;
|
||||
import de.lessvoid.nifty.Nifty;
|
||||
import de.lessvoid.nifty.elements.render.TextRenderer;
|
||||
|
||||
@ -39,7 +39,7 @@ import de.lessvoid.nifty.elements.render.TextRenderer;
|
||||
*
|
||||
* @author Nehon
|
||||
*/
|
||||
public class SubtitleTrack extends GuiTrack{
|
||||
public class SubtitleTrack extends GuiEvent{
|
||||
private String text="";
|
||||
|
||||
public SubtitleTrack(Nifty nifty, String screen,float initialDuration, String text) {
|
||||
@ -50,7 +50,8 @@ public class SubtitleTrack extends GuiTrack{
|
||||
@Override
|
||||
public void onPlay() {
|
||||
super.onPlay();
|
||||
nifty.getScreen(screen).findElementByName("text").getRenderer(TextRenderer.class).setText(text);
|
||||
nifty.getScreen(screen).findElementById("text")
|
||||
.getRenderer(TextRenderer.class).setText(text);
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ import com.jme3.scene.CameraNode;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.jme3.scene.shape.Box;
|
||||
import com.jme3.shadow.PssmShadowRenderer;
|
||||
import com.jme3.shadow.DirectionalLightShadowRenderer;
|
||||
import de.lessvoid.nifty.Nifty;
|
||||
|
||||
public class TestCinematic extends SimpleApplication {
|
||||
@ -237,10 +237,11 @@ public class TestCinematic extends SimpleApplication {
|
||||
fpp.addFilter(fade);
|
||||
|
||||
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);
|
||||
DirectionalLightShadowRenderer dlsr
|
||||
= new DirectionalLightShadowRenderer(assetManager, 512, 1);
|
||||
dlsr.setLight(light);
|
||||
dlsr.setShadowIntensity(0.4f);
|
||||
viewPort.addProcessor(dlsr);
|
||||
viewPort.addProcessor(fpp);
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
package jme3test.audio;
|
||||
|
||||
import com.jme3.app.SimpleApplication;
|
||||
import com.jme3.audio.AudioData.DataType;
|
||||
import com.jme3.audio.AudioNode;
|
||||
import com.jme3.audio.Environment;
|
||||
import com.jme3.material.Material;
|
||||
@ -55,13 +56,15 @@ public class TestAmbient extends SimpleApplication {
|
||||
Environment env = new Environment(eax);
|
||||
audioRenderer.setEnvironment(env);
|
||||
|
||||
waves = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg", false);
|
||||
waves = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg",
|
||||
DataType.Buffer);
|
||||
waves.setPositional(true);
|
||||
waves.setLocalTranslation(new Vector3f(0, 0,0));
|
||||
waves.setMaxDistance(100);
|
||||
waves.setRefDistance(5);
|
||||
|
||||
nature = new AudioNode(assetManager, "Sound/Environment/Nature.ogg", true);
|
||||
nature = new AudioNode(assetManager, "Sound/Environment/Nature.ogg",
|
||||
DataType.Stream);
|
||||
nature.setPositional(false);
|
||||
nature.setVolume(3);
|
||||
|
||||
|
@ -34,6 +34,7 @@ package jme3test.audio;
|
||||
|
||||
import com.jme3.app.SimpleApplication;
|
||||
import com.jme3.asset.plugins.UrlLocator;
|
||||
import com.jme3.audio.AudioData;
|
||||
import com.jme3.audio.AudioNode;
|
||||
|
||||
public class TestMusicStreaming extends SimpleApplication {
|
||||
@ -46,7 +47,8 @@ public class TestMusicStreaming extends SimpleApplication {
|
||||
@Override
|
||||
public void simpleInitApp(){
|
||||
assetManager.registerLocator("http://www.vorbis.com/music/", UrlLocator.class);
|
||||
AudioNode audioSource = new AudioNode(assetManager, "Lumme-Badloop.ogg", true);
|
||||
AudioNode audioSource = new AudioNode(assetManager, "Lumme-Badloop.ogg",
|
||||
AudioData.DataType.Stream);
|
||||
audioSource.setPositional(false);
|
||||
audioSource.setReverbEnabled(false);
|
||||
audioSource.play();
|
||||
|
@ -29,6 +29,7 @@
|
||||
package jme3test.audio;
|
||||
|
||||
import com.jme3.app.SimpleApplication;
|
||||
import com.jme3.audio.AudioData;
|
||||
import com.jme3.audio.AudioNode;
|
||||
import com.jme3.audio.Environment;
|
||||
import com.jme3.math.FastMath;
|
||||
@ -47,7 +48,8 @@ public class TestReverb extends SimpleApplication {
|
||||
|
||||
@Override
|
||||
public void simpleInitApp() {
|
||||
audioSource = new AudioNode(assetManager, "Sound/Effects/Bang.wav");
|
||||
audioSource = new AudioNode(assetManager, "Sound/Effects/Bang.wav",
|
||||
AudioData.DataType.Buffer);
|
||||
|
||||
float[] eax = new float[]{15, 38.0f, 0.300f, -1000, -3300, 0,
|
||||
1.49f, 0.54f, 1.00f, -2560, 0.162f, 0.00f, 0.00f, 0.00f,
|
||||
|
@ -30,6 +30,7 @@
|
||||
package jme3test.audio;
|
||||
|
||||
import com.jme3.app.SimpleApplication;
|
||||
import com.jme3.audio.AudioData;
|
||||
import com.jme3.audio.AudioNode;
|
||||
|
||||
public class TestWav extends SimpleApplication {
|
||||
@ -54,7 +55,8 @@ public class TestWav extends SimpleApplication {
|
||||
|
||||
@Override
|
||||
public void simpleInitApp() {
|
||||
audioSource = new AudioNode(assetManager, "Sound/Effects/Gun.wav", false);
|
||||
audioSource = new AudioNode(assetManager, "Sound/Effects/Gun.wav",
|
||||
AudioData.DataType.Buffer);
|
||||
audioSource.setLooping(false);
|
||||
}
|
||||
}
|
||||
|
@ -102,8 +102,9 @@ public class BombControl extends RigidBodyControl implements PhysicsCollisionLis
|
||||
effect.setGravity(0, -5f, 0);
|
||||
effect.setLowLife(.4f);
|
||||
effect.setHighLife(.5f);
|
||||
effect.setInitialVelocity(new Vector3f(0, 7, 0));
|
||||
effect.setVelocityVariation(1f);
|
||||
effect.getParticleInfluencer()
|
||||
.setInitialVelocity(new Vector3f(0, 7, 0));
|
||||
effect.getParticleInfluencer().setVelocityVariation(1f);
|
||||
effect.setImagesX(2);
|
||||
effect.setImagesY(2);
|
||||
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
|
||||
|
@ -54,9 +54,8 @@ import com.jme3.renderer.Camera;
|
||||
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.jme3.shadow.PssmShadowRenderer;
|
||||
import com.jme3.shadow.PssmShadowRenderer.CompareMode;
|
||||
import com.jme3.shadow.PssmShadowRenderer.FilterMode;
|
||||
import com.jme3.shadow.DirectionalLightShadowRenderer;
|
||||
import com.jme3.shadow.EdgeFilteringMode;
|
||||
import com.jme3.system.AppSettings;
|
||||
import com.jme3.terrain.geomipmap.TerrainLodControl;
|
||||
import com.jme3.terrain.geomipmap.TerrainQuad;
|
||||
@ -65,6 +64,7 @@ import com.jme3.terrain.heightmap.ImageBasedHeightMap;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.jme3.texture.Texture.WrapMode;
|
||||
import com.jme3.util.SkyFactory;
|
||||
import com.jme3.util.SkyFactory.EnvMapType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -113,21 +113,22 @@ public class TestHoveringTank extends SimpleApplication implements AnalogListene
|
||||
stateManager.attach(bulletAppState);
|
||||
// bulletAppState.getPhysicsSpace().enableDebug(assetManager);
|
||||
bulletAppState.getPhysicsSpace().setAccuracy(1f/30f);
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager,
|
||||
"Textures/Sky/Bright/BrightSky.dds", EnvMapType.CubeMap));
|
||||
|
||||
PssmShadowRenderer pssmr = new PssmShadowRenderer(assetManager, 2048, 3);
|
||||
pssmr.setDirection(new Vector3f(-0.5f, -0.3f, -0.3f).normalizeLocal());
|
||||
pssmr.setLambda(0.55f);
|
||||
pssmr.setShadowIntensity(0.6f);
|
||||
pssmr.setCompareMode(CompareMode.Hardware);
|
||||
pssmr.setFilterMode(FilterMode.Bilinear);
|
||||
viewPort.addProcessor(pssmr);
|
||||
DirectionalLightShadowRenderer dlsr
|
||||
= new DirectionalLightShadowRenderer(assetManager, 2048, 3);
|
||||
dlsr.setLambda(0.55f);
|
||||
dlsr.setShadowIntensity(0.6f);
|
||||
dlsr.setEdgeFilteringMode(EdgeFilteringMode.Bilinear);
|
||||
viewPort.addProcessor(dlsr);
|
||||
|
||||
setupKeys();
|
||||
createTerrain();
|
||||
buildPlayer();
|
||||
|
||||
DirectionalLight dl = new DirectionalLight();
|
||||
dlsr.setLight(dl);
|
||||
dl.setColor(new ColorRGBA(1.0f, 0.94f, 0.8f, 1f).multLocal(1.3f));
|
||||
dl.setDirection(new Vector3f(-0.5f, -0.3f, -0.3f).normalizeLocal());
|
||||
rootNode.addLight(dl);
|
||||
|
@ -217,8 +217,9 @@ public class TestWalkingChar extends SimpleApplication implements ActionListener
|
||||
effect.setGravity(0, -5, 0);
|
||||
effect.setLowLife(.4f);
|
||||
effect.setHighLife(.5f);
|
||||
effect.setInitialVelocity(new Vector3f(0, 7, 0));
|
||||
effect.setVelocityVariation(1f);
|
||||
effect.getParticleInfluencer()
|
||||
.setInitialVelocity(new Vector3f(0, 7, 0));
|
||||
effect.getParticleInfluencer().setVelocityVariation(1f);
|
||||
effect.setImagesX(2);
|
||||
effect.setImagesY(2);
|
||||
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
|
||||
@ -237,7 +238,9 @@ public class TestWalkingChar extends SimpleApplication implements ActionListener
|
||||
}
|
||||
|
||||
private void createSky() {
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager,
|
||||
"Textures/Sky/Bright/BrightSky.dds",
|
||||
SkyFactory.EnvMapType.CubeMap));
|
||||
}
|
||||
|
||||
private void createTerrain() {
|
||||
|
@ -36,7 +36,8 @@ import com.jme3.app.SimpleApplication;
|
||||
import com.jme3.light.DirectionalLight;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.math.*;
|
||||
import com.jme3.post.HDRRenderer;
|
||||
import com.jme3.post.FilterPostProcessor;
|
||||
import com.jme3.post.filters.ToneMapFilter;
|
||||
import com.jme3.renderer.Caps;
|
||||
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
|
||||
import com.jme3.scene.Geometry;
|
||||
@ -44,7 +45,7 @@ import com.jme3.scene.Node;
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.jme3.scene.Spatial.CullHint;
|
||||
import com.jme3.scene.shape.Box;
|
||||
import com.jme3.shadow.BasicShadowRenderer;
|
||||
import com.jme3.shadow.DirectionalLightShadowRenderer;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.jme3.texture.Texture.WrapMode;
|
||||
import com.jme3.util.SkyFactory;
|
||||
@ -52,8 +53,8 @@ import com.jme3.util.TangentBinormalGenerator;
|
||||
|
||||
public class TestEverything extends SimpleApplication {
|
||||
|
||||
private BasicShadowRenderer bsr;
|
||||
private HDRRenderer hdrRender;
|
||||
private DirectionalLightShadowRenderer dlsr;
|
||||
private ToneMapFilter toneMapFilter;
|
||||
private Vector3f lightDir = new Vector3f(-1, -1, .5f).normalizeLocal();
|
||||
|
||||
public static void main(String[] args){
|
||||
@ -63,26 +64,20 @@ public class TestEverything extends SimpleApplication {
|
||||
|
||||
public void setupHdr(){
|
||||
if (renderer.getCaps().contains(Caps.GLSL100)){
|
||||
hdrRender = new HDRRenderer(assetManager, renderer);
|
||||
hdrRender.setMaxIterations(40);
|
||||
hdrRender.setSamples(settings.getSamples());
|
||||
|
||||
hdrRender.setWhiteLevel(3);
|
||||
hdrRender.setExposure(0.72f);
|
||||
hdrRender.setThrottle(1);
|
||||
toneMapFilter = new ToneMapFilter();
|
||||
toneMapFilter.setWhitePoint(new Vector3f(3f, 3f, 3f));
|
||||
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
|
||||
fpp.addFilter(toneMapFilter);
|
||||
viewPort.addProcessor(fpp);
|
||||
|
||||
// setPauseOnLostFocus(false);
|
||||
// new HDRConfig(hdrRender).setVisible(true);
|
||||
|
||||
viewPort.addProcessor(hdrRender);
|
||||
}
|
||||
}
|
||||
|
||||
public void setupBasicShadow(){
|
||||
if (renderer.getCaps().contains(Caps.GLSL100)){
|
||||
bsr = new BasicShadowRenderer(assetManager, 1024);
|
||||
bsr.setDirection(lightDir);
|
||||
viewPort.addProcessor(bsr);
|
||||
dlsr = new DirectionalLightShadowRenderer(assetManager, 1024, 1);
|
||||
viewPort.addProcessor(dlsr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,16 +88,20 @@ public class TestEverything extends SimpleApplication {
|
||||
}else{
|
||||
envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.jpg");
|
||||
}
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager, envMap, new Vector3f(-1,-1,-1), true));
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager, envMap,
|
||||
new Vector3f(-1,-1,-1), SkyFactory.EnvMapType.SphereMap));
|
||||
}
|
||||
|
||||
public void setupLighting(){
|
||||
boolean hdr = false;
|
||||
if (hdrRender != null){
|
||||
hdr = hdrRender.isEnabled();
|
||||
if (toneMapFilter != null){
|
||||
hdr = toneMapFilter.isEnabled();
|
||||
}
|
||||
|
||||
DirectionalLight dl = new DirectionalLight();
|
||||
if (dlsr != null) {
|
||||
dlsr.setLight(dl);
|
||||
}
|
||||
dl.setDirection(lightDir);
|
||||
if (hdr){
|
||||
dl.setColor(new ColorRGBA(3, 3, 3, 1));
|
||||
|
@ -98,8 +98,9 @@ public class TestExplosionEffect extends SimpleApplication {
|
||||
flash.setGravity(0, 0, 0);
|
||||
flash.setLowLife(.2f);
|
||||
flash.setHighLife(.2f);
|
||||
flash.setInitialVelocity(new Vector3f(0, 5f, 0));
|
||||
flash.setVelocityVariation(1);
|
||||
flash.getParticleInfluencer()
|
||||
.setInitialVelocity(new Vector3f(0, 5f, 0));
|
||||
flash.getParticleInfluencer().setVelocityVariation(1);
|
||||
flash.setImagesX(2);
|
||||
flash.setImagesY(2);
|
||||
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
|
||||
@ -120,8 +121,9 @@ public class TestExplosionEffect extends SimpleApplication {
|
||||
roundspark.setGravity(0, -.5f, 0);
|
||||
roundspark.setLowLife(1.8f);
|
||||
roundspark.setHighLife(2f);
|
||||
roundspark.setInitialVelocity(new Vector3f(0, 3, 0));
|
||||
roundspark.setVelocityVariation(.5f);
|
||||
roundspark.getParticleInfluencer()
|
||||
.setInitialVelocity(new Vector3f(0, 3, 0));
|
||||
roundspark.getParticleInfluencer().setVelocityVariation(.5f);
|
||||
roundspark.setImagesX(1);
|
||||
roundspark.setImagesY(1);
|
||||
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
|
||||
@ -165,8 +167,9 @@ public class TestExplosionEffect extends SimpleApplication {
|
||||
smoketrail.setGravity(0, 1, 0);
|
||||
smoketrail.setLowLife(.4f);
|
||||
smoketrail.setHighLife(.5f);
|
||||
smoketrail.setInitialVelocity(new Vector3f(0, 12, 0));
|
||||
smoketrail.setVelocityVariation(1);
|
||||
smoketrail.getParticleInfluencer()
|
||||
.setInitialVelocity(new Vector3f(0, 12, 0));
|
||||
smoketrail.getParticleInfluencer().setVelocityVariation(1);
|
||||
smoketrail.setImagesX(1);
|
||||
smoketrail.setImagesY(3);
|
||||
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
|
||||
@ -190,8 +193,9 @@ public class TestExplosionEffect extends SimpleApplication {
|
||||
debris.setGravity(0, 12f, 0);
|
||||
debris.setLowLife(1.4f);
|
||||
debris.setHighLife(1.5f);
|
||||
debris.setInitialVelocity(new Vector3f(0, 15, 0));
|
||||
debris.setVelocityVariation(.60f);
|
||||
debris.getParticleInfluencer()
|
||||
.setInitialVelocity(new Vector3f(0, 15, 0));
|
||||
debris.getParticleInfluencer().setVelocityVariation(.60f);
|
||||
debris.setImagesX(3);
|
||||
debris.setImagesY(3);
|
||||
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
|
||||
@ -214,8 +218,9 @@ public class TestExplosionEffect extends SimpleApplication {
|
||||
shockwave.setGravity(0, 0, 0);
|
||||
shockwave.setLowLife(0.5f);
|
||||
shockwave.setHighLife(0.5f);
|
||||
shockwave.setInitialVelocity(new Vector3f(0, 0, 0));
|
||||
shockwave.setVelocityVariation(0f);
|
||||
shockwave.getParticleInfluencer()
|
||||
.setInitialVelocity(new Vector3f(0, 0, 0));
|
||||
shockwave.getParticleInfluencer().setVelocityVariation(0f);
|
||||
shockwave.setImagesX(1);
|
||||
shockwave.setImagesY(1);
|
||||
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
|
||||
|
@ -60,10 +60,11 @@ public class TestMovingParticle extends SimpleApplication {
|
||||
public void simpleInitApp() {
|
||||
emit = new ParticleEmitter("Emitter", Type.Triangle, 300);
|
||||
emit.setGravity(0, 0, 0);
|
||||
emit.setVelocityVariation(1);
|
||||
emit.getParticleInfluencer().setVelocityVariation(1);
|
||||
emit.setLowLife(1);
|
||||
emit.setHighLife(1);
|
||||
emit.setInitialVelocity(new Vector3f(0, .5f, 0));
|
||||
emit.getParticleInfluencer()
|
||||
.setInitialVelocity(new Vector3f(0, .5f, 0));
|
||||
emit.setImagesX(15);
|
||||
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", assetManager.loadTexture("Effects/Smoke/Smoke.png"));
|
||||
|
@ -57,7 +57,7 @@ public class TestParticleExportingCloning extends SimpleApplication {
|
||||
emit.setGravity(0, 0, 0);
|
||||
emit.setLowLife(5);
|
||||
emit.setHighLife(10);
|
||||
emit.setInitialVelocity(new Vector3f(0, 0, 0));
|
||||
emit.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 0, 0));
|
||||
emit.setImagesX(15);
|
||||
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", assetManager.loadTexture("Effects/Smoke/Smoke.png"));
|
||||
|
@ -1,6 +1,7 @@
|
||||
package jme3test.helloworld;
|
||||
|
||||
import com.jme3.app.SimpleApplication;
|
||||
import com.jme3.audio.AudioData.DataType;
|
||||
import com.jme3.audio.AudioNode;
|
||||
import com.jme3.input.MouseInput;
|
||||
import com.jme3.input.controls.ActionListener;
|
||||
@ -42,14 +43,16 @@ public class HelloAudio extends SimpleApplication {
|
||||
/** We create two audio nodes. */
|
||||
private void initAudio() {
|
||||
/* gun shot sound is to be triggered by a mouse click. */
|
||||
audio_gun = new AudioNode(assetManager, "Sound/Effects/Gun.wav", false);
|
||||
audio_gun = new AudioNode(assetManager,
|
||||
"Sound/Effects/Gun.wav", DataType.Buffer);
|
||||
audio_gun.setPositional(false);
|
||||
audio_gun.setLooping(false);
|
||||
audio_gun.setVolume(2);
|
||||
rootNode.attachChild(audio_gun);
|
||||
|
||||
/* nature sound - keeps playing in a loop. */
|
||||
audio_nature = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg", true);
|
||||
audio_nature = new AudioNode(assetManager,
|
||||
"Sound/Environment/Ocean Waves.ogg", DataType.Stream);
|
||||
audio_nature.setLooping(true); // activate continuous playing
|
||||
audio_nature.setPositional(true);
|
||||
audio_nature.setVolume(3);
|
||||
|
@ -59,6 +59,7 @@ import com.jme3.shadow.EdgeFilteringMode;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.jme3.texture.Texture.WrapMode;
|
||||
import com.jme3.util.SkyFactory;
|
||||
import com.jme3.util.SkyFactory.EnvMapType;
|
||||
import com.jme3.util.TangentBinormalGenerator;
|
||||
|
||||
public class TestDirectionalLightShadow extends SimpleApplication implements ActionListener, AnalogListener {
|
||||
@ -155,7 +156,8 @@ public class TestDirectionalLightShadow extends SimpleApplication implements Act
|
||||
al.setColor(ColorRGBA.White.mult(0.02f));
|
||||
rootNode.addLight(al);
|
||||
|
||||
Spatial sky = SkyFactory.createSky(assetManager, "Scenes/Beach/FullskiesSunset0068.dds", false);
|
||||
Spatial sky = SkyFactory.createSky(assetManager,
|
||||
"Scenes/Beach/FullskiesSunset0068.dds", EnvMapType.CubeMap);
|
||||
sky.setLocalScale(350);
|
||||
|
||||
rootNode.attachChild(sky);
|
||||
|
@ -48,7 +48,8 @@ public class TestEnvironmentMapping extends SimpleApplication {
|
||||
chaseCam.setLookAtOffset(new Vector3f(0,0.5f,-1.0f));
|
||||
buggy.addControl(chaseCam);
|
||||
rootNode.attachChild(buggy);
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager, tex, false));
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager, tex,
|
||||
SkyFactory.EnvMapType.CubeMap));
|
||||
|
||||
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
|
||||
BloomFilter bf = new BloomFilter(BloomFilter.GlowMode.Objects);
|
||||
|
@ -93,7 +93,7 @@ public class TestCustomAnim extends SimpleApplication {
|
||||
box.setBuffer(indicesBuf);
|
||||
|
||||
// Create bind pose buffers
|
||||
box.generateBindPose(true);
|
||||
box.generateBindPose();
|
||||
|
||||
// Create skeleton
|
||||
bone = new Bone("root");
|
||||
|
@ -49,6 +49,7 @@ import com.jme3.scene.Spatial;
|
||||
import com.jme3.scene.debug.WireFrustum;
|
||||
import com.jme3.scene.shape.Box;
|
||||
import com.jme3.util.SkyFactory;
|
||||
import com.jme3.util.SkyFactory.EnvMapType;
|
||||
|
||||
public class TestBloom extends SimpleApplication {
|
||||
|
||||
@ -114,7 +115,9 @@ public class TestBloom extends SimpleApplication {
|
||||
rootNode.addLight(light);
|
||||
|
||||
// load sky
|
||||
Spatial sky = SkyFactory.createSky(assetManager, "Textures/Sky/Bright/FullskiesBlueClear03.dds", false);
|
||||
Spatial sky = SkyFactory.createSky(assetManager,
|
||||
"Textures/Sky/Bright/FullskiesBlueClear03.dds",
|
||||
EnvMapType.CubeMap);
|
||||
sky.setCullHint(Spatial.CullHint.Never);
|
||||
rootNode.attachChild(sky);
|
||||
|
||||
|
@ -51,6 +51,7 @@ import com.jme3.scene.Spatial;
|
||||
import com.jme3.scene.debug.WireFrustum;
|
||||
import com.jme3.scene.shape.Box;
|
||||
import com.jme3.util.SkyFactory;
|
||||
import com.jme3.util.SkyFactory.EnvMapType;
|
||||
|
||||
public class TestBloomAlphaThreshold extends SimpleApplication
|
||||
{
|
||||
@ -101,7 +102,10 @@ public class TestBloomAlphaThreshold extends SimpleApplication
|
||||
teapot.setLocalScale(10.0f);
|
||||
rootNode.attachChild(teapot);
|
||||
|
||||
Geometry soil = new Geometry("soil", new Box(new Vector3f(0, -13, 550), 800, 10, 700));
|
||||
Vector3f boxMin1 = new Vector3f(-800f, -23f, -150f);
|
||||
Vector3f boxMax1 = new Vector3f(800f, 3f, 1250f);
|
||||
Box boxMesh1 = new Box(boxMin1, boxMax1);
|
||||
Geometry soil = new Geometry("soil", boxMesh1);
|
||||
soil.setMaterial(matSoil);
|
||||
soil.setShadowMode(ShadowMode.CastAndReceive);
|
||||
rootNode.attachChild(soil);
|
||||
@ -110,7 +114,10 @@ public class TestBloomAlphaThreshold extends SimpleApplication
|
||||
matBox.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
|
||||
matBox.setFloat("AlphaDiscardThreshold", 0.5f);
|
||||
|
||||
Geometry box = new Geometry("box", new Box(new Vector3f(-3.5f, 10, -2), 2, 2, 2));
|
||||
Vector3f boxMin2 = new Vector3f(-5.5f, 8f, -4f);
|
||||
Vector3f boxMax2 = new Vector3f(-1.5f, 12f, 0f);
|
||||
Box boxMesh2 = new Box(boxMin2, boxMax2);
|
||||
Geometry box = new Geometry("box", boxMesh2);
|
||||
box.setMaterial(matBox);
|
||||
box.setQueueBucket(RenderQueue.Bucket.Translucent);
|
||||
// box.setShadowMode(ShadowMode.CastAndReceive);
|
||||
@ -122,7 +129,9 @@ public class TestBloomAlphaThreshold extends SimpleApplication
|
||||
rootNode.addLight(light);
|
||||
|
||||
// load sky
|
||||
Spatial sky = SkyFactory.createSky(assetManager, "Textures/Sky/Bright/FullskiesBlueClear03.dds", false);
|
||||
Spatial sky = SkyFactory.createSky(assetManager,
|
||||
"Textures/Sky/Bright/FullskiesBlueClear03.dds",
|
||||
EnvMapType.CubeMap);
|
||||
sky.setCullHint(Spatial.CullHint.Never);
|
||||
rootNode.attachChild(sky);
|
||||
|
||||
|
@ -49,6 +49,7 @@ import com.jme3.scene.Spatial;
|
||||
import com.jme3.scene.debug.WireFrustum;
|
||||
import com.jme3.scene.shape.Box;
|
||||
import com.jme3.util.SkyFactory;
|
||||
import com.jme3.util.SkyFactory.EnvMapType;
|
||||
|
||||
public class TestCrossHatch extends SimpleApplication {
|
||||
|
||||
@ -114,7 +115,9 @@ public class TestCrossHatch extends SimpleApplication {
|
||||
rootNode.addLight(light);
|
||||
|
||||
// load sky
|
||||
Spatial sky = SkyFactory.createSky(assetManager, "Textures/Sky/Bright/FullskiesBlueClear03.dds", false);
|
||||
Spatial sky = SkyFactory.createSky(assetManager,
|
||||
"Textures/Sky/Bright/FullskiesBlueClear03.dds",
|
||||
EnvMapType.CubeMap);
|
||||
sky.setCullHint(Spatial.CullHint.Never);
|
||||
rootNode.attachChild(sky);
|
||||
|
||||
|
@ -21,6 +21,7 @@ import com.jme3.terrain.heightmap.ImageBasedHeightMap;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.jme3.texture.Texture.WrapMode;
|
||||
import com.jme3.util.SkyFactory;
|
||||
import com.jme3.util.SkyFactory.EnvMapType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -65,7 +66,8 @@ public class TestDepthOfField extends SimpleApplication {
|
||||
cam.setRotation(new Quaternion().fromAngles(new float[]{FastMath.PI * 0.06f, FastMath.PI * 0.65f, 0}));
|
||||
|
||||
|
||||
Spatial sky = SkyFactory.createSky(assetManager, "Scenes/Beach/FullskiesSunset0068.dds", false);
|
||||
Spatial sky = SkyFactory.createSky(assetManager,
|
||||
"Scenes/Beach/FullskiesSunset0068.dds", EnvMapType.CubeMap);
|
||||
sky.setLocalScale(350);
|
||||
mainScene.attachChild(sky);
|
||||
|
||||
|
@ -77,7 +77,9 @@ public class TestFog extends SimpleApplication {
|
||||
cam.setRotation(new Quaternion(0.023536969f, 0.9361278f, -0.016098259f, -0.35050195f));
|
||||
|
||||
// load sky
|
||||
mainScene.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
|
||||
mainScene.attachChild(SkyFactory.createSky(assetManager,
|
||||
"Textures/Sky/Bright/BrightSky.dds",
|
||||
SkyFactory.EnvMapType.CubeMap));
|
||||
createTerrain(mainScene);
|
||||
|
||||
|
||||
|
@ -44,7 +44,6 @@ import com.jme3.renderer.queue.RenderQueue.ShadowMode;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.jme3.shadow.PssmShadowRenderer;
|
||||
import com.jme3.util.SkyFactory;
|
||||
import com.jme3.util.TangentBinormalGenerator;
|
||||
|
||||
@ -76,7 +75,9 @@ public class TestLightScattering extends SimpleApplication {
|
||||
rootNode.attachChild(scene);
|
||||
|
||||
// load sky
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/FullskiesBlueClear03.dds", false));
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager,
|
||||
"Textures/Sky/Bright/FullskiesBlueClear03.dds",
|
||||
SkyFactory.EnvMapType.CubeMap));
|
||||
|
||||
DirectionalLight sun = new DirectionalLight();
|
||||
Vector3f lightDir = new Vector3f(-0.12f, -0.3729129f, 0.74847335f);
|
||||
|
@ -126,7 +126,9 @@ public class TestMultiViewsFilters extends SimpleApplication {
|
||||
|
||||
|
||||
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager,
|
||||
"Textures/Sky/Bright/BrightSky.dds",
|
||||
SkyFactory.EnvMapType.CubeMap));
|
||||
|
||||
final FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
|
||||
final FilterPostProcessor fpp2 = new FilterPostProcessor(assetManager);
|
||||
|
@ -72,7 +72,9 @@ public class TestMultiplesFilters extends SimpleApplication {
|
||||
cam.setRotation(new Quaternion(0.0016069f, 0.9810479f, -0.008143323f, 0.19358753f));
|
||||
|
||||
// load sky
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager,
|
||||
"Textures/Sky/Bright/BrightSky.dds",
|
||||
SkyFactory.EnvMapType.CubeMap));
|
||||
|
||||
// create the geometry and attach it
|
||||
// load the level from zip or http zip
|
||||
|
@ -50,6 +50,7 @@ import com.jme3.system.AppSettings;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.jme3.texture.Texture.WrapMode;
|
||||
import com.jme3.util.SkyFactory;
|
||||
import com.jme3.util.SkyFactory.EnvMapType;
|
||||
import com.jme3.util.TangentBinormalGenerator;
|
||||
|
||||
public class TestPostFilters extends SimpleApplication implements ActionListener {
|
||||
@ -88,7 +89,9 @@ public class TestPostFilters extends SimpleApplication implements ActionListener
|
||||
} else {
|
||||
envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.jpg");
|
||||
}
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager, envMap, new Vector3f(-1, -1, -1), true));
|
||||
Spatial sky = SkyFactory.createSky(assetManager, envMap,
|
||||
new Vector3f(-1f, -1f, -1f), EnvMapType.SphereMap);
|
||||
rootNode.attachChild(sky);
|
||||
}
|
||||
|
||||
public void setupLighting() {
|
||||
|
@ -41,12 +41,14 @@ import com.jme3.math.Vector3f;
|
||||
import com.jme3.renderer.Camera;
|
||||
import com.jme3.renderer.ViewPort;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.jme3.scene.shape.Box;
|
||||
import com.jme3.texture.FrameBuffer;
|
||||
import com.jme3.texture.Image.Format;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.jme3.texture.TextureCubeMap;
|
||||
import com.jme3.util.SkyFactory;
|
||||
import com.jme3.util.SkyFactory.EnvMapType;
|
||||
|
||||
/**
|
||||
* Renders a rotating box to a cubemap texture, then applies the cubemap
|
||||
@ -114,7 +116,9 @@ public class TestRenderToCubemap extends SimpleApplication {
|
||||
cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
|
||||
|
||||
Texture offTex = setupOffscreenView();
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager, offTex, false));
|
||||
Spatial sky = SkyFactory.createSky(assetManager, offTex,
|
||||
EnvMapType.CubeMap);
|
||||
rootNode.attachChild(sky);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,7 +66,9 @@ public class TestSceneLoading extends SimpleApplication {
|
||||
this.flyCam.setMoveSpeed(10);
|
||||
|
||||
// load sky
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager,
|
||||
"Textures/Sky/Bright/BrightSky.dds",
|
||||
SkyFactory.EnvMapType.CubeMap));
|
||||
|
||||
File file = new File("wildhouse.zip");
|
||||
if (!file.exists()) {
|
||||
|
@ -20,6 +20,7 @@ import com.jme3.texture.Texture;
|
||||
import com.jme3.texture.Texture.WrapMode;
|
||||
import com.jme3.texture.Texture2D;
|
||||
import com.jme3.util.SkyFactory;
|
||||
import com.jme3.util.SkyFactory.EnvMapType;
|
||||
import com.jme3.water.WaterFilter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -73,7 +74,8 @@ public class TestMultiPostWater extends SimpleApplication {
|
||||
cam.setRotation(new Quaternion().fromAngles(new float[]{FastMath.PI * 0.06f, FastMath.PI * 0.65f, 0}));
|
||||
|
||||
|
||||
Spatial sky = SkyFactory.createSky(assetManager, "Scenes/Beach/FullskiesSunset0068.dds", false);
|
||||
Spatial sky = SkyFactory.createSky(assetManager,
|
||||
"Scenes/Beach/FullskiesSunset0068.dds", EnvMapType.CubeMap);
|
||||
sky.setLocalScale(350);
|
||||
|
||||
mainScene.attachChild(sky);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package jme3test.water;
|
||||
|
||||
import com.jme3.app.SimpleApplication;
|
||||
import com.jme3.audio.AudioData.DataType;
|
||||
import com.jme3.audio.AudioNode;
|
||||
import com.jme3.audio.LowPassFilter;
|
||||
import com.jme3.effect.ParticleEmitter;
|
||||
@ -35,6 +36,7 @@ import com.jme3.texture.Texture;
|
||||
import com.jme3.texture.Texture.WrapMode;
|
||||
import com.jme3.texture.Texture2D;
|
||||
import com.jme3.util.SkyFactory;
|
||||
import com.jme3.util.SkyFactory.EnvMapType;
|
||||
import com.jme3.water.WaterFilter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -93,7 +95,8 @@ public class TestPostWater extends SimpleApplication {
|
||||
|
||||
|
||||
|
||||
Spatial sky = SkyFactory.createSky(assetManager, "Scenes/Beach/FullskiesSunset0068.dds", false);
|
||||
Spatial sky = SkyFactory.createSky(assetManager,
|
||||
"Scenes/Beach/FullskiesSunset0068.dds", EnvMapType.CubeMap);
|
||||
sky.setLocalScale(350);
|
||||
|
||||
mainScene.attachChild(sky);
|
||||
@ -149,7 +152,8 @@ public class TestPostWater extends SimpleApplication {
|
||||
|
||||
uw = cam.getLocation().y < waterHeight;
|
||||
|
||||
waves = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg", false);
|
||||
waves = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg",
|
||||
DataType.Buffer);
|
||||
waves.setLooping(true);
|
||||
waves.setReverbEnabled(true);
|
||||
if (uw) {
|
||||
|
@ -62,7 +62,9 @@ public class TestPostWaterLake extends SimpleApplication {
|
||||
// cam.setRotation(new Quaternion(0.03f, 0.9f, 0f, 0.4f));
|
||||
|
||||
// load sky
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
|
||||
rootNode.attachChild(SkyFactory.createSky(assetManager,
|
||||
"Textures/Sky/Bright/BrightSky.dds",
|
||||
SkyFactory.EnvMapType.CubeMap));
|
||||
|
||||
File file = new File("wildhouse.zip");
|
||||
|
||||
|
@ -66,7 +66,9 @@ public class TestSceneWater extends SimpleApplication {
|
||||
cam.setRotation(new Quaternion(0.03f, 0.9f, 0f, 0.4f));
|
||||
|
||||
// load sky
|
||||
mainScene.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
|
||||
mainScene.attachChild(SkyFactory.createSky(assetManager,
|
||||
"Textures/Sky/Bright/BrightSky.dds",
|
||||
SkyFactory.EnvMapType.CubeMap));
|
||||
|
||||
|
||||
File file = new File("wildhouse.zip");
|
||||
|
@ -103,7 +103,9 @@ public class TestSimpleWater extends SimpleApplication implements ActionListener
|
||||
sceneNode.attachChild(geom);
|
||||
|
||||
// load sky
|
||||
sceneNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
|
||||
sceneNode.attachChild(SkyFactory.createSky(assetManager,
|
||||
"Textures/Sky/Bright/BrightSky.dds",
|
||||
SkyFactory.EnvMapType.CubeMap));
|
||||
rootNode.attachChild(sceneNode);
|
||||
|
||||
//add lightPos Geometry
|
||||
|
Loading…
x
Reference in New Issue
Block a user