* 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
This commit is contained in:
parent
6c2332d833
commit
2636343ac7
@ -173,11 +173,15 @@ void main(){
|
|||||||
float innerAngleCos = floor(g_LightDirection.w) * 0.001;
|
float innerAngleCos = floor(g_LightDirection.w) * 0.001;
|
||||||
float outerAngleCos = fract(g_LightDirection.w);
|
float outerAngleCos = fract(g_LightDirection.w);
|
||||||
float innerMinusOuter = innerAngleCos - outerAngleCos;
|
float innerMinusOuter = innerAngleCos - outerAngleCos;
|
||||||
spotFallOff = clamp((curAngleCos - outerAngleCos) / innerMinusOuter, 0.0, 1.0);
|
|
||||||
|
spotFallOff = (curAngleCos - outerAngleCos) / innerMinusOuter;
|
||||||
|
|
||||||
if(spotFallOff <= 0.0){
|
if(spotFallOff <= 0.0){
|
||||||
gl_FragColor.rgb = AmbientSum * diffuseColor.rgb;
|
gl_FragColor.rgb = AmbientSum * diffuseColor.rgb;
|
||||||
gl_FragColor.a = alpha;
|
gl_FragColor.a = alpha;
|
||||||
return;
|
return;
|
||||||
|
}else{
|
||||||
|
spotFallOff = clamp(spotFallOff, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -191,7 +195,7 @@ void main(){
|
|||||||
#ifdef LATC
|
#ifdef LATC
|
||||||
normal.z = sqrt(1.0 - (normal.x * normal.x) - (normal.y * normal.y));
|
normal.z = sqrt(1.0 - (normal.x * normal.x) - (normal.y * normal.y));
|
||||||
#endif
|
#endif
|
||||||
normal.y = -normal.y;
|
//normal.y = -normal.y;
|
||||||
#elif !defined(VERTEX_LIGHTING)
|
#elif !defined(VERTEX_LIGHTING)
|
||||||
vec3 normal = vNormal;
|
vec3 normal = vNormal;
|
||||||
#if !defined(LOW_QUALITY) && !defined(V_TANGENT)
|
#if !defined(LOW_QUALITY) && !defined(V_TANGENT)
|
||||||
|
@ -210,6 +210,7 @@ public class Application implements SystemListener {
|
|||||||
if (settings.getAudioRenderer() != null){
|
if (settings.getAudioRenderer() != null){
|
||||||
audioRenderer = JmeSystem.newAudioRenderer(settings);
|
audioRenderer = JmeSystem.newAudioRenderer(settings);
|
||||||
audioRenderer.initialize();
|
audioRenderer.initialize();
|
||||||
|
AudioContext.setAudioRenderer(audioRenderer);
|
||||||
|
|
||||||
listener = new Listener();
|
listener = new Listener();
|
||||||
audioRenderer.setListener(listener);
|
audioRenderer.setListener(listener);
|
||||||
@ -544,7 +545,6 @@ public class Application implements SystemListener {
|
|||||||
* Callback from ContextListener.
|
* Callback from ContextListener.
|
||||||
*/
|
*/
|
||||||
public void update(){
|
public void update(){
|
||||||
|
|
||||||
// Make sure the audio renderer is available to callables
|
// Make sure the audio renderer is available to callables
|
||||||
AudioContext.setAudioRenderer(audioRenderer);
|
AudioContext.setAudioRenderer(audioRenderer);
|
||||||
|
|
||||||
|
@ -315,7 +315,12 @@ public class Geometry extends Spatial {
|
|||||||
public void setModelBound(BoundingVolume modelBound) {
|
public void setModelBound(BoundingVolume modelBound) {
|
||||||
this.worldBound = null;
|
this.worldBound = null;
|
||||||
mesh.setBound(modelBound);
|
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) {
|
public int collideWith(Collidable other, CollisionResults results) {
|
||||||
|
@ -2,6 +2,7 @@ package com.jme3.util;
|
|||||||
|
|
||||||
import com.jme3.asset.AssetManager;
|
import com.jme3.asset.AssetManager;
|
||||||
import com.jme3.asset.TextureKey;
|
import com.jme3.asset.TextureKey;
|
||||||
|
import com.jme3.bounding.BoundingSphere;
|
||||||
import com.jme3.material.Material;
|
import com.jme3.material.Material;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.renderer.queue.RenderQueue.Bucket;
|
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);
|
private static final Sphere sphereMesh = new Sphere(10, 10, 10, false, true);
|
||||||
|
|
||||||
public static Spatial createSky(AssetManager assetManager, Texture texture, Vector3f normalScale, boolean sphereMap){
|
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);
|
Geometry sky = new Geometry("Sky", sphereMesh);
|
||||||
sky.setQueueBucket(Bucket.Sky);
|
sky.setQueueBucket(Bucket.Sky);
|
||||||
sky.setCullHint(Spatial.CullHint.Never);
|
sky.setCullHint(Spatial.CullHint.Never);
|
||||||
|
sky.setModelBound(new BoundingSphere(Float.POSITIVE_INFINITY, Vector3f.ZERO));
|
||||||
|
|
||||||
Material skyMat = new Material(assetManager, "Common/MatDefs/Misc/Sky.j3md");
|
Material skyMat = new Material(assetManager, "Common/MatDefs/Misc/Sky.j3md");
|
||||||
|
|
||||||
@ -72,6 +77,7 @@ public class SkyFactory {
|
|||||||
Geometry sky = new Geometry("Sky", sphereMesh);
|
Geometry sky = new Geometry("Sky", sphereMesh);
|
||||||
sky.setQueueBucket(Bucket.Sky);
|
sky.setQueueBucket(Bucket.Sky);
|
||||||
sky.setCullHint(Spatial.CullHint.Never);
|
sky.setCullHint(Spatial.CullHint.Never);
|
||||||
|
sky.setModelBound(new BoundingSphere(Float.POSITIVE_INFINITY, Vector3f.ZERO));
|
||||||
|
|
||||||
Image westImg = west.getImage();
|
Image westImg = west.getImage();
|
||||||
Image eastImg = east.getImage();
|
Image eastImg = east.getImage();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Material Pong Rock : Common/MatDefs/Light/Lighting.j3md {
|
Material Pong Rock : Common/MatDefs/Light/Lighting.j3md {
|
||||||
MaterialParameters {
|
MaterialParameters {
|
||||||
Shininess: 8.0
|
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
|
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");
|
AudioData audio = am.loadAudio("Sound/Effects/Gun.wav");
|
||||||
|
|
||||||
// find a texture
|
// find a texture
|
||||||
Texture tex = am.loadTexture("Textures/Terrain/Pond/Pond.png");
|
Texture tex = am.loadTexture("Textures/Terrain/Pond/Pond.jpg");
|
||||||
|
|
||||||
if (audio == null)
|
if (audio == null)
|
||||||
throw new RuntimeException("Cannot find audio!");
|
throw new RuntimeException("Cannot find audio!");
|
||||||
@ -64,7 +64,7 @@ public class TestAbsoluteLocators {
|
|||||||
if (tex == null)
|
if (tex == null)
|
||||||
throw new RuntimeException("Cannot find texture!");
|
throw new RuntimeException("Cannot find texture!");
|
||||||
else
|
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!");
|
System.out.println("Success!");
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ public class TestBrickTower extends SimpleApplication {
|
|||||||
mat2.setTexture("ColorMap", tex2);
|
mat2.setTexture("ColorMap", tex2);
|
||||||
|
|
||||||
mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
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);
|
key3.setGenerateMips(true);
|
||||||
Texture tex3 = assetManager.loadTexture(key3);
|
Texture tex3 = assetManager.loadTexture(key3);
|
||||||
tex3.setWrap(WrapMode.Repeat);
|
tex3.setWrap(WrapMode.Repeat);
|
||||||
|
@ -177,7 +177,7 @@ public class TestBrickWall extends SimpleApplication {
|
|||||||
mat2.setTexture("ColorMap", tex2);
|
mat2.setTexture("ColorMap", tex2);
|
||||||
|
|
||||||
mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
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);
|
key3.setGenerateMips(true);
|
||||||
Texture tex3 = assetManager.loadTexture(key3);
|
Texture tex3 = assetManager.loadTexture(key3);
|
||||||
tex3.setWrap(WrapMode.Repeat);
|
tex3.setWrap(WrapMode.Repeat);
|
||||||
|
@ -93,7 +93,7 @@ public class HelloMaterial extends SimpleApplication {
|
|||||||
rock.setTextureMode(Sphere.TextureMode.Projected); // better quality on spheres
|
rock.setTextureMode(Sphere.TextureMode.Projected); // better quality on spheres
|
||||||
TangentBinormalGenerator.generate(rock); // for lighting effect
|
TangentBinormalGenerator.generate(rock); // for lighting effect
|
||||||
Material mat_lit = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
|
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.setTexture("NormalMap", assetManager.loadTexture("Textures/Terrain/Pond/Pond_normal.png"));
|
||||||
mat_lit.setFloat("Shininess", 5f); // [0,128]
|
mat_lit.setFloat("Shininess", 5f); // [0,128]
|
||||||
shiny_rock.setMaterial(mat_lit);
|
shiny_rock.setMaterial(mat_lit);
|
||||||
|
@ -146,7 +146,7 @@ public class HelloPhysics extends SimpleApplication {
|
|||||||
stone_mat.setTexture("ColorMap", tex2);
|
stone_mat.setTexture("ColorMap", tex2);
|
||||||
|
|
||||||
floor_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
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);
|
key3.setGenerateMips(true);
|
||||||
Texture tex3 = assetManager.loadTexture(key3);
|
Texture tex3 = assetManager.loadTexture(key3);
|
||||||
tex3.setWrap(WrapMode.Repeat);
|
tex3.setWrap(WrapMode.Repeat);
|
||||||
|
@ -131,7 +131,7 @@ public class TerrainTestAdvanced extends SimpleApplication {
|
|||||||
matTerrain.setFloat("DiffuseMap_3_scale", rockScale);
|
matTerrain.setFloat("DiffuseMap_3_scale", rockScale);
|
||||||
|
|
||||||
// RIVER ROCK texture
|
// 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);
|
riverRock.setWrap(WrapMode.Repeat);
|
||||||
matTerrain.setTexture("DiffuseMap_4", riverRock);
|
matTerrain.setTexture("DiffuseMap_4", riverRock);
|
||||||
matTerrain.setFloat("DiffuseMap_4_scale", rockScale);
|
matTerrain.setFloat("DiffuseMap_4_scale", rockScale);
|
||||||
|
@ -439,6 +439,10 @@ public class ImageToAwt {
|
|||||||
int expansionG = 8 - Integer.bitCount(p.gm);
|
int expansionG = 8 - Integer.bitCount(p.gm);
|
||||||
int expansionB = 8 - Integer.bitCount(p.bm);
|
int expansionB = 8 - Integer.bitCount(p.bm);
|
||||||
|
|
||||||
|
if (expansionR < 0){
|
||||||
|
expansionR = 0;
|
||||||
|
}
|
||||||
|
|
||||||
int mipPos = 0;
|
int mipPos = 0;
|
||||||
for (int i = 0; i < mipLevel; i++){
|
for (int i = 0; i < mipLevel; i++){
|
||||||
mipPos += image.getMipMapSizes()[i];
|
mipPos += image.getMipMapSizes()[i];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user