* Removed shiny check in Lighting.frag (for ATI Radeon X1600 and similar)

* Applying default values for materials inside old J3O files
 * Default shininess in TerrainLighting

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8163 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..rd 14 years ago
parent 2d1b2b7948
commit f421e2a876
  1. 5
      engine/src/core-data/Common/MatDefs/Light/Lighting.frag
  2. 1
      engine/src/core/com/jme3/effect/ParticleEmitter.java
  3. 17
      engine/src/core/com/jme3/material/Material.java
  4. 2
      engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java
  5. 2
      engine/src/niftygui/com/jme3/niftygui/RenderFontJme.java
  6. 3
      engine/src/terrain/Common/MatDefs/Terrain/TerrainLighting.j3md

@ -93,9 +93,8 @@ float lightComputeDiffuse(in vec3 norm, in vec3 lightdir, in vec3 viewdir){
}
float lightComputeSpecular(in vec3 norm, in vec3 viewdir, in vec3 lightdir, in float shiny){
if (shiny <= 1.0){
return 0.0;
}
// NOTE: check for shiny <= 1 removed since shininess is now
// 1.0 by default (uses matdefs default vals)
#ifdef LOW_QUALITY
// Blinn-Phong
// Note: preferably, H should be computed in the vertex shader

@ -44,7 +44,6 @@ import com.jme3.export.OutputCapsule;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.math.Matrix3f;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.renderer.Camera;
import com.jme3.renderer.RenderManager;

@ -81,6 +81,8 @@ import java.util.logging.Logger;
*/
public class Material implements Asset, Cloneable, Savable, Comparable<Material> {
public static final int SAVABLE_VERSION = 1;
private static final Logger logger = Logger.getLogger(Material.class.getName());
private static final RenderState additiveLight = new RenderState();
private static final RenderState depthOnly = new RenderState();
@ -1046,6 +1048,7 @@ public class Material implements Asset, Cloneable, Savable, Comparable<Material>
boolean enableVcolor = false;
boolean separateTexCoord = false;
boolean applyDefaults = false;
if (im.getFormatVersion() == 0) {
// Enable compatibility with old models
@ -1069,6 +1072,9 @@ public class Material implements Asset, Cloneable, Savable, Comparable<Material>
separateTexCoord = true;
}
}
applyDefaults = true;
}else if (ic.getSavableVersion(Material.class) == 0){
applyDefaults = true;
}
def = (MaterialDef) im.getAssetManager().loadAsset(new AssetKey(defName));
@ -1093,7 +1099,16 @@ public class Material implements Asset, Cloneable, Savable, Comparable<Material>
param.setName(checkSetParam(param.getVarType(), param.getName()));
paramValues.put(param.getName(), param);
}
if (applyDefaults){
// compatability with old versions where default vars were
// not available
for (MatParam param : def.getMaterialParams()){
if (param.getValue() != null && paramValues.get(param.getName()) == null){
setParam(param.getName(), param.getVarType(), param.getValue());
}
}
}
if (enableVcolor) {
setBoolean("VertexColor", true);
}

@ -187,9 +187,7 @@ public class RenderDeviceJme implements RenderDevice {
RenderFontJme jmeFont = (RenderFontJme) font;
BitmapText text = jmeFont.getText();
// WARNING: Not compatible with OpenGL1 implementations..
niftyMat.setColor("Color", convertColor(color, tempColor));
niftyMat.setBoolean("UseTex", true);
niftyMat.getAdditionalRenderState().setBlendMode(convertBlend());
text.setMaterial(niftyMat);

@ -34,8 +34,6 @@ package com.jme3.niftygui;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.texture.Texture;
import com.jme3.texture.Texture2D;
import de.lessvoid.nifty.spi.render.RenderFont;
public class RenderFontJme implements RenderFont {

@ -1,3 +1,4 @@
// NOTE: Doesn't support OpenGL1
MaterialDef Terrain Lighting {
MaterialParameters {
@ -21,7 +22,7 @@ MaterialDef Terrain Lighting {
Color Specular
// Specular power/shininess
Float Shininess
Float Shininess : 1
// Texture map #0
Texture2D DiffuseMap

Loading…
Cancel
Save