diff --git a/engine/src/core-data/Common/MatDefs/Light/Lighting.frag b/engine/src/core-data/Common/MatDefs/Light/Lighting.frag index 33843ffec..285247042 100644 --- a/engine/src/core-data/Common/MatDefs/Light/Lighting.frag +++ b/engine/src/core-data/Common/MatDefs/Light/Lighting.frag @@ -173,11 +173,15 @@ void main(){ float innerAngleCos = floor(g_LightDirection.w) * 0.001; float outerAngleCos = fract(g_LightDirection.w); float innerMinusOuter = innerAngleCos - outerAngleCos; - spotFallOff = clamp((curAngleCos - outerAngleCos) / innerMinusOuter, 0.0, 1.0); + + spotFallOff = (curAngleCos - outerAngleCos) / innerMinusOuter; + if(spotFallOff <= 0.0){ gl_FragColor.rgb = AmbientSum * diffuseColor.rgb; gl_FragColor.a = alpha; return; + }else{ + spotFallOff = clamp(spotFallOff, 0.0, 1.0); } } #endif @@ -191,7 +195,7 @@ void main(){ #ifdef LATC normal.z = sqrt(1.0 - (normal.x * normal.x) - (normal.y * normal.y)); #endif - normal.y = -normal.y; + //normal.y = -normal.y; #elif !defined(VERTEX_LIGHTING) vec3 normal = vNormal; #if !defined(LOW_QUALITY) && !defined(V_TANGENT) diff --git a/engine/src/core/com/jme3/app/Application.java b/engine/src/core/com/jme3/app/Application.java index 84a7bf23d..1a9fbe8a9 100644 --- a/engine/src/core/com/jme3/app/Application.java +++ b/engine/src/core/com/jme3/app/Application.java @@ -210,6 +210,7 @@ public class Application implements SystemListener { if (settings.getAudioRenderer() != null){ audioRenderer = JmeSystem.newAudioRenderer(settings); audioRenderer.initialize(); + AudioContext.setAudioRenderer(audioRenderer); listener = new Listener(); audioRenderer.setListener(listener); @@ -544,7 +545,6 @@ public class Application implements SystemListener { * Callback from ContextListener. */ public void update(){ - // Make sure the audio renderer is available to callables AudioContext.setAudioRenderer(audioRenderer); diff --git a/engine/src/core/com/jme3/scene/Geometry.java b/engine/src/core/com/jme3/scene/Geometry.java index c459c97b8..9e687eb8b 100644 --- a/engine/src/core/com/jme3/scene/Geometry.java +++ b/engine/src/core/com/jme3/scene/Geometry.java @@ -315,7 +315,12 @@ public class Geometry extends Spatial { public void setModelBound(BoundingVolume modelBound) { this.worldBound = null; mesh.setBound(modelBound); - updateModelBound(); + setBoundRefresh(); + + // NOTE: Calling updateModelBound() would cause the mesh + // to recompute the bound based on the geometry thus making + // this call useless! + //updateModelBound(); } public int collideWith(Collidable other, CollisionResults results) { diff --git a/engine/src/core/com/jme3/util/SkyFactory.java b/engine/src/core/com/jme3/util/SkyFactory.java index 1a7de75e7..0f577b412 100644 --- a/engine/src/core/com/jme3/util/SkyFactory.java +++ b/engine/src/core/com/jme3/util/SkyFactory.java @@ -2,6 +2,7 @@ package com.jme3.util; import com.jme3.asset.AssetManager; import com.jme3.asset.TextureKey; +import com.jme3.bounding.BoundingSphere; import com.jme3.material.Material; import com.jme3.math.Vector3f; import com.jme3.renderer.queue.RenderQueue.Bucket; @@ -18,9 +19,13 @@ public class SkyFactory { private static final Sphere sphereMesh = new Sphere(10, 10, 10, false, true); public static Spatial createSky(AssetManager assetManager, Texture texture, Vector3f normalScale, boolean sphereMap){ + if (texture == null) + throw new IllegalArgumentException("texture cannot be null"); + Geometry sky = new Geometry("Sky", sphereMesh); sky.setQueueBucket(Bucket.Sky); sky.setCullHint(Spatial.CullHint.Never); + sky.setModelBound(new BoundingSphere(Float.POSITIVE_INFINITY, Vector3f.ZERO)); Material skyMat = new Material(assetManager, "Common/MatDefs/Misc/Sky.j3md"); @@ -72,6 +77,7 @@ public class SkyFactory { Geometry sky = new Geometry("Sky", sphereMesh); sky.setQueueBucket(Bucket.Sky); sky.setCullHint(Spatial.CullHint.Never); + sky.setModelBound(new BoundingSphere(Float.POSITIVE_INFINITY, Vector3f.ZERO)); Image westImg = west.getImage(); Image eastImg = east.getImage(); diff --git a/engine/src/test-data/Textures/Terrain/Pond/Pond.j3m b/engine/src/test-data/Textures/Terrain/Pond/Pond.j3m index 3ae6f8243..a7aa9181e 100644 --- a/engine/src/test-data/Textures/Terrain/Pond/Pond.j3m +++ b/engine/src/test-data/Textures/Terrain/Pond/Pond.j3m @@ -1,7 +1,7 @@ Material Pong Rock : Common/MatDefs/Light/Lighting.j3md { MaterialParameters { Shininess: 8.0 - DiffuseMap: Repeat Textures/Terrain/Pond/Pond.png + DiffuseMap: Repeat Textures/Terrain/Pond/Pond.jpg NormalMap: Repeat Textures/Terrain/Pond/Pond_normal.png } } \ No newline at end of file diff --git a/engine/src/test-data/Textures/Terrain/Pond/Pond.png b/engine/src/test-data/Textures/Terrain/Pond/Pond.png deleted file mode 100644 index bd0794eb0..000000000 Binary files a/engine/src/test-data/Textures/Terrain/Pond/Pond.png and /dev/null differ diff --git a/engine/src/test-data/Textures/Terrain/Pond/Pond_normal.png b/engine/src/test-data/Textures/Terrain/Pond/Pond_normal.png index 081e39e67..6f5f7095d 100644 Binary files a/engine/src/test-data/Textures/Terrain/Pond/Pond_normal.png and b/engine/src/test-data/Textures/Terrain/Pond/Pond_normal.png differ diff --git a/engine/src/test/jme3test/asset/TestAbsoluteLocators.java b/engine/src/test/jme3test/asset/TestAbsoluteLocators.java index c56d9e286..0e271f094 100644 --- a/engine/src/test/jme3test/asset/TestAbsoluteLocators.java +++ b/engine/src/test/jme3test/asset/TestAbsoluteLocators.java @@ -54,7 +54,7 @@ public class TestAbsoluteLocators { AudioData audio = am.loadAudio("Sound/Effects/Gun.wav"); // find a texture - Texture tex = am.loadTexture("Textures/Terrain/Pond/Pond.png"); + Texture tex = am.loadTexture("Textures/Terrain/Pond/Pond.jpg"); if (audio == null) throw new RuntimeException("Cannot find audio!"); @@ -64,7 +64,7 @@ public class TestAbsoluteLocators { if (tex == null) throw new RuntimeException("Cannot find texture!"); else - System.out.println("Texture loaded from Textures/Terrain/Pond/Pond.png"); + System.out.println("Texture loaded from Textures/Terrain/Pond/Pond.jpg"); System.out.println("Success!"); } diff --git a/engine/src/test/jme3test/bullet/TestBrickTower.java b/engine/src/test/jme3test/bullet/TestBrickTower.java index a1fbee7ee..13fe0f974 100644 --- a/engine/src/test/jme3test/bullet/TestBrickTower.java +++ b/engine/src/test/jme3test/bullet/TestBrickTower.java @@ -203,7 +203,7 @@ public class TestBrickTower extends SimpleApplication { mat2.setTexture("ColorMap", tex2); mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); - TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.png"); + TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.jpg"); key3.setGenerateMips(true); Texture tex3 = assetManager.loadTexture(key3); tex3.setWrap(WrapMode.Repeat); diff --git a/engine/src/test/jme3test/bullet/TestBrickWall.java b/engine/src/test/jme3test/bullet/TestBrickWall.java index 3f5596094..198a238f1 100644 --- a/engine/src/test/jme3test/bullet/TestBrickWall.java +++ b/engine/src/test/jme3test/bullet/TestBrickWall.java @@ -177,7 +177,7 @@ public class TestBrickWall extends SimpleApplication { mat2.setTexture("ColorMap", tex2); mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); - TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.png"); + TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.jpg"); key3.setGenerateMips(true); Texture tex3 = assetManager.loadTexture(key3); tex3.setWrap(WrapMode.Repeat); diff --git a/engine/src/test/jme3test/helloworld/HelloMaterial.java b/engine/src/test/jme3test/helloworld/HelloMaterial.java index 1d07c42cd..8e94ff43c 100644 --- a/engine/src/test/jme3test/helloworld/HelloMaterial.java +++ b/engine/src/test/jme3test/helloworld/HelloMaterial.java @@ -93,7 +93,7 @@ public class HelloMaterial extends SimpleApplication { rock.setTextureMode(Sphere.TextureMode.Projected); // better quality on spheres TangentBinormalGenerator.generate(rock); // for lighting effect Material mat_lit = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md"); - mat_lit.setTexture("DiffuseMap", assetManager.loadTexture("Textures/Terrain/Pond/Pond.png")); + mat_lit.setTexture("DiffuseMap", assetManager.loadTexture("Textures/Terrain/Pond/Pond.jpg")); mat_lit.setTexture("NormalMap", assetManager.loadTexture("Textures/Terrain/Pond/Pond_normal.png")); mat_lit.setFloat("Shininess", 5f); // [0,128] shiny_rock.setMaterial(mat_lit); diff --git a/engine/src/test/jme3test/helloworld/HelloPhysics.java b/engine/src/test/jme3test/helloworld/HelloPhysics.java index 38348a748..3c78b114d 100644 --- a/engine/src/test/jme3test/helloworld/HelloPhysics.java +++ b/engine/src/test/jme3test/helloworld/HelloPhysics.java @@ -146,7 +146,7 @@ public class HelloPhysics extends SimpleApplication { stone_mat.setTexture("ColorMap", tex2); floor_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); - TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.png"); + TextureKey key3 = new TextureKey("Textures/Terrain/Pond/Pond.jpg"); key3.setGenerateMips(true); Texture tex3 = assetManager.loadTexture(key3); tex3.setWrap(WrapMode.Repeat); diff --git a/engine/src/test/jme3test/terrain/TerrainTestAdvanced.java b/engine/src/test/jme3test/terrain/TerrainTestAdvanced.java index ebeddfd62..0f2da8137 100644 --- a/engine/src/test/jme3test/terrain/TerrainTestAdvanced.java +++ b/engine/src/test/jme3test/terrain/TerrainTestAdvanced.java @@ -131,7 +131,7 @@ public class TerrainTestAdvanced extends SimpleApplication { matTerrain.setFloat("DiffuseMap_3_scale", rockScale); // RIVER ROCK texture - Texture riverRock = assetManager.loadTexture("Textures/Terrain/Pond/Pond.png"); + Texture riverRock = assetManager.loadTexture("Textures/Terrain/Pond/Pond.jpg"); riverRock.setWrap(WrapMode.Repeat); matTerrain.setTexture("DiffuseMap_4", riverRock); matTerrain.setFloat("DiffuseMap_4_scale", rockScale); diff --git a/engine/src/tools/jme3tools/converters/ImageToAwt.java b/engine/src/tools/jme3tools/converters/ImageToAwt.java index 995dedfa2..3dc86c2e4 100644 --- a/engine/src/tools/jme3tools/converters/ImageToAwt.java +++ b/engine/src/tools/jme3tools/converters/ImageToAwt.java @@ -439,6 +439,10 @@ public class ImageToAwt { int expansionG = 8 - Integer.bitCount(p.gm); int expansionB = 8 - Integer.bitCount(p.bm); + if (expansionR < 0){ + expansionR = 0; + } + int mipPos = 0; for (int i = 0; i < mipLevel; i++){ mipPos += image.getMipMapSizes()[i];