Working TestPostWater with only one light to avoid the depth write bug until i found a solution

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7622 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 14 years ago
parent 39a7c743af
commit 97e4a03ceb
  1. 18
      engine/src/test/jme3test/water/TestPostWater.java

@ -19,10 +19,12 @@ import com.jme3.math.Vector3f;
import com.jme3.post.FilterPostProcessor; import com.jme3.post.FilterPostProcessor;
import com.jme3.post.filters.BloomFilter; import com.jme3.post.filters.BloomFilter;
import com.jme3.post.filters.CartoonEdgeFilter;
import com.jme3.post.filters.DepthOfFieldFilter; import com.jme3.post.filters.DepthOfFieldFilter;
import com.jme3.post.filters.FogFilter; import com.jme3.post.filters.FogFilter;
import com.jme3.post.filters.LightScatteringFilter; import com.jme3.post.filters.LightScatteringFilter;
import com.jme3.post.filters.TranslucentBucketFilter; import com.jme3.post.filters.TranslucentBucketFilter;
import com.jme3.post.ssao.SSAOFilter;
import com.jme3.renderer.Camera; import com.jme3.renderer.Camera;
import com.jme3.renderer.queue.RenderQueue.Bucket; import com.jme3.renderer.queue.RenderQueue.Bucket;
import com.jme3.renderer.queue.RenderQueue.ShadowMode; import com.jme3.renderer.queue.RenderQueue.ShadowMode;
@ -81,7 +83,7 @@ public class TestPostWater extends SimpleApplication {
DirectionalLight l = new DirectionalLight(); DirectionalLight l = new DirectionalLight();
l.setDirection(Vector3f.UNIT_Y.mult(-1)); l.setDirection(Vector3f.UNIT_Y.mult(-1));
l.setColor(ColorRGBA.White.clone().multLocal(0.3f)); l.setColor(ColorRGBA.White.clone().multLocal(0.3f));
mainScene.addLight(l); // mainScene.addLight(l);
flyCam.setMoveSpeed(50); flyCam.setMoveSpeed(50);
@ -96,6 +98,7 @@ public class TestPostWater extends SimpleApplication {
Spatial sky = SkyFactory.createSky(assetManager, "Scenes/Beach/FullskiesSunset0068.dds", false); Spatial sky = SkyFactory.createSky(assetManager, "Scenes/Beach/FullskiesSunset0068.dds", false);
sky.setLocalScale(350); sky.setLocalScale(350);
mainScene.attachChild(sky); mainScene.attachChild(sky);
cam.setFrustumFar(4000); cam.setFrustumFar(4000);
//cam.setFrustumNear(100); //cam.setFrustumNear(100);
@ -108,9 +111,12 @@ public class TestPostWater extends SimpleApplication {
water = new WaterFilter(rootNode, lightDir); water = new WaterFilter(rootNode, lightDir);
FilterPostProcessor fpp = new FilterPostProcessor(assetManager); FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
fpp.addFilter(water); fpp.addFilter(water);
BloomFilter bloom=new BloomFilter(); BloomFilter bloom=new BloomFilter();
//bloom.getE
bloom.setExposurePower(55); bloom.setExposurePower(55);
bloom.setBloomIntensity(1.0f);
fpp.addFilter(bloom); fpp.addFilter(bloom);
LightScatteringFilter lsf = new LightScatteringFilter(lightDir.mult(-300)); LightScatteringFilter lsf = new LightScatteringFilter(lightDir.mult(-300));
lsf.setLightDensity(1.0f); lsf.setLightDensity(1.0f);
@ -172,7 +178,7 @@ public class TestPostWater extends SimpleApplication {
inputManager.addMapping("foam2", new KeyTrigger(keyInput.KEY_2)); inputManager.addMapping("foam2", new KeyTrigger(keyInput.KEY_2));
inputManager.addMapping("foam3", new KeyTrigger(keyInput.KEY_3)); inputManager.addMapping("foam3", new KeyTrigger(keyInput.KEY_3));
// createBox(); // createBox();
// createFire(); // createFire();
} }
Geometry box; Geometry box;
@ -213,16 +219,16 @@ public class TestPostWater extends SimpleApplication {
fire.setImagesY(2); // 2x2 texture animation fire.setImagesY(2); // 2x2 texture animation
fire.setEndColor(new ColorRGBA(1f, 0f, 0f, 1f)); // red fire.setEndColor(new ColorRGBA(1f, 0f, 0f, 1f)); // red
fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow
fire.setInitialVelocity(new Vector3f(0, 2, 0)); fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 2, 0));
fire.setStartSize(10f); fire.setStartSize(10f);
fire.setEndSize(1f); fire.setEndSize(1f);
fire.setGravity(0, 0, 0); fire.setGravity(0, 0, 0);
fire.setLowLife(0.5f); fire.setLowLife(0.5f);
fire.setHighLife(1.5f); fire.setHighLife(1.5f);
fire.setVelocityVariation(0.3f); fire.getParticleInfluencer().setVelocityVariation(0.3f);
fire.setLocalTranslation(-500, 30, 300); fire.setLocalTranslation(-350, 40, 430);
fire.setQueueBucket(Bucket.Translucent); fire.setQueueBucket(Bucket.Transparent);
rootNode.attachChild(fire); rootNode.attachChild(fire);
} }

Loading…
Cancel
Save