diff --git a/engine/src/android/jme3test/android/SimpleTexturedTest.java b/engine/src/android/jme3test/android/SimpleTexturedTest.java
index 635d8e188..1413f99ee 100644
--- a/engine/src/android/jme3test/android/SimpleTexturedTest.java
+++ b/engine/src/android/jme3test/android/SimpleTexturedTest.java
@@ -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);
}
diff --git a/engine/src/blender/com/jme3/scene/plugins/blender/utils/DataRepository.java b/engine/src/blender/com/jme3/scene/plugins/blender/utils/DataRepository.java
index e25a8e825..83fefab3d 100644
--- a/engine/src/blender/com/jme3/scene/plugins/blender/utils/DataRepository.java
+++ b/engine/src/blender/com/jme3/scene/plugins/blender/utils/DataRepository.java
@@ -372,7 +372,7 @@ public class DataRepository {
*/
public synchronized Material getDefaultMaterial() {
if(blenderKey.getDefaultMaterial() == null) {
- Material defaultMaterial = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
+ Material defaultMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
defaultMaterial.setColor("Color", ColorRGBA.DarkGray);
blenderKey.setDefaultMaterial(defaultMaterial);
}
diff --git a/engine/src/bullet/com/jme3/bullet/collision/PhysicsCollisionObject.java b/engine/src/bullet/com/jme3/bullet/collision/PhysicsCollisionObject.java
index 491197c1c..74559397f 100644
--- a/engine/src/bullet/com/jme3/bullet/collision/PhysicsCollisionObject.java
+++ b/engine/src/bullet/com/jme3/bullet/collision/PhysicsCollisionObject.java
@@ -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);
diff --git a/engine/src/core-data/Common/MatDefs/Light/Glow.frag b/engine/src/core-data/Common/MatDefs/Light/Glow.frag
index b39e6defd..a18a22809 100644
--- a/engine/src/core-data/Common/MatDefs/Light/Glow.frag
+++ b/engine/src/core-data/Common/MatDefs/Light/Glow.frag
@@ -16,7 +16,6 @@
void main(){
-
#ifdef HAS_GLOWMAP
#if defined(NEED_TEXCOORD1)
gl_FragColor = texture2D(m_GlowMap, texCoord1);
diff --git a/engine/src/core-data/Common/MatDefs/Misc/SimpleTextured.j3md b/engine/src/core-data/Common/MatDefs/Misc/SimpleTextured.j3md
index c18559c70..53469e2eb 100644
--- a/engine/src/core-data/Common/MatDefs/Misc/SimpleTextured.j3md
+++ b/engine/src/core-data/Common/MatDefs/Misc/SimpleTextured.j3md
@@ -1,3 +1,5 @@
+Exception SimpleTextured.j3md has been marked as obsolete. Please use Unshaded.j3md instead.
+
MaterialDef Plain Texture {
MaterialParameters {
diff --git a/engine/src/core-data/Common/MatDefs/Misc/SolidColor.j3md b/engine/src/core-data/Common/MatDefs/Misc/SolidColor.j3md
index 50c8b9d12..15cdff231 100644
--- a/engine/src/core-data/Common/MatDefs/Misc/SolidColor.j3md
+++ b/engine/src/core-data/Common/MatDefs/Misc/SolidColor.j3md
@@ -1,3 +1,5 @@
+Exception SolidColor.j3md has been marked as obsolete. Please use Unshaded.j3md instead.
+
MaterialDef Solid Color {
MaterialParameters {
diff --git a/engine/src/core-data/Common/MatDefs/Misc/VertexColor.j3md b/engine/src/core-data/Common/MatDefs/Misc/VertexColor.j3md
index 09b3e7bb7..d5b3eba8d 100644
--- a/engine/src/core-data/Common/MatDefs/Misc/VertexColor.j3md
+++ b/engine/src/core-data/Common/MatDefs/Misc/VertexColor.j3md
@@ -1,3 +1,5 @@
+Exception VertexColor.j3md has been marked as obsolete. Please use Unshaded.j3md instead.
+
MaterialDef Vertex Color {
Technique {
diff --git a/engine/src/core-data/Common/MatDefs/Misc/WireColor.j3md b/engine/src/core-data/Common/MatDefs/Misc/WireColor.j3md
index 35debff16..51a473348 100644
--- a/engine/src/core-data/Common/MatDefs/Misc/WireColor.j3md
+++ b/engine/src/core-data/Common/MatDefs/Misc/WireColor.j3md
@@ -1,3 +1,5 @@
+Exception WireColor.j3md has been marked as obsolete. Please use Unshaded.j3md instead.
+
MaterialDef Wire Color {
MaterialParameters {
diff --git a/engine/src/core-plugins/com/jme3/material/plugins/J3MLoader.java b/engine/src/core-plugins/com/jme3/material/plugins/J3MLoader.java
index ec3268a46..3d7525879 100644
--- a/engine/src/core-plugins/com/jme3/material/plugins/J3MLoader.java
+++ b/engine/src/core-plugins/com/jme3/material/plugins/J3MLoader.java
@@ -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");
}
diff --git a/engine/src/core/com/jme3/cinematic/MotionPath.java b/engine/src/core/com/jme3/cinematic/MotionPath.java
index b885b7b11..038e347ff 100644
--- a/engine/src/core/com/jme3/cinematic/MotionPath.java
+++ b/engine/src/core/com/jme3/cinematic/MotionPath.java
@@ -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);
diff --git a/engine/src/core/com/jme3/font/BitmapFont.java b/engine/src/core/com/jme3/font/BitmapFont.java
index cf38faff0..ca792c89f 100644
--- a/engine/src/core/com/jme3/font/BitmapFont.java
+++ b/engine/src/core/com/jme3/font/BitmapFont.java
@@ -41,8 +41,6 @@ import com.jme3.export.JmeImporter;
import com.jme3.export.OutputCapsule;
import com.jme3.export.Savable;
import com.jme3.material.Material;
-import com.jme3.shader.VarType;
-import com.jme3.texture.Texture;
/**
* Represents a font within jME that is generated with the AngelCode Bitmap Font Generator
diff --git a/engine/src/core/com/jme3/material/FixedFuncBinding.java b/engine/src/core/com/jme3/material/FixedFuncBinding.java
index d13f74c26..1f6ba1181 100644
--- a/engine/src/core/com/jme3/material/FixedFuncBinding.java
+++ b/engine/src/core/com/jme3/material/FixedFuncBinding.java
@@ -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
index 000000000..de6021055
--- /dev/null
+++ b/engine/src/core/com/jme3/material/MatParamTexture.java
@@ -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
diff --git a/engine/src/core/com/jme3/material/Material.java b/engine/src/core/com/jme3/material/Material.java
index c96cfac4d..8a6f39509 100644
--- a/engine/src/core/com/jme3/material/Material.java
+++ b/engine/src/core/com/jme3/material/Material.java
@@ -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;
+/**
+ * Material
describes the rendering style for a given
+ * {@link Geometry}.
+ *
+ *
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 {
private static final Logger logger = Logger.getLogger(Material.class.getName());
@@ -98,70 +111,10 @@ public class Material implements Cloneable, Savable, Comparable {
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 {
public Material() {
}
+ /**
+ * Returns the asset key name of the asset from which this material was loaded.
+ *
+ * This value will be null
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.
+ *
+ *
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 {
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 this
has a lower sorting ID than m
,
+ * 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 {
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.
+ *
+ * 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.
+ *
+ *
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.
+ *
+ *
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 {
return additionalState;
}
+ /**
+ * Get the material definition (j3md file info) that this
+ * 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 {
// 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;
}
}
diff --git a/engine/src/core/com/jme3/material/RenderState.java b/engine/src/core/com/jme3/material/RenderState.java
index 512e946d9..20d870c42 100644
--- a/engine/src/core/com/jme3/material/RenderState.java
+++ b/engine/src/core/com/jme3/material/RenderState.java
@@ -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]";
}
}
diff --git a/engine/src/desktop-fx/com/jme3/shadow/PssmShadowRenderer.java b/engine/src/desktop-fx/com/jme3/shadow/PssmShadowRenderer.java
index 85ce7ec28..4257669aa 100644
--- a/engine/src/desktop-fx/com/jme3/shadow/PssmShadowRenderer.java
+++ b/engine/src/desktop-fx/com/jme3/shadow/PssmShadowRenderer.java
@@ -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);
diff --git a/engine/src/games/jme3game/cubefield/CubeField.java b/engine/src/games/jme3game/cubefield/CubeField.java
index d9f57e2a2..4c287de33 100644
--- a/engine/src/games/jme3game/cubefield/CubeField.java
+++ b/engine/src/games/jme3game/cubefield/CubeField.java
@@ -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
diff --git a/engine/src/jbullet/com/jme3/bullet/collision/PhysicsCollisionObject.java b/engine/src/jbullet/com/jme3/bullet/collision/PhysicsCollisionObject.java
index 82c0846d2..991295cd1 100644
--- a/engine/src/jbullet/com/jme3/bullet/collision/PhysicsCollisionObject.java
+++ b/engine/src/jbullet/com/jme3/bullet/collision/PhysicsCollisionObject.java
@@ -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);
diff --git a/engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglGL1Renderer.java b/engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglGL1Renderer.java
index 97d16df4d..d7116406c 100644
--- a/engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglGL1Renderer.java
+++ b/engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglGL1Renderer.java
@@ -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) {
diff --git a/engine/src/test-data/Textures/HdrTest/Memorial.j3m b/engine/src/test-data/Textures/HdrTest/Memorial.j3m
index 9087aa99a..81c5c8a54 100644
--- a/engine/src/test-data/Textures/HdrTest/Memorial.j3m
+++ b/engine/src/test-data/Textures/HdrTest/Memorial.j3m
@@ -1,4 +1,4 @@
-Material HDR Picture : Common/MatDefs/Misc/SimpleTextured.j3md {
+Material HDR Picture : Common/MatDefs/Misc/Unshaded.j3md {
MaterialParameters {
ColorMap : Flip Textures/HdrTest/Memorial.hdr
}
diff --git a/engine/src/test/jme3test/audio/TestMusicStreaming.java b/engine/src/test/jme3test/audio/TestMusicStreaming.java
new file mode 100644
index 000000000..ccd7318b3
--- /dev/null
+++ b/engine/src/test/jme3test/audio/TestMusicStreaming.java
@@ -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
diff --git a/engine/src/test/jme3test/awt/TestSafeCanvas.java b/engine/src/test/jme3test/awt/TestSafeCanvas.java
index bfb95ee6d..88451f5d7 100644
--- a/engine/src/test/jme3test/awt/TestSafeCanvas.java
+++ b/engine/src/test/jme3test/awt/TestSafeCanvas.java
@@ -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);
diff --git a/engine/src/test/jme3test/blender/scene/Pivot.java b/engine/src/test/jme3test/blender/scene/Pivot.java
index ecb14defb..28f266a83 100644
--- a/engine/src/test/jme3test/blender/scene/Pivot.java
+++ b/engine/src/test/jme3test/blender/scene/Pivot.java
@@ -22,8 +22,8 @@ public class Pivot extends Node {
}
private void assignPoints(AssetManager assetManager) {
- Material defaultMaterial = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
- defaultMaterial.setColor("m_Color", ColorRGBA.DarkGray);
+ Material defaultMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+ defaultMaterial.setColor("Color", ColorRGBA.DarkGray);
for(int i = -10; i <= 10; ++i) {
Geometry g = new Geometry("", new Sphere(3, 3, 0.05f));
g.setLocalTranslation(i, 0, 0);
@@ -44,8 +44,8 @@ public class Pivot extends Node {
private Geometry getAxis(String name, Vector3f endPoint, ColorRGBA color, AssetManager assetManager) {
Line axis = new Line(new Vector3f(0, 0, 0), endPoint);
- Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
- mat.setColor("m_Color", color);
+ Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+ mat.setColor("Color", color);
Geometry geom = new Geometry(name, axis);
geom.setMaterial(mat);
return geom;
diff --git a/engine/src/test/jme3test/blender/scene/VisibleBone.java b/engine/src/test/jme3test/blender/scene/VisibleBone.java
index 18ee7649b..40ecf1b52 100644
--- a/engine/src/test/jme3test/blender/scene/VisibleBone.java
+++ b/engine/src/test/jme3test/blender/scene/VisibleBone.java
@@ -19,11 +19,11 @@ public class VisibleBone extends Node {
private Vector3f globalPosition;
public VisibleBone(Bone bone, Vector3f parentLocation, Quaternion parentRotation, AssetManager assetManager) {
- Material redMat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
- redMat.setColor("m_Color", ColorRGBA.Red);
+ Material redMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+ redMat.setColor("Color", ColorRGBA.Red);
- Material whiteMat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
- whiteMat.setColor("m_Color", ColorRGBA.White);
+ Material whiteMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
+ whiteMat.setColor("Color", ColorRGBA.White);
Geometry g = new Geometry(bone.getName(), new Sphere(9, 9, 0.01f));
globalPosition = bone.getLocalPosition().add(parentLocation);
diff --git a/engine/src/test/jme3test/bullet/PhysicsTestHelper.java b/engine/src/test/jme3test/bullet/PhysicsTestHelper.java
index 04f7720c9..c3a28d7a0 100644
--- a/engine/src/test/jme3test/bullet/PhysicsTestHelper.java
+++ b/engine/src/test/jme3test/bullet/PhysicsTestHelper.java
@@ -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);
diff --git a/engine/src/test/jme3test/bullet/TestAttachDriver.java b/engine/src/test/jme3test/bullet/TestAttachDriver.java
index b50e55845..9130c8d2d 100644
--- a/engine/src/test/jme3test/bullet/TestAttachDriver.java
+++ b/engine/src/test/jme3test/bullet/TestAttachDriver.java
@@ -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
diff --git a/engine/src/test/jme3test/bullet/TestAttachGhostObject.java b/engine/src/test/jme3test/bullet/TestAttachGhostObject.java
index 7cfab75b8..560631aab 100644
--- a/engine/src/test/jme3test/bullet/TestAttachGhostObject.java
+++ b/engine/src/test/jme3test/bullet/TestAttachGhostObject.java
@@ -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);
diff --git a/engine/src/test/jme3test/bullet/TestBoneRagdoll.java b/engine/src/test/jme3test/bullet/TestBoneRagdoll.java
index f78c9f3ab..1bf21df63 100644
--- a/engine/src/test/jme3test/bullet/TestBoneRagdoll.java
+++ b/engine/src/test/jme3test/bullet/TestBoneRagdoll.java
@@ -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);
diff --git a/engine/src/test/jme3test/bullet/TestBrickTower.java b/engine/src/test/jme3test/bullet/TestBrickTower.java
index bb1026cab..a1fbee7ee 100644
--- a/engine/src/test/jme3test/bullet/TestBrickTower.java
+++ b/engine/src/test/jme3test/bullet/TestBrickTower.java
@@ -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);
diff --git a/engine/src/test/jme3test/bullet/TestBrickWall.java b/engine/src/test/jme3test/bullet/TestBrickWall.java
index 3a7f6390a..3f5596094 100644
--- a/engine/src/test/jme3test/bullet/TestBrickWall.java
+++ b/engine/src/test/jme3test/bullet/TestBrickWall.java
@@ -164,19 +164,19 @@ public class TestBrickWall 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);
diff --git a/engine/src/test/jme3test/bullet/TestCcd.java b/engine/src/test/jme3test/bullet/TestCcd.java
index 5ed99ef04..5645f859d 100644
--- a/engine/src/test/jme3test/bullet/TestCcd.java
+++ b/engine/src/test/jme3test/bullet/TestCcd.java
@@ -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.bullet;
import com.jme3.bullet.BulletAppState;
@@ -57,7 +56,7 @@ import com.jme3.scene.shape.Sphere.TextureMode;
*
* @author normenhansen
*/
-public class TestCcd extends SimpleApplication implements ActionListener{
+public class TestCcd extends SimpleApplication implements ActionListener {
private Material mat;
private Material mat2;
@@ -87,17 +86,19 @@ public class TestCcd extends SimpleApplication implements ActionListener{
bulletCollisionShape = new SphereCollisionShape(0.1f);
setupKeys();
- mat = new Material(getAssetManager(), "Common/MatDefs/Misc/WireColor.j3md");
+ mat = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
+ mat.getAdditionalRenderState().setWireframe(true);
mat.setColor("Color", ColorRGBA.Green);
- mat2 = new Material(getAssetManager(), "Common/MatDefs/Misc/WireColor.j3md");
+ mat2 = new Material(getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
+ mat2.getAdditionalRenderState().setWireframe(true);
mat2.setColor("Color", ColorRGBA.Red);
// An obstacle mesh, does not move (mass=0)
Node node2 = new Node();
node2.setName("mesh");
node2.setLocalTranslation(new Vector3f(2.5f, 0, 0f));
- node2.addControl(new RigidBodyControl(new MeshCollisionShape(new Box(Vector3f.ZERO,4,4,0.1f)), 0));
+ node2.addControl(new RigidBodyControl(new MeshCollisionShape(new Box(Vector3f.ZERO, 4, 4, 0.1f)), 0));
rootNode.attachChild(node2);
getPhysicsSpace().add(node2);
@@ -110,7 +111,7 @@ public class TestCcd extends SimpleApplication implements ActionListener{
}
- private PhysicsSpace getPhysicsSpace(){
+ private PhysicsSpace getPhysicsSpace() {
return bulletAppState.getPhysicsSpace();
}
@@ -136,8 +137,7 @@ public class TestCcd extends SimpleApplication implements ActionListener{
bulletg.getControl(RigidBodyControl.class).setLinearVelocity(cam.getDirection().mult(40));
rootNode.attachChild(bulletg);
getPhysicsSpace().add(bulletg);
- }
- else if(binding.equals("shoot2") && !value) {
+ } else if (binding.equals("shoot2") && !value) {
Geometry bulletg = new Geometry("bullet", bullet);
bulletg.setMaterial(mat2);
bulletg.setName("bullet");
@@ -149,5 +149,4 @@ public class TestCcd extends SimpleApplication implements ActionListener{
getPhysicsSpace().add(bulletg);
}
}
-
}
diff --git a/engine/src/test/jme3test/bullet/TestCollisionGroups.java b/engine/src/test/jme3test/bullet/TestCollisionGroups.java
index 92caaddd6..ddd57909a 100644
--- a/engine/src/test/jme3test/bullet/TestCollisionGroups.java
+++ b/engine/src/test/jme3test/bullet/TestCollisionGroups.java
@@ -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));
diff --git a/engine/src/test/jme3test/bullet/TestCollisionListener.java b/engine/src/test/jme3test/bullet/TestCollisionListener.java
index 3c6c38c9b..f659e2240 100644
--- a/engine/src/test/jme3test/bullet/TestCollisionListener.java
+++ b/engine/src/test/jme3test/bullet/TestCollisionListener.java
@@ -51,7 +51,6 @@ import com.jme3.scene.shape.Sphere.TextureMode;
public class TestCollisionListener extends SimpleApplication implements PhysicsCollisionListener {
private BulletAppState bulletAppState;
- private Material mat;
private Sphere bullet;
private SphereCollisionShape bulletCollisionShape;
@@ -72,9 +71,6 @@ public class TestCollisionListener extends SimpleApplication implements PhysicsC
PhysicsTestHelper.createPhysicsTestWorld(rootNode, assetManager, bulletAppState.getPhysicsSpace());
PhysicsTestHelper.createBallShooter(this, rootNode, bulletAppState.getPhysicsSpace());
- mat = new Material(getAssetManager(), "Common/MatDefs/Misc/WireColor.j3md");
- mat.setColor("Color", ColorRGBA.Red);
-
// add ourselves as collision listener
getPhysicsSpace().addCollisionListener(this);
}
diff --git a/engine/src/test/jme3test/bullet/TestGhostObject.java b/engine/src/test/jme3test/bullet/TestGhostObject.java
index 06ae522ca..ff08817dd 100644
--- a/engine/src/test/jme3test/bullet/TestGhostObject.java
+++ b/engine/src/test/jme3test/bullet/TestGhostObject.java
@@ -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);
diff --git a/engine/src/test/jme3test/bullet/TestHoveringTank.java b/engine/src/test/jme3test/bullet/TestHoveringTank.java
index 60336a543..71eaa9bb6 100644
--- a/engine/src/test/jme3test/bullet/TestHoveringTank.java
+++ b/engine/src/test/jme3test/bullet/TestHoveringTank.java
@@ -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);
diff --git a/engine/src/test/jme3test/bullet/TestPhysicsCar.java b/engine/src/test/jme3test/bullet/TestPhysicsCar.java
index ff93132c3..e34472b09 100644
--- a/engine/src/test/jme3test/bullet/TestPhysicsCar.java
+++ b/engine/src/test/jme3test/bullet/TestPhysicsCar.java
@@ -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
diff --git a/engine/src/test/jme3test/bullet/TestPhysicsHingeJoint.java b/engine/src/test/jme3test/bullet/TestPhysicsHingeJoint.java
index e0ffd5b25..1fb57f93d 100644
--- a/engine/src/test/jme3test/bullet/TestPhysicsHingeJoint.java
+++ b/engine/src/test/jme3test/bullet/TestPhysicsHingeJoint.java
@@ -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);
diff --git a/engine/src/test/jme3test/bullet/TestWalkingChar.java b/engine/src/test/jme3test/bullet/TestWalkingChar.java
index 94d370ec7..0055b7f00 100644
--- a/engine/src/test/jme3test/bullet/TestWalkingChar.java
+++ b/engine/src/test/jme3test/bullet/TestWalkingChar.java
@@ -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 {
diff --git a/engine/src/test/jme3test/collision/TestMousePick.java b/engine/src/test/jme3test/collision/TestMousePick.java
index 1d487f0a4..fa2d64a43 100644
--- a/engine/src/test/jme3test/collision/TestMousePick.java
+++ b/engine/src/test/jme3test/collision/TestMousePick.java
@@ -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);
}
diff --git a/engine/src/test/jme3test/collision/TestTriangleCollision.java b/engine/src/test/jme3test/collision/TestTriangleCollision.java
index a3b9b12bc..56ee49679 100644
--- a/engine/src/test/jme3test/collision/TestTriangleCollision.java
+++ b/engine/src/test/jme3test/collision/TestTriangleCollision.java
@@ -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);
diff --git a/engine/src/test/jme3test/conversion/TestMipMapGen.java b/engine/src/test/jme3test/conversion/TestMipMapGen.java
index f5b519ea7..13f67f1fb 100644
--- a/engine/src/test/jme3test/conversion/TestMipMapGen.java
+++ b/engine/src/test/jme3test/conversion/TestMipMapGen.java
@@ -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);
diff --git a/engine/src/test/jme3test/helloworld/HelloAssets.java b/engine/src/test/jme3test/helloworld/HelloAssets.java
index 348ee9a88..44336c9fb 100644
--- a/engine/src/test/jme3test/helloworld/HelloAssets.java
+++ b/engine/src/test/jme3test/helloworld/HelloAssets.java
@@ -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);
diff --git a/engine/src/test/jme3test/helloworld/HelloAudio.java b/engine/src/test/jme3test/helloworld/HelloAudio.java
index e9b89c92c..13dcbeba7 100644
--- a/engine/src/test/jme3test/helloworld/HelloAudio.java
+++ b/engine/src/test/jme3test/helloworld/HelloAudio.java
@@ -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);
diff --git a/engine/src/test/jme3test/helloworld/HelloInput.java b/engine/src/test/jme3test/helloworld/HelloInput.java
index c610af0aa..7182eb24d 100644
--- a/engine/src/test/jme3test/helloworld/HelloInput.java
+++ b/engine/src/test/jme3test/helloworld/HelloInput.java
@@ -59,7 +59,7 @@ public class HelloInput extends SimpleApplication {
public void simpleInitApp() {
Box b = new Box(Vector3f.ZERO, 1, 1, 1);
player = new Geometry("Player", 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);
player.setMaterial(mat);
rootNode.attachChild(player);
diff --git a/engine/src/test/jme3test/helloworld/HelloJME3.java b/engine/src/test/jme3test/helloworld/HelloJME3.java
index 6833b1145..3a0414c9d 100644
--- a/engine/src/test/jme3test/helloworld/HelloJME3.java
+++ b/engine/src/test/jme3test/helloworld/HelloJME3.java
@@ -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
diff --git a/engine/src/test/jme3test/helloworld/HelloLoop.java b/engine/src/test/jme3test/helloworld/HelloLoop.java
index 77d72b4a4..ec0d5e816 100644
--- a/engine/src/test/jme3test/helloworld/HelloLoop.java
+++ b/engine/src/test/jme3test/helloworld/HelloLoop.java
@@ -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);
diff --git a/engine/src/test/jme3test/helloworld/HelloMaterial.java b/engine/src/test/jme3test/helloworld/HelloMaterial.java
index 5504598b2..1d07c42cd 100644
--- a/engine/src/test/jme3test/helloworld/HelloMaterial.java
+++ b/engine/src/test/jme3test/helloworld/HelloMaterial.java
@@ -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);
diff --git a/engine/src/test/jme3test/helloworld/HelloNode.java b/engine/src/test/jme3test/helloworld/HelloNode.java
index d70160b06..4bd853951 100644
--- a/engine/src/test/jme3test/helloworld/HelloNode.java
+++ b/engine/src/test/jme3test/helloworld/HelloNode.java
@@ -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);
diff --git a/engine/src/test/jme3test/helloworld/HelloPhysics.java b/engine/src/test/jme3test/helloworld/HelloPhysics.java
index 6b36ae91b..38348a748 100644
--- a/engine/src/test/jme3test/helloworld/HelloPhysics.java
+++ b/engine/src/test/jme3test/helloworld/HelloPhysics.java
@@ -133,19 +133,19 @@ public class HelloPhysics extends SimpleApplication {
/** Initialize the materials used in this scene. */
public void initMaterials() {
- wall_mat = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+ wall_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);
wall_mat.setTexture("ColorMap", tex);
- stone_mat = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+ stone_mat = 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);
stone_mat.setTexture("ColorMap", tex2);
- floor_mat = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
+ floor_mat = 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);
diff --git a/engine/src/test/jme3test/helloworld/HelloPicking.java b/engine/src/test/jme3test/helloworld/HelloPicking.java
index 6e1dd5a70..60815e7c6 100644
--- a/engine/src/test/jme3test/helloworld/HelloPicking.java
+++ b/engine/src/test/jme3test/helloworld/HelloPicking.java
@@ -128,7 +128,7 @@ public class HelloPicking 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;
@@ -138,7 +138,7 @@ public class HelloPicking 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;
@@ -148,7 +148,7 @@ public class HelloPicking extends SimpleApplication {
protected void initMark() {
Sphere sphere = new Sphere(30, 30, 0.2f);
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);
}
diff --git a/engine/src/test/jme3test/input/TestChaseCamera.java b/engine/src/test/jme3test/input/TestChaseCamera.java
index 230dd9cfa..459b74547 100644
--- a/engine/src/test/jme3test/input/TestChaseCamera.java
+++ b/engine/src/test/jme3test/input/TestChaseCamera.java
@@ -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));
diff --git a/engine/src/test/jme3test/light/TestPssmShadow.java b/engine/src/test/jme3test/light/TestPssmShadow.java
index dc302d52c..67addf008 100644
--- a/engine/src/test/jme3test/light/TestPssmShadow.java
+++ b/engine/src/test/jme3test/light/TestPssmShadow.java
@@ -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));
diff --git a/engine/src/test/jme3test/light/TestShadow.java b/engine/src/test/jme3test/light/TestShadow.java
index fc287df73..a8d168c38 100644
--- a/engine/src/test/jme3test/light/TestShadow.java
+++ b/engine/src/test/jme3test/light/TestShadow.java
@@ -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);
}
diff --git a/engine/src/test/jme3test/light/TestSimpleLighting.java b/engine/src/test/jme3test/light/TestSimpleLighting.java
index 5daf2fa47..5c94f8131 100644
--- a/engine/src/test/jme3test/light/TestSimpleLighting.java
+++ b/engine/src/test/jme3test/light/TestSimpleLighting.java
@@ -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;
diff --git a/engine/src/test/jme3test/network/sync/BoxEntity.java b/engine/src/test/jme3test/network/sync/BoxEntity.java
index 148ec00f6..969c93e5b 100644
--- a/engine/src/test/jme3test/network/sync/BoxEntity.java
+++ b/engine/src/test/jme3test/network/sync/BoxEntity.java
@@ -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);
}
diff --git a/engine/src/test/jme3test/post/TestDepthOfField.java b/engine/src/test/jme3test/post/TestDepthOfField.java
index 580fe5acd..64d7afba9 100644
--- a/engine/src/test/jme3test/post/TestDepthOfField.java
+++ b/engine/src/test/jme3test/post/TestDepthOfField.java
@@ -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);
diff --git a/engine/src/test/jme3test/post/TestHDR.java b/engine/src/test/jme3test/post/TestHDR.java
index df1714cf7..52fbeb8db 100644
--- a/engine/src/test/jme3test/post/TestHDR.java
+++ b/engine/src/test/jme3test/post/TestHDR.java
@@ -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);
diff --git a/engine/src/test/jme3test/post/TestLightScattering.java b/engine/src/test/jme3test/post/TestLightScattering.java
index cc5bfbd1e..78fb67005 100644
--- a/engine/src/test/jme3test/post/TestLightScattering.java
+++ b/engine/src/test/jme3test/post/TestLightScattering.java
@@ -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);
diff --git a/engine/src/test/jme3test/post/TestRenderToTexture.java b/engine/src/test/jme3test/post/TestRenderToTexture.java
index d3b033ac8..ccc993ae3 100644
--- a/engine/src/test/jme3test/post/TestRenderToTexture.java
+++ b/engine/src/test/jme3test/post/TestRenderToTexture.java
@@ -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);
diff --git a/engine/src/test/jme3test/terrain/TerrainTest.java b/engine/src/test/jme3test/terrain/TerrainTest.java
index 1f5149044..d4405464f 100644
--- a/engine/src/test/jme3test/terrain/TerrainTest.java
+++ b/engine/src/test/jme3test/terrain/TerrainTest.java
@@ -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 cameras = new ArrayList();
+ 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 cameras = new ArrayList();
- 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);
}
}
- }
- };
+ }
+ };
}
diff --git a/engine/src/test/jme3test/terrain/TerrainTestAdvanced.java b/engine/src/test/jme3test/terrain/TerrainTestAdvanced.java
index 90ecdb6c5..55977dcb0 100644
--- a/engine/src/test/jme3test/terrain/TerrainTestAdvanced.java
+++ b/engine/src/test/jme3test/terrain/TerrainTestAdvanced.java
@@ -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 cameras = new ArrayList();
- 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 cameras = new ArrayList();
+ 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");
diff --git a/engine/src/test/jme3test/terrain/TerrainTestCollision.java b/engine/src/test/jme3test/terrain/TerrainTestCollision.java
index f9e910a4e..8dc8edd87 100644
--- a/engine/src/test/jme3test/terrain/TerrainTestCollision.java
+++ b/engine/src/test/jme3test/terrain/TerrainTestCollision.java
@@ -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 cameras = new ArrayList();
@@ -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);
+ }
}
}
diff --git a/engine/src/test/jme3test/terrain/TerrainTestModifyHeight.java b/engine/src/test/jme3test/terrain/TerrainTestModifyHeight.java
index a613a35b0..93d1133d9 100644
--- a/engine/src/test/jme3test/terrain/TerrainTestModifyHeight.java
+++ b/engine/src/test/jme3test/terrain/TerrainTestModifyHeight.java
@@ -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 cameras = new ArrayList();
- 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 cameras = new ArrayList();
+ 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