Main repository of MikuMikuStudio
Révision | 471515481a205abdd42c86a9442c8e44bcd59d76 (tree) |
---|---|
l'heure | 2013-03-03 19:31:10 |
Auteur | remy.bouquet@gmail.com <remy.bouquet@gmai...> |
Commiter | remy.bouquet@gmail.com |
Better TestMultiPostWater
git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@10457 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
@@ -1,30 +1,17 @@ | ||
1 | 1 | package jme3test.water; |
2 | 2 | |
3 | 3 | import com.jme3.app.SimpleApplication; |
4 | -import com.jme3.audio.AudioNode; | |
5 | -import com.jme3.audio.LowPassFilter; | |
6 | -import com.jme3.effect.ParticleEmitter; | |
7 | -import com.jme3.effect.ParticleMesh; | |
8 | -import com.jme3.input.controls.ActionListener; | |
9 | -import com.jme3.input.controls.KeyTrigger; | |
10 | 4 | import com.jme3.light.DirectionalLight; |
11 | 5 | import com.jme3.material.Material; |
12 | -import com.jme3.material.RenderState.BlendMode; | |
13 | 6 | import com.jme3.math.ColorRGBA; |
14 | 7 | import com.jme3.math.FastMath; |
15 | 8 | import com.jme3.math.Quaternion; |
16 | 9 | import com.jme3.math.Vector3f; |
17 | 10 | import com.jme3.post.FilterPostProcessor; |
18 | -import com.jme3.post.filters.BloomFilter; | |
19 | -import com.jme3.post.filters.DepthOfFieldFilter; | |
20 | -import com.jme3.post.filters.LightScatteringFilter; | |
21 | 11 | import com.jme3.renderer.Camera; |
22 | -import com.jme3.renderer.queue.RenderQueue.Bucket; | |
23 | 12 | import com.jme3.renderer.queue.RenderQueue.ShadowMode; |
24 | -import com.jme3.scene.Geometry; | |
25 | 13 | import com.jme3.scene.Node; |
26 | 14 | import com.jme3.scene.Spatial; |
27 | -import com.jme3.scene.shape.Box; | |
28 | 15 | import com.jme3.system.AppSettings; |
29 | 16 | import com.jme3.terrain.geomipmap.TerrainQuad; |
30 | 17 | import com.jme3.terrain.heightmap.AbstractHeightMap; |
@@ -39,22 +26,27 @@ import java.util.List; | ||
39 | 26 | |
40 | 27 | /** |
41 | 28 | * test |
29 | + * | |
42 | 30 | * @author normenhansen |
43 | 31 | */ |
44 | 32 | public class TestMultiPostWater extends SimpleApplication { |
45 | 33 | |
46 | 34 | private Vector3f lightDir = new Vector3f(-4.9236743f, -1.27054665f, 5.896916f); |
47 | 35 | private WaterFilter water; |
48 | - TerrainQuad terrain; | |
49 | - Material matRock; | |
50 | - AudioNode waves; | |
51 | - LowPassFilter underWaterAudioFilter = new LowPassFilter(0.5f, 0.1f); | |
52 | - LowPassFilter underWaterReverbFilter = new LowPassFilter(0.5f, 0.1f); | |
53 | - LowPassFilter aboveWaterAudioFilter = new LowPassFilter(1, 1); | |
36 | + private TerrainQuad terrain; | |
37 | + private Material matRock; | |
38 | + private static float WATER_HEIGHT = 90; | |
54 | 39 | |
55 | 40 | public static void main(String[] args) { |
56 | 41 | TestMultiPostWater app = new TestMultiPostWater(); |
57 | - app.setSettings(new AppSettings(true)); | |
42 | + AppSettings s = new AppSettings(true); | |
43 | + s.setRenderer(AppSettings.LWJGL_OPENGL2); | |
44 | + s.setAudioRenderer(AppSettings.LWJGL_OPENAL); | |
45 | +// | |
46 | +// s.setRenderer("JOGL"); | |
47 | +// s.setAudioRenderer("JOAL"); | |
48 | + app.setSettings(s); | |
49 | + | |
58 | 50 | app.start(); |
59 | 51 | } |
60 | 52 |
@@ -76,36 +68,36 @@ public class TestMultiPostWater extends SimpleApplication { | ||
76 | 68 | flyCam.setMoveSpeed(100); |
77 | 69 | |
78 | 70 | //cam.setLocation(new Vector3f(-700, 100, 300)); |
79 | - //cam.setRotation(new Quaternion().fromAngleAxis(0.5f, Vector3f.UNIT_Z)); | |
80 | - cam.setLocation(new Vector3f(-327.21957f, 61.6459f, 126.884346f)); | |
71 | + //cam.setRotation(new Quaternion().fromAngleAxis(0.5f, Vector3f.UNIT_Z)); | |
72 | + cam.setLocation(new Vector3f(-327.21957f, 251.6459f, 126.884346f)); | |
81 | 73 | cam.setRotation(new Quaternion().fromAngles(new float[]{FastMath.PI * 0.06f, FastMath.PI * 0.65f, 0})); |
82 | 74 | |
83 | 75 | |
84 | 76 | Spatial sky = SkyFactory.createSky(assetManager, "Scenes/Beach/FullskiesSunset0068.dds", false); |
85 | 77 | sky.setLocalScale(350); |
86 | - | |
78 | + | |
87 | 79 | mainScene.attachChild(sky); |
88 | 80 | cam.setFrustumFar(4000); |
89 | - | |
90 | 81 | |
91 | - | |
92 | - FilterPostProcessor fpp = new FilterPostProcessor(assetManager); | |
93 | - | |
82 | + | |
83 | + | |
84 | + FilterPostProcessor fpp = new FilterPostProcessor(assetManager); | |
85 | + | |
94 | 86 | water = new WaterFilter(rootNode, lightDir); |
95 | 87 | water.setCenter(new Vector3f(9.628218f, -15.830074f, 199.23595f)); |
96 | 88 | water.setRadius(260); |
97 | 89 | water.setWaveScale(0.003f); |
98 | 90 | water.setMaxAmplitude(2f); |
99 | 91 | water.setFoamExistence(new Vector3f(1f, 4, 0.5f)); |
100 | - water.setFoamTexture((Texture2D) assetManager.loadTexture("Common/MatDefs/Water/Textures/foam2.jpg")); | |
92 | + water.setFoamTexture((Texture2D) assetManager.loadTexture("Common/MatDefs/Water/Textures/foam2.jpg")); | |
101 | 93 | water.setRefractionStrength(0.2f); |
102 | - water.setWaterHeight(0.8f); | |
94 | + water.setWaterHeight(WATER_HEIGHT); | |
103 | 95 | fpp.addFilter(water); |
104 | - | |
96 | + | |
105 | 97 | WaterFilter water2 = new WaterFilter(rootNode, lightDir); |
106 | 98 | water2.setCenter(new Vector3f(-280.46027f, -24.971727f, -271.71976f)); |
107 | 99 | water2.setRadius(260); |
108 | - water2.setWaterHeight(0.8f); | |
100 | + water2.setWaterHeight(WATER_HEIGHT); | |
109 | 101 | water2.setUseFoam(false); |
110 | 102 | water2.setUseRipples(false); |
111 | 103 | water2.setDeepWaterColor(ColorRGBA.Brown); |
@@ -120,28 +112,27 @@ public class TestMultiPostWater extends SimpleApplication { | ||
120 | 112 | water2.setSunScale(1.0f); |
121 | 113 | water2.setColorExtinction(new Vector3f(10.0f, 20.0f, 30.0f)); |
122 | 114 | fpp.addFilter(water2); |
123 | - | |
124 | - | |
115 | + | |
116 | + | |
125 | 117 | WaterFilter water3 = new WaterFilter(rootNode, lightDir); |
126 | 118 | water3.setCenter(new Vector3f(319.6663f, -18.367947f, -236.67674f)); |
127 | 119 | water3.setRadius(260); |
128 | - water3.setWaterHeight(0.8f); | |
120 | + water3.setWaterHeight(WATER_HEIGHT); | |
129 | 121 | water3.setWaveScale(0.003f); |
130 | 122 | water3.setMaxAmplitude(2f); |
131 | 123 | water3.setFoamExistence(new Vector3f(1f, 4, 0.5f)); |
132 | - water3.setFoamTexture((Texture2D) assetManager.loadTexture("Common/MatDefs/Water/Textures/foam2.jpg")); | |
124 | + water3.setFoamTexture((Texture2D) assetManager.loadTexture("Common/MatDefs/Water/Textures/foam2.jpg")); | |
133 | 125 | water3.setRefractionStrength(0.2f); |
134 | - water3.setWaterHeight(0.8f); | |
135 | 126 | water3.setDeepWaterColor(ColorRGBA.Red); |
136 | 127 | water3.setWaterColor(ColorRGBA.Red.mult(2.0f)); |
137 | 128 | water3.setLightColor(ColorRGBA.Red); |
138 | 129 | fpp.addFilter(water3); |
139 | - | |
130 | + | |
140 | 131 | viewPort.addProcessor(fpp); |
141 | 132 | |
142 | - | |
133 | + //fpp.setNumSamples(4); | |
143 | 134 | } |
144 | - | |
135 | + | |
145 | 136 | private void createTerrain(Node rootNode) { |
146 | 137 | matRock = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md"); |
147 | 138 | matRock.setBoolean("useTriPlanarMapping", false); |
@@ -192,6 +183,5 @@ public class TestMultiPostWater extends SimpleApplication { | ||
192 | 183 | |
193 | 184 | @Override |
194 | 185 | public void simpleUpdate(float tpf) { |
195 | - | |
196 | 186 | } |
197 | 187 | } |