* Fix hard edge bug for spot lights on NVIDIA cards

* Fix bump mapping issue that was there since the beginning of time ... flipping normal.y only worked for pond_normal.png texture and IS NOT CORRECT in most cases. Now the texture itself has been adjusted to be correct while the flipping of normal.y removed
 * Fix crash when playing sound in simpleInitApp()
 * Fix issue where Spatial.setModelBound() would do absolutely nothing
 * Skies created via SkyFactory now don't suffer from "premature culling" bug

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8010 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..rd 13 years ago
parent 6c2332d833
commit 2636343ac7
  1. 8
      engine/src/core-data/Common/MatDefs/Light/Lighting.frag
  2. 2
      engine/src/core/com/jme3/app/Application.java
  3. 7
      engine/src/core/com/jme3/scene/Geometry.java
  4. 6
      engine/src/core/com/jme3/util/SkyFactory.java
  5. 2
      engine/src/test-data/Textures/Terrain/Pond/Pond.j3m
  6. BIN
      engine/src/test-data/Textures/Terrain/Pond/Pond.png
  7. BIN
      engine/src/test-data/Textures/Terrain/Pond/Pond_normal.png
  8. 4
      engine/src/test/jme3test/asset/TestAbsoluteLocators.java
  9. 2
      engine/src/test/jme3test/bullet/TestBrickTower.java
  10. 2
      engine/src/test/jme3test/bullet/TestBrickWall.java
  11. 2
      engine/src/test/jme3test/helloworld/HelloMaterial.java
  12. 2
      engine/src/test/jme3test/helloworld/HelloPhysics.java
  13. 2
      engine/src/test/jme3test/terrain/TerrainTestAdvanced.java
  14. 4
      engine/src/tools/jme3tools/converters/ImageToAwt.java

@ -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)

@ -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);

@ -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) {

@ -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();

@ -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
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 654 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 KiB

After

Width:  |  Height:  |  Size: 490 KiB

@ -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!");
}

@ -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);

@ -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);

@ -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);

@ -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);

@ -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);

@ -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];

Loading…
Cancel
Save