diff --git a/.classpath b/.classpath
index c7a0cd7..1a2837e 100644
--- a/.classpath
+++ b/.classpath
@@ -8,7 +8,7 @@
-
+
diff --git a/src/sg/SpaceGame2.java b/src/sg/SpaceGame2.java
index c90c600..93f4f63 100644
--- a/src/sg/SpaceGame2.java
+++ b/src/sg/SpaceGame2.java
@@ -92,6 +92,7 @@ public class SpaceGame2 extends BaseGame {
GameStateManager.getInstance().cleanup();
GameStateManager.getInstance().attachChild(new MenuState("menu"));
GameStateManager.getInstance().attachChild(new InGameState("ingame"));
+ GameStateManager.getInstance().activateChildNamed("ingame");
timer.reset();
}
diff --git a/src/sg/data/models/stations/metal_mapbrown.jpg b/src/sg/data/models/stations/metal_mapbrown.jpg
new file mode 100644
index 0000000..b993d1d
Binary files /dev/null and b/src/sg/data/models/stations/metal_mapbrown.jpg differ
diff --git a/src/sg/data/models/stations/station.3ds b/src/sg/data/models/stations/station.3ds
new file mode 100644
index 0000000..737fca8
Binary files /dev/null and b/src/sg/data/models/stations/station.3ds differ
diff --git a/src/sg/data/models/stations/station2.3ds b/src/sg/data/models/stations/station2.3ds
new file mode 100644
index 0000000..98ca3b5
Binary files /dev/null and b/src/sg/data/models/stations/station2.3ds differ
diff --git a/src/sg/env/Environment.java b/src/sg/env/Environment.java
index 7fe1df6..f43c7de 100644
--- a/src/sg/env/Environment.java
+++ b/src/sg/env/Environment.java
@@ -4,6 +4,7 @@ import sg.util.SGUtil;
import com.jme.image.Texture;
import com.jme.light.LightNode;
+import com.jme.math.Vector3f;
import com.jme.scene.Node;
import com.jme.scene.Skybox;
import com.jme.scene.state.TextureState;
@@ -21,13 +22,25 @@ public class Environment extends Node {
public Environment(Node parentNode){
buildLocalNode();
+ buildEnvoriment();
+ }
+
+ private void buildEnvoriment(){
+ Node station = SGUtil.loadModel("sg/data/models/stations/station.3ds");
+ station.setLocalTranslation(new Vector3f( 500, 0, 0));
+ this.attachChild(station);
+
+ //Node station2 = SGUtil.loadModel("sg/data/models/stations/station2.obj");
+ //station2.setLocalScale(0.5f);
+ //station2.setLocalTranslation(new Vector3f( -500, 0, 0));
+ //this.attachChild(station2);
}
private void buildLocalNode() {
localNode = new Node("local_space");
// Skybox
- Skybox space = new Skybox("space", 500, 500, 500);
+ Skybox space = new Skybox("space", 3000, 3000, 3000);
Texture north = SGUtil.loadTexture("sg/data/skybox/advanced/front.png");
Texture rest = SGUtil.loadTexture("sg/data/skybox/advanced/rest.png");
@@ -52,7 +65,7 @@ public class Environment extends Node {
tex[3] = SGUtil.getTextureState("jmetest/data/texture/flare4.png");
LensFlare flare = LensFlareFactory.createBasicLensFlare("sunflare", tex);
flare.setRootNode(this);
- flare.setLocalTranslation( 0, 0, 500);
+ flare.setLocalTranslation( 0, 0, 5000);
lightNode.attachChild(flare);
lightNode.updateRenderState();
diff --git a/src/sg/states/HudState.java b/src/sg/states/HudState.java
index 8f60c06..191f0c7 100644
--- a/src/sg/states/HudState.java
+++ b/src/sg/states/HudState.java
@@ -5,9 +5,13 @@ import java.awt.Font;
import com.jme.math.Vector3f;
import com.jme.renderer.Renderer;
import com.jme.scene.Node;
+import com.jme.scene.Spatial;
import com.jme.scene.Spatial.LightCombineMode;
import com.jme.scene.state.BlendState;
+import com.jme.scene.state.ZBufferState;
import com.jme.system.DisplaySystem;
+import com.jmex.font2d.Font2D;
+import com.jmex.font2d.Text2D;
import com.jmex.font3d.Font3D;
import com.jmex.font3d.Text3D;
import com.jmex.game.state.BasicGameState;
@@ -21,27 +25,34 @@ public class HudState extends BasicGameState{
hudNode = new Node("hud");
hudNode.setRenderQueueMode(Renderer.QUEUE_ORTHO);
+ hudNode.setCullHint(Spatial.CullHint.Never);
hudNode.setLocalTranslation(new Vector3f(
DisplaySystem.getDisplaySystem().getWidth()/2,
DisplaySystem.getDisplaySystem().getHeight()/2,0));
//Add the alpha values for the transparent node
- BlendState as = DisplaySystem.getDisplaySystem().getRenderer().createBlendState();
- as.setBlendEnabled(true);
- as.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
- as.setDestinationFunction(BlendState.DestinationFunction.One);
- as.setTestEnabled(true);
- as.setTestFunction(BlendState.TestFunction.GreaterThan);
- as.setEnabled(true);
+ BlendState alphaState = DisplaySystem.getDisplaySystem().getRenderer().createBlendState();
+ alphaState.setBlendEnabled(true);
+ alphaState.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
+ alphaState.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
+ alphaState.setTestEnabled(true);
+ alphaState.setTestFunction(BlendState.TestFunction.GreaterThan);
+ alphaState.setEnabled(true);
- Font3D font = new Font3D(new Font("Arial", Font.PLAIN, 24), 0.001f, true, true, true);
- Text3D text = font.createText("Testing 1, 2, 3", 50.0f, 0);
- //text.setLocalScale(new Vector3f(5.0f, 5.0f, 0.01f));
+ ZBufferState zbs = DisplaySystem.getDisplaySystem().getRenderer().createZBufferState();
+ zbs.setFunction(ZBufferState.TestFunction.Always);
+
+ Font2D font = new Font2D();
+ Text2D text = font.createText("Loading...", 10.0f, 0);
+ text.setRenderQueueMode(Renderer.QUEUE_ORTHO);
+ text.setRenderState(zbs);
+ text.updateRenderState();
hudNode.attachChild(text);
hudNode = new Node("hud_node");
hudNode.setLightCombineMode(LightCombineMode.Off);
- hudNode.setRenderState(as);
+ hudNode.setRenderState(alphaState);
+ hudNode.setRenderState(zbs);
hudNode.updateRenderState();
rootNode.attachChild(hudNode);
}
diff --git a/src/sg/test/TestShaderTexturing.java b/src/sg/test/TestShaderTexturing.java
deleted file mode 100644
index 7aabe8f..0000000
--- a/src/sg/test/TestShaderTexturing.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2003-2009 jMonkeyEngine
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package sg.test;
-
-import com.jme.app.SimpleGame;
-import com.jme.image.Texture;
-import com.jme.scene.shape.Quad;
-import com.jme.scene.state.GLSLShaderObjectsState;
-import com.jme.scene.state.TextureState;
-import com.jme.util.TextureManager;
-
-public class TestShaderTexturing extends SimpleGame {
-
- public static void main(String[] args) {
- TestShaderTexturing app = new TestShaderTexturing();
- app.setConfigShowMode(ConfigShowMode.AlwaysShow);
- app.start();
- }
-
- @Override
- protected void simpleInitGame() {
- String shader = "uniform sampler2D tex0, tex1, tex2, tex3, tex4;"
- + " void main(){"
- + "vec2 tc0 = vec2(gl_TexCoord[1].x, gl_TexCoord[1].y);"
- + "vec2 tc1 = vec2(gl_TexCoord[0].x, gl_TexCoord[0].y);"
- + "vec4 result = texture2D(tex0,tc0);"
- + "vec4 col0 = texture2D(tex1, tc0);"
- + "vec4 alp0= texture2D(tex2, tc1);"
- + "result = mix(result, col0, alp0.r);"
- + "vec4 col1 = texture2D(tex3, tc0);"
- + "vec4 alp1= texture2D(tex4, tc1);"
- + "result = mix(result, col1, alp1.r);"
- + "gl_FragColor = result * gl_Color;" + "}";
-
- GLSLShaderObjectsState so = display.getRenderer()
- .createGLSLShaderObjectsState();
- so.load(null, shader);
- so.setUniform("tex0", 0);
- so.setUniform("tex1", 1);
- so.setUniform("tex2", 2);
- so.setUniform("tex3", 3);
- so.setUniform("tex4", 4);
- so.setEnabled(true);
-
- Quad mesh = new Quad("mesh", 10, 10);
- mesh.copyTextureCoordinates(0, 1, 1.0f);
- mesh.setRenderState(so);
-
- TextureState ts = display.getRenderer().createTextureState();
- Texture t0 = TextureManager.loadTexture(ClassLoader
- .getSystemResource("jmetest/data/texture/Decal.PNG"),
- Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.NearestNeighbor);
- ts.setTexture(t0, 0);
- Texture t1 = TextureManager.loadTexture(ClassLoader
- .getSystemResource("jmetest/data/texture/highest.jpg"),
- Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear);
- ts.setTexture(t1, 1);
- Texture t2 = TextureManager.loadTexture(ClassLoader
- .getSystemResource("jmetest/data/cursor/test.PNG"),
- Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.NearestNeighbor, 0, true);
- t2.setWrap(Texture.WrapMode.EdgeClamp);
- ts.setTexture(t2, 2);
- Texture t3 = TextureManager.loadTexture(ClassLoader
- .getSystemResource("jmetest/data/texture/highest.jpg"),
- Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear);
- ts.setTexture(t3, 3);
- Texture t4 = TextureManager.loadTexture(ClassLoader
- .getSystemResource("jmetest/data/cursor/test.PNG"),
- Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.NearestNeighbor, 0, false);
- t4.setWrap(Texture.WrapMode.EdgeClamp);
- ts.setTexture(t4, 4);
-
- mesh.setRenderState(ts);
- rootNode.attachChild(mesh);
-
- lightState.setEnabled(false);
- }
-
-}
diff --git a/src/sg/test/TestShadowPass.java b/src/sg/test/TestShadowPass.java
deleted file mode 100644
index 55f7a49..0000000
--- a/src/sg/test/TestShadowPass.java
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Copyright (c) 2003-2009 jMonkeyEngine
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package sg.test;
-
-import java.util.HashMap;
-
-import javax.swing.ImageIcon;
-
-import jmetest.renderer.ShadowTweaker;
-
-import com.jme.app.SimplePassGame;
-import com.jme.bounding.BoundingBox;
-import com.jme.image.Texture;
-import com.jme.input.ChaseCamera;
-import com.jme.input.KeyBindingManager;
-import com.jme.input.KeyInput;
-import com.jme.input.ThirdPersonHandler;
-import com.jme.light.DirectionalLight;
-import com.jme.light.PointLight;
-import com.jme.math.FastMath;
-import com.jme.math.Vector3f;
-import com.jme.renderer.ColorRGBA;
-import com.jme.renderer.Renderer;
-import com.jme.renderer.pass.RenderPass;
-import com.jme.renderer.pass.ShadowedRenderPass;
-import com.jme.scene.Node;
-import com.jme.scene.VBOInfo;
-import com.jme.scene.shape.Box;
-import com.jme.scene.shape.PQTorus;
-import com.jme.scene.state.CullState;
-import com.jme.scene.state.FogState;
-import com.jme.scene.state.TextureState;
-import com.jme.util.TextureManager;
-import com.jmex.terrain.TerrainPage;
-import com.jmex.terrain.util.FaultFractalHeightMap;
-import com.jmex.terrain.util.ProceduralTextureGenerator;
-
-/**
- * TestShadowPass
- *
- * @author Joshua Slack
- * @version $Revision: 1.15 $
- */
-public class TestShadowPass extends SimplePassGame {
- private Node m_character;
- private Node occluders;
- private ChaseCamera chaser;
- private TerrainPage page;
- private FogState fs;
- private Vector3f normal = new Vector3f();
- private static ShadowedRenderPass sPass = new ShadowedRenderPass();
- private static boolean debug = true;
-
- /**
- * Entry point for the test,
- *
- * @param args
- */
- public static void main(String[] args) {
- TestShadowPass app = new TestShadowPass();
- if (debug) new ShadowTweaker(sPass).setVisible(true);
-
- app.setConfigShowMode(ConfigShowMode.AlwaysShow);
- app.start();
- }
-
- TestShadowPass() {
- stencilBits = 4; // we need a minimum stencil buffer at least.
-
- }
-
- /**
- * builds the scene.
- *
- * @see com.jme.app.BaseGame#initGame()
- */
- protected void simpleInitGame() {
- display.setTitle("jME - Shadow Volume Test : X - enable/disable shadows");
- display.getRenderer().setBackgroundColor(ColorRGBA.gray.clone());
-
- setupCharacter();
- setupTerrain();
- setupChaseCamera();
- setupInput();
- setupOccluders();
-
- rootNode.setRenderQueueMode(Renderer.QUEUE_OPAQUE);
-
- /** Assign key X to action "toggle_shadows". */
- KeyBindingManager.getKeyBindingManager().set("toggle_shadows",
- KeyInput.KEY_X);
-
-
- sPass.add(rootNode);
- sPass.addOccluder(m_character);
- sPass.addOccluder(occluders);
- sPass.setRenderShadows(true);
- sPass.setLightingMethod(ShadowedRenderPass.LightingMethod.Additive);
- pManager.add(sPass);
-
- RenderPass rPass = new RenderPass();
- rPass.add(statNode);
- pManager.add(rPass);
- }
-
- protected void simpleUpdate() {
- chaser.update(tpf);
- float characterMinHeight = page.getHeight(m_character
- .getLocalTranslation())+((BoundingBox)m_character.getWorldBound()).yExtent;
- if (!Float.isInfinite(characterMinHeight) && !Float.isNaN(characterMinHeight)) {
- m_character.getLocalTranslation().y = characterMinHeight;
- }
-
- float camMinHeight = characterMinHeight + 150f;
- if (!Float.isInfinite(camMinHeight) && !Float.isNaN(camMinHeight)
- && cam.getLocation().y <= camMinHeight) {
- cam.getLocation().y = camMinHeight;
- cam.update();
- }
-
-
- if (KeyBindingManager.getKeyBindingManager().isValidCommand(
- "toggle_shadows", false)) {
- sPass.setRenderShadows(!sPass.getRenderShadows());
- }
- }
-
- private void setupCharacter() {
- PQTorus b = new PQTorus("torus - target", 2, 3, 2.0f, 1.0f, 64, 12);
- b.setModelBound(new BoundingBox());
- b.updateModelBound();
- b.setVBOInfo(new VBOInfo(true));
- m_character = new Node("char node");
- rootNode.attachChild(m_character);
- m_character.attachChild(b);
- m_character.updateWorldBound(); // We do this to allow the camera setup access to the world bound in our setup code.
-
- TextureState ts = display.getRenderer().createTextureState();
- ts.setEnabled(true);
- ts.setTexture(
- TextureManager.loadTexture(
- TestShadowPass.class.getClassLoader().getResource(
- "jmetest/data/images/Monkey.jpg"),
- Texture.MinificationFilter.BilinearNearestMipMap,
- Texture.MagnificationFilter.Bilinear));
- m_character.setRenderState(ts);
- }
-
- private void setupTerrain() {
-
- DirectionalLight dr = new DirectionalLight();
- dr.setEnabled(true);
- dr.setDiffuse(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
- dr.setAmbient(new ColorRGBA(.2f, .2f, .2f, .3f));
- dr.setDirection(new Vector3f(0.5f, -0.4f, 0).normalizeLocal());
- dr.setShadowCaster(true);
-
- PointLight pl = new PointLight();
- pl.setEnabled(true);
- pl.setDiffuse(new ColorRGBA(.7f, .7f, .7f, 1.0f));
- pl.setAmbient(new ColorRGBA(.25f, .25f, .25f, .25f));
- pl.setLocation(new Vector3f(0,500,0));
- pl.setShadowCaster(true);
-
- DirectionalLight dr2 = new DirectionalLight();
- dr2.setEnabled(true);
- dr2.setDiffuse(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
- dr2.setAmbient(new ColorRGBA(.2f, .2f, .2f, .4f));
- dr2.setDirection(new Vector3f(-0.2f, -0.3f, .2f).normalizeLocal());
- dr2.setShadowCaster(true);
-
- CullState cs = display.getRenderer().createCullState();
- cs.setCullFace(CullState.Face.Back);
- cs.setEnabled(true);
- rootNode.setRenderState(cs);
-
- lightState.detachAll();
- lightState.attach(dr);
- lightState.attach(dr2);
- lightState.attach(pl);
- lightState.setGlobalAmbient(new ColorRGBA(0.6f, 0.6f, 0.6f, 1.0f));
-
- FaultFractalHeightMap heightMap = new FaultFractalHeightMap(257, 32, 0,
- 255, 0.55f);
- Vector3f terrainScale = new Vector3f(10, 1, 10);
- heightMap.setHeightScale(0.001f);
- page = new TerrainPage("Terrain", 33, heightMap.getSize(),
- terrainScale, heightMap.getHeightMap());
-
- page.setDetailTexture(1, 16);
- rootNode.attachChild(page);
-
- ProceduralTextureGenerator pt = new ProceduralTextureGenerator(
- heightMap);
- pt.addTexture(new ImageIcon(TestShadowPass.class.getClassLoader()
- .getResource("jmetest/data/texture/grassb.png")), -128, 0, 128);
- pt.addTexture(new ImageIcon(TestShadowPass.class.getClassLoader()
- .getResource("jmetest/data/texture/dirt.jpg")), 0, 128, 255);
- pt.addTexture(new ImageIcon(TestShadowPass.class.getClassLoader()
- .getResource("jmetest/data/texture/highest.jpg")), 128, 255,
- 384);
-
- pt.createTexture(512);
-
- TextureState ts = display.getRenderer().createTextureState();
- ts.setEnabled(true);
- Texture t1 = TextureManager.loadTexture(pt.getImageIcon().getImage(),
- Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear, true);
- ts.setTexture(t1, 0);
-
- Texture t2 = TextureManager.loadTexture(TestShadowPass.class
- .getClassLoader()
- .getResource("jmetest/data/texture/Detail.jpg"),
- Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear);
- ts.setTexture(t2, 1);
- t2.setWrap(Texture.WrapMode.Repeat);
-
- t1.setApply(Texture.ApplyMode.Combine);
- t1.setCombineFuncRGB(Texture.CombinerFunctionRGB.Modulate);
- t1.setCombineSrc0RGB(Texture.CombinerSource.CurrentTexture);
- t1.setCombineOp0RGB(Texture.CombinerOperandRGB.SourceColor);
- t1.setCombineSrc1RGB(Texture.CombinerSource.PrimaryColor);
- t1.setCombineOp1RGB(Texture.CombinerOperandRGB.SourceColor);
-
- t2.setApply(Texture.ApplyMode.Combine);
- t2.setCombineFuncRGB(Texture.CombinerFunctionRGB.AddSigned);
- t2.setCombineSrc0RGB(Texture.CombinerSource.CurrentTexture);
- t2.setCombineOp0RGB(Texture.CombinerOperandRGB.SourceColor);
- t2.setCombineSrc1RGB(Texture.CombinerSource.Previous);
- t2.setCombineOp1RGB(Texture.CombinerOperandRGB.SourceColor);
- rootNode.setRenderState(ts);
-
- fs = display.getRenderer().createFogState();
- fs.setDensity(0.5f);
- fs.setEnabled(true);
- fs.setColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 0.5f));
- fs.setEnd(1000);
- fs.setStart(500);
- fs.setDensityFunction(FogState.DensityFunction.Linear);
- fs.setQuality(FogState.Quality.PerVertex);
- rootNode.setRenderState(fs);
- }
-
- private void setupOccluders() {
-
- TextureState ts = display.getRenderer().createTextureState();
- ts.setEnabled(true);
- ts.setTexture(
- TextureManager.loadTexture(
- TestShadowPass.class.getClassLoader().getResource(
- "jmetest/data/texture/rust.jpg"),
- Texture.MinificationFilter.Trilinear,
- Texture.MagnificationFilter.Bilinear));
-
- occluders = new Node("occs");
- occluders.setRenderState(ts);
- rootNode.attachChild(occluders);
- for (int i = 0; i < 50; i++) {
- Box b = new Box("box", new Vector3f(), 8, 50, 8);
- b.setModelBound(new BoundingBox());
- b.updateModelBound();
- float x = (float) Math.random() * 2000 - 1000;
- float z = (float) Math.random() * 2000 - 1000;
- b.setLocalTranslation(new Vector3f(x, page.getHeight(x, z)+50, z));
- page.getSurfaceNormal(b.getLocalTranslation(), normal );
- if (normal != null)
- b.rotateUpTo(normal);
- occluders.attachChild(b);
- }
- occluders.lock();
- }
-
- private void setupChaseCamera() {
- Vector3f targetOffset = new Vector3f();
- targetOffset.y = ((BoundingBox) m_character.getWorldBound()).yExtent * 1.5f;
- chaser = new ChaseCamera(cam, m_character);
- chaser.setTargetOffset(targetOffset);
- chaser.getMouseLook().setMinRollOut(150);
- chaser.setMaxDistance(300);
- }
-
- private void setupInput() {
- HashMap handlerProps = new HashMap();
- handlerProps.put(ThirdPersonHandler.PROP_DOGRADUAL, "true");
- handlerProps.put(ThirdPersonHandler.PROP_TURNSPEED, ""+(.5f * FastMath.PI));
- handlerProps.put(ThirdPersonHandler.PROP_LOCKBACKWARDS, "true");
- handlerProps.put(ThirdPersonHandler.PROP_CAMERAALIGNEDMOVE, "true");
- handlerProps.put(ThirdPersonHandler.PROP_ROTATEONLY, "true");
- input = new ThirdPersonHandler(m_character, cam, handlerProps);
- input.setActionSpeed(100f);
- }
-}