check point and line attributes at the end, so that defines can override

autodetection
This commit is contained in:
codeanticode
2016-11-03 10:15:41 -03:00
parent 50a0943d60
commit 35e4381cfb
+14 -13
View File
@@ -1020,19 +1020,8 @@ public class PShader implements PConstants {
static protected int getShaderType(String[] source, int defaultType) {
for (int i = 0; i < source.length; i++) {
String line = source[i].trim();
if (PApplet.match(line, pointShaderAttrRegexp) != null)
return PShader.POINT;
else if (PApplet.match(line, pointShaderInRegexp) != null)
return PShader.POINT;
else if (PApplet.match(line, lineShaderAttrRegexp) != null)
return PShader.LINE;
else if (PApplet.match(line, lineShaderInRegexp) != null)
return PShader.LINE;
else if (PApplet.match(line, pointShaderDefRegexp) != null)
return PShader.POINT;
else if (PApplet.match(line, lineShaderDefRegexp) != null)
return PShader.LINE;
else if (PApplet.match(line, colorShaderDefRegexp) != null)
if (PApplet.match(line, colorShaderDefRegexp) != null)
return PShader.COLOR;
else if (PApplet.match(line, lightShaderDefRegexp) != null)
return PShader.LIGHT;
@@ -1046,6 +1035,18 @@ public class PShader implements PConstants {
return PShader.POLY;
else if (PApplet.match(line, quadShaderAttrRegexp) != null)
return PShader.POLY;
else if (PApplet.match(line, pointShaderDefRegexp) != null)
return PShader.POINT;
else if (PApplet.match(line, lineShaderDefRegexp) != null)
return PShader.LINE;
else if (PApplet.match(line, pointShaderAttrRegexp) != null)
return PShader.POINT;
else if (PApplet.match(line, pointShaderInRegexp) != null)
return PShader.POINT;
else if (PApplet.match(line, lineShaderAttrRegexp) != null)
return PShader.LINE;
else if (PApplet.match(line, lineShaderInRegexp) != null)
return PShader.LINE;
}
return defaultType;
}