OSDN Git Service

* SimpleTextured, SolidColor, VertexColor, and WireColor are now obsolete. Using...
authorshadowislord <shadowislord@75d07b2b-3a1a-0410-a2c5-0572b91ccdca>
Sun, 12 Jun 2011 02:35:19 +0000 (02:35 +0000)
committershadowislord <shadowislord@75d07b2b-3a1a-0410-a2c5-0572b91ccdca>
Sun, 12 Jun 2011 02:35:19 +0000 (02:35 +0000)
 * Additional javadocs for Material
 * Added TestMusicStreaming

git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@7591 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

68 files changed:
engine/src/android/jme3test/android/SimpleTexturedTest.java
engine/src/blender/com/jme3/scene/plugins/blender/utils/DataRepository.java
engine/src/bullet/com/jme3/bullet/collision/PhysicsCollisionObject.java
engine/src/core-data/Common/MatDefs/Light/Glow.frag
engine/src/core-data/Common/MatDefs/Misc/SimpleTextured.j3md
engine/src/core-data/Common/MatDefs/Misc/SolidColor.j3md
engine/src/core-data/Common/MatDefs/Misc/VertexColor.j3md
engine/src/core-data/Common/MatDefs/Misc/WireColor.j3md
engine/src/core-plugins/com/jme3/material/plugins/J3MLoader.java
engine/src/core/com/jme3/cinematic/MotionPath.java
engine/src/core/com/jme3/font/BitmapFont.java
engine/src/core/com/jme3/material/FixedFuncBinding.java
engine/src/core/com/jme3/material/MatParamTexture.java [new file with mode: 0644]
engine/src/core/com/jme3/material/Material.java
engine/src/core/com/jme3/material/RenderState.java
engine/src/desktop-fx/com/jme3/shadow/PssmShadowRenderer.java
engine/src/games/jme3game/cubefield/CubeField.java
engine/src/jbullet/com/jme3/bullet/collision/PhysicsCollisionObject.java
engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglGL1Renderer.java
engine/src/test-data/Textures/HdrTest/Memorial.j3m
engine/src/test/jme3test/audio/TestMusicStreaming.java [new file with mode: 0644]
engine/src/test/jme3test/awt/TestSafeCanvas.java
engine/src/test/jme3test/blender/scene/Pivot.java
engine/src/test/jme3test/blender/scene/VisibleBone.java
engine/src/test/jme3test/bullet/PhysicsTestHelper.java
engine/src/test/jme3test/bullet/TestAttachDriver.java
engine/src/test/jme3test/bullet/TestAttachGhostObject.java
engine/src/test/jme3test/bullet/TestBoneRagdoll.java
engine/src/test/jme3test/bullet/TestBrickTower.java
engine/src/test/jme3test/bullet/TestBrickWall.java
engine/src/test/jme3test/bullet/TestCcd.java
engine/src/test/jme3test/bullet/TestCollisionGroups.java
engine/src/test/jme3test/bullet/TestCollisionListener.java
engine/src/test/jme3test/bullet/TestGhostObject.java
engine/src/test/jme3test/bullet/TestHoveringTank.java
engine/src/test/jme3test/bullet/TestPhysicsCar.java
engine/src/test/jme3test/bullet/TestPhysicsHingeJoint.java
engine/src/test/jme3test/bullet/TestWalkingChar.java
engine/src/test/jme3test/collision/TestMousePick.java
engine/src/test/jme3test/collision/TestTriangleCollision.java
engine/src/test/jme3test/conversion/TestMipMapGen.java
engine/src/test/jme3test/helloworld/HelloAssets.java
engine/src/test/jme3test/helloworld/HelloAudio.java
engine/src/test/jme3test/helloworld/HelloInput.java
engine/src/test/jme3test/helloworld/HelloJME3.java
engine/src/test/jme3test/helloworld/HelloLoop.java
engine/src/test/jme3test/helloworld/HelloMaterial.java
engine/src/test/jme3test/helloworld/HelloNode.java
engine/src/test/jme3test/helloworld/HelloPhysics.java
engine/src/test/jme3test/helloworld/HelloPicking.java
engine/src/test/jme3test/input/TestChaseCamera.java
engine/src/test/jme3test/light/TestPssmShadow.java
engine/src/test/jme3test/light/TestShadow.java
engine/src/test/jme3test/light/TestSimpleLighting.java
engine/src/test/jme3test/network/sync/BoxEntity.java
engine/src/test/jme3test/post/TestDepthOfField.java
engine/src/test/jme3test/post/TestHDR.java
engine/src/test/jme3test/post/TestLightScattering.java
engine/src/test/jme3test/post/TestRenderToTexture.java
engine/src/test/jme3test/terrain/TerrainTest.java
engine/src/test/jme3test/terrain/TerrainTestAdvanced.java
engine/src/test/jme3test/terrain/TerrainTestCollision.java
engine/src/test/jme3test/terrain/TerrainTestModifyHeight.java
engine/src/test/jme3test/terrain/TerrainTestReadWrite.java
engine/src/test/jme3test/texture/TestNormalLatc.java
engine/src/test/jme3test/water/TestPostWater.java
engine/src/test/jme3test/water/TestSceneWater.java
engine/src/test/jme3test/water/TestSimpleWater.java

index 635d8e1..1413f99 100644 (file)
@@ -80,11 +80,11 @@ public class SimpleTexturedTest extends SimpleApplication {
                                material.setBoolean("LowQuality", true);
                                material.setTexture("DiffuseMap", texture);
                        } else {
-                               material = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+                               material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
                                material.setTexture("ColorMap", texture);
                        }
                } else {
-                       material = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
+                       material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
                        material.setColor("Color", ColorRGBA.Red);
                }
 
index e25a8e8..83fefab 100644 (file)
@@ -372,7 +372,7 @@ public class DataRepository {
         */\r
        public synchronized Material getDefaultMaterial() {\r
                if(blenderKey.getDefaultMaterial() == null) {\r
-                       Material defaultMaterial = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");\r
+                       Material defaultMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");\r
                        defaultMaterial.setColor("Color", ColorRGBA.DarkGray);\r
                        blenderKey.setDefaultMaterial(defaultMaterial);\r
                }\r
index 491197c..7455939 100644 (file)
@@ -167,13 +167,17 @@ public abstract class PhysicsCollisionObject implements Savable {
      * @param manager AssetManager to load the default wireframe material for the debug shape
      */
     protected Spatial attachDebugShape(AssetManager manager) {
-        debugMaterialBlue = new Material(manager, "Common/MatDefs/Misc/WireColor.j3md");
+        debugMaterialBlue = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
+        debugMaterialBlue.getAdditionalRenderState().setWireframe(true);
         debugMaterialBlue.setColor("Color", ColorRGBA.Blue);
-        debugMaterialGreen = new Material(manager, "Common/MatDefs/Misc/WireColor.j3md");
+        debugMaterialGreen = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
+        debugMaterialGreen.getAdditionalRenderState().setWireframe(true);
         debugMaterialGreen.setColor("Color", ColorRGBA.Green);
-        debugMaterialRed = new Material(manager, "Common/MatDefs/Misc/WireColor.j3md");
+        debugMaterialRed = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
+        debugMaterialRed.getAdditionalRenderState().setWireframe(true);
         debugMaterialRed.setColor("Color", ColorRGBA.Red);
-        debugMaterialYellow = new Material(manager, "Common/MatDefs/Misc/WireColor.j3md");
+        debugMaterialYellow = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
+        debugMaterialYellow.getAdditionalRenderState().setWireframe(true);
         debugMaterialYellow.setColor("Color", ColorRGBA.Yellow);
         debugArrow = new Arrow(Vector3f.UNIT_XYZ);
         debugArrowGeom = new Geometry("DebugArrow", debugArrow);
index b39e6de..a18a228 100644 (file)
@@ -16,7 +16,6 @@
 \r
 \r
 void main(){\r
-   \r
     #ifdef HAS_GLOWMAP\r
         #if defined(NEED_TEXCOORD1) \r
            gl_FragColor = texture2D(m_GlowMap, texCoord1);\r
index c18559c..53469e2 100644 (file)
@@ -1,3 +1,5 @@
+Exception SimpleTextured.j3md has been marked as obsolete. Please use Unshaded.j3md instead.\r
+\r
 MaterialDef Plain Texture {\r
 \r
     MaterialParameters {\r
index 50c8b9d..15cdff2 100644 (file)
@@ -1,3 +1,5 @@
+Exception SolidColor.j3md has been marked as obsolete. Please use Unshaded.j3md instead.\r
+\r
 MaterialDef Solid Color {\r
 \r
     MaterialParameters {\r
index 09b3e7b..d5b3eba 100644 (file)
@@ -1,3 +1,5 @@
+Exception VertexColor.j3md has been marked as obsolete. Please use Unshaded.j3md instead.\r
+\r
 MaterialDef Vertex Color {\r
 \r
     Technique {\r
index 35debff..51a4733 100644 (file)
@@ -1,3 +1,5 @@
+Exception WireColor.j3md has been marked as obsolete. Please use Unshaded.j3md instead.\r
+\r
 MaterialDef Wire Color {\r
 \r
     MaterialParameters {\r
index ec3268a..3d75258 100644 (file)
@@ -34,6 +34,7 @@ package com.jme3.material.plugins;
 
 import com.jme3.asset.AssetInfo;
 import com.jme3.asset.AssetKey;
+import com.jme3.asset.AssetLoadException;
 import com.jme3.material.*;
 import com.jme3.math.ColorRGBA;
 import com.jme3.math.Vector2f;
@@ -507,6 +508,9 @@ public class J3MLoader implements AssetLoader {
             extending = true;
         }else if (word.equals("MaterialDef")){
             extending = false;
+        }else if (word.equals("Exception")){
+            String exception = scan.nextLine();
+            throw new AssetLoadException(exception);
         }else{
             throw new IOException("Specified file is not a Material file");
         }
index b885b7b..038e347 100644 (file)
@@ -152,7 +152,8 @@ public class MotionPath implements Savable {
 
     private Geometry CreateLinearPath() {
 
-        Material mat = new Material(assetManager, "Common/MatDefs/Misc/WireColor.j3md");
+        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+        mat.getAdditionalRenderState().setWireframe(true);
         mat.setColor("Color", ColorRGBA.Blue);
         Geometry lineGeometry = new Geometry("line", new Curve(spline, 0));
         lineGeometry.setMaterial(mat);
@@ -161,7 +162,8 @@ public class MotionPath implements Savable {
 
     private Geometry CreateCatmullRomPath() {
 
-        Material mat = new Material(assetManager, "Common/MatDefs/Misc/WireColor.j3md");
+        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+        mat.getAdditionalRenderState().setWireframe(true);
         mat.setColor("Color", ColorRGBA.Blue);
         Geometry lineGeometry = new Geometry("line", new Curve(spline, 10));
         lineGeometry.setMaterial(mat);
index cf38faf..ca792c8 100644 (file)
@@ -41,8 +41,6 @@ import com.jme3.export.JmeImporter;
 import com.jme3.export.OutputCapsule;\r
 import com.jme3.export.Savable;\r
 import com.jme3.material.Material;\r
-import com.jme3.shader.VarType;\r
-import com.jme3.texture.Texture;\r
 \r
 /**\r
  * Represents a font within jME that is generated with the AngelCode Bitmap Font Generator\r
index d13f74c..1f6ba11 100644 (file)
@@ -69,5 +69,5 @@ public enum FixedFuncBinding {
      * 
      * Same as GL_SHININESS for OpenGL.
      */
-    Shininess
+    MaterialShininess
 }
diff --git a/engine/src/core/com/jme3/material/MatParamTexture.java b/engine/src/core/com/jme3/material/MatParamTexture.java
new file mode 100644 (file)
index 0000000..de60210
--- /dev/null
@@ -0,0 +1,67 @@
+package com.jme3.material;
+
+import com.jme3.export.InputCapsule;
+import com.jme3.export.JmeExporter;
+import com.jme3.export.JmeImporter;
+import com.jme3.export.OutputCapsule;
+import com.jme3.renderer.Renderer;
+import com.jme3.shader.VarType;
+import com.jme3.texture.Texture;
+import java.io.IOException;
+
+public class MatParamTexture extends MatParam {
+
+    private Texture texture;
+    private int unit;
+
+    public MatParamTexture(VarType type, String name, Texture texture, int unit) {
+        super(type, name, texture, null);
+        this.texture = texture;
+        this.unit = unit;
+    }
+
+    public MatParamTexture() {
+    }
+
+    public Texture getTextureValue() {
+        return texture;
+    }
+
+    public void setTextureValue(Texture value) {
+        this.value = value;
+        this.texture = value;
+    }
+
+    public void setUnit(int unit) {
+        this.unit = unit;
+    }
+
+    public int getUnit() {
+        return unit;
+    }
+
+    @Override
+    public void apply(Renderer r, Technique technique) {
+        TechniqueDef techDef = technique.getDef();
+        r.setTexture(getUnit(), getTextureValue());
+        if (techDef.isUsingShaders()) {
+            technique.updateUniformParam(getName(), getVarType(), getUnit(), true);
+        }
+    }
+
+    @Override
+    public void write(JmeExporter ex) throws IOException {
+        super.write(ex);
+        OutputCapsule oc = ex.getCapsule(this);
+        oc.write(unit, "texture_unit", -1);
+        oc.write(texture, "texture", null);
+    }
+
+    @Override
+    public void read(JmeImporter im) throws IOException {
+        super.read(im);
+        InputCapsule ic = im.getCapsule(this);
+        unit = ic.readInt("texture_unit", -1);
+        texture = (Texture) ic.readSavable("texture", null);
+    }
+}
\ No newline at end of file
index c96cfac..8a6f395 100644 (file)
@@ -53,7 +53,10 @@ import com.jme3.math.Vector4f;
 import com.jme3.renderer.Caps;
 import com.jme3.renderer.RenderManager;
 import com.jme3.renderer.Renderer;
+import com.jme3.renderer.queue.RenderQueue.Bucket;
+import com.jme3.renderer.queue.RenderQueue.ShadowMode;
 import com.jme3.scene.Geometry;
+import com.jme3.scene.Spatial;
 import com.jme3.shader.Shader;
 import com.jme3.shader.Uniform;
 import com.jme3.shader.VarType;
@@ -68,6 +71,16 @@ import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+/**
+ * <code>Material</code> describes the rendering style for a given 
+ * {@link Geometry}. 
+ * 
+ * <p>A material is essentially a list of {@link MatParam parameters}, those parameters
+ * map to uniforms which are defined in a shader. 
+ * Setting the parameters can modify the behavior of a shader.
+ * 
+ * @author Kirill Vainer
+ */
 public class Material implements Cloneable, Savable, Comparable<Material> {
 
     private static final Logger logger = Logger.getLogger(Material.class.getName());
@@ -98,70 +111,10 @@ public class Material implements Cloneable, Savable, Comparable<Material> {
     private int sortingId = -1;
     private transient ColorRGBA ambientLightColor = new ColorRGBA(0, 0, 0, 1);
 
-    public static class MatParamTexture extends MatParam {
-
-        private Texture texture;
-        private int unit;
-//        private transient TextureKey key;
-
-        public MatParamTexture(VarType type, String name, Texture texture, int unit) {
-            super(type, name, texture, null);
-            this.texture = texture;
-            this.unit = unit;
-        }
-
-        public MatParamTexture() {
-        }
-
-        public Texture getTextureValue() {
-            return texture;
-        }
-
-        public void setTextureValue(Texture value) {
-            this.value = value;
-            this.texture = value;
-        }
-
-        public void setUnit(int unit) {
-            this.unit = unit;
-        }
-
-        public int getUnit() {
-            return unit;
-        }
-
-        @Override
-        public void apply(Renderer r, Technique technique) {
-            TechniqueDef techDef = technique.getDef();
-            r.setTexture(getUnit(), getTextureValue());
-            if (techDef.isUsingShaders()) {
-                technique.updateUniformParam(getName(), getVarType(), getUnit(), true);
-            }
-        }
-
-        @Override
-        public void write(JmeExporter ex) throws IOException {
-            super.write(ex);
-            OutputCapsule oc = ex.getCapsule(this);
-            oc.write(unit, "texture_unit", -1);
-            oc.write(texture, "texture", null);
-        }
-
-        @Override
-        public void read(JmeImporter im) throws IOException {
-            super.read(im);
-            InputCapsule ic = im.getCapsule(this);
-            unit = ic.readInt("texture_unit", -1);
-            texture = (Texture) ic.readSavable("texture", null);
-//            key = texture.getTextureKey();
-        }
-    }
-
     public Material(MaterialDef def) {
         if (def == null) {
             throw new NullPointerException("Material definition cannot be null");
         }
-
         this.def = def;
     }
 
@@ -175,14 +128,36 @@ public class Material implements Cloneable, Savable, Comparable<Material> {
     public Material() {
     }
 
+    /**
+     * Returns the asset key name of the asset from which this material was loaded.
+     * 
+     * <p>This value will be <code>null</code> unless this material was loaded
+     * from a .j3m file.
+     * 
+     * @return Asset key name of the j3m file 
+     */
     public String getAssetName() {
         return assetName;
     }
 
+    /**
+     * Set the asset key name. This is used internally by the j3m material loader.
+     * 
+     * @param assetName the asset key name
+     */
     public void setAssetName(String assetName) {
         this.assetName = assetName;
     }
 
+    /**
+     * Returns the sorting ID or sorting index for this material. 
+     * 
+     * <p>The sorting ID is used internally by the system to sort rendering
+     * of geometries. It sorted to reduce shader switches, if the shaders
+     * are equal, then it is sorted by textures.
+     * 
+     * @return The sorting ID used for sorting geometries for rendering.
+     */
     public int getSortId() {
         Technique t = getActiveTechnique();
         if (sortingId == -1 && t != null && t.getShader() != null) {
@@ -204,14 +179,28 @@ public class Material implements Cloneable, Savable, Comparable<Material> {
         return sortingId;
     }
 
+    /**
+     * Uses the sorting ID for each material to compare them.
+     * 
+     * @param m The other material to compare to.
+     * 
+     * @return zero if the materials are equal, returns a negative value
+     * if <code>this</code> has a lower sorting ID than <code>m</code>, 
+     * otherwise returns a positive value.
+     */
     public int compareTo(Material m) {
         return m.getSortId() - getSortId();
     }
 
+    /**
+     * Clones this material. The result 
+     * @return 
+     */
     @Override
     public Material clone() {
         try {
             Material mat = (Material) super.clone();
+            
             if (additionalState != null) {
                 mat.additionalState = additionalState.clone();
             }
@@ -234,30 +223,62 @@ public class Material implements Cloneable, Savable, Comparable<Material> {
         return technique;
     }
 
-    /**
-     * Should only be used in Technique.makeCurrent()
-     * @param tech
-     */
-    public void setActiveTechnique(Technique tech) {
-        technique = tech;
-    }
-
     public boolean isTransparent() {
         return transparent;
     }
 
+    /**
+     * Set the transparent value marker.
+     * 
+     * <p>This value is merely a marker, by itself it does nothing.
+     * Generally model loaders will use this marker to indicate further
+     * up that the material is transparent and therefore any geometries
+     * using it should be put into the {@link Bucket#Transparent transparent
+     * bucket}.
+     * 
+     * @param transparent the transparent value marker.
+     */
     public void setTransparent(boolean transparent) {
         this.transparent = transparent;
     }
 
+    /**
+     * Check if the material should receive shadows or not.
+     * 
+     * @return True if the material should receive shadows.
+     * 
+     * @see Material#setReceivesShadows(boolean) 
+     */
     public boolean isReceivesShadows() {
         return receivesShadows;
     }
 
+    /**
+     * Set if the material should receive shadows or not.
+     * 
+     * <p>This value is merely a marker, by itself it does nothing.
+     * Generally model loaders will use this marker to indicate
+     * the material should receive shadows and therefore any
+     * geometries using it should have the {@link ShadowMode#Receive} set
+     * on them.
+     * 
+     * @param receivesShadows if the material should receive shadows or not.
+     */
     public void setReceivesShadows(boolean receivesShadows) {
         this.receivesShadows = receivesShadows;
     }
 
+    /**
+     * Acquire the additional {@link RenderState render state} to apply
+     * for this material. 
+     * 
+     * <p>The first call to this method will create an additional render
+     * state which can be modified by the user to apply any render
+     * states in addition to the ones used by the renderer. Only render
+     * states which are modified in the additional render state will be applied.
+     * 
+     * @return The additional render state.
+     */
     public RenderState getAdditionalRenderState() {
         if (additionalState == null) {
             additionalState = RenderState.ADDITIONAL.clone();
@@ -265,15 +286,16 @@ public class Material implements Cloneable, Savable, Comparable<Material> {
         return additionalState;
     }
 
+    /**
+     * Get the material definition (j3md file info) that <code>this</code>
+     * material is implementing.
+     * 
+     * @return the material definition this material implements.
+     */
     public MaterialDef getMaterialDef() {
         return def;
     }
 
-//    void updateUniformLinks(){
-//        for (MatParam param : paramValues.values()){
-//            param.uniform = technique.getShader().getUniform(param.name);
-//        }
-//    }
     public MatParam getParam(String name) {
         MatParam param = paramValues.get(name);
         if (param instanceof MatParam) {
@@ -924,7 +946,7 @@ public class Material implements Cloneable, Savable, Comparable<Material> {
 
                 // the texture failed to load for this param
                 // do not add to param values
-                if (texVal.texture == null || texVal.texture.getImage() == null) {
+                if (texVal.getTextureValue() == null || texVal.getTextureValue().getImage() == null) {
                     continue;
                 }
             }
index 512e946..20d870c 100644 (file)
@@ -1047,6 +1047,6 @@ public class RenderState implements Cloneable, Savable {
 
     @Override
     public String toString() {
-        return "RenderState[" + "pointSprite=" + pointSprite + "applyPointSprite=" + applyPointSprite + "wireframe=" + wireframe + "applyWireFrame=" + applyWireFrame + "cullMode=" + cullMode + "applyCullMode=" + applyCullMode + "depthWrite=" + depthWrite + "applyDepthWrite=" + applyDepthWrite + "depthTest=" + depthTest + "applyDepthTest=" + applyDepthTest + "colorWrite=" + colorWrite + "applyColorWrite=" + applyColorWrite + "blendMode=" + blendMode + "applyBlendMode=" + applyBlendMode + "alphaTest=" + alphaTest + "applyAlphaTest=" + applyAlphaTest + "alphaFallOff=" + alphaFallOff + "applyAlphaFallOff=" + applyAlphaFallOff + "offsetEnabled=" + offsetEnabled + "applyPolyOffset=" + applyPolyOffset + "offsetFactor=" + offsetFactor + "offsetUnits=" + offsetUnits + ']';
+        return "RenderState[\n" + "pointSprite=" + pointSprite + "\napplyPointSprite=" + applyPointSprite + "\nwireframe=" + wireframe + "\napplyWireFrame=" + applyWireFrame + "\ncullMode=" + cullMode + "\napplyCullMode=" + applyCullMode + "\ndepthWrite=" + depthWrite + "\napplyDepthWrite=" + applyDepthWrite + "\ndepthTest=" + depthTest + "\napplyDepthTest=" + applyDepthTest + "\ncolorWrite=" + colorWrite + "\napplyColorWrite=" + applyColorWrite + "\nblendMode=" + blendMode + "\napplyBlendMode=" + applyBlendMode + "\nalphaTest=" + alphaTest + "\napplyAlphaTest=" + applyAlphaTest + "\nalphaFallOff=" + alphaFallOff + "\napplyAlphaFallOff=" + applyAlphaFallOff + "\noffsetEnabled=" + offsetEnabled + "\napplyPolyOffset=" + applyPolyOffset + "\noffsetFactor=" + offsetFactor + "\noffsetUnits=" + offsetUnits + "\n]";
     }
 }
index 85ce7ec..4257669 100644 (file)
@@ -246,7 +246,9 @@ public class PssmShadowRenderer implements SceneProcessor {
         Geometry frustumMdl = new Geometry("f", frustum);
         frustumMdl.setCullHint(Spatial.CullHint.Never);
         frustumMdl.setShadowMode(ShadowMode.Off);
-        frustumMdl.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/WireColor.j3md"));
+        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+        mat.getAdditionalRenderState().setWireframe(true);
+        frustumMdl.setMaterial(mat);
         switch (i) {
             case 0:
                 frustumMdl.getMaterial().setColor("Color", ColorRGBA.Pink);
index d9f57e2..4c287de 100644 (file)
@@ -75,8 +75,8 @@ public class CubeField extends SimpleApplication implements AnalogListener {
     private float speed, coreTime,coreTime2;
     private float camAngle = 0;
     private BitmapText fpsScoreText, pressStart;
-    private String boxSolid;
 
+    private boolean solidBox = true;
     private Material playerMaterial;
     private Material floorMaterial;
 
@@ -133,7 +133,6 @@ public class CubeField extends SimpleApplication implements AnalogListener {
         obstacleColors.add(ColorRGBA.Red);
         obstacleColors.add(ColorRGBA.Yellow);
         renderer.setBackgroundColor(ColorRGBA.White);
-        boxSolid = "Common/MatDefs/Misc/SolidColor.j3md";
         speed = lowCap / 400f;
         coreTime = 20.0f;
         coreTime2 = 10.0f;
@@ -186,8 +185,10 @@ public class CubeField extends SimpleApplication implements AnalogListener {
 
 //        playerX+difficulty+30,playerX+difficulty+90
 
-
-        Material mat = new Material(assetManager, boxSolid);
+        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+        if (!solidBox){
+            mat.getAdditionalRenderState().setWireframe(true);
+        }
         mat.setColor("Color", obstacleColors.get(FastMath.nextRandomInt(0, obstacleColors.size() - 1)));
         cube.setMaterial(mat);
 
@@ -201,7 +202,7 @@ public class CubeField extends SimpleApplication implements AnalogListener {
         Box b = new Box(loc, 1, 1, 1);
 
         Geometry geom = new Geometry("Box", b);
-        Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
+        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat.setColor("Color", ColorRGBA.Blue);
         geom.setMaterial(mat);
 
@@ -212,7 +213,7 @@ public class CubeField extends SimpleApplication implements AnalogListener {
         Dome b = new Dome(Vector3f.ZERO, 10, 100, 1);
         Geometry playerMesh = new Geometry("Box", b);
 
-        playerMaterial = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
+        playerMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         playerMaterial.setColor("Color", ColorRGBA.Red);
         playerMesh.setMaterial(playerMaterial);
         playerMesh.setName("player");
@@ -221,7 +222,7 @@ public class CubeField extends SimpleApplication implements AnalogListener {
                 playerMesh.getLocalTranslation().getY() - 1, 0), 100, 0, 100);
         Geometry floorMesh = new Geometry("Box", floor);
 
-        floorMaterial = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
+        floorMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         floorMaterial.setColor("Color", ColorRGBA.LightGray);
         floorMesh.setMaterial(floorMaterial);
         floorMesh.setName("floor");
@@ -335,7 +336,7 @@ public class CubeField extends SimpleApplication implements AnalogListener {
                switch (colorInt){
                    case 1:
                        obstacleColors.clear();
-                       boxSolid(false);
+                       solidBox = false;
                        obstacleColors.add(ColorRGBA.Green);
                        renderer.setBackgroundColor(ColorRGBA.Black);
                        playerMaterial.setColor("Color", ColorRGBA.White);
@@ -343,7 +344,7 @@ public class CubeField extends SimpleApplication implements AnalogListener {
                        break;
                    case 2:
                        obstacleColors.set(0, ColorRGBA.Black);
-                       boxSolid(true);
+                       solidBox = true;
                        renderer.setBackgroundColor(ColorRGBA.White);
                        playerMaterial.setColor("Color", ColorRGBA.Gray);
                         floorMaterial.setColor("Color", ColorRGBA.LightGray);
@@ -361,12 +362,12 @@ public class CubeField extends SimpleApplication implements AnalogListener {
                    case 5:
                        obstacleColors.remove(0);
                        renderer.setBackgroundColor(ColorRGBA.Pink);
-                       boxSolid(false);
+                       solidBox = false;
                        playerMaterial.setColor("Color", ColorRGBA.White);
                        break;
                    case 6:
                        obstacleColors.set(0, ColorRGBA.White);
-                       boxSolid(true);
+                       solidBox = true;
                        renderer.setBackgroundColor(ColorRGBA.Black);
                        playerMaterial.setColor("Color", ColorRGBA.Gray);
                         floorMaterial.setColor("Color", ColorRGBA.LightGray);
@@ -410,17 +411,4 @@ public class CubeField extends SimpleApplication implements AnalogListener {
         txt.setText(text);
         guiNode.attachChild(txt);
     }
-
-    /**
-     * Changes the boolean variable boxSolid 
-     * @param solid the boolean to determine if the boxes will be solid or wireFrame
-     */
-    private void boxSolid(boolean solid) {
-        if (solid == false){
-            boxSolid = "Common/MatDefs/Misc/WireColor.j3md";
-        }else{
-            boxSolid = "Common/MatDefs/Misc/SolidColor.j3md";
-        }
-    }
-
 } 
\ No newline at end of file
index 82c0846..991295c 100644 (file)
@@ -164,13 +164,17 @@ public abstract class PhysicsCollisionObject implements Savable {
      * @param manager AssetManager to load the default wireframe material for the debug shape
      */
     protected Spatial attachDebugShape(AssetManager manager) {
-        debugMaterialBlue = new Material(manager, "Common/MatDefs/Misc/WireColor.j3md");
+        debugMaterialBlue = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
+        debugMaterialBlue.getAdditionalRenderState().setWireframe(true);
         debugMaterialBlue.setColor("Color", ColorRGBA.Blue);
-        debugMaterialGreen = new Material(manager, "Common/MatDefs/Misc/WireColor.j3md");
+        debugMaterialGreen = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
+        debugMaterialGreen.getAdditionalRenderState().setWireframe(true);
         debugMaterialGreen.setColor("Color", ColorRGBA.Green);
-        debugMaterialRed = new Material(manager, "Common/MatDefs/Misc/WireColor.j3md");
+        debugMaterialRed = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
+        debugMaterialRed.getAdditionalRenderState().setWireframe(true);
         debugMaterialRed.setColor("Color", ColorRGBA.Red);
-        debugMaterialYellow = new Material(manager, "Common/MatDefs/Misc/WireColor.j3md");
+        debugMaterialYellow = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
+        debugMaterialYellow.getAdditionalRenderState().setWireframe(true);
         debugMaterialYellow.setColor("Color", ColorRGBA.Yellow);
         debugArrow = new Arrow(Vector3f.UNIT_XYZ);
         debugArrowGeom = new Geometry("DebugArrow", debugArrow);
index 97d16df..d711640 100644 (file)
@@ -35,6 +35,7 @@ import java.nio.IntBuffer;
 import java.util.EnumSet;
 import java.util.logging.Logger;
 import jme3tools.converters.MipMapGenerator;
+import org.lwjgl.opengl.GL12;
 import org.lwjgl.opengl.GLContext;
 
 import static org.lwjgl.opengl.GL11.*;
@@ -54,6 +55,7 @@ public class LwjglGL1Renderer implements GL1Renderer {
     private int maxCubeTexSize;
     private int maxVertCount;
     private int maxTriCount;
+    private boolean gl12 = false;
     private final Statistics statistics = new Statistics();
     private int vpX, vpY, vpW, vpH;
     private int clipX, clipY, clipW, clipH;
@@ -95,6 +97,10 @@ public class LwjglGL1Renderer implements GL1Renderer {
                     + "support non-power-of-2 textures. "
                     + "Some features might not work.");
         }
+        
+        if (GLContext.getCapabilities().OpenGL12){
+            gl12 = true;
+        }
     }
 
     public void invalidateState() {
@@ -150,6 +156,15 @@ public class LwjglGL1Renderer implements GL1Renderer {
         glMaterial(GL_FRONT_AND_BACK, type, fb16);
     }
 
+    private void setMaterialFloat(int type, float value){
+        if (!materialSet) {
+            materialSet = true;
+            glEnable(GL_COLOR_MATERIAL);
+        }
+
+        glMaterialf(GL_FRONT_AND_BACK, type, value);
+    }
+    
     public void setFixedFuncBinding(FixedFuncBinding ffBinding, Object val) {
         switch (ffBinding) {
             case Color:
@@ -169,6 +184,11 @@ public class LwjglGL1Renderer implements GL1Renderer {
                 ColorRGBA specular = (ColorRGBA) val;
                 setMaterialColor(GL_SPECULAR, specular);
                 break;
+            case MaterialShininess:
+                float shiny = (Float) val;
+                setMaterialFloat(GL_SPECULAR, shiny);
+                break;
+                
         }
     }
 
@@ -403,9 +423,7 @@ public class LwjglGL1Renderer implements GL1Renderer {
             return;
         }
 
-//        glEnable(GL_LIGHTING);
-
-        //TODO: ...
+        //glEnable(GL_LIGHTING);
     }
 
     private int convertTextureType(Texture.Type type) {
@@ -455,6 +473,7 @@ public class LwjglGL1Renderer implements GL1Renderer {
         switch (mode) {
             case EdgeClamp:
             case Clamp:
+            case BorderClamp:
                 return GL_CLAMP;
             case Repeat:
                 return GL_REPEAT;
@@ -611,7 +630,7 @@ public class LwjglGL1Renderer implements GL1Renderer {
         setupTextureParams(tex);
     }
 
-    private void checkTexturingUsed() {
+    private void clearTextureUnits() {
         Image[] textures = context.boundTextures;
         if (textures[0] != null) {
             glDisable(GL_TEXTURE_2D);
@@ -866,8 +885,10 @@ public class LwjglGL1Renderer implements GL1Renderer {
         } else {
             glDrawArrays(convertElementMode(mesh.getMode()), 0, mesh.getVertexCount());
         }
+        
+        // TODO: Fix these to use IDList??
         clearVertexAttribs();
-        checkTexturingUsed();
+        clearTextureUnits();
         clearSetFixedFuncBindings();
     }
 
@@ -887,7 +908,7 @@ public class LwjglGL1Renderer implements GL1Renderer {
 
         boolean dynamic = false;
         if (mesh.getBuffer(Type.InterleavedData) != null) {
-            throw new UnsupportedOperationException();
+            throw new UnsupportedOperationException("Interleaved meshes are not supported");
         }
 
         if (mesh.getNumLodLevels() == 0) {
index 9087aa9..81c5c8a 100644 (file)
@@ -1,4 +1,4 @@
-Material HDR Picture : Common/MatDefs/Misc/SimpleTextured.j3md {\r
+Material HDR Picture : Common/MatDefs/Misc/Unshaded.j3md {\r
     MaterialParameters {\r
         ColorMap : Flip Textures/HdrTest/Memorial.hdr\r
     }\r
diff --git a/engine/src/test/jme3test/audio/TestMusicStreaming.java b/engine/src/test/jme3test/audio/TestMusicStreaming.java
new file mode 100644 (file)
index 0000000..ccd7318
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2009-2010 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 jme3test.audio;
+
+import com.jme3.asset.plugins.UrlLocator;
+import com.jme3.audio.AudioNode;
+
+public class TestMusicStreaming extends AudioApp {
+
+    public static void main(String[] args){
+        TestMusicStreaming test = new TestMusicStreaming();
+        test.start();
+    }
+
+    @Override
+    public void updateAudioApp(float tpf){
+    }
+
+    @Override
+    public void initAudioApp(){
+        assetManager.registerLocator("http://www.vorbis.com/music/", UrlLocator.class);
+        AudioNode src = new AudioNode(audioRenderer, assetManager, "Lumme-Badloop.ogg", true);
+        audioRenderer.playSource(src);
+    }
+}
\ No newline at end of file
index bfb95ee..88451f5 100644 (file)
@@ -61,7 +61,7 @@ public class TestSafeCanvas extends SimpleApplication {
 
         Box b = new Box(Vector3f.ZERO, 1, 1, 1);
         Geometry geom = new Geometry("Box", b);
-        Material mat = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
         geom.setMaterial(mat);
         rootNode.attachChild(geom);
index ecb14de..28f266a 100644 (file)
@@ -22,8 +22,8 @@ public class Pivot extends Node {
        }\r
 \r
        private void assignPoints(AssetManager assetManager) {\r
-               Material defaultMaterial = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");\r
-               defaultMaterial.setColor("m_Color", ColorRGBA.DarkGray);\r
+               Material defaultMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");\r
+               defaultMaterial.setColor("Color", ColorRGBA.DarkGray);\r
                for(int i = -10; i <= 10; ++i) {\r
                        Geometry g = new Geometry("", new Sphere(3, 3, 0.05f));\r
                        g.setLocalTranslation(i, 0, 0);\r
@@ -44,8 +44,8 @@ public class Pivot extends Node {
 \r
        private Geometry getAxis(String name, Vector3f endPoint, ColorRGBA color, AssetManager assetManager) {\r
                Line axis = new Line(new Vector3f(0, 0, 0), endPoint);\r
-               Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");\r
-               mat.setColor("m_Color", color);\r
+               Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");\r
+               mat.setColor("Color", color);\r
                Geometry geom = new Geometry(name, axis);\r
                geom.setMaterial(mat);\r
                return geom;\r
index 18ee764..40ecf1b 100644 (file)
@@ -19,11 +19,11 @@ public class VisibleBone extends Node {
        private Vector3f        globalPosition;\r
 \r
        public VisibleBone(Bone bone, Vector3f parentLocation, Quaternion parentRotation, AssetManager assetManager) {\r
-               Material redMat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");\r
-               redMat.setColor("m_Color", ColorRGBA.Red);\r
+               Material redMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");\r
+               redMat.setColor("Color", ColorRGBA.Red);\r
 \r
-               Material whiteMat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");\r
-               whiteMat.setColor("m_Color", ColorRGBA.White);\r
+               Material whiteMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");\r
+               whiteMat.setColor("Color", ColorRGBA.White);\r
 \r
                Geometry g = new Geometry(bone.getName(), new Sphere(9, 9, 0.01f));\r
                globalPosition = bone.getLocalPosition().add(parentLocation);\r
index 04f7720..c3a28d7 100644 (file)
@@ -42,7 +42,7 @@ public class PhysicsTestHelper {
         light.setColor(ColorRGBA.LightGray);
         rootNode.addLight(light);
 
-        Material material = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         material.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
 
         Box floorBox = new Box(140, 0.25f, 140);
@@ -85,7 +85,7 @@ public class PhysicsTestHelper {
      * @return
      */
     public static Geometry createPhysicsTestBox(AssetManager assetManager) {
-        Material material = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         material.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
         Box box = new Box(0.25f, 0.25f, 0.25f);
         Geometry boxGeometry = new Geometry("Box", box);
@@ -101,7 +101,7 @@ public class PhysicsTestHelper {
      * @return
      */
     public static Geometry createPhysicsTestSphere(AssetManager assetManager) {
-        Material material = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         material.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
         Sphere sphere = new Sphere(8, 8, 0.25f);
         Geometry boxGeometry = new Geometry("Sphere", sphere);
@@ -137,7 +137,7 @@ public class PhysicsTestHelper {
             public void onAction(String name, boolean keyPressed, float tpf) {
                 Sphere bullet = new Sphere(32, 32, 0.4f, true, false);
                 bullet.setTextureMode(TextureMode.Projected);
-                Material mat2 = new Material(app.getAssetManager(), "Common/MatDefs/Misc/SimpleTextured.j3md");
+                Material mat2 = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
                 TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG");
                 key2.setGenerateMips(true);
                 Texture tex2 = app.getAssetManager().loadTexture(key2);
index b50e558..9130c8d 100644 (file)
@@ -127,7 +127,8 @@ public class TestAttachDriver extends SimpleApplication implements ActionListene
     }
 
     private void buildPlayer() {
-        Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/WireColor.j3md");
+        Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
+        mat.getAdditionalRenderState().setWireframe(true);
         mat.setColor("Color", ColorRGBA.Red);
 
         //create a compound shape and attach the BoxCollisionShape for the car body at 0,1,0
index 7cfab75..560631a 100644 (file)
@@ -97,10 +97,6 @@ public class TestAttachGhostObject extends SimpleApplication implements AnalogLi
     }
 
     public void setupJoint() {
-
-        Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/WireColor.j3md");
-        mat.setColor("Color", ColorRGBA.Gray);
-
         Node holderNode = PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f(.1f, .1f, .1f)), 0);
         holderNode.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(0f, 0, 0f));
         rootNode.attachChild(holderNode);
index f78c9f3..1bf21df 100644 (file)
@@ -112,7 +112,8 @@ public class TestBoneRagdoll extends SimpleApplication implements RagdollCollisi
         //debug view
         AnimControl control = model.getControl(AnimControl.class);
         SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeleton", control.getSkeleton());
-        Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/WireColor.j3md");
+        Material mat2 = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
+        mat2.getAdditionalRenderState().setWireframe(true);
         mat2.setColor("Color", ColorRGBA.Green);
         mat2.getAdditionalRenderState().setDepthTest(false);
         skeletonDebug.setMaterial(mat2);
@@ -238,7 +239,7 @@ public class TestBoneRagdoll extends SimpleApplication implements RagdollCollisi
 
     public void initMaterial() {
 
-        matBullet = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        matBullet = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG");
         key2.setGenerateMips(true);
         Texture tex2 = assetManager.loadTexture(key2);
index bb1026c..a1fbee7 100644 (file)
@@ -190,19 +190,19 @@ public class TestBrickTower extends SimpleApplication {
     }
 
     public void initMaterial() {
-        mat = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg");
         key.setGenerateMips(true);
         Texture tex = assetManager.loadTexture(key);
         mat.setTexture("ColorMap", tex);
 
-        mat2 = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG");
         key2.setGenerateMips(true);
         Texture tex2 = assetManager.loadTexture(key2);
         mat2.setTexture("ColorMap", tex2);
 
-        mat3 = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.png");
         key3.setGenerateMips(true);
         Texture tex3 = assetManager.loadTexture(key3);
index 3a7f639..3f55960 100644 (file)
@@ -164,19 +164,19 @@ public class TestBrickWall extends SimpleApplication {
     }\r
 \r
     public void initMaterial() {\r
-        mat = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");\r
+        mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");\r
         TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg");\r
         key.setGenerateMips(true);\r
         Texture tex = assetManager.loadTexture(key);\r
         mat.setTexture("ColorMap", tex);\r
 \r
-        mat2 = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");\r
+        mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");\r
         TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG");\r
         key2.setGenerateMips(true);\r
         Texture tex2 = assetManager.loadTexture(key2);\r
         mat2.setTexture("ColorMap", tex2);\r
 \r
-        mat3 = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");\r
+        mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");\r
         TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.png");\r
         key3.setGenerateMips(true);\r
         Texture tex3 = assetManager.loadTexture(key3);\r
index 5ed99ef..5645f85 100644 (file)
@@ -29,7 +29,6 @@
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
  */\r
-\r
 package jme3test.bullet;\r
 \r
 import com.jme3.bullet.BulletAppState;\r
@@ -57,7 +56,7 @@ import com.jme3.scene.shape.Sphere.TextureMode;
  *\r
  * @author normenhansen\r
  */\r
-public class TestCcd extends SimpleApplication implements ActionListener{\r
+public class TestCcd extends SimpleApplication implements ActionListener {\r
 \r
     private Material mat;\r
     private Material mat2;\r
@@ -87,17 +86,19 @@ public class TestCcd extends SimpleApplication implements ActionListener{
         bulletCollisionShape = new SphereCollisionShape(0.1f);\r
         setupKeys();\r
 \r
-        mat = new Material(getAssetManager(), "Common/MatDefs/Misc/WireColor.j3md");\r
+        mat = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");\r
+        mat.getAdditionalRenderState().setWireframe(true);\r
         mat.setColor("Color", ColorRGBA.Green);\r
 \r
-        mat2 = new Material(getAssetManager(), "Common/MatDefs/Misc/WireColor.j3md");\r
+        mat2 = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");\r
+        mat2.getAdditionalRenderState().setWireframe(true);\r
         mat2.setColor("Color", ColorRGBA.Red);\r
 \r
         // An obstacle mesh, does not move (mass=0)\r
         Node node2 = new Node();\r
         node2.setName("mesh");\r
         node2.setLocalTranslation(new Vector3f(2.5f, 0, 0f));\r
-        node2.addControl(new RigidBodyControl(new MeshCollisionShape(new Box(Vector3f.ZERO,4,4,0.1f)), 0));\r
+        node2.addControl(new RigidBodyControl(new MeshCollisionShape(new Box(Vector3f.ZERO, 4, 4, 0.1f)), 0));\r
         rootNode.attachChild(node2);\r
         getPhysicsSpace().add(node2);\r
 \r
@@ -110,7 +111,7 @@ public class TestCcd extends SimpleApplication implements ActionListener{
 \r
     }\r
 \r
-    private PhysicsSpace getPhysicsSpace(){\r
+    private PhysicsSpace getPhysicsSpace() {\r
         return bulletAppState.getPhysicsSpace();\r
     }\r
 \r
@@ -136,8 +137,7 @@ public class TestCcd extends SimpleApplication implements ActionListener{
             bulletg.getControl(RigidBodyControl.class).setLinearVelocity(cam.getDirection().mult(40));\r
             rootNode.attachChild(bulletg);\r
             getPhysicsSpace().add(bulletg);\r
-        }\r
-        else if(binding.equals("shoot2") && !value) {\r
+        } else if (binding.equals("shoot2") && !value) {\r
             Geometry bulletg = new Geometry("bullet", bullet);\r
             bulletg.setMaterial(mat2);\r
             bulletg.setName("bullet");\r
@@ -149,5 +149,4 @@ public class TestCcd extends SimpleApplication implements ActionListener{
             getPhysicsSpace().add(bulletg);\r
         }\r
     }\r
-\r
 }\r
index 92caadd..ddd5790 100644 (file)
@@ -64,11 +64,7 @@ public class TestCollisionGroups extends SimpleApplication {
         bulletAppState = new BulletAppState();
         stateManager.attach(bulletAppState);
         bulletAppState.getPhysicsSpace().enableDebug(assetManager);
-        Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/WireColor.j3md");
-        mat.setColor("Color", ColorRGBA.Red);
-        Material mat2 = new Material(getAssetManager(), "Common/MatDefs/Misc/WireColor.j3md");
-        mat2.setColor("Color", ColorRGBA.Magenta);
-
+        
         // Add a physics sphere to the world
         Node physicsSphere = PhysicsTestHelper.createPhysicsTestNode(assetManager, new SphereCollisionShape(1), 1);
         physicsSphere.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(3, 6, 0));
index 3c6c38c..f659e22 100644 (file)
@@ -51,7 +51,6 @@ import com.jme3.scene.shape.Sphere.TextureMode;
 public class TestCollisionListener extends SimpleApplication implements PhysicsCollisionListener {\r
 \r
     private BulletAppState bulletAppState;\r
-    private Material mat;\r
     private Sphere bullet;\r
     private SphereCollisionShape bulletCollisionShape;\r
 \r
@@ -72,9 +71,6 @@ public class TestCollisionListener extends SimpleApplication implements PhysicsC
         PhysicsTestHelper.createPhysicsTestWorld(rootNode, assetManager, bulletAppState.getPhysicsSpace());\r
         PhysicsTestHelper.createBallShooter(this, rootNode, bulletAppState.getPhysicsSpace());\r
 \r
-        mat = new Material(getAssetManager(), "Common/MatDefs/Misc/WireColor.j3md");\r
-        mat.setColor("Color", ColorRGBA.Red);\r
-\r
         // add ourselves as collision listener\r
         getPhysicsSpace().addCollisionListener(this);\r
     }\r
index 06ae522..ff08817 100644 (file)
@@ -105,8 +105,6 @@ public class TestGhostObject extends SimpleApplication {
 
     private void initGhostObject() {
         Vector3f halfExtents = new Vector3f(3, 4.2f, 1);
-        Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/WireColor.j3md");
-        mat.setColor("Color", ColorRGBA.Red);
         ghostControl = new GhostControl(new BoxCollisionShape(halfExtents));
         Node node=new Node("Ghost Object");
         node.addControl(ghostControl);
index 60336a5..71eaa9b 100644 (file)
@@ -81,7 +81,6 @@ public class TestHoveringTank extends SimpleApplication implements AnalogListene
     private Spatial spaceCraft;
     TerrainQuad terrain;
     Material matRock;
-    Material matWire;
     boolean wireframe = false;
     protected BitmapText hintText;
     PointLight pl;
@@ -281,8 +280,6 @@ public class TestHoveringTank extends SimpleApplication implements AnalogListene
         matRock.setTexture("NormalMap_1", normalMap2);
         matRock.setTexture("NormalMap_2", normalMap2);
 
-        matWire = new Material(assetManager, "Common/MatDefs/Misc/WireColor.j3md");
-        matWire.setColor("Color", ColorRGBA.Green);
         AbstractHeightMap heightmap = null;
         try {
             heightmap = new ImageBasedHeightMap(ImageToAwt.convert(heightMapImage.getImage(), false, true, 0), 0.25f);
index ff93132..e34472b 100644 (file)
@@ -95,7 +95,8 @@ public class TestPhysicsCar extends SimpleApplication implements ActionListener
     }
 
     private void buildPlayer() {
-        Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/WireColor.j3md");
+        Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
+        mat.getAdditionalRenderState().setWireframe(true);
         mat.setColor("Color", ColorRGBA.Red);
 
         //create a compound shape and attach the BoxCollisionShape for the car body at 0,1,0
index e0ffd5b..1fb57f9 100644 (file)
@@ -88,10 +88,6 @@ public class TestPhysicsHingeJoint extends SimpleApplication implements AnalogLi
     }
 
     public void setupJoint() {
-
-        Material mat = new Material(getAssetManager(), "Common/MatDefs/Misc/WireColor.j3md");
-        mat.setColor("Color", ColorRGBA.Yellow);
-
         Node holderNode=PhysicsTestHelper.createPhysicsTestNode(assetManager, new BoxCollisionShape(new Vector3f( .1f, .1f, .1f)),0);
         holderNode.getControl(RigidBodyControl.class).setPhysicsLocation(new Vector3f(0f,0,0f));
         rootNode.attachChild(holderNode);
index 94d370e..0055b7f 100644 (file)
@@ -98,7 +98,6 @@ public class TestWalkingChar extends SimpleApplication implements ActionListener
     RigidBodyControl terrainPhysicsNode;
     //Materials
     Material matRock;
-    Material matWire;
     Material matBullet;
     //animation
     AnimChannel animationChannel;
@@ -202,7 +201,7 @@ public class TestWalkingChar extends SimpleApplication implements ActionListener
         bullet = new Sphere(32, 32, 0.4f, true, false);
         bullet.setTextureMode(TextureMode.Projected);
         bulletCollisionShape = new SphereCollisionShape(0.4f);
-        matBullet = new Material(getAssetManager(), "Common/MatDefs/Misc/SolidColor.j3md");
+        matBullet = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
         matBullet.setColor("Color", ColorRGBA.Green);
         matBullet.setColor("m_GlowColor", ColorRGBA.Green);
         getPhysicsSpace().addCollisionListener(this);
@@ -272,8 +271,6 @@ public class TestWalkingChar extends SimpleApplication implements ActionListener
         matRock.setTexture("NormalMap", normalMap0);
         matRock.setTexture("NormalMap_1", normalMap2);
         matRock.setTexture("NormalMap_2", normalMap2);
-        matWire = new Material(assetManager, "Common/MatDefs/Misc/WireColor.j3md");
-        matWire.setColor("Color", ColorRGBA.Green);
 
         AbstractHeightMap heightmap = null;
         try {
index 1d487f0..fa2d64a 100644 (file)
@@ -110,7 +110,7 @@ public class TestMousePick extends SimpleApplication {
     protected Geometry makeCube(String name, float x, float y, float z) {
         Box box = new Box(new Vector3f(x, y, z), 1, 1, 1);
         Geometry cube = new Geometry(name, box);
-        Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
+        Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat1.setColor("Color", ColorRGBA.randomColor());
         cube.setMaterial(mat1);
         return cube;
@@ -120,7 +120,7 @@ public class TestMousePick extends SimpleApplication {
     protected Geometry makeFloor() {
         Box box = new Box(new Vector3f(0, -4, -5), 15, .2f, 15);
         Geometry floor = new Geometry("the Floor", box);
-        Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
+        Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat1.setColor("Color", ColorRGBA.Gray);
         floor.setMaterial(mat1);
         return floor;
@@ -134,7 +134,7 @@ public class TestMousePick extends SimpleApplication {
         //Sphere sphere = new Sphere(30, 30, 0.2f);
         mark = new Geometry("BOOM!", arrow);
         //mark = new Geometry("BOOM!", sphere);
-        Material mark_mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
+        Material mark_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mark_mat.setColor("Color", ColorRGBA.Red);
         mark.setMaterial(mark_mat);
     }
index a3b9b12..56ee496 100644 (file)
@@ -64,7 +64,7 @@ public class TestTriangleCollision extends SimpleApplication {
         Mesh mesh1 = new Box(0.5f, 0.5f, 0.5f);
         geom1 = new Geometry("Box", mesh1);
         geom1.move(2, 2, -.5f);
-        Material m1 = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
+        Material m1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         m1.setColor("Color", ColorRGBA.Blue);
         geom1.setMaterial(m1);
         rootNode.attachChild(geom1);
index f5b519e..13f67f1 100644 (file)
@@ -74,10 +74,10 @@ public class TestMipMapGen extends SimpleApplication {
         MipMapGenerator.generateMipMaps(imageCustomMip);
         texCustomMip.setImage(imageCustomMip);
 
-        Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat1.setTexture("ColorMap", tex);
 
-        Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat2.setTexture("ColorMap", texCustomMip);
 
         quad1.setMaterial(mat1);
index 348ee9a..44336c9 100644 (file)
@@ -62,7 +62,7 @@ public class HelloAssets extends SimpleApplication {
         /** Create a wall (Box with material and texture from test-data) */
         Box box = new Box(Vector3f.ZERO, 2.5f,2.5f,1.0f);
         Spatial wall = new Geometry("Box", box );
-        Material mat_brick = new Material( assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        Material mat_brick = new Material( assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat_brick.setTexture("ColorMap", assetManager.loadTexture("Textures/Terrain/BrickWall/BrickWall.jpg"));
         wall.setMaterial(mat_brick);
         wall.setLocalTranslation(2.0f,-2.5f,0.0f);
index e9b89c9..13dcbeb 100644 (file)
@@ -29,7 +29,7 @@ public class HelloAudio extends SimpleApplication {
     /** just a blue box floating in space */
     Box box1 = new Box(Vector3f.ZERO, 1, 1, 1);
     player = new Geometry("Player", box1);
-    Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
+    Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
     mat1.setColor("Color", ColorRGBA.Blue);
     player.setMaterial(mat1);
     rootNode.attachChild(player);
index c610af0..7182eb2 100644 (file)
@@ -59,7 +59,7 @@ public class HelloInput extends SimpleApplication {
   public void simpleInitApp() {\r
     Box b = new Box(Vector3f.ZERO, 1, 1, 1);\r
     player = new Geometry("Player", b);\r
-    Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");\r
+    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");\r
     mat.setColor("Color", ColorRGBA.Blue);\r
     player.setMaterial(mat);\r
     rootNode.attachChild(player);\r
index 6833b11..3a0414c 100644 (file)
@@ -55,7 +55,7 @@ public class HelloJME3 extends SimpleApplication {
         Box b = new Box(Vector3f.ZERO, 1, 1, 1); // create cube shape
         Geometry geom = new Geometry("Box", b);  // create cube geometry from the shape
         Material mat = new Material(assetManager,
-         "Common/MatDefs/Misc/SolidColor.j3md"); // create a simple material
+         "Common/MatDefs/Misc/Unshaded.j3md"); // create a simple material
         mat.setColor("Color", ColorRGBA.Blue); // set color of material to blue
         geom.setMaterial(mat);                   // set the cube's material
         rootNode.attachChild(geom);              // make the cube appear in the scene
index 77d72b4..ec0d5e8 100644 (file)
@@ -56,7 +56,7 @@ public class HelloLoop extends SimpleApplication {
         Box b = new Box(Vector3f.ZERO, 1, 1, 1);
         player = new Geometry("blue cube", b);
         Material mat = new Material(assetManager,
-          "Common/MatDefs/Misc/SolidColor.j3md");
+          "Common/MatDefs/Misc/Unshaded.j3md");
         mat.setColor("Color", ColorRGBA.Blue);
         player.setMaterial(mat);
         rootNode.attachChild(player);
index 5504598..1d07c42 100644 (file)
@@ -61,7 +61,7 @@ public class HelloMaterial extends SimpleApplication {
     /** A simple textured cube -- in good MIP map quality. */
     Box boxshape1 = new Box(new Vector3f(-3f,1.1f,0f), 1f,1f,1f);
     Geometry cube = new Geometry("My Textured Box", boxshape1);
-    Material mat_stl = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+    Material mat_stl = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
     Texture tex_ml = assetManager.loadTexture("Interface/Logo/Monkey.jpg");
     mat_stl.setTexture("ColorMap", tex_ml);
     cube.setMaterial(mat_stl);
@@ -70,7 +70,7 @@ public class HelloMaterial extends SimpleApplication {
     /** A translucent/transparent texture, similar to a window frame. */
     Box boxshape3 = new Box(new Vector3f(0f,0f,0f), 1f,1f,0.01f);
     Geometry window_frame = new Geometry("window frame", boxshape3);
-    Material mat_tt = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+    Material mat_tt = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
     mat_tt.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
     mat_tt.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);  // activate transparency
     window_frame.setQueueBucket(Bucket.Transparent);
index d70160b..4bd8539 100644 (file)
@@ -56,14 +56,14 @@ public class HelloNode extends SimpleApplication {
         /** create a blue box at coordinates (1,-1,1) */
         Box box1 = new Box( new Vector3f(1,-1,1), 1,1,1);
         Geometry blue = new Geometry("Box", box1);
-        Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
+        Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat1.setColor("Color", ColorRGBA.Blue);
         blue.setMaterial(mat1);
 
         /** create a red box straight above the blue one at (1,3,1) */
         Box box2 = new Box( new Vector3f(1,3,1), 1,1,1);
         Geometry red = new Geometry("Box", box2);
-        Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
+        Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat2.setColor("Color", ColorRGBA.Red);
         red.setMaterial(mat2);
 
index 6b36ae9..38348a7 100644 (file)
@@ -133,19 +133,19 @@ public class HelloPhysics extends SimpleApplication {
 \r
   /** Initialize the materials used in this scene. */\r
   public void initMaterials() {\r
-    wall_mat = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");\r
+    wall_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");\r
     TextureKey key = new TextureKey("Textures/Terrain/BrickWall/BrickWall.jpg");\r
     key.setGenerateMips(true);\r
     Texture tex = assetManager.loadTexture(key);\r
     wall_mat.setTexture("ColorMap", tex);\r
 \r
-    stone_mat = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");\r
+    stone_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");\r
     TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG");\r
     key2.setGenerateMips(true);\r
     Texture tex2 = assetManager.loadTexture(key2);\r
     stone_mat.setTexture("ColorMap", tex2);\r
 \r
-    floor_mat = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");\r
+    floor_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");\r
     TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.png");\r
     key3.setGenerateMips(true);\r
     Texture tex3 = assetManager.loadTexture(key3);\r
index 6e1dd5a..60815e7 100644 (file)
@@ -128,7 +128,7 @@ public class HelloPicking extends SimpleApplication {
   protected Geometry makeCube(String name, float x, float y, float z) {\r
     Box box = new Box(new Vector3f(x, y, z), 1, 1, 1);\r
     Geometry cube = new Geometry(name, box);\r
-    Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");\r
+    Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");\r
     mat1.setColor("Color", ColorRGBA.randomColor());\r
     cube.setMaterial(mat1);\r
     return cube;\r
@@ -138,7 +138,7 @@ public class HelloPicking extends SimpleApplication {
   protected Geometry makeFloor() {\r
     Box box = new Box(new Vector3f(0, -4, -5), 15, .2f, 15);\r
     Geometry floor = new Geometry("the Floor", box);\r
-    Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");\r
+    Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");\r
     mat1.setColor("Color", ColorRGBA.Gray);\r
     floor.setMaterial(mat1);\r
     return floor;\r
@@ -148,7 +148,7 @@ public class HelloPicking extends SimpleApplication {
   protected void initMark() {\r
     Sphere sphere = new Sphere(30, 30, 0.2f);\r
     mark = new Geometry("BOOM!", sphere);\r
-    Material mark_mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");\r
+    Material mark_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");\r
     mark_mat.setColor("Color", ColorRGBA.Red);\r
     mark.setMaterial(mark_mat);\r
   }\r
index 230dd9c..459b745 100644 (file)
@@ -66,7 +66,7 @@ public class TestChaseCamera extends SimpleApplication implements AnalogListener
         Material mat = new Material(assetManager, "Common/MatDefs/Misc/ShowNormals.j3md");
         teaGeom.setMaterial(mat);
         pivot.attachChild(teaGeom);
-        mat = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
         Geometry ground = new Geometry("ground", new Quad(50, 50));
         ground.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X));
index dc302d5..67addf0 100644 (file)
@@ -64,7 +64,7 @@ public class TestPssmShadow extends SimpleApplication implements ActionListener
 
     public void loadScene(){
         Material mat = assetManager.loadMaterial("Common/Materials/RedColor.j3m");
-        Material matSoil = new Material(assetManager,"Common/MatDefs/Misc/SolidColor.j3md");
+        Material matSoil = new Material(assetManager,"Common/MatDefs/Misc/Unshaded.j3md");
         matSoil.setColor("Color", ColorRGBA.Cyan);
 
         teapot = new Geometry("sphere", new Sphere(30, 30, 2));
index fc287df..a8d168c 100644 (file)
@@ -102,7 +102,8 @@ public class TestShadow extends SimpleApplication {
         frustumMdl = new Geometry("f", frustum);
         frustumMdl.setCullHint(Spatial.CullHint.Never);
         frustumMdl.setShadowMode(ShadowMode.Off);
-        frustumMdl.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/WireColor.j3md"));
+        frustumMdl.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"));
+        frustumMdl.getMaterial().getAdditionalRenderState().setWireframe(true);
         frustumMdl.getMaterial().setColor("Color", ColorRGBA.Red);
         rootNode.attachChild(frustumMdl);
     }
index 5daf2fa..5c94f81 100644 (file)
@@ -38,7 +38,6 @@ import com.jme3.light.PointLight;
 import com.jme3.material.Material;
 import com.jme3.math.ColorRGBA;
 import com.jme3.math.FastMath;
-import com.jme3.math.Quaternion;
 import com.jme3.math.Vector3f;
 import com.jme3.scene.Geometry;
 import com.jme3.scene.shape.Sphere;
index 148ec00..969c93e 100644 (file)
@@ -16,7 +16,7 @@ public class BoxEntity extends Geometry implements SyncEntity {
     
     public BoxEntity(AssetManager assetManager, ColorRGBA color){
         super("Box", new Box(1,1,1));
-        setMaterial(new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md"));
+        setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"));
         getMaterial().setColor("Color", color);
     }
 
index 580fe5a..64d7afb 100644 (file)
@@ -42,7 +42,6 @@ public class TestDepthOfField extends SimpleApplication {
     private Vector3f lightDir = new Vector3f(-4.9236743f, -1.27054665f, 5.896916f);
     TerrainQuad terrain;
     Material matRock;
-    Material matWire;
     DepthOfFieldFilter dofFilter;
 
     public static void main(String[] args) {
@@ -172,8 +171,6 @@ public class TestDepthOfField extends SimpleApplication {
         matRock.setTexture("NormalMap_1", normalMap2);
         matRock.setTexture("NormalMap_2", normalMap2);
 
-        matWire = new Material(assetManager, "Common/MatDefs/Misc/WireColor.j3md");
-        matWire.setColor("Color", ColorRGBA.Green);
         AbstractHeightMap heightmap = null;
         try {
             heightmap = new ImageBasedHeightMap(ImageToAwt.convert(heightMapImage.getImage(), false, true, 0), 0.25f);
index df1714c..52fbeb8 100644 (file)
@@ -57,7 +57,7 @@ public class TestHDR extends SimpleApplication {
 //        Material mat = assetManager.loadMaterial("Textures/HdrTest/Memorial.j3m");
 //        box.setMaterial(mat);
 
-        Material mat = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat.setTexture("ColorMap", assetManager.loadTexture("Textures/HdrTest/Memorial.hdr"));
         box.setMaterial(mat);
 
index cc5bfbd..78fb670 100644 (file)
@@ -112,7 +112,7 @@ public class TestLightScattering extends SimpleApplication {
 //        fpp.addFilter(ssaoFilter);
 
 
-//           Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+//           Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
 //        mat2.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
 //
 //        Sphere lite=new Sphere(8, 8, 10.0f);
index d3b033a..ccc993a 100644 (file)
@@ -114,7 +114,7 @@ public class TestRenderToTexture extends SimpleApplication implements ActionList
 
         Texture offTex = setupOffscreenView();
 
-        Material mat = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat.setTexture("ColorMap", offTex);
         quad.setMaterial(mat);
         rootNode.attachChild(quad);
index 1f51490..d440546 100644 (file)
@@ -29,7 +29,6 @@
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-
 package jme3test.terrain;
 
 import jme3tools.converters.ImageToAwt;
@@ -77,153 +76,152 @@ import java.util.List;
  */
 public class TerrainTest extends SimpleApplication {
 
-       private TerrainQuad terrain;
-       Material matRock;
-       Material matWire;
-       boolean wireframe = false;
+    private TerrainQuad terrain;
+    Material matRock;
+    Material matWire;
+    boolean wireframe = false;
     boolean triPlanar = false;
-       protected BitmapText hintText;
-       PointLight pl;
-       Geometry lightMdl;
+    protected BitmapText hintText;
+    PointLight pl;
+    Geometry lightMdl;
     private float grassScale = 64;
     private float dirtScale = 16;
     private float rockScale = 128;
 
-       public static void main(String[] args) {
-               TerrainTest app = new TerrainTest();
-               app.start();
-       }
+    public static void main(String[] args) {
+        TerrainTest app = new TerrainTest();
+        app.start();
+    }
 
-       @Override
-       public void initialize() {
-               super.initialize();
+    @Override
+    public void initialize() {
+        super.initialize();
 
-               loadHintText();
-       }
+        loadHintText();
+    }
 
-       @Override
-       public void simpleInitApp() {
-               setupKeys();
+    @Override
+    public void simpleInitApp() {
+        setupKeys();
 
         // First, we load up our textures and the heightmap texture for the terrain
 
-               // TERRAIN TEXTURE material
-               matRock = new Material(assetManager, "Common/MatDefs/Terrain/Terrain.j3md");
+        // TERRAIN TEXTURE material
+        matRock = new Material(assetManager, "Common/MatDefs/Terrain/Terrain.j3md");
         matRock.setBoolean("useTriPlanarMapping", false);
 
-               // ALPHA map (for splat textures)
-               matRock.setTexture("Alpha", assetManager.loadTexture("Textures/Terrain/splat/alphamap.png"));
-
-               // HEIGHTMAP image (for the terrain heightmap)
-               Texture heightMapImage = assetManager.loadTexture("Textures/Terrain/splat/mountains512.png");
-        
-               // GRASS texture
-               Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
-               grass.setWrap(WrapMode.Repeat);
-               matRock.setTexture("Tex1", grass);
-               matRock.setFloat("Tex1Scale", grassScale);
-
-               // DIRT texture
-               Texture dirt = assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
-               dirt.setWrap(WrapMode.Repeat);
-               matRock.setTexture("Tex2", dirt);
-               matRock.setFloat("Tex2Scale", dirtScale);
-
-               // ROCK texture
-               Texture rock = assetManager.loadTexture("Textures/Terrain/splat/road.jpg");
-               rock.setWrap(WrapMode.Repeat);
-               matRock.setTexture("Tex3", rock);
-               matRock.setFloat("Tex3Scale", rockScale);
-        
-               // WIREFRAME material
-               matWire = new Material(assetManager, "Common/MatDefs/Misc/WireColor.j3md");
+        // ALPHA map (for splat textures)
+        matRock.setTexture("Alpha", assetManager.loadTexture("Textures/Terrain/splat/alphamap.png"));
+
+        // HEIGHTMAP image (for the terrain heightmap)
+        Texture heightMapImage = assetManager.loadTexture("Textures/Terrain/splat/mountains512.png");
+
+        // GRASS texture
+        Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
+        grass.setWrap(WrapMode.Repeat);
+        matRock.setTexture("Tex1", grass);
+        matRock.setFloat("Tex1Scale", grassScale);
+
+        // DIRT texture
+        Texture dirt = assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
+        dirt.setWrap(WrapMode.Repeat);
+        matRock.setTexture("Tex2", dirt);
+        matRock.setFloat("Tex2Scale", dirtScale);
+
+        // ROCK texture
+        Texture rock = assetManager.loadTexture("Textures/Terrain/splat/road.jpg");
+        rock.setWrap(WrapMode.Repeat);
+        matRock.setTexture("Tex3", rock);
+        matRock.setFloat("Tex3Scale", rockScale);
+
+        // WIREFRAME material
+        matWire = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+        matWire.getAdditionalRenderState().setWireframe(true);
         matWire.setColor("Color", ColorRGBA.Green);
 
+        // CREATE HEIGHTMAP
+        AbstractHeightMap heightmap = null;
+        try {
+            //heightmap = new HillHeightMap(1025, 1000, 50, 100, (byte) 3);
+
+            heightmap = new ImageBasedHeightMap(ImageToAwt.convert(heightMapImage.getImage(), false, true, 0), 1f);
+            heightmap.load();
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        /*
+         * Here we create the actual terrain. The tiles will be 65x65, and the total size of the
+         * terrain will be 513x513. It uses the heightmap we created to generate the height values.
+         */
+        /**
+         * Optimal terrain patch size is 65 (64x64).
+         * The total size is up to you. At 1025 it ran fine for me (200+FPS), however at
+         * size=2049, it got really slow. But that is a jump from 2 million to 8 million triangles...
+         */
+        terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());//, new LodPerspectiveCalculatorFactory(getCamera(), 4)); // add this in to see it use entropy for LOD calculations
+        List<Camera> cameras = new ArrayList<Camera>();
+        cameras.add(getCamera());
+        TerrainLodControl control = new TerrainLodControl(terrain, cameras);
+        terrain.addControl(control);
+        terrain.setMaterial(matRock);
+        terrain.setModelBound(new BoundingBox());
+        terrain.updateModelBound();
+        terrain.setLocalTranslation(0, -100, 0);
+        terrain.setLocalScale(2f, 1f, 2f);
+        rootNode.attachChild(terrain);
 
-               // CREATE HEIGHTMAP
-               AbstractHeightMap heightmap = null;
-               try {
-                       //heightmap = new HillHeightMap(1025, 1000, 50, 100, (byte) 3);
-
-                       heightmap = new ImageBasedHeightMap(ImageToAwt.convert(heightMapImage.getImage(), false, true, 0), 1f);
-                       heightmap.load();
-
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }
-
-               /*
-                * Here we create the actual terrain. The tiles will be 65x65, and the total size of the
-                * terrain will be 513x513. It uses the heightmap we created to generate the height values.
-                */
-               /**
-                * Optimal terrain patch size is 65 (64x64).
-                * The total size is up to you. At 1025 it ran fine for me (200+FPS), however at
-                * size=2049, it got really slow. But that is a jump from 2 million to 8 million triangles...
-                */
-               terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());//, new LodPerspectiveCalculatorFactory(getCamera(), 4)); // add this in to see it use entropy for LOD calculations
-               List<Camera> cameras = new ArrayList<Camera>();
-               cameras.add(getCamera());
-               TerrainLodControl control = new TerrainLodControl(terrain, cameras);
-               terrain.addControl(control);
-               terrain.setMaterial(matRock);
-               terrain.setModelBound(new BoundingBox());
-               terrain.updateModelBound();
-               terrain.setLocalTranslation(0, -100, 0);
-               terrain.setLocalScale(2f, 1f, 2f);
-               rootNode.attachChild(terrain);
-        
         DirectionalLight light = new DirectionalLight();
-        light.setDirection((new Vector3f(-0.5f,-1f, -0.5f)).normalize());
+        light.setDirection((new Vector3f(-0.5f, -1f, -0.5f)).normalize());
         rootNode.addLight(light);
 
-               getCamera().getLocation().y = 10;
-               getCamera().setDirection(new Vector3f(0, -1.5f, -1));
-       }
-
-       public void loadHintText() {
-               hintText = new BitmapText(guiFont, false);
-               hintText.setSize(guiFont.getCharSet().getRenderedSize());
-               hintText.setLocalTranslation(0, getCamera().getHeight(), 0);
-               hintText.setText("Hit T to switch to wireframe,  P to switch to tri-planar texturing");
-               guiNode.attachChild(hintText);
-       }
-
-       private void setupKeys() {
-               flyCam.setMoveSpeed(50);
-               inputManager.addMapping("wireframe", new KeyTrigger(KeyInput.KEY_T));
-               inputManager.addListener(actionListener, "wireframe");
+        getCamera().getLocation().y = 10;
+        getCamera().setDirection(new Vector3f(0, -1.5f, -1));
+    }
+
+    public void loadHintText() {
+        hintText = new BitmapText(guiFont, false);
+        hintText.setSize(guiFont.getCharSet().getRenderedSize());
+        hintText.setLocalTranslation(0, getCamera().getHeight(), 0);
+        hintText.setText("Hit T to switch to wireframe,  P to switch to tri-planar texturing");
+        guiNode.attachChild(hintText);
+    }
+
+    private void setupKeys() {
+        flyCam.setMoveSpeed(50);
+        inputManager.addMapping("wireframe", new KeyTrigger(KeyInput.KEY_T));
+        inputManager.addListener(actionListener, "wireframe");
         inputManager.addMapping("triPlanar", new KeyTrigger(KeyInput.KEY_P));
-               inputManager.addListener(actionListener, "triPlanar");
-       }
-
-       private ActionListener actionListener = new ActionListener() {
-
-               public void onAction(String name, boolean pressed, float tpf) {
-                       if (name.equals("wireframe") && !pressed) {
-                               wireframe = !wireframe;
-                               if (!wireframe) {
-                                       terrain.setMaterial(matWire);
-                               } else {
-                                       terrain.setMaterial(matRock);
-                               }
-                       } else if (name.equals("triPlanar") && !pressed) {
+        inputManager.addListener(actionListener, "triPlanar");
+    }
+    private ActionListener actionListener = new ActionListener() {
+
+        public void onAction(String name, boolean pressed, float tpf) {
+            if (name.equals("wireframe") && !pressed) {
+                wireframe = !wireframe;
+                if (!wireframe) {
+                    terrain.setMaterial(matWire);
+                } else {
+                    terrain.setMaterial(matRock);
+                }
+            } else if (name.equals("triPlanar") && !pressed) {
                 triPlanar = !triPlanar;
                 if (triPlanar) {
                     matRock.setBoolean("useTriPlanarMapping", true);
                     // planar textures don't use the mesh's texture coordinates but real world coordinates,
                     // so we need to convert these texture coordinate scales into real world scales so it looks
                     // the same when we switch to/from tr-planar mode
-                    matRock.setFloat("Tex1Scale", 1f/(float)(512f/grassScale));
-                    matRock.setFloat("Tex2Scale", 1f/(float)(512f/dirtScale));
-                    matRock.setFloat("Tex3Scale", 1f/(float)(512f/rockScale));
-                }  else {
+                    matRock.setFloat("Tex1Scale", 1f / (float) (512f / grassScale));
+                    matRock.setFloat("Tex2Scale", 1f / (float) (512f / dirtScale));
+                    matRock.setFloat("Tex3Scale", 1f / (float) (512f / rockScale));
+                } else {
                     matRock.setBoolean("useTriPlanarMapping", false);
                     matRock.setFloat("Tex1Scale", grassScale);
                     matRock.setFloat("Tex2Scale", dirtScale);
                     matRock.setFloat("Tex3Scale", rockScale);
                 }
             }
-               }
-       };
+        }
+    };
 }
index 90ecdb6..55977dc 100644 (file)
@@ -29,7 +29,6 @@
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-
 package jme3test.terrain;
 
 import jme3tools.converters.ImageToAwt;
@@ -67,69 +66,69 @@ import java.util.List;
  */
 public class TerrainTestAdvanced extends SimpleApplication {
 
-       private TerrainQuad terrain;
-       Material matTerrain;
-       Material matWire;
-       boolean wireframe = false;
+    private TerrainQuad terrain;
+    Material matTerrain;
+    Material matWire;
+    boolean wireframe = false;
     boolean triPlanar = false;
     boolean wardiso = false;
     boolean minnaert = false;
-       protected BitmapText hintText;
-       PointLight pl;
-       Geometry lightMdl;
+    protected BitmapText hintText;
+    PointLight pl;
+    Geometry lightMdl;
     private float grassScale = 64;
     private float dirtScale = 16;
     private float rockScale = 128;
 
-       public static void main(String[] args) {
-               TerrainTestAdvanced app = new TerrainTestAdvanced();
-               app.start();
-       }
+    public static void main(String[] args) {
+        TerrainTestAdvanced app = new TerrainTestAdvanced();
+        app.start();
+    }
 
-       @Override
-       public void initialize() {
-               super.initialize();
+    @Override
+    public void initialize() {
+        super.initialize();
 
-               loadHintText();
-       }
+        loadHintText();
+    }
 
-       @Override
-       public void simpleInitApp() {
-               setupKeys();
+    @Override
+    public void simpleInitApp() {
+        setupKeys();
 
         // First, we load up our textures and the heightmap texture for the terrain
 
-               // TERRAIN TEXTURE material
-               matTerrain = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
+        // TERRAIN TEXTURE material
+        matTerrain = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
         matTerrain.setBoolean("useTriPlanarMapping", false);
         matTerrain.setBoolean("WardIso", true);
 
-               // ALPHA map (for splat textures)
-               matTerrain.setTexture("AlphaMap", assetManager.loadTexture("Textures/Terrain/splat/alphamap.png"));
+        // ALPHA map (for splat textures)
+        matTerrain.setTexture("AlphaMap", assetManager.loadTexture("Textures/Terrain/splat/alphamap.png"));
 
-               // HEIGHTMAP image (for the terrain heightmap)
-               Texture heightMapImage = assetManager.loadTexture("Textures/Terrain/splat/mountains512.png");
+        // HEIGHTMAP image (for the terrain heightmap)
+        Texture heightMapImage = assetManager.loadTexture("Textures/Terrain/splat/mountains512.png");
 
-               // GRASS texture
-               Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
-               grass.setWrap(WrapMode.Repeat);
-               matTerrain.setTexture("DiffuseMap", grass);
-               matTerrain.setFloat("DiffuseMap_0_scale", grassScale);
-        
+        // GRASS texture
+        Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
+        grass.setWrap(WrapMode.Repeat);
+        matTerrain.setTexture("DiffuseMap", grass);
+        matTerrain.setFloat("DiffuseMap_0_scale", grassScale);
 
-               // DIRT texture
-               Texture dirt = assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
-               dirt.setWrap(WrapMode.Repeat);
-               matTerrain.setTexture("DiffuseMap_1", dirt);
-               matTerrain.setFloat("DiffuseMap_1_scale", dirtScale);
 
-               // ROCK texture
-               Texture rock = assetManager.loadTexture("Textures/Terrain/splat/road.jpg");
-               rock.setWrap(WrapMode.Repeat);
-               matTerrain.setTexture("DiffuseMap_2", rock);
-               matTerrain.setFloat("DiffuseMap_2_scale", rockScale);
+        // DIRT texture
+        Texture dirt = assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
+        dirt.setWrap(WrapMode.Repeat);
+        matTerrain.setTexture("DiffuseMap_1", dirt);
+        matTerrain.setFloat("DiffuseMap_1_scale", dirtScale);
+
+        // ROCK texture
+        Texture rock = assetManager.loadTexture("Textures/Terrain/splat/road.jpg");
+        rock.setWrap(WrapMode.Repeat);
+        matTerrain.setTexture("DiffuseMap_2", rock);
+        matTerrain.setFloat("DiffuseMap_2_scale", rockScale);
+
 
-        
         Texture normalMap0 = assetManager.loadTexture("Textures/Terrain/splat/grass_normal.png");
         normalMap0.setWrap(WrapMode.Repeat);
         Texture normalMap1 = assetManager.loadTexture("Textures/Terrain/splat/dirt_normal.png");
@@ -140,106 +139,106 @@ public class TerrainTestAdvanced extends SimpleApplication {
         matTerrain.setTexture("NormalMap_1", normalMap2);
         matTerrain.setTexture("NormalMap_2", normalMap2);
 
-               // WIREFRAME material
-               matWire = new Material(assetManager, "Common/MatDefs/Misc/WireColor.j3md");
+        // WIREFRAME material
+        matWire = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+        matWire.getAdditionalRenderState().setWireframe(true);
         matWire.setColor("Color", ColorRGBA.Green);
 
         createSky();
 
-               // CREATE HEIGHTMAP
-               AbstractHeightMap heightmap = null;
-               try {
-                       //heightmap = new HillHeightMap(1025, 1000, 50, 100, (byte) 3);
-
-                       heightmap = new ImageBasedHeightMap(ImageToAwt.convert(heightMapImage.getImage(), false, true, 0), 1f);
-                       heightmap.load();
-
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }
-
-               /*
-                * Here we create the actual terrain. The tiles will be 65x65, and the total size of the
-                * terrain will be 513x513. It uses the heightmap we created to generate the height values.
-                */
-               /**
-                * Optimal terrain patch size is 65 (64x64).
-                * The total size is up to you. At 1025 it ran fine for me (200+FPS), however at
-                * size=2049, it got really slow. But that is a jump from 2 million to 8 million triangles...
-                */
-               terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());//, new LodPerspectiveCalculatorFactory(getCamera(), 4)); // add this in to see it use entropy for LOD calculations
-               List<Camera> cameras = new ArrayList<Camera>();
-               cameras.add(getCamera());
-               TerrainLodControl control = new TerrainLodControl(terrain, cameras);
-               terrain.addControl(control);
-               terrain.setMaterial(matTerrain);
-               terrain.setModelBound(new BoundingBox());
-               terrain.updateModelBound();
-               terrain.setLocalTranslation(0, -100, 0);
-               terrain.setLocalScale(1f, 1f, 1f);
-               rootNode.attachChild(terrain);
+        // CREATE HEIGHTMAP
+        AbstractHeightMap heightmap = null;
+        try {
+            //heightmap = new HillHeightMap(1025, 1000, 50, 100, (byte) 3);
+
+            heightmap = new ImageBasedHeightMap(ImageToAwt.convert(heightMapImage.getImage(), false, true, 0), 1f);
+            heightmap.load();
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        /*
+         * Here we create the actual terrain. The tiles will be 65x65, and the total size of the
+         * terrain will be 513x513. It uses the heightmap we created to generate the height values.
+         */
+        /**
+         * Optimal terrain patch size is 65 (64x64).
+         * The total size is up to you. At 1025 it ran fine for me (200+FPS), however at
+         * size=2049, it got really slow. But that is a jump from 2 million to 8 million triangles...
+         */
+        terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());//, new LodPerspectiveCalculatorFactory(getCamera(), 4)); // add this in to see it use entropy for LOD calculations
+        List<Camera> cameras = new ArrayList<Camera>();
+        cameras.add(getCamera());
+        TerrainLodControl control = new TerrainLodControl(terrain, cameras);
+        terrain.addControl(control);
+        terrain.setMaterial(matTerrain);
+        terrain.setModelBound(new BoundingBox());
+        terrain.updateModelBound();
+        terrain.setLocalTranslation(0, -100, 0);
+        terrain.setLocalScale(1f, 1f, 1f);
+        rootNode.attachChild(terrain);
 
         DirectionalLight light = new DirectionalLight();
-        light.setDirection((new Vector3f(-0.5f,-1f, -0.5f)).normalize());
+        light.setDirection((new Vector3f(-0.5f, -1f, -0.5f)).normalize());
         rootNode.addLight(light);
 
         AmbientLight ambLight = new AmbientLight();
         ambLight.setColor(new ColorRGBA(1f, 1f, 0.8f, 0.2f));
         rootNode.addLight(ambLight);
 
-               getCamera().getLocation().y = 10;
-               getCamera().setDirection(new Vector3f(0, -1.5f, -1));
-       }
-
-       public void loadHintText() {
-               hintText = new BitmapText(guiFont, false);
-               hintText.setSize(guiFont.getCharSet().getRenderedSize());
-               hintText.setLocalTranslation(0, getCamera().getHeight(), 0);
-               hintText.setText("Hit T to switch to wireframe,  P to switch to tri-planar texturing");
-               guiNode.attachChild(hintText);
-       }
-
-       private void setupKeys() {
-               flyCam.setMoveSpeed(50);
-               inputManager.addMapping("wireframe", new KeyTrigger(KeyInput.KEY_T));
-               inputManager.addListener(actionListener, "wireframe");
+        getCamera().getLocation().y = 10;
+        getCamera().setDirection(new Vector3f(0, -1.5f, -1));
+    }
+
+    public void loadHintText() {
+        hintText = new BitmapText(guiFont, false);
+        hintText.setSize(guiFont.getCharSet().getRenderedSize());
+        hintText.setLocalTranslation(0, getCamera().getHeight(), 0);
+        hintText.setText("Hit T to switch to wireframe,  P to switch to tri-planar texturing");
+        guiNode.attachChild(hintText);
+    }
+
+    private void setupKeys() {
+        flyCam.setMoveSpeed(50);
+        inputManager.addMapping("wireframe", new KeyTrigger(KeyInput.KEY_T));
+        inputManager.addListener(actionListener, "wireframe");
         inputManager.addMapping("triPlanar", new KeyTrigger(KeyInput.KEY_P));
-               inputManager.addListener(actionListener, "triPlanar");
+        inputManager.addListener(actionListener, "triPlanar");
         inputManager.addMapping("WardIso", new KeyTrigger(KeyInput.KEY_9));
-               inputManager.addListener(actionListener, "WardIso");
+        inputManager.addListener(actionListener, "WardIso");
         inputManager.addMapping("Minnaert", new KeyTrigger(KeyInput.KEY_0));
-               inputManager.addListener(actionListener, "Minnaert");
-       }
-
-       private ActionListener actionListener = new ActionListener() {
-
-               public void onAction(String name, boolean pressed, float tpf) {
-                       if (name.equals("wireframe") && !pressed) {
-                               wireframe = !wireframe;
-                               if (!wireframe) {
-                                       terrain.setMaterial(matWire);
-                               } else {
-                                       terrain.setMaterial(matTerrain);
-                               }
-                       } else if (name.equals("triPlanar") && !pressed) {
+        inputManager.addListener(actionListener, "Minnaert");
+    }
+    private ActionListener actionListener = new ActionListener() {
+
+        public void onAction(String name, boolean pressed, float tpf) {
+            if (name.equals("wireframe") && !pressed) {
+                wireframe = !wireframe;
+                if (!wireframe) {
+                    terrain.setMaterial(matWire);
+                } else {
+                    terrain.setMaterial(matTerrain);
+                }
+            } else if (name.equals("triPlanar") && !pressed) {
                 triPlanar = !triPlanar;
                 if (triPlanar) {
                     matTerrain.setBoolean("useTriPlanarMapping", true);
                     // planar textures don't use the mesh's texture coordinates but real world coordinates,
                     // so we need to convert these texture coordinate scales into real world scales so it looks
                     // the same when we switch to/from tr-planar mode
-                    matTerrain.setFloat("DiffuseMap_0_scale", 1f/(float)(512f/grassScale));
-                    matTerrain.setFloat("DiffuseMap_1_scale", 1f/(float)(512f/dirtScale));
-                    matTerrain.setFloat("DiffuseMap_2_scale", 1f/(float)(512f/rockScale));
-                }  else {
+                    matTerrain.setFloat("DiffuseMap_0_scale", 1f / (float) (512f / grassScale));
+                    matTerrain.setFloat("DiffuseMap_1_scale", 1f / (float) (512f / dirtScale));
+                    matTerrain.setFloat("DiffuseMap_2_scale", 1f / (float) (512f / rockScale));
+                } else {
                     matTerrain.setBoolean("useTriPlanarMapping", false);
                     matTerrain.setFloat("DiffuseMap_0_scale", grassScale);
                     matTerrain.setFloat("DiffuseMap_1_scale", dirtScale);
                     matTerrain.setFloat("DiffuseMap_2_scale", rockScale);
                 }
             }
-               }
-       };
+        }
+    };
 
     private void createSky() {
         Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg");
index f9e910a..8dc8edd 100644 (file)
@@ -125,14 +125,16 @@ public class TerrainTestCollision extends SimpleApplication {
         rock.setWrap(WrapMode.Repeat);
         matRock.setTexture("Tex3", rock);
         matRock.setFloat("Tex3Scale", 128f);
-        matWire = new Material(assetManager, "Common/MatDefs/Misc/WireColor.j3md");
+        matWire = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+        matWire.getAdditionalRenderState().setWireframe(true);
         matWire.setColor("Color", ColorRGBA.Green);
         AbstractHeightMap heightmap = null;
         try {
             heightmap = new ImageBasedHeightMap(ImageToAwt.convert(heightMapImage.getImage(), false, true, 0), 0.25f);
             heightmap.load();
 
-        } catch (Exception e) {        }
+        } catch (Exception e) {
+        }
 
         terrain = new TerrainQuad("terrain", 65, 513, heightmap.getHeightMap());
         List<Camera> cameras = new ArrayList<Camera>();
@@ -158,18 +160,18 @@ public class TerrainTestCollision extends SimpleApplication {
         // let them drop from the sky
         for (int i = 0; i < 5; i++) {
             float r = (float) (8 * Math.random());
-            Geometry sphere = new Geometry("cannonball",new Sphere(10, 10, r) );
+            Geometry sphere = new Geometry("cannonball", new Sphere(10, 10, r));
             sphere.setMaterial(matWire);
             float x = (float) (20 * Math.random()) - 40; // random position
             float y = (float) (20 * Math.random()) - 40; // random position
             float z = (float) (20 * Math.random()) - 40; // random position
             sphere.setLocalTranslation(new Vector3f(x, 100 + y, z));
-            sphere.addControl(new RigidBodyControl(new SphereCollisionShape(r),2));
+            sphere.addControl(new RigidBodyControl(new SphereCollisionShape(r), 2));
             rootNode.attachChild(sphere);
             bulletAppState.getPhysicsSpace().add(sphere);
         }
 
-        collisionBox = new Geometry("collisionBox",new Box(2, 2, 2));
+        collisionBox = new Geometry("collisionBox", new Box(2, 2, 2));
         collisionBox.setModelBound(new BoundingBox());
         collisionBox.setLocalTranslation(new Vector3f(20, 95, 30));
         collisionBox.setMaterial(matWire);
@@ -236,7 +238,7 @@ public class TerrainTestCollision extends SimpleApplication {
         Sphere s = new Sphere(6, 6, 1);
         collisionMarker = new Geometry("collisionMarker");
         collisionMarker.setMesh(s);
-        Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
+        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat.setColor("Color", ColorRGBA.Orange);
         collisionMarker.setMaterial(mat);
         rootNode.attachChild(collisionMarker);
@@ -268,38 +270,32 @@ public class TerrainTestCollision extends SimpleApplication {
                     }
                     Vector2f loc = new Vector2f(hit.getContactPoint().x, hit.getContactPoint().z);
                     float height = terrain.getHeight(loc);
-                    System.out.println("collide " + hit.getContactPoint() + ", height: " + height+", distance: "+hit.getDistance());
+                    System.out.println("collide " + hit.getContactPoint() + ", height: " + height + ", distance: " + hit.getDistance());
                     collisionMarker.setLocalTranslation(new Vector3f(hit.getContactPoint().x, height, hit.getContactPoint().z));
                 }
             } else if (binding.equals("cameraDown") && !keyPressed) {
-                getCamera().setDirection(new Vector3f(0,-1,0));
-            }
-            else if (binding.equals("Lefts") && !keyPressed) {
+                getCamera().setDirection(new Vector3f(0, -1, 0));
+            } else if (binding.equals("Lefts") && !keyPressed) {
                 Vector3f oldLoc = selectedCollisionObject.getLocalTranslation().clone();
                 selectedCollisionObject.move(-0.5f, 0, 0);
                 testCollision(oldLoc);
-            }
-            else if (binding.equals("Rights") && !keyPressed) {
+            } else if (binding.equals("Rights") && !keyPressed) {
                 Vector3f oldLoc = selectedCollisionObject.getLocalTranslation().clone();
                 selectedCollisionObject.move(0.5f, 0, 0);
                 testCollision(oldLoc);
-            }
-            else if (binding.equals("Forwards") && !keyPressed) {
+            } else if (binding.equals("Forwards") && !keyPressed) {
                 Vector3f oldLoc = selectedCollisionObject.getLocalTranslation().clone();
                 selectedCollisionObject.move(0, 0, 0.5f);
                 testCollision(oldLoc);
-            }
-            else if (binding.equals("Backs") && !keyPressed) {
+            } else if (binding.equals("Backs") && !keyPressed) {
                 Vector3f oldLoc = selectedCollisionObject.getLocalTranslation().clone();
                 selectedCollisionObject.move(0, 0, -0.5f);
                 testCollision(oldLoc);
-            }
-            else if (binding.equals("Ups") && !keyPressed) {
+            } else if (binding.equals("Ups") && !keyPressed) {
                 Vector3f oldLoc = selectedCollisionObject.getLocalTranslation().clone();
                 selectedCollisionObject.move(0, 0.5f, 0);
                 testCollision(oldLoc);
-            }
-            else if (binding.equals("Downs") && !keyPressed) {
+            } else if (binding.equals("Downs") && !keyPressed) {
                 Vector3f oldLoc = selectedCollisionObject.getLocalTranslation().clone();
                 selectedCollisionObject.move(0, -0.5f, 0);
                 testCollision(oldLoc);
@@ -309,7 +305,8 @@ public class TerrainTestCollision extends SimpleApplication {
     };
 
     private void testCollision(Vector3f oldLoc) {
-        if (terrain.collideWith(selectedCollisionObject.getWorldBound(), new CollisionResults()) > 0)
+        if (terrain.collideWith(selectedCollisionObject.getWorldBound(), new CollisionResults()) > 0) {
             selectedCollisionObject.setLocalTranslation(oldLoc);
+        }
     }
 }
index a613a35..93d1133 100644 (file)
@@ -29,7 +29,6 @@
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-
 package jme3test.terrain;
 
 import com.jme3.app.SimpleApplication;
@@ -65,13 +64,13 @@ import jme3tools.converters.ImageToAwt;
 public class TerrainTestModifyHeight extends SimpleApplication {
 
     private TerrainQuad terrain;
-       Material matTerrain;
-       Material matWire;
-       boolean wireframe = false;
+    Material matTerrain;
+    Material matWire;
+    boolean wireframe = false;
     boolean triPlanar = false;
     boolean wardiso = false;
     boolean minnaert = false;
-       protected BitmapText hintText;
+    protected BitmapText hintText;
     private float grassScale = 64;
     private float dirtScale = 16;
     private float rockScale = 128;
@@ -81,96 +80,96 @@ public class TerrainTestModifyHeight extends SimpleApplication {
         app.start();
     }
 
-
     @Override
-       public void initialize() {
-               super.initialize();
+    public void initialize() {
+        super.initialize();
 
-               loadHintText();
+        loadHintText();
         initCrossHairs();
-       }
+    }
 
     @Override
     public void update() {
         super.update();
-        
+
         updateHintText();
     }
 
-       @Override
-       public void simpleInitApp() {
-               setupKeys();
+    @Override
+    public void simpleInitApp() {
+        setupKeys();
 
         // First, we load up our textures and the heightmap texture for the terrain
 
-               // TERRAIN TEXTURE material
-               matTerrain = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
+        // TERRAIN TEXTURE material
+        matTerrain = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
         matTerrain.setBoolean("useTriPlanarMapping", false);
         matTerrain.setBoolean("WardIso", true);
 
-               // ALPHA map (for splat textures)
-               matTerrain.setTexture("AlphaMap", assetManager.loadTexture("Textures/Terrain/splat/alphamap.png"));
-
-               // GRASS texture
-               Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
-               grass.setWrap(WrapMode.Repeat);
-               matTerrain.setTexture("DiffuseMap", grass);
-               matTerrain.setFloat("DiffuseMap_0_scale", grassScale);
-
-               // DIRT texture
-               Texture dirt = assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
-               dirt.setWrap(WrapMode.Repeat);
-               matTerrain.setTexture("DiffuseMap_1", dirt);
-               matTerrain.setFloat("DiffuseMap_1_scale", dirtScale);
-
-               // ROCK texture
-               Texture rock = assetManager.loadTexture("Textures/Terrain/splat/road.jpg");
-               rock.setWrap(WrapMode.Repeat);
-               matTerrain.setTexture("DiffuseMap_2", rock);
-               matTerrain.setFloat("DiffuseMap_2_scale", rockScale);
-
-               // WIREFRAME material
-               matWire = new Material(assetManager, "Common/MatDefs/Misc/WireColor.j3md");
+        // ALPHA map (for splat textures)
+        matTerrain.setTexture("AlphaMap", assetManager.loadTexture("Textures/Terrain/splat/alphamap.png"));
+
+        // GRASS texture
+        Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
+        grass.setWrap(WrapMode.Repeat);
+        matTerrain.setTexture("DiffuseMap", grass);
+        matTerrain.setFloat("DiffuseMap_0_scale", grassScale);
+
+        // DIRT texture
+        Texture dirt = assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
+        dirt.setWrap(WrapMode.Repeat);
+        matTerrain.setTexture("DiffuseMap_1", dirt);
+        matTerrain.setFloat("DiffuseMap_1_scale", dirtScale);
+
+        // ROCK texture
+        Texture rock = assetManager.loadTexture("Textures/Terrain/splat/road.jpg");
+        rock.setWrap(WrapMode.Repeat);
+        matTerrain.setTexture("DiffuseMap_2", rock);
+        matTerrain.setFloat("DiffuseMap_2_scale", rockScale);
+
+        // WIREFRAME material
+        matWire = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+        matWire.getAdditionalRenderState().setWireframe(true);
         matWire.setColor("Color", ColorRGBA.Green);
 
         // CREATE THE TERRAIN
-               terrain = new TerrainQuad("terrain", 65, 513, null);
-               List<Camera> cameras = new ArrayList<Camera>();
-               cameras.add(getCamera());
-               TerrainLodControl control = new TerrainLodControl(terrain, cameras);
-               terrain.addControl(control);
-               terrain.setMaterial(matTerrain);
-               terrain.setModelBound(new BoundingBox());
-               terrain.updateModelBound();
-               terrain.setLocalTranslation(0, -100, 0);
-               terrain.setLocalScale(2f, 1f, 2f);
-               rootNode.attachChild(terrain);
+        terrain = new TerrainQuad("terrain", 65, 513, null);
+        List<Camera> cameras = new ArrayList<Camera>();
+        cameras.add(getCamera());
+        TerrainLodControl control = new TerrainLodControl(terrain, cameras);
+        terrain.addControl(control);
+        terrain.setMaterial(matTerrain);
+        terrain.setModelBound(new BoundingBox());
+        terrain.updateModelBound();
+        terrain.setLocalTranslation(0, -100, 0);
+        terrain.setLocalScale(2f, 1f, 2f);
+        rootNode.attachChild(terrain);
 
         DirectionalLight light = new DirectionalLight();
-        light.setDirection((new Vector3f(-0.5f,-1f, -0.5f)).normalize());
+        light.setDirection((new Vector3f(-0.5f, -1f, -0.5f)).normalize());
         rootNode.addLight(light);
 
         AmbientLight ambLight = new AmbientLight();
         ambLight.setColor(new ColorRGBA(1f, 1f, 0.8f, 0.2f));
         rootNode.addLight(ambLight);
 
-               getCamera().getLocation().y = 10;
-               getCamera().setDirection(new Vector3f(0, -1.5f, -1));
-       }
+        getCamera().getLocation().y = 10;
+        getCamera().setDirection(new Vector3f(0, -1.5f, -1));
+    }
 
-       public void loadHintText() {
-               hintText = new BitmapText(guiFont, false);
-               hintText.setSize(guiFont.getCharSet().getRenderedSize());
-               hintText.setLocalTranslation(0, getCamera().getHeight(), 0);
-               hintText.setText("Hit 1 to raise terrain, hit 2 to lower terrain");
-               guiNode.attachChild(hintText);
-       }
+    public void loadHintText() {
+        hintText = new BitmapText(guiFont, false);
+        hintText.setSize(guiFont.getCharSet().getRenderedSize());
+        hintText.setLocalTranslation(0, getCamera().getHeight(), 0);
+        hintText.setText("Hit 1 to raise terrain, hit 2 to lower terrain");
+        guiNode.attachChild(hintText);
+    }
 
     public void updateHintText() {
         int x = (int) getCamera().getLocation().x;
         int y = (int) getCamera().getLocation().y;
         int z = (int) getCamera().getLocation().z;
-        hintText.setText("Hit 1 to raise terrain, hit 2 to lower terrain.  "+x+","+y+","+z);
+        hintText.setText("Hit 1 to raise terrain, hit 2 to lower terrain.  " + x + "," + y + "," + z);
     }
 
     protected void initCrossHairs() {
@@ -184,27 +183,26 @@ public class TerrainTestModifyHeight extends SimpleApplication {
         guiNode.attachChild(ch);
     }
 
-       private void setupKeys() {
-               flyCam.setMoveSpeed(100);
-               inputManager.addMapping("wireframe", new KeyTrigger(KeyInput.KEY_T));
-               inputManager.addListener(actionListener, "wireframe");
+    private void setupKeys() {
+        flyCam.setMoveSpeed(100);
+        inputManager.addMapping("wireframe", new KeyTrigger(KeyInput.KEY_T));
+        inputManager.addListener(actionListener, "wireframe");
         inputManager.addMapping("Raise", new KeyTrigger(KeyInput.KEY_1));
         inputManager.addListener(actionListener, "Raise");
         inputManager.addMapping("Lower", new KeyTrigger(KeyInput.KEY_2));
         inputManager.addListener(actionListener, "Lower");
-       }
-
-       private ActionListener actionListener = new ActionListener() {
-
-               public void onAction(String name, boolean pressed, float tpf) {
-                       if (name.equals("wireframe") && !pressed) {
-                               wireframe = !wireframe;
-                               if (!wireframe) {
-                                       terrain.setMaterial(matWire);
-                               } else {
-                                       terrain.setMaterial(matTerrain);
-                               }
-                       } else if (name.equals("Raise")) {
+    }
+    private ActionListener actionListener = new ActionListener() {
+
+        public void onAction(String name, boolean pressed, float tpf) {
+            if (name.equals("wireframe") && !pressed) {
+                wireframe = !wireframe;
+                if (!wireframe) {
+                    terrain.setMaterial(matWire);
+                } else {
+                    terrain.setMaterial(matTerrain);
+                }
+            } else if (name.equals("Raise")) {
                 if (pressed) {
                     Vector3f intersection = getWorldIntersection();
                     if (intersection != null) {
@@ -219,53 +217,54 @@ public class TerrainTestModifyHeight extends SimpleApplication {
                     }
                 }
             }
-            
-               }
-       };
+
+        }
+    };
 
     private void adjustHeight(Vector3f loc, float radius, float height) {
-    
+
         // offset it by radius because in the loop we iterate through 2 radii
         int radiusStepsX = (int) (radius / terrain.getLocalScale().x);
         int radiusStepsZ = (int) (radius / terrain.getLocalScale().z);
 
         float xStepAmount = terrain.getLocalScale().x;
         float zStepAmount = terrain.getLocalScale().z;
-long start = System.currentTimeMillis();
-        for (int z=-radiusStepsZ; z<radiusStepsZ; z++) {
-                       for (int x=-radiusStepsZ; x<radiusStepsX; x++) {
-
-                float locX = loc.x + (x*xStepAmount);
-                float locZ = loc.z + (z*zStepAmount);
-                
-                               if (isInRadius(locX-loc.x,locZ-loc.z,radius)) {
+        long start = System.currentTimeMillis();
+        for (int z = -radiusStepsZ; z < radiusStepsZ; z++) {
+            for (int x = -radiusStepsZ; x < radiusStepsX; x++) {
+
+                float locX = loc.x + (x * xStepAmount);
+                float locZ = loc.z + (z * zStepAmount);
+
+                if (isInRadius(locX - loc.x, locZ - loc.z, radius)) {
                     // see if it is in the radius of the tool
-                                       float h = calculateHeight(radius, height, locX-loc.x, locZ-loc.z);
-                    
-                                       // increase the height
-                                       terrain.adjustHeight(new Vector2f(locX, locZ), h);
-                               }
-                       }
-               }
-        System.out.println("took: "+(System.currentTimeMillis()-start));
+                    float h = calculateHeight(radius, height, locX - loc.x, locZ - loc.z);
+
+                    // increase the height
+                    terrain.adjustHeight(new Vector2f(locX, locZ), h);
+                }
+            }
+        }
+        System.out.println("took: " + (System.currentTimeMillis() - start));
         terrain.updateModelBound();
     }
 
     private boolean isInRadius(float x, float y, float radius) {
-               Vector2f point = new Vector2f(x,y);
-               // return true if the distance is less than equal to the radius
-               return point.length() <= radius;
-       }
+        Vector2f point = new Vector2f(x, y);
+        // return true if the distance is less than equal to the radius
+        return point.length() <= radius;
+    }
 
     private float calculateHeight(float radius, float heightFactor, float x, float z) {
         // find percentage for each 'unit' in radius
-        Vector2f point = new Vector2f(x,z);
+        Vector2f point = new Vector2f(x, z);
         float val = point.length() / radius;
         val = 1 - val;
-        if (val <= 0)
+        if (val <= 0) {
             val = 0;
+        }
         return heightFactor * val;
-       }
+    }
 
     private Vector3f getWorldIntersection() {
         Vector3f origin = cam.getWorldCoordinates(new Vector2f(settings.getWidth() / 2, settings.getHeight() / 2), 0.0f);
index 8703fcc..423728d 100644 (file)
@@ -103,30 +103,30 @@ public class TerrainTestReadWrite extends SimpleApplication {
         matTerrain.setBoolean("useTriPlanarMapping", false);
         matTerrain.setBoolean("WardIso", true);
 
-               // ALPHA map (for splat textures)
-               matTerrain.setTexture("AlphaMap", assetManager.loadTexture("Textures/Terrain/splat/alphamap.png"));
+        // ALPHA map (for splat textures)
+        matTerrain.setTexture("AlphaMap", assetManager.loadTexture("Textures/Terrain/splat/alphamap.png"));
 
-               // HEIGHTMAP image (for the terrain heightmap)
-               Texture heightMapImage = assetManager.loadTexture("Textures/Terrain/splat/mountains512.png");
+        // HEIGHTMAP image (for the terrain heightmap)
+        Texture heightMapImage = assetManager.loadTexture("Textures/Terrain/splat/mountains512.png");
 
-               // GRASS texture
-               Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
-               grass.setWrap(WrapMode.Repeat);
-               matTerrain.setTexture("DiffuseMap", grass);
-               matTerrain.setFloat("DiffuseMap_0_scale", grassScale);
+        // GRASS texture
+        Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
+        grass.setWrap(WrapMode.Repeat);
+        matTerrain.setTexture("DiffuseMap", grass);
+        matTerrain.setFloat("DiffuseMap_0_scale", grassScale);
 
 
-               // DIRT texture
-               Texture dirt = assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
-               dirt.setWrap(WrapMode.Repeat);
-               matTerrain.setTexture("DiffuseMap_1", dirt);
-               matTerrain.setFloat("DiffuseMap_1_scale", dirtScale);
+        // DIRT texture
+        Texture dirt = assetManager.loadTexture("Textures/Terrain/splat/dirt.jpg");
+        dirt.setWrap(WrapMode.Repeat);
+        matTerrain.setTexture("DiffuseMap_1", dirt);
+        matTerrain.setFloat("DiffuseMap_1_scale", dirtScale);
 
-               // ROCK texture
-               Texture rock = assetManager.loadTexture("Textures/Terrain/splat/road.jpg");
-               rock.setWrap(WrapMode.Repeat);
-               matTerrain.setTexture("DiffuseMap_2", rock);
-               matTerrain.setFloat("DiffuseMap_2_scale", rockScale);
+        // ROCK texture
+        Texture rock = assetManager.loadTexture("Textures/Terrain/splat/road.jpg");
+        rock.setWrap(WrapMode.Repeat);
+        matTerrain.setTexture("DiffuseMap_2", rock);
+        matTerrain.setFloat("DiffuseMap_2_scale", rockScale);
 
 
         Texture normalMap0 = assetManager.loadTexture("Textures/Terrain/splat/grass_normal.png");
@@ -139,21 +139,22 @@ public class TerrainTestReadWrite extends SimpleApplication {
         matTerrain.setTexture("NormalMap_1", normalMap2);
         matTerrain.setTexture("NormalMap_2", normalMap2);
 
-        matWire = new Material(assetManager, "Common/MatDefs/Misc/WireColor.j3md");
+        matWire = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+        matWire.getAdditionalRenderState().setWireframe(true);
         matWire.setColor("Color", ColorRGBA.Green);
 
 
         // CREATE HEIGHTMAP
-               AbstractHeightMap heightmap = null;
-               try {
-                       //heightmap = new HillHeightMap(1025, 1000, 50, 100, (byte) 3);
+        AbstractHeightMap heightmap = null;
+        try {
+            //heightmap = new HillHeightMap(1025, 1000, 50, 100, (byte) 3);
 
-                       heightmap = new ImageBasedHeightMap(ImageToAwt.convert(heightMapImage.getImage(), false, true, 0), 1f);
-                       heightmap.load();
+            heightmap = new ImageBasedHeightMap(ImageToAwt.convert(heightMapImage.getImage(), false, true, 0), 1f);
+            heightmap.load();
 
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
 
         if (new File("terrainsave.jme").exists()) {
             loadTerrain();
@@ -171,9 +172,9 @@ public class TerrainTestReadWrite extends SimpleApplication {
             terrain.setLocalScale(2f, 1f, 2f);
             rootNode.attachChild(terrain);
         }
-        
+
         DirectionalLight light = new DirectionalLight();
-        light.setDirection((new Vector3f(-0.5f,-1f, -0.5f)).normalize());
+        light.setDirection((new Vector3f(-0.5f, -1f, -0.5f)).normalize());
         rootNode.addLight(light);
     }
 
@@ -182,7 +183,7 @@ public class TerrainTestReadWrite extends SimpleApplication {
      */
     private void createControls() {
         flyCam.setMoveSpeed(50);
-        cam.setLocation(new Vector3f(0,100,0));
+        cam.setLocation(new Vector3f(0, 100, 0));
 
         inputManager.addMapping("save", new KeyTrigger(KeyInput.KEY_T));
         inputManager.addListener(saveActionListener, "save");
@@ -274,7 +275,6 @@ public class TerrainTestReadWrite extends SimpleApplication {
             }
         }
     }
-
     private ActionListener loadActionListener = new ActionListener() {
 
         public void onAction(String name, boolean pressed, float tpf) {
index 24a97f6..3381751 100644 (file)
@@ -57,7 +57,7 @@ public class TestNormalLatc extends SimpleApplication {
         TextureKey key = new TextureKey(texName, true);
         key.setGenerateMips(false);
         Texture tex = assetManager.loadTexture(key);
-        Material mat = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat.setTexture("ColorMap", tex);
 //        mat.setBoolean("Normalize", true);
         if (latc)
index a39d605..c76174c 100644 (file)
@@ -48,7 +48,6 @@ public class TestPostWater extends SimpleApplication {
     private WaterFilter water;
     TerrainQuad terrain;
     Material matRock;
-    Material matWire;
 
     public static void main(String[] args) {
         TestPostWater app = new TestPostWater();
@@ -224,8 +223,6 @@ public class TestPostWater extends SimpleApplication {
         matRock.setTexture("NormalMap_1", normalMap2);
         matRock.setTexture("NormalMap_2", normalMap2);
 
-        matWire = new Material(assetManager, "Common/MatDefs/Misc/WireColor.j3md");
-        matWire.setColor("Color", ColorRGBA.Green);
         AbstractHeightMap heightmap = null;
         try {
             heightmap = new ImageBasedHeightMap(ImageToAwt.convert(heightMapImage.getImage(), false, true, 0), 0.25f);
index 0b5fa11..7ea146f 100644 (file)
@@ -93,7 +93,7 @@ public class TestSceneWater extends SimpleApplication {
         sun.setColor(ColorRGBA.White.clone().multLocal(2));
         scene.addLight(sun);
 
-        Material mat = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
            //add lightPos Geometry
         Sphere lite=new Sphere(8, 8, 3.0f);
index 43f1464..1654413 100644 (file)
@@ -98,7 +98,7 @@ public class TestSimpleWater extends SimpleApplication implements ActionListener
         cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
         //init scene
         sceneNode = new Node("Scene");
-        mat = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+        mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
         mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
         Box b = new Box(1, 1, 1);
         Geometry geom = new Geometry("Box", b);