* Tried to fix NVIDIA shininess==0 bug (again!)

* MTL loader now properly follows spec regarding initial values of colors
 * TangentBinormalGenerator now throws proper exception on missing normals

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7730 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..rd 14 years ago
parent 951d9fe23a
commit 9f7d5410b7
  1. 2
      engine/nbproject/project.properties
  2. 4
      engine/src/core-data/Common/MatDefs/Light/Lighting.frag
  3. 7
      engine/src/core-plugins/com/jme3/scene/plugins/MTLLoader.java
  4. 4
      engine/src/core/com/jme3/util/TangentBinormalGenerator.java

@ -78,7 +78,7 @@ jnlp.signed=true
jnlp.signing=generated
jnlp.signing.alias=
jnlp.signing.keystore=
main.class=jme3test.export.TestOgreConvert
main.class=testcases.ObjImport
manifest.file=MANIFEST.MF
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false

@ -101,7 +101,9 @@ float lightComputeSpecular(in vec3 norm, in vec3 viewdir, in vec3 lightdir, in f
vec2 computeLighting(in vec3 wvPos, in vec3 wvNorm, in vec3 wvViewDir, in vec3 wvLightDir){
float diffuseFactor = lightComputeDiffuse(wvNorm, wvLightDir, wvViewDir);
float specularFactor = lightComputeSpecular(wvNorm, wvViewDir, wvLightDir, m_Shininess);
specularFactor *= step(1.0, m_Shininess);
// if shininess is == 0, spec == 0, if shininess > 1, spec == 1
specularFactor *= min(1.0, m_Shininess);
#ifdef HQ_ATTENUATION
float att = clamp(1.0 - g_LightPosition.w * length(lightVec), 0.0, 1.0);

@ -92,8 +92,8 @@ public class MTLLoader implements AssetLoader {
}
protected void resetMaterial(){
ambient.set(ColorRGBA.Black);
diffuse.set(ColorRGBA.Black);
ambient.set(ColorRGBA.DarkGray);
diffuse.set(ColorRGBA.LightGray);
specular.set(ColorRGBA.Black);
shininess = 16;
shadeless = false;
@ -189,6 +189,9 @@ public class MTLLoader implements AssetLoader {
specular.set(readColor());
}else if (cmd.equals("ns")){
shininess = scan.nextFloat(); /* (128f / 1000f)*/
if (specular.equals(ColorRGBA.Black)){
specular.set(ColorRGBA.White);
}
}else if (cmd.equals("d") || cmd.equals("tr")){
alpha = scan.nextFloat();
transparent = true;

@ -165,6 +165,10 @@ public class TangentBinormalGenerator {
v[i] = new Vector3f();
t[i] = new Vector2f();
}
if (mesh.getBuffer(Type.Normal) == null){
throw new IllegalArgumentException("The given mesh has no normal data!");
}
VertexData[] vertices;
switch (mesh.getMode()) {

Loading…
Cancel
Save