SDK: fix build error
This commit is contained in:
parent
15465a020f
commit
85feb305ef
@ -70,13 +70,15 @@ public abstract class ShaderGenerator {
|
|||||||
this.assetManager = assetManager;
|
this.assetManager = assetManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize(TechniqueDef techniqueDef){
|
public void initialize(TechniqueDef techniqueDef) {
|
||||||
this.techniqueDef = techniqueDef;
|
this.techniqueDef = techniqueDef;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate vertex and fragment shaders for the given technique
|
* Generate vertex and fragment shaders for the given technique
|
||||||
*
|
*
|
||||||
|
* @param definesSourceCode Defines to include alongside the shader. May be
|
||||||
|
* null.
|
||||||
* @return a Shader program
|
* @return a Shader program
|
||||||
*/
|
*/
|
||||||
public Shader generateShader(String definesSourceCode) {
|
public Shader generateShader(String definesSourceCode) {
|
||||||
@ -114,9 +116,9 @@ public abstract class ShaderGenerator {
|
|||||||
* @return the code of the generated vertex shader
|
* @return the code of the generated vertex shader
|
||||||
*/
|
*/
|
||||||
protected String buildShader(List<ShaderNode> shaderNodes, ShaderGenerationInfo info, ShaderType type) {
|
protected String buildShader(List<ShaderNode> shaderNodes, ShaderGenerationInfo info, ShaderType type) {
|
||||||
if (type == ShaderType.TessellationControl ||
|
if (type == ShaderType.TessellationControl
|
||||||
type == ShaderType.TessellationEvaluation ||
|
|| type == ShaderType.TessellationEvaluation
|
||||||
type == ShaderType.Geometry) {
|
|| type == ShaderType.Geometry) {
|
||||||
// TODO: Those are not supported.
|
// TODO: Those are not supported.
|
||||||
// Too much code assumes that type is either Vertex or Fragment
|
// Too much code assumes that type is either Vertex or Fragment
|
||||||
return null;
|
return null;
|
||||||
@ -192,8 +194,8 @@ public abstract class ShaderGenerator {
|
|||||||
if (loadedSource.length() > 1) {
|
if (loadedSource.length() > 1) {
|
||||||
loadedSource = loadedSource.substring(0, loadedSource.lastIndexOf("}"));
|
loadedSource = loadedSource.substring(0, loadedSource.lastIndexOf("}"));
|
||||||
String[] sourceParts = loadedSource.split("\\s*void\\s*main\\s*\\(\\s*\\)\\s*\\{");
|
String[] sourceParts = loadedSource.split("\\s*void\\s*main\\s*\\(\\s*\\)\\s*\\{");
|
||||||
if(sourceParts.length<2){
|
if (sourceParts.length < 2) {
|
||||||
throw new IllegalArgumentException("Syntax error in "+ shaderPath +". Cannot find 'void main(){' in \n"+ loadedSource);
|
throw new IllegalArgumentException("Syntax error in " + shaderPath + ". Cannot find 'void main(){' in \n" + loadedSource);
|
||||||
}
|
}
|
||||||
generateDeclarativeSection(sourceDeclaration, shaderNode, sourceParts[0], info);
|
generateDeclarativeSection(sourceDeclaration, shaderNode, sourceParts[0], info);
|
||||||
generateNodeMainSection(source, shaderNode, sourceParts[1], info);
|
generateNodeMainSection(source, shaderNode, sourceParts[1], info);
|
||||||
|
@ -134,7 +134,7 @@ public class EditableMatDefFile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (materialDef != null && !matParseError) {
|
if (materialDef != null && !matParseError) {
|
||||||
if(currentTechnique == null){
|
if (currentTechnique == null) {
|
||||||
currentTechnique = matDefStructure.getTechniques().get(0);
|
currentTechnique = matDefStructure.getTechniques().get(0);
|
||||||
}
|
}
|
||||||
registerListener(matDefStructure);
|
registerListener(matDefStructure);
|
||||||
@ -172,11 +172,11 @@ public class EditableMatDefFile {
|
|||||||
material.selectTechnique(currentTechnique.getName(), SceneApplication.getApplication().getRenderManager());
|
material.selectTechnique(currentTechnique.getName(), SceneApplication.getApplication().getRenderManager());
|
||||||
Shader s;
|
Shader s;
|
||||||
if (version.equals(GLSL100)) {
|
if (version.equals(GLSL100)) {
|
||||||
glsl100.initialize(material.getActiveTechnique());
|
glsl100.initialize(material.getActiveTechnique().getDef());
|
||||||
s = glsl100.generateShader();
|
s = glsl100.generateShader(null);
|
||||||
} else {
|
} else {
|
||||||
glsl150.initialize(material.getActiveTechnique());
|
glsl150.initialize(material.getActiveTechnique().getDef());
|
||||||
s = glsl150.generateShader();
|
s = glsl150.generateShader(null);
|
||||||
}
|
}
|
||||||
for (Shader.ShaderSource source : s.getSources()) {
|
for (Shader.ShaderSource source : s.getSources()) {
|
||||||
if (source.getType() == type) {
|
if (source.getType() == type) {
|
||||||
@ -194,7 +194,7 @@ public class EditableMatDefFile {
|
|||||||
return currentTechnique;
|
return currentTechnique;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCurrentTechnique(TechniqueBlock tech){
|
public void setCurrentTechnique(TechniqueBlock tech) {
|
||||||
this.currentTechnique = tech;
|
this.currentTechnique = tech;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ public class EditableMatDefFile {
|
|||||||
updateLookupWithMaterialData(obj);
|
updateLookupWithMaterialData(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cleanup(){
|
public void cleanup() {
|
||||||
if (matDefStructure != null) {
|
if (matDefStructure != null) {
|
||||||
obj.getLookupContents().remove(matDefStructure);
|
obj.getLookupContents().remove(matDefStructure);
|
||||||
matDefStructure = null;
|
matDefStructure = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user