Merged commits r11009 to r11012 to gradle restructure branch.

Moved the workaround for GLSL100 into the renderers instead of having it when selecting a technique

git-svn-id: https://jmonkeyengine.googlecode.com/svn/branches/gradle-restructure@11019 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
experimental
rem..om 11 years ago
parent 4ac9babeb2
commit e65d6ea44b
  1. 5
      jme3-android/src/main/java/com/jme3/renderer/android/OGLESShaderRenderer.java
  2. 11
      jme3-core/src/main/java/com/jme3/material/Material.java
  3. 9
      jme3-core/src/main/java/com/jme3/material/Technique.java
  4. 7
      jme3-core/src/main/java/com/jme3/shader/DefineList.java
  5. 4
      jme3-jogl/src/main/java/com/jme3/renderer/jogl/JoglGL1Renderer.java
  6. 4
      jme3-jogl/src/main/java/com/jme3/renderer/jogl/JoglRenderer.java
  7. 4
      jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglGL1Renderer.java
  8. 4
      jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglRenderer.java

@ -153,6 +153,11 @@ public class OGLESShaderRenderer implements Renderer {
powerVr = GLES20.glGetString(GLES20.GL_RENDERER).contains("PowerVR"); powerVr = GLES20.glGetString(GLES20.GL_RENDERER).contains("PowerVR");
//workaround, always assume we support GLSL100
//some cards just don't report this correctly
caps.add(Caps.GLSL100);
/* /*
// Fix issue in TestRenderToMemory when GL_FRONT is the main // Fix issue in TestRenderToMemory when GL_FRONT is the main
// buffer being used. // buffer being used.

@ -435,6 +435,17 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
return paramValues.values(); return paramValues.values();
} }
/**
* Returns the ListMap of all parameters set on this material.
*
* @return a ListMap of all parameters set on this material.
*
* @see #setParam(java.lang.String, com.jme3.shader.VarType, java.lang.Object)
*/
public ListMap getParamsMap() {
return paramValues;
}
/** /**
* Check if setting the parameter given the type and name is allowed. * Check if setting the parameter given the type and name is allowed.
* @param type The type that the "set" function is designed to set * @param type The type that the "set" function is designed to set

@ -34,8 +34,8 @@ package com.jme3.material;
import com.jme3.asset.AssetManager; import com.jme3.asset.AssetManager;
import com.jme3.renderer.Caps; import com.jme3.renderer.Caps;
import com.jme3.shader.*; import com.jme3.shader.*;
import com.jme3.util.ListMap;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -182,12 +182,13 @@ public class Technique /* implements Savable */ {
// If the technique was switched, check if the define list changed // If the technique was switched, check if the define list changed
// based on material parameters. // based on material parameters.
Collection<MatParam> params = owner.getParams(); ListMap params = owner.getParamsMap();
if (!defines.equalsParams(params,def)) { if (!defines.equalsParams(params, def)) {
// Defines were changed, update define list // Defines were changed, update define list
defines.clear(); defines.clear();
for (MatParam param : params) { for(int i=0;i<params.size();i++) {
MatParam param = (MatParam)params.getValue(i);
String defineName = def.getShaderParamDefine(param.getName()); String defineName = def.getShaderParamDefine(param.getName());
if (defineName != null) { if (defineName != null) {
defines.set(defineName, param.getVarType(), param.getValue()); defines.set(defineName, param.getVarType(), param.getValue());

@ -34,9 +34,9 @@ package com.jme3.shader;
import com.jme3.export.*; import com.jme3.export.*;
import com.jme3.material.MatParam; import com.jme3.material.MatParam;
import com.jme3.material.TechniqueDef; import com.jme3.material.TechniqueDef;
import com.jme3.util.ListMap;
import java.io.IOException; import java.io.IOException;
import java.util.Collection;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
@ -182,11 +182,12 @@ public class DefineList implements Savable, Cloneable {
return defines.equals(other.defines); return defines.equals(other.defines);
} }
public boolean equalsParams(Collection<MatParam> params, TechniqueDef def) { public boolean equalsParams(ListMap params, TechniqueDef def) {
int size = 0; int size = 0;
for (MatParam param : params) { for(int i = 0; i < params.size() ; i++ ) {
MatParam param = (MatParam)params.getValue(i);
String key = def.getShaderParamDefine(param.getName()); String key = def.getShaderParamDefine(param.getName());
if (key != null) { if (key != null) {
Object val = param.getValue(); Object val = param.getValue();

@ -138,6 +138,10 @@ public class JoglGL1Renderer implements GL1Renderer {
gl12 = true; gl12 = true;
} }
//workaround, always assume we support GLSL100
//some cards just don't report this correctly
caps.add(Caps.GLSL100);
// Default values for certain GL state. // Default values for certain GL state.
gl.getGL2ES1().glShadeModel(GLLightingFunc.GL_SMOOTH); gl.getGL2ES1().glShadeModel(GLLightingFunc.GL_SMOOTH);
gl.getGL2().glColorMaterial(GL.GL_FRONT_AND_BACK, GLLightingFunc.GL_DIFFUSE); gl.getGL2().glColorMaterial(GL.GL_FRONT_AND_BACK, GLLightingFunc.GL_DIFFUSE);

@ -164,6 +164,10 @@ public class JoglRenderer implements Renderer {
} }
} }
//workaround, always assume we support GLSL100
//some cards just don't report this correctly
caps.add(Caps.GLSL100);
String versionStr = null; String versionStr = null;
if (caps.contains(Caps.OpenGL20) || gl.isGL2ES2()) { if (caps.contains(Caps.OpenGL20) || gl.isGL2ES2()) {
versionStr = gl.glGetString(GL2ES2.GL_SHADING_LANGUAGE_VERSION); versionStr = gl.glGetString(GL2ES2.GL_SHADING_LANGUAGE_VERSION);

@ -102,6 +102,10 @@ public class LwjglGL1Renderer implements GL1Renderer {
gl12 = true; gl12 = true;
} }
//workaround, always assume we support GLSL100
//some cards just don't report this correctly
caps.add(Caps.GLSL100);
// Default values for certain GL state. // Default values for certain GL state.
glShadeModel(GL_SMOOTH); glShadeModel(GL_SMOOTH);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);

@ -159,6 +159,10 @@ public class LwjglRenderer implements Renderer {
} }
} }
//workaround, always assume we support GLSL100
//some cards just don't report this correctly
caps.add(Caps.GLSL100);
String versionStr = null; String versionStr = null;
if (ctxCaps.OpenGL20) { if (ctxCaps.OpenGL20) {
versionStr = glGetString(GL_SHADING_LANGUAGE_VERSION); versionStr = glGetString(GL_SHADING_LANGUAGE_VERSION);

Loading…
Cancel
Save