* 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
15
engine/src/core/com/jme3/app/state/package.html
Normal file
@ -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>
|
19
engine/src/core/com/jme3/input/controls/package.html
Normal file
@ -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>
|
14
engine/src/core/com/jme3/input/dummy/package.html
Normal file
@ -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>
|
13
engine/src/core/com/jme3/input/event/package.html
Normal file
@ -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;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class Eigen3f {
|
||||
@ -381,7 +382,7 @@ public class Eigen3f {
|
||||
|
||||
logger.info("eigenvalues = ");
|
||||
for (int i = 0; i < 3; i++)
|
||||
logger.info(eigenSystem.getEigenValue(i) + " ");
|
||||
logger.log(Level.INFO, "{0} ", eigenSystem.getEigenValue(i));
|
||||
|
||||
logger.info("eigenvectors = ");
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
53
engine/src/core/com/jme3/math/package.html
Normal file
@ -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>
|
24
engine/src/core/com/jme3/post/package.html
Normal file
@ -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.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 {
|
||||
|
||||
/**
|
||||
* Get the capabilities of the renderer.
|
||||
* @return The capabilities of the renderer.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
public Statistics getStatistics();
|
||||
|
@ -32,7 +32,17 @@
|
||||
|
||||
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 {
|
||||
|
||||
/**
|
||||
* Creates a new isntance of <code>RendererException</code>
|
||||
*/
|
||||
public RendererException(String message){
|
||||
super(message);
|
||||
}
|
||||
|
@ -38,6 +38,13 @@ import com.jme3.texture.FrameBuffer;
|
||||
import com.jme3.texture.Image;
|
||||
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 {
|
||||
|
||||
protected int numObjects;
|
||||
@ -56,6 +63,13 @@ public class Statistics {
|
||||
protected HashSet<Integer> texturesUsed = 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(){
|
||||
return new String[]{ "Vertices",
|
||||
"Triangles",
|
||||
@ -176,6 +190,9 @@ public class Statistics {
|
||||
memoryFrameBuffers --;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when video memory is cleared.
|
||||
*/
|
||||
public void clearMemory(){
|
||||
memoryFrameBuffers = 0;
|
||||
memoryShaders = 0;
|
||||
|
38
engine/src/core/com/jme3/renderer/package.html
Normal file
@ -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.setFrustumPerspective(45, 1, 1, 20);
|
||||
|
||||
shadowCam.setDirection(direction);
|
||||
shadowCam.lookAtDirection(direction, Vector3f.UNIT_Y);
|
||||
shadowCam.update();
|
||||
shadowCam.setLocation(frustaCenter);
|
||||
shadowCam.update();
|
||||
|
@ -58,7 +58,7 @@ public class ShadowCamera {
|
||||
DirectionalLight dl = (DirectionalLight) target;
|
||||
lightCam.setParallelProjection(true);
|
||||
lightCam.setLocation(Vector3f.ZERO);
|
||||
lightCam.setDirection(dl.getDirection());
|
||||
lightCam.lookAtDirection(dl.getDirection(), Vector3f.UNIT_Y );
|
||||
lightCam.setFrustum(-1, 1, -1, 1, 1, -1);
|
||||
}else{
|
||||
PointLight pl = (PointLight) target;
|
||||
|
@ -4,18 +4,17 @@
|
||||
*/
|
||||
package com.jme3.terrain.heightmap;
|
||||
|
||||
import com.jme3.asset.AssetInfo;
|
||||
import com.jme3.asset.AssetKey;
|
||||
import com.jme3.asset.AssetManager;
|
||||
import com.jme3.asset.AssetNotFoundException;
|
||||
import com.jme3.math.FastMath;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.texture.Texture;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.imageio.ImageIO;
|
||||
import jme3tools.converters.ImageToAwt;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -23,6 +22,7 @@ import jme3tools.converters.ImageToAwt;
|
||||
*/
|
||||
public class ImageBasedHeightMapGrid implements HeightMapGrid {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ImageBasedHeightMapGrid.class.getName());
|
||||
private final AssetManager assetManager;
|
||||
private final Namer namer;
|
||||
private int size;
|
||||
@ -45,17 +45,20 @@ public class ImageBasedHeightMapGrid implements HeightMapGrid {
|
||||
// HEIGHTMAP image (for the terrain heightmap)
|
||||
int x = (int) location.x;
|
||||
int z = (int) location.z;
|
||||
|
||||
AbstractHeightMap heightmap = null;
|
||||
BufferedImage im = null;
|
||||
|
||||
try {
|
||||
String name = namer.getName(x, z);
|
||||
Logger.getLogger(ImageBasedHeightMapGrid.class.getCanonicalName()).log(Level.INFO, "Loading heightmap from file: " + name);
|
||||
final InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
|
||||
BufferedImage im = null;
|
||||
if (stream != null) {
|
||||
im = ImageIO.read(stream);
|
||||
logger.log(Level.INFO, "Loading heightmap from file: {0}", name);
|
||||
final AssetInfo assetInfo = assetManager.locateAsset(new AssetKey(name));
|
||||
if (assetInfo != null){
|
||||
InputStream in = assetInfo.openStream();
|
||||
im = ImageIO.read(in);
|
||||
} else {
|
||||
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
|
||||
heightmap = new Grayscale16BitHeightMap(im);
|
||||
|
Before ![]() (image error) Size: 91 KiB After ![]() (image error) Size: 91 KiB ![]() ![]() |
Before ![]() (image error) Size: 444 KiB |
Before ![]() (image error) Size: 437 KiB |
Before ![]() (image error) Size: 424 KiB |
Before ![]() (image error) Size: 358 KiB |
Before ![]() (image error) Size: 370 KiB |
Before ![]() (image error) Size: 415 KiB |
Before ![]() (image error) Size: 438 KiB |
Before ![]() (image error) Size: 430 KiB |
Before ![]() (image error) Size: 420 KiB |
Before ![]() (image error) Size: 445 KiB |
Before ![]() (image error) Size: 395 KiB |
Before ![]() (image error) Size: 410 KiB |
Before ![]() (image error) Size: 414 KiB |
Before ![]() (image error) Size: 420 KiB |
Before ![]() (image error) Size: 442 KiB |
Before ![]() (image error) Size: 336 KiB |
Before ![]() (image error) Size: 444 KiB |
Before ![]() (image error) Size: 428 KiB |
Before ![]() (image error) Size: 374 KiB |
Before ![]() (image error) Size: 428 KiB |
Before ![]() (image error) Size: 420 KiB |
Before ![]() (image error) Size: 436 KiB |
Before ![]() (image error) Size: 450 KiB |
Before ![]() (image error) Size: 446 KiB |
Before ![]() (image error) Size: 436 KiB |
Before ![]() (image error) Size: 429 KiB |
Before ![]() (image error) Size: 416 KiB |
Before ![]() (image error) Size: 430 KiB |
Before ![]() (image error) Size: 432 KiB |
Before ![]() (image error) Size: 414 KiB |
Before ![]() (image error) Size: 424 KiB |
Before ![]() (image error) Size: 439 KiB |
Before ![]() (image error) Size: 426 KiB |
Before ![]() (image error) Size: 432 KiB |
Before ![]() (image error) Size: 338 KiB |
Before ![]() (image error) Size: 414 KiB |
Before ![]() (image error) Size: 422 KiB |
Before ![]() (image error) Size: 425 KiB |
Before ![]() (image error) Size: 424 KiB |
Before ![]() (image error) Size: 381 KiB |
@ -5,6 +5,8 @@ import java.util.List;
|
||||
|
||||
import com.jme3.app.SimpleApplication;
|
||||
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.collision.shapes.CapsuleCollisionShape;
|
||||
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.texture.Texture;
|
||||
import com.jme3.texture.Texture.WrapMode;
|
||||
import java.io.File;
|
||||
import org.novyon.noise.ShaderUtils;
|
||||
import org.novyon.noise.basis.FilteredBasis;
|
||||
import org.novyon.noise.filter.IterativeFilter;
|
||||
@ -56,6 +59,13 @@ public class TerrainGridTest extends SimpleApplication {
|
||||
|
||||
@Override
|
||||
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);
|
||||
ScreenshotAppState state = new ScreenshotAppState();
|
||||
this.stateManager.attach(state);
|
||||
@ -86,7 +96,7 @@ public class TerrainGridTest extends SimpleApplication {
|
||||
this.mat_terrain.setVector3("region2", new Vector3f(0, 90, this.dirtScale));
|
||||
|
||||
// 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);
|
||||
this.mat_terrain.setTexture("region3ColorMap", rock);
|
||||
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.setScale(0.02125f);
|
||||
this.base.addModulator(new NoiseModulator() {
|
||||
|
||||
@Override
|
||||
public float value(float... in) {
|
||||
return ShaderUtils.clamp(in[0] * 0.5f + 0.5f, 0, 1);
|
||||
@ -133,9 +142,8 @@ public class TerrainGridTest extends SimpleApplication {
|
||||
ground.addPreFilter(this.iterate);
|
||||
|
||||
this.terrain = new TerrainGrid("terrain", 65, 1025, new ImageBasedHeightMapGrid(assetManager, new Namer() {
|
||||
|
||||
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());
|
||||
rootNode.addLight(light);
|
||||
|
||||
getCamera().getLocation().y = 10;
|
||||
getCamera().setDirection(new Vector3f(0, -1.5f, -1));
|
||||
cam.setLocation(new Vector3f(0, 10, -10));
|
||||
cam.lookAtDirection(new Vector3f(0, -1.5f, -1).normalizeLocal(), Vector3f.UNIT_Y);
|
||||
}
|
||||
|
||||
public void loadHintText() {
|
||||
|
@ -129,7 +129,7 @@ public class TerrainTestAdvanced extends SimpleApplication {
|
||||
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);
|
||||
Texture normalMap1 = assetManager.loadTexture("Textures/Terrain/splat/dirt_normal.png");
|
||||
normalMap1.setWrap(WrapMode.Repeat);
|
||||
@ -187,8 +187,8 @@ public class TerrainTestAdvanced extends SimpleApplication {
|
||||
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));
|
||||
cam.setLocation(new Vector3f(0, 10, -10));
|
||||
cam.lookAtDirection(new Vector3f(0, -1.5f, -1).normalizeLocal(), Vector3f.UNIT_Y);
|
||||
}
|
||||
|
||||
public void loadHintText() {
|
||||
|
@ -183,8 +183,8 @@ public class TerrainTestCollision extends SimpleApplication {
|
||||
dl.setColor(new ColorRGBA(0.50f, 0.40f, 0.50f, 1.0f));
|
||||
rootNode.addLight(dl);
|
||||
|
||||
getCamera().getLocation().y = 25;
|
||||
getCamera().setDirection(new Vector3f(0, -1, 0));
|
||||
cam.setLocation(new Vector3f(0, 25, -10));
|
||||
cam.lookAtDirection(new Vector3f(0, -1, 0).normalizeLocal(), Vector3f.UNIT_Y);
|
||||
}
|
||||
|
||||
public void loadHintText() {
|
||||
@ -274,7 +274,7 @@ public class TerrainTestCollision extends SimpleApplication {
|
||||
collisionMarker.setLocalTranslation(new Vector3f(hit.getContactPoint().x, height, hit.getContactPoint().z));
|
||||
}
|
||||
} 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) {
|
||||
Vector3f oldLoc = selectedCollisionObject.getLocalTranslation().clone();
|
||||
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));
|
||||
rootNode.addLight(ambLight);
|
||||
|
||||
getCamera().getLocation().y = 10;
|
||||
getCamera().setDirection(new Vector3f(0, -1.5f, -1));
|
||||
cam.setLocation(new Vector3f(0, 10, -10));
|
||||
cam.lookAtDirection(new Vector3f(0, -1.5f, -1).normalizeLocal(), Vector3f.UNIT_Y);
|
||||
}
|
||||
|
||||
public void loadHintText() {
|
||||
|
@ -129,7 +129,7 @@ public class TerrainTestReadWrite extends SimpleApplication {
|
||||
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);
|
||||
Texture normalMap1 = assetManager.loadTexture("Textures/Terrain/splat/dirt_normal.png");
|
||||
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));
|
||||
}
|
||||
|
||||
}
|