From 65d83b37f07283de57cc4840dd1abbb82894fe6d Mon Sep 17 00:00:00 2001 From: shadowislord Date: Tue, 3 Jun 2014 22:58:33 -0400 Subject: [PATCH] * Deprecated LTC and LATC texture formats, OpenGL3+ does not support them. Instead RGTC / BC5 must be used. * Add missing license to InstancedGeometry. * Minor cosmetic / doc changes. --- .../main/java/com/jme3/light/LightList.java | 2 +- .../src/main/java/com/jme3/post/Filter.java | 1 - .../scene/instancing/InstancedGeometry.java | 31 ++++++++++++++++ .../src/main/java/com/jme3/texture/Image.java | 35 ++++++++++++++++--- .../texture/image/ByteOffsetImageCodec.java | 2 +- .../com/jme3/shader/plugins/GLSLLoader.java | 3 +- .../src/main/java/jme3test/post/TestHDR.java | 10 +----- 7 files changed, 67 insertions(+), 17 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/light/LightList.java b/jme3-core/src/main/java/com/jme3/light/LightList.java index ebb97a2a8..fc08df2c2 100644 --- a/jme3-core/src/main/java/com/jme3/light/LightList.java +++ b/jme3-core/src/main/java/com/jme3/light/LightList.java @@ -186,7 +186,7 @@ public final class LightList implements Iterable, Savable, Cloneable { } /** - * Sorts the elements in the list acording to their Comparator. + * Sorts the elements in the list according to their Comparator. * There are two reasons why lights should be resorted. * First, if the lights have moved, that means their distance to * the spatial changed. diff --git a/jme3-core/src/main/java/com/jme3/post/Filter.java b/jme3-core/src/main/java/com/jme3/post/Filter.java index ba94772b5..320ff734d 100644 --- a/jme3-core/src/main/java/com/jme3/post/Filter.java +++ b/jme3-core/src/main/java/com/jme3/post/Filter.java @@ -40,7 +40,6 @@ import com.jme3.renderer.Renderer; import com.jme3.renderer.ViewPort; import com.jme3.renderer.queue.RenderQueue; import com.jme3.texture.FrameBuffer; -import com.jme3.texture.Image; import com.jme3.texture.Image.Format; import com.jme3.texture.Texture; import com.jme3.texture.Texture2D; diff --git a/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedGeometry.java b/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedGeometry.java index 1a573ea84..86f922c2a 100644 --- a/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedGeometry.java +++ b/jme3-core/src/main/java/com/jme3/scene/instancing/InstancedGeometry.java @@ -1,3 +1,34 @@ +/* + * Copyright (c) 2009-2012 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 com.jme3.scene.instancing; import com.jme3.export.InputCapsule; diff --git a/jme3-core/src/main/java/com/jme3/texture/Image.java b/jme3-core/src/main/java/com/jme3/texture/Image.java index 0f0038b18..069852408 100644 --- a/jme3-core/src/main/java/com/jme3/texture/Image.java +++ b/jme3-core/src/main/java/com/jme3/texture/Image.java @@ -79,11 +79,15 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ { /** * half-precision floating-point grayscale/luminance. + * + * Requires {@link Caps#FloatTexture}. */ Luminance16F(16,true), /** * single-precision floating-point grayscale/luminance. + * + * Requires {@link Caps#FloatTexture}. */ Luminance32F(32,true), @@ -99,6 +103,8 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ { /** * half-precision floating-point grayscale/luminance and alpha. + * + * Requires {@link Caps#FloatTexture}. */ Luminance16FAlpha16F(32,true), @@ -168,7 +174,6 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ { /** * S3TC compression DXT1. - * Called BC1 in DirectX10. */ DXT1(4,false,true, false), @@ -179,20 +184,21 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ { /** * S3TC compression DXT3 with 4-bit alpha. - * Called BC2 in DirectX10. */ DXT3(8,false,true, false), /** * S3TC compression DXT5 with interpolated 8-bit alpha. - * Called BC3 in DirectX10. + * */ DXT5(8,false,true, false), /** * Luminance-Alpha Texture Compression. - * Called BC5 in DirectX10. + * + * @deprecated Not supported by OpenGL 3.0. */ + @Deprecated LATC(8, false, true, false), /** @@ -218,6 +224,8 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ { /** * single-precision floating point depth. + * + * Requires {@link Caps#FloatDepthBuffer}. */ Depth32F(32,true,false,true), @@ -225,11 +233,15 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ { * Texture data is stored as {@link Format#RGB16F} in system memory, * but will be converted to {@link Format#RGB111110F} when sent * to the video hardware. + * + * Requires {@link Caps#FloatTexture} and {@link Caps#PackedFloatTexture}. */ RGB16F_to_RGB111110F(48,true), /** * unsigned floating-point red, green and blue that uses 32 bits. + * + * Requires {@link Caps#PackedFloatTexture}. */ RGB111110F(32,true), @@ -237,38 +249,53 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ { * Texture data is stored as {@link Format#RGB16F} in system memory, * but will be converted to {@link Format#RGB9E5} when sent * to the video hardware. + * + * Requires {@link Caps#FloatTexture} and {@link Caps#SharedExponentTexture}. */ RGB16F_to_RGB9E5(48,true), /** * 9-bit red, green and blue with 5-bit exponent. + * + * Requires {@link Caps#SharedExponentTexture}. */ RGB9E5(32,true), /** * half-precision floating point red, green, and blue. + * + * Requires {@link Caps#FloatTexture}. */ RGB16F(48,true), /** * half-precision floating point red, green, blue, and alpha. + * + * Requires {@link Caps#FloatTexture}. */ RGBA16F(64,true), /** * single-precision floating point red, green, and blue. + * + * Requires {@link Caps#FloatTexture}. */ RGB32F(96,true), /** * single-precision floating point red, green, blue and alpha. + * + * Requires {@link Caps#FloatTexture}. */ RGBA32F(128,true), /** * Luminance/grayscale texture compression. * Called BC4 in DirectX10. + * + * @deprecated Not supported by OpenGL 3.0. */ + @Deprecated LTC(4, false, true, false), /** diff --git a/jme3-core/src/main/java/com/jme3/texture/image/ByteOffsetImageCodec.java b/jme3-core/src/main/java/com/jme3/texture/image/ByteOffsetImageCodec.java index 908bcdf0b..e0054d7e5 100644 --- a/jme3-core/src/main/java/com/jme3/texture/image/ByteOffsetImageCodec.java +++ b/jme3-core/src/main/java/com/jme3/texture/image/ByteOffsetImageCodec.java @@ -35,7 +35,7 @@ import java.nio.ByteBuffer; public class ByteOffsetImageCodec extends ImageCodec { - private int redPos, greenPos, bluePos, alphaPos; + private final int redPos, greenPos, bluePos, alphaPos; public ByteOffsetImageCodec(int bpp, int flags, int alphaPos, int redPos, int greenPos, int bluePos) { super(bpp, flags, alphaPos != -1 ? 255 : 0, diff --git a/jme3-core/src/plugins/java/com/jme3/shader/plugins/GLSLLoader.java b/jme3-core/src/plugins/java/com/jme3/shader/plugins/GLSLLoader.java index fbd4d4b95..b8aa155d0 100644 --- a/jme3-core/src/plugins/java/com/jme3/shader/plugins/GLSLLoader.java +++ b/jme3-core/src/plugins/java/com/jme3/shader/plugins/GLSLLoader.java @@ -80,8 +80,9 @@ public class GLSLLoader implements AssetLoader { ShaderDependencyNode node = new ShaderDependencyNode(nodeName); StringBuilder sb = new StringBuilder(); - BufferedReader bufReader = new BufferedReader(reader); + BufferedReader bufReader = null; try { + bufReader = new BufferedReader(reader); String ln; while ((ln = bufReader.readLine()) != null) { if (ln.trim().startsWith("#import ")) { diff --git a/jme3-examples/src/main/java/jme3test/post/TestHDR.java b/jme3-examples/src/main/java/jme3test/post/TestHDR.java index 7a44bc904..6cfcbdb7f 100644 --- a/jme3-examples/src/main/java/jme3test/post/TestHDR.java +++ b/jme3-examples/src/main/java/jme3test/post/TestHDR.java @@ -51,16 +51,11 @@ public class TestHDR extends SimpleApplication { } public Geometry createHDRBox(){ - Box boxMesh = new Box(Vector3f.ZERO, 1, 1, 1); + Box boxMesh = new Box(1, 1, 1); Geometry box = new Geometry("Box", boxMesh); - -// Material mat = assetManager.loadMaterial("Textures/HdrTest/Memorial.j3m"); -// box.setMaterial(mat); - Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", assetManager.loadTexture("Textures/HdrTest/Memorial.hdr")); box.setMaterial(mat); - return box; } @@ -73,11 +68,8 @@ public class TestHDR extends SimpleApplication { hdrRender.setMaxIterations(20); hdrRender.setExposure(0.87f); hdrRender.setThrottle(0.33f); - viewPort.addProcessor(hdrRender); - // config.setVisible(true); - rootNode.attachChild(createHDRBox()); }