* New version of nifty * Added simple package.html for some of the jME3 packages

* Additional javadocs for com.jme3.renderer
 * Removed Camera.setDirection()
 * ImageBasedHeightMapGrid now uses AssetManager to find heightmaps


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7605 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..rd 14 years ago
parent 928345295b
commit d6d3894fff
  1. 15
      engine/src/core/com/jme3/app/state/package.html
  2. 19
      engine/src/core/com/jme3/input/controls/package.html
  3. 14
      engine/src/core/com/jme3/input/dummy/package.html
  4. 13
      engine/src/core/com/jme3/input/event/package.html
  5. 3
      engine/src/core/com/jme3/math/Eigen3f.java
  6. 53
      engine/src/core/com/jme3/math/package.html
  7. 24
      engine/src/core/com/jme3/post/package.html
  8. 9
      engine/src/core/com/jme3/renderer/Renderer.java
  9. 10
      engine/src/core/com/jme3/renderer/RendererException.java
  10. 17
      engine/src/core/com/jme3/renderer/Statistics.java
  11. 38
      engine/src/core/com/jme3/renderer/package.html
  12. 2
      engine/src/desktop-fx/com/jme3/shadow/BasicShadowRenderer.java
  13. 2
      engine/src/desktop-fx/com/jme3/shadow/ShadowCamera.java
  14. 21
      engine/src/terrain/com/jme3/terrain/heightmap/ImageBasedHeightMapGrid.java
  15. BIN
      engine/src/test-data/Scenes/ManyLights/AO.dds
  16. BIN
      engine/src/test-data/Scenes/ManyLights/AO.tga
  17. 0
      engine/src/test-data/Textures/Terrain/Rock2/rock.jpg
  18. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_0_-512.png
  19. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_0_0.png
  20. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_0_1024.png
  21. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_0_1536.png
  22. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_0_2048.png
  23. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_0_2560.png
  24. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_0_3072.png
  25. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_0_512.png
  26. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_1024_-512.png
  27. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_1024_0.png
  28. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_1024_1024.png
  29. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_1024_1536.png
  30. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_1024_2048.png
  31. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_1024_2560.png
  32. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_1024_3072.png
  33. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_1024_512.png
  34. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_1536_-512.png
  35. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_1536_0.png
  36. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_1536_1024.png
  37. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_1536_1536.png
  38. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_1536_2048.png
  39. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_1536_2560.png
  40. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_1536_3072.png
  41. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_1536_512.png
  42. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_2048_-512.png
  43. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_2048_0.png
  44. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_2048_1024.png
  45. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_2048_1536.png
  46. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_2048_2048.png
  47. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_2048_2560.png
  48. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_2048_3072.png
  49. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_2048_512.png
  50. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_512_-512.png
  51. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_512_0.png
  52. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_512_1024.png
  53. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_512_1536.png
  54. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_512_2048.png
  55. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_512_2560.png
  56. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_512_3072.png
  57. BIN
      engine/src/test-data/Textures/Terrain/grid/mountains_512_512.png
  58. 16
      engine/src/test/jme3test/terrain/TerrainGridTest.java
  59. 4
      engine/src/test/jme3test/terrain/TerrainTest.java
  60. 6
      engine/src/test/jme3test/terrain/TerrainTestAdvanced.java
  61. 6
      engine/src/test/jme3test/terrain/TerrainTestCollision.java
  62. 4
      engine/src/test/jme3test/terrain/TerrainTestModifyHeight.java
  63. 2
      engine/src/test/jme3test/terrain/TerrainTestReadWrite.java
  64. 92
      engine/src/test/jme3test/texture/TestNormalLatc.java

@ -0,0 +1,15 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
The <code>com.jme3.app.state</code> package provides
{@link com.jme3.app.state.AppState app states},
an abstract way of handling application logic.
</body>
</html>

@ -0,0 +1,19 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
The <code>com.jme3.input.controls</code> package allows user code to listen
to input events regardless of the type of input used.
<p>
Users will receive input in one of two forms, either
{@link com.jme3.input.controls.AnalogListener analog input} or
{@link com.jme3.input.controls.Action digital/action input}.
</body>
</html>

@ -0,0 +1,14 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
The <code>com.jme3.input.dummy</code> package provides "dummy" or "null"
implementations of the input interfaces.
</body>
</html>

@ -0,0 +1,13 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
The <code>com.jme3.input.event</code> package contains low-level input events.
</body>
</html>

@ -32,6 +32,7 @@
package com.jme3.math; package com.jme3.math;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
public class Eigen3f { public class Eigen3f {
@ -381,7 +382,7 @@ public class Eigen3f {
logger.info("eigenvalues = "); logger.info("eigenvalues = ");
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
logger.info(eigenSystem.getEigenValue(i) + " "); logger.log(Level.INFO, "{0} ", eigenSystem.getEigenValue(i));
logger.info("eigenvectors = "); logger.info("eigenvectors = ");
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {

@ -0,0 +1,53 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
The <code>com.jme3.math</code> package provides mathematic data structures
and utilities which are used by the rest of the engine.
The math package provides the following classes:<br>
<h3>General purpose vectors</h3>
<ul>
<li>{@link com.jme3.math.Vector2f} - 2D general purpose vector</li>
<li>{@link com.jme3.math.Vector3f} - 3D general purpose vector</li>
<li>{@link com.jme3.math.Vector4f} - 4D general purpose vector</li>
</ul>
<h3>Special purpose vectors</h3>
<ul>
<li>{@link com.jme3.math.ColorRGBA} - Floating-point RGB color with alpha</li>
<li>{@link com.jme3.math.Quaternion} - Specialized 4D data structure to represent rotation</li>
</ul>
<h3>Matrices</h3>
<ul>
<li>{@link com.jme3.math.Matrix3f} - 3x3 matrix, usually used to represent rotation</li>
<li>{@link com.jme3.math.Matrix4f} - 4x4 matrix, used as an efficient transform representation</li>
</ul>
<h3>Shapes</h3>
<ul>
<li>{@link com.jme3.math.AbstractTriangle} - Abstract triangle. Data to be provided by implementation</li>
<li>{@link com.jme3.math.Triangle} - Concrete implementation of AbstractTriangle with center and normal vectors</li>
<li>{@link com.jme3.math.Line} - Infinite 3D line</li>
<li>{@link com.jme3.math.LineSegment} - 3D line with start and end point</li>
<li>{@link com.jme3.math.Plane} - 3D plane</li>
<li>{@link com.jme3.math.Ray} - 3D ray</li>
<li>{@link com.jme3.math.Rectangle} - 3D rectangle</li>
<li>{@link com.jme3.math.Ring} - 3D ring</li>
</ul>
<h3>Curves</h3>
<ul>
<li>{@link com.jme3.math.Spline} - 3D curve defined by control points and a function</li>
</ul>
<h3>Utility classes</h3>
<ul>
<li>{@link com.jme3.math.Transform} - Representation of a transform with translation, rotation, and scale</li>
<li>{@link com.jme3.math.FastMath} - Contains static methods for floating-point math</li>
<li>{@link com.jme3.math.CurveAndSurfaceMath} - Contains static methods specific to curve and surface math</li>
<li>{@link com.jme3.math.Eigen3f} - Provides computation of eigenvectors given a matrix</li>
</ul>
</body>
</html>

@ -0,0 +1,24 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
The <code>com.jme3.post</code> package provides utilities for
render processing.
<p>
The {@link com.jme3.post.SceneProcessor} interface is used as the base interface
for all render processing. The SceneProcessor contains hooks for various rendering
events.
<p>
One use of render processing is post-processing, which is applying effects
on an already-rendered scene. The engine's post-processing system is implemented
in the {@link com.jme3.post.FilterPostProcessor} class, which contains a list
of {@link com.jme3.post.Filter filters}. Each are invoked in order to apply
various effects on the rendered scene.
</body>
</html>

@ -45,15 +45,22 @@ import com.jme3.texture.Texture;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.EnumSet; import java.util.EnumSet;
/**
* The <code>Renderer</code> is responsible for taking rendering commands and
* executing them on the underlying video hardware.
*
* @author Kirill Vainer
*/
public interface Renderer { public interface Renderer {
/** /**
* Get the capabilities of the renderer.
* @return The capabilities of the renderer. * @return The capabilities of the renderer.
*/ */
public EnumSet<Caps> getCaps(); public EnumSet<Caps> getCaps();
/** /**
* @return The statistics allow tracking of how data * The statistics allow tracking of how data
* per frame, such as number of objects rendered, number of triangles, etc. * per frame, such as number of objects rendered, number of triangles, etc.
*/ */
public Statistics getStatistics(); public Statistics getStatistics();

@ -32,7 +32,17 @@
package com.jme3.renderer; package com.jme3.renderer;
/**
* <code>RendererException</code> is raised when a renderer encounters
* a fatal rendering error.
*
* @author Kirill Vainer
*/
public class RendererException extends RuntimeException { public class RendererException extends RuntimeException {
/**
* Creates a new isntance of <code>RendererException</code>
*/
public RendererException(String message){ public RendererException(String message){
super(message); super(message);
} }

@ -38,6 +38,13 @@ import com.jme3.texture.FrameBuffer;
import com.jme3.texture.Image; import com.jme3.texture.Image;
import java.util.HashSet; import java.util.HashSet;
/**
* The statistics class allows tracking of real-time rendering statistics.
* <p>
* The <code>Statistics</code> can be retrieved by using {@link Renderer#getStatistics() }.
*
* @author Kirill Vainer
*/
public class Statistics { public class Statistics {
protected int numObjects; protected int numObjects;
@ -56,6 +63,13 @@ public class Statistics {
protected HashSet<Integer> texturesUsed = new HashSet<Integer>(); protected HashSet<Integer> texturesUsed = new HashSet<Integer>();
protected HashSet<Integer> fbosUsed = new HashSet<Integer>(); protected HashSet<Integer> fbosUsed = new HashSet<Integer>();
/**
* Returns a list of labels corresponding to each statistic.
*
* @return a list of labels corresponding to each statistic.
*
* @see #getData(int[])
*/
public String[] getLabels(){ public String[] getLabels(){
return new String[]{ "Vertices", return new String[]{ "Vertices",
"Triangles", "Triangles",
@ -176,6 +190,9 @@ public class Statistics {
memoryFrameBuffers --; memoryFrameBuffers --;
} }
/**
* Called when video memory is cleared.
*/
public void clearMemory(){ public void clearMemory(){
memoryFrameBuffers = 0; memoryFrameBuffers = 0;
memoryShaders = 0; memoryShaders = 0;

@ -0,0 +1,38 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
The <code>com.jme3.renderer</code> package provides classes responsible for
rendering.
<p>
The most critical classes are the {@link com.jme3.renderer.Renderer},
which is the low-level rendering implementation and is abstract, and the
{@link com.jme3.renderer.RenderManager} class, which provides the high-level
rendering logic on top of the <code>Renderer</code>.
<p>
To accompany rendering, several helper classes are available.
<ul>
<li>The {@link com.jme3.renderer.Camera} is used to specify the point-of-view
from which scenes are rendered.</li>
<li>The {@link com.jme3.renderer.ViewPort} is the
aggregation of a Camera and a set of {@link com.jme3.scene.Spatial scenes}
which are to be rendered, as well as additional info.</li>
<li>The {@link com.jme3.renderer.Caps} class contains renderer capabilities
which the user can query to find out what features are available in the
rendering implementation. </li>
<li>The {@link com.jme3.renderer.Statistics} class is updated in real time
by the Renderer, and is used to find out various statistics about
the rendering</li>
<li>The {@link com.jme3.renderer.GLObjectManager} and {@link com.jme3.renderer.GLObject} classes
provide a link between the renderer's native objects and Java's garbage collected objects,
allowing the engine to track when the Java object counterpart is garbage collected
and then delete the native object counterpart from the renderer.</li>
</ul>
</body>
</html>

@ -140,7 +140,7 @@ public class BasicShadowRenderer implements SceneProcessor {
shadowCam.setParallelProjection(true); shadowCam.setParallelProjection(true);
// shadowCam.setFrustumPerspective(45, 1, 1, 20); // shadowCam.setFrustumPerspective(45, 1, 1, 20);
shadowCam.setDirection(direction); shadowCam.lookAtDirection(direction, Vector3f.UNIT_Y);
shadowCam.update(); shadowCam.update();
shadowCam.setLocation(frustaCenter); shadowCam.setLocation(frustaCenter);
shadowCam.update(); shadowCam.update();

@ -58,7 +58,7 @@ public class ShadowCamera {
DirectionalLight dl = (DirectionalLight) target; DirectionalLight dl = (DirectionalLight) target;
lightCam.setParallelProjection(true); lightCam.setParallelProjection(true);
lightCam.setLocation(Vector3f.ZERO); lightCam.setLocation(Vector3f.ZERO);
lightCam.setDirection(dl.getDirection()); lightCam.lookAtDirection(dl.getDirection(), Vector3f.UNIT_Y );
lightCam.setFrustum(-1, 1, -1, 1, 1, -1); lightCam.setFrustum(-1, 1, -1, 1, 1, -1);
}else{ }else{
PointLight pl = (PointLight) target; PointLight pl = (PointLight) target;

@ -4,18 +4,17 @@
*/ */
package com.jme3.terrain.heightmap; package com.jme3.terrain.heightmap;
import com.jme3.asset.AssetInfo;
import com.jme3.asset.AssetKey;
import com.jme3.asset.AssetManager; import com.jme3.asset.AssetManager;
import com.jme3.asset.AssetNotFoundException; import com.jme3.asset.AssetNotFoundException;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f; import com.jme3.math.Vector3f;
import com.jme3.texture.Texture;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import jme3tools.converters.ImageToAwt;
/** /**
* *
@ -23,6 +22,7 @@ import jme3tools.converters.ImageToAwt;
*/ */
public class ImageBasedHeightMapGrid implements HeightMapGrid { public class ImageBasedHeightMapGrid implements HeightMapGrid {
private static final Logger logger = Logger.getLogger(ImageBasedHeightMapGrid.class.getName());
private final AssetManager assetManager; private final AssetManager assetManager;
private final Namer namer; private final Namer namer;
private int size; private int size;
@ -45,17 +45,20 @@ public class ImageBasedHeightMapGrid implements HeightMapGrid {
// HEIGHTMAP image (for the terrain heightmap) // HEIGHTMAP image (for the terrain heightmap)
int x = (int) location.x; int x = (int) location.x;
int z = (int) location.z; int z = (int) location.z;
AbstractHeightMap heightmap = null; AbstractHeightMap heightmap = null;
BufferedImage im = null;
try { try {
String name = namer.getName(x, z); String name = namer.getName(x, z);
Logger.getLogger(ImageBasedHeightMapGrid.class.getCanonicalName()).log(Level.INFO, "Loading heightmap from file: " + name); logger.log(Level.INFO, "Loading heightmap from file: {0}", name);
final InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(name); final AssetInfo assetInfo = assetManager.locateAsset(new AssetKey(name));
BufferedImage im = null; if (assetInfo != null){
if (stream != null) { InputStream in = assetInfo.openStream();
im = ImageIO.read(stream); im = ImageIO.read(in);
} else { } else {
im = new BufferedImage(size, size, BufferedImage.TYPE_USHORT_GRAY); im = new BufferedImage(size, size, BufferedImage.TYPE_USHORT_GRAY);
Logger.getLogger(ImageBasedHeightMapGrid.class.getCanonicalName()).log(Level.WARNING, "File: " + name + " not found, loading zero heightmap instead"); logger.log(Level.WARNING, "File: {0} not found, loading zero heightmap instead", name);
} }
// CREATE HEIGHTMAP // CREATE HEIGHTMAP
heightmap = new Grayscale16BitHeightMap(im); heightmap = new Grayscale16BitHeightMap(im);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 444 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 437 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 438 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 430 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 414 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 444 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 436 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 446 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 436 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 430 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 414 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 426 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 414 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 425 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 381 KiB

@ -5,6 +5,8 @@ import java.util.List;
import com.jme3.app.SimpleApplication; import com.jme3.app.SimpleApplication;
import com.jme3.app.state.ScreenshotAppState; import com.jme3.app.state.ScreenshotAppState;
import com.jme3.asset.plugins.HttpZipLocator;
import com.jme3.asset.plugins.ZipLocator;
import com.jme3.bullet.BulletAppState; import com.jme3.bullet.BulletAppState;
import com.jme3.bullet.collision.shapes.CapsuleCollisionShape; import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;
import com.jme3.bullet.collision.shapes.HeightfieldCollisionShape; import com.jme3.bullet.collision.shapes.HeightfieldCollisionShape;
@ -25,6 +27,7 @@ import com.jme3.terrain.heightmap.ImageBasedHeightMapGrid;
import com.jme3.terrain.heightmap.Namer; import com.jme3.terrain.heightmap.Namer;
import com.jme3.texture.Texture; import com.jme3.texture.Texture;
import com.jme3.texture.Texture.WrapMode; import com.jme3.texture.Texture.WrapMode;
import java.io.File;
import org.novyon.noise.ShaderUtils; import org.novyon.noise.ShaderUtils;
import org.novyon.noise.basis.FilteredBasis; import org.novyon.noise.basis.FilteredBasis;
import org.novyon.noise.filter.IterativeFilter; import org.novyon.noise.filter.IterativeFilter;
@ -56,6 +59,13 @@ public class TerrainGridTest extends SimpleApplication {
@Override @Override
public void simpleInitApp() { public void simpleInitApp() {
File file = new File("mountains.zip");
if (!file.exists()) {
assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/mountains.zip", HttpZipLocator.class.getName());
}else{
assetManager.registerLocator("mountains.zip", ZipLocator.class.getName());
}
this.flyCam.setMoveSpeed(100f); this.flyCam.setMoveSpeed(100f);
ScreenshotAppState state = new ScreenshotAppState(); ScreenshotAppState state = new ScreenshotAppState();
this.stateManager.attach(state); this.stateManager.attach(state);
@ -86,7 +96,7 @@ public class TerrainGridTest extends SimpleApplication {
this.mat_terrain.setVector3("region2", new Vector3f(0, 90, this.dirtScale)); this.mat_terrain.setVector3("region2", new Vector3f(0, 90, this.dirtScale));
// ROCK texture // ROCK texture
Texture rock = this.assetManager.loadTexture("Textures/Terrain/grid/rock.jpg"); Texture rock = this.assetManager.loadTexture("Textures/Terrain/Rock2/rock.jpg");
rock.setWrap(WrapMode.Repeat); rock.setWrap(WrapMode.Repeat);
this.mat_terrain.setTexture("region3ColorMap", rock); this.mat_terrain.setTexture("region3ColorMap", rock);
this.mat_terrain.setVector3("region3", new Vector3f(198, 260, this.rockScale)); this.mat_terrain.setVector3("region3", new Vector3f(198, 260, this.rockScale));
@ -104,7 +114,6 @@ public class TerrainGridTest extends SimpleApplication {
this.base.setOctaves(8); this.base.setOctaves(8);
this.base.setScale(0.02125f); this.base.setScale(0.02125f);
this.base.addModulator(new NoiseModulator() { this.base.addModulator(new NoiseModulator() {
@Override @Override
public float value(float... in) { public float value(float... in) {
return ShaderUtils.clamp(in[0] * 0.5f + 0.5f, 0, 1); return ShaderUtils.clamp(in[0] * 0.5f + 0.5f, 0, 1);
@ -133,9 +142,8 @@ public class TerrainGridTest extends SimpleApplication {
ground.addPreFilter(this.iterate); ground.addPreFilter(this.iterate);
this.terrain = new TerrainGrid("terrain", 65, 1025, new ImageBasedHeightMapGrid(assetManager, new Namer() { this.terrain = new TerrainGrid("terrain", 65, 1025, new ImageBasedHeightMapGrid(assetManager, new Namer() {
public String getName(int x, int y) { public String getName(int x, int y) {
return "Textures/Terrain/grid/mountains_" + (x * 512) + "_" + (y * 512) + ".png"; return "Scenes/TerrainMountains/mountains_" + (x * 512) + "_" + (y * 512) + ".png";
} }
})); }));

@ -176,8 +176,8 @@ public class TerrainTest extends SimpleApplication {
light.setDirection((new Vector3f(-0.5f, -1f, -0.5f)).normalize()); light.setDirection((new Vector3f(-0.5f, -1f, -0.5f)).normalize());
rootNode.addLight(light); rootNode.addLight(light);
getCamera().getLocation().y = 10; cam.setLocation(new Vector3f(0, 10, -10));
getCamera().setDirection(new Vector3f(0, -1.5f, -1)); cam.lookAtDirection(new Vector3f(0, -1.5f, -1).normalizeLocal(), Vector3f.UNIT_Y);
} }
public void loadHintText() { public void loadHintText() {

@ -129,7 +129,7 @@ public class TerrainTestAdvanced extends SimpleApplication {
matTerrain.setFloat("DiffuseMap_2_scale", rockScale); matTerrain.setFloat("DiffuseMap_2_scale", rockScale);
Texture normalMap0 = assetManager.loadTexture("Textures/Terrain/splat/grass_normal.png"); Texture normalMap0 = assetManager.loadTexture("Textures/Terrain/splat/grass_normal.jpg");
normalMap0.setWrap(WrapMode.Repeat); normalMap0.setWrap(WrapMode.Repeat);
Texture normalMap1 = assetManager.loadTexture("Textures/Terrain/splat/dirt_normal.png"); Texture normalMap1 = assetManager.loadTexture("Textures/Terrain/splat/dirt_normal.png");
normalMap1.setWrap(WrapMode.Repeat); normalMap1.setWrap(WrapMode.Repeat);
@ -187,8 +187,8 @@ public class TerrainTestAdvanced extends SimpleApplication {
ambLight.setColor(new ColorRGBA(1f, 1f, 0.8f, 0.2f)); ambLight.setColor(new ColorRGBA(1f, 1f, 0.8f, 0.2f));
rootNode.addLight(ambLight); rootNode.addLight(ambLight);
getCamera().getLocation().y = 10; cam.setLocation(new Vector3f(0, 10, -10));
getCamera().setDirection(new Vector3f(0, -1.5f, -1)); cam.lookAtDirection(new Vector3f(0, -1.5f, -1).normalizeLocal(), Vector3f.UNIT_Y);
} }
public void loadHintText() { public void loadHintText() {

@ -183,8 +183,8 @@ public class TerrainTestCollision extends SimpleApplication {
dl.setColor(new ColorRGBA(0.50f, 0.40f, 0.50f, 1.0f)); dl.setColor(new ColorRGBA(0.50f, 0.40f, 0.50f, 1.0f));
rootNode.addLight(dl); rootNode.addLight(dl);
getCamera().getLocation().y = 25; cam.setLocation(new Vector3f(0, 25, -10));
getCamera().setDirection(new Vector3f(0, -1, 0)); cam.lookAtDirection(new Vector3f(0, -1, 0).normalizeLocal(), Vector3f.UNIT_Y);
} }
public void loadHintText() { public void loadHintText() {
@ -274,7 +274,7 @@ public class TerrainTestCollision extends SimpleApplication {
collisionMarker.setLocalTranslation(new Vector3f(hit.getContactPoint().x, height, hit.getContactPoint().z)); collisionMarker.setLocalTranslation(new Vector3f(hit.getContactPoint().x, height, hit.getContactPoint().z));
} }
} else if (binding.equals("cameraDown") && !keyPressed) { } else if (binding.equals("cameraDown") && !keyPressed) {
getCamera().setDirection(new Vector3f(0, -1, 0)); getCamera().lookAtDirection(new Vector3f(0, -1, 0), Vector3f.UNIT_Y);
} else if (binding.equals("Lefts") && !keyPressed) { } else if (binding.equals("Lefts") && !keyPressed) {
Vector3f oldLoc = selectedCollisionObject.getLocalTranslation().clone(); Vector3f oldLoc = selectedCollisionObject.getLocalTranslation().clone();
selectedCollisionObject.move(-0.5f, 0, 0); selectedCollisionObject.move(-0.5f, 0, 0);

@ -153,8 +153,8 @@ public class TerrainTestModifyHeight extends SimpleApplication {
ambLight.setColor(new ColorRGBA(1f, 1f, 0.8f, 0.2f)); ambLight.setColor(new ColorRGBA(1f, 1f, 0.8f, 0.2f));
rootNode.addLight(ambLight); rootNode.addLight(ambLight);
getCamera().getLocation().y = 10; cam.setLocation(new Vector3f(0, 10, -10));
getCamera().setDirection(new Vector3f(0, -1.5f, -1)); cam.lookAtDirection(new Vector3f(0, -1.5f, -1).normalizeLocal(), Vector3f.UNIT_Y);
} }
public void loadHintText() { public void loadHintText() {

@ -129,7 +129,7 @@ public class TerrainTestReadWrite extends SimpleApplication {
matTerrain.setFloat("DiffuseMap_2_scale", rockScale); matTerrain.setFloat("DiffuseMap_2_scale", rockScale);
Texture normalMap0 = assetManager.loadTexture("Textures/Terrain/splat/grass_normal.png"); Texture normalMap0 = assetManager.loadTexture("Textures/Terrain/splat/grass_normal.jpg");
normalMap0.setWrap(WrapMode.Repeat); normalMap0.setWrap(WrapMode.Repeat);
Texture normalMap1 = assetManager.loadTexture("Textures/Terrain/splat/dirt_normal.png"); Texture normalMap1 = assetManager.loadTexture("Textures/Terrain/splat/dirt_normal.png");
normalMap1.setWrap(WrapMode.Repeat); normalMap1.setWrap(WrapMode.Repeat);

@ -1,92 +0,0 @@
/*
* 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.texture;
import com.jme3.app.SimpleApplication;
import com.jme3.asset.TextureKey;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Quad;
import com.jme3.texture.Texture;
public class TestNormalLatc extends SimpleApplication {
private Quad quadMesh;
public static void main(String[] args){
TestNormalLatc app = new TestNormalLatc();
app.start();
}
public Geometry createQuad(float side, String texName, boolean latc){
Geometry quad = new Geometry("Textured Quad", quadMesh);
TextureKey key = new TextureKey(texName, true);
key.setGenerateMips(false);
Texture tex = assetManager.loadTexture(key);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", tex);
// mat.setBoolean("Normalize", true);
if (latc)
mat.setBoolean("LATC", true);
quad.setMaterial(mat);
float aspect = tex.getImage().getWidth() / (float) tex.getImage().getHeight();
quad.setLocalScale(new Vector3f(aspect * 5, 5, 1));
quad.center();
quad.setLocalTranslation(quad.getLocalTranslation().x + quad.getLocalScale().x * side, 0, 0);
return quad;
}
public void simpleInitApp() {
BitmapFont font = assetManager.loadFont("Interface/Fonts/Default.fnt");
BitmapText txt = new BitmapText(font, false);
txt.setText("Left: LATC, Middle: JPG, Right: DXT1nm");
txt.setLocalTranslation(0, txt.getLineHeight() * 2, 0);
guiNode.attachChild(txt);
// create a simple plane/quad
quadMesh = new Quad(1, 1);
quadMesh.updateGeometry(1, 1, false);
rootNode.attachChild(createQuad(-1f, "Textures/BumpMapTest/Dot3_latc.dds", true));
rootNode.attachChild(createQuad(0f, "Textures/BumpMapTest/Dot3.jpg", false));
rootNode.attachChild(createQuad(1f, "Textures/BumpMapTest/Dot3_dxt1.dds", false));
}
}
Loading…
Cancel
Save