Package com.jme3.shader
Class Glsl150ShaderGenerator
java.lang.Object
com.jme3.shader.ShaderGenerator
com.jme3.shader.Glsl100ShaderGenerator
com.jme3.shader.Glsl150ShaderGenerator
- Direct Known Subclasses:
- Glsl300ShaderGenerator
This shader Generator can generate Vertex and Fragment shaders from
 ShaderNodes for GLSL 1.5
- 
Field SummaryFields inherited from class com.jme3.shader.Glsl100ShaderGeneratorinPosTmpFields inherited from class com.jme3.shader.ShaderGeneratorassetManager, indent, NAME_SPACE_GLOBAL, NAME_SPACE_MAT_PARAM, NAME_SPACE_VERTEX_ATTRIBUTE, NAME_SPACE_WORLD_PARAM, techniqueDef
- 
Constructor SummaryConstructorsConstructorDescriptionGlsl150ShaderGenerator(AssetManager assetManager) Creates a Glsl150ShaderGenerator
- 
Method SummaryModifier and TypeMethodDescriptionprotected voiddeclareAttribute(StringBuilder source, ShaderNodeVariable var) Declares an attributeprotected voiddeclareVarying(StringBuilder source, ShaderNodeVariable var, boolean input) Declares a varyingprotected voidgenerateEndOfMainSection(StringBuilder source, ShaderGenerationInfo info, Shader.ShaderType type) Generates the end of the shader main section.protected voidgenerateStartOfMainSection(StringBuilder source, ShaderGenerationInfo info, Shader.ShaderType type) generates the start of the shader main section.protected voidgenerateUniforms(StringBuilder source, ShaderGenerationInfo info, Shader.ShaderType type) generates the uniforms declaration for a shader of the given type.protected Stringreturns the language + version of the shader should be something like "GLSL100" for glsl 1.0 "GLSL150" for glsl 1.5.protected voidinitVariable(StringBuilder source, ShaderNodeVariable var, String initValue) Append a variable initialization to the codeMethods inherited from class com.jme3.shader.Glsl100ShaderGeneratorappendIndent, appendOutput, comment, declareGlobalPosition, declareVariable, declareVariable, declareVariable, declareVariable, declareVariable, endCondition, fixInPositionType, generateAttributes, generateDeclarativeSection, generateNodeMainSection, generateUniforms, generateVaryings, getAppendableNameSpace, indent, isVarying, isWorldOrMaterialParam, map, replace, replaceVariableName, startCondition, unIndent, updateDefinesNameMethods inherited from class com.jme3.shader.ShaderGeneratorappendNodeDeclarationAndMain, buildShader, findShaderIndexFromVersion, generateDeclarationAndMainBody, generateShader, initialize
- 
Constructor Details- 
Glsl150ShaderGeneratorCreates a Glsl150ShaderGenerator- Parameters:
- assetManager- the assetmanager
 
 
- 
- 
Method Details- 
getLanguageAndVersionDescription copied from class:ShaderGeneratorreturns the language + version of the shader should be something like "GLSL100" for glsl 1.0 "GLSL150" for glsl 1.5.- Overrides:
- getLanguageAndVersionin class- Glsl100ShaderGenerator
- Parameters:
- type- the shader type for which the version should be returned.
- Returns:
- the shaderLanguage and version.
 
- 
declareAttributeDeclares an attribute in glsl 1.5 attributes are prefixed with the "in" keyword and not the "attribute" keyword- Overrides:
- declareAttributein class- Glsl100ShaderGenerator
- Parameters:
- source- the StringBuilder to use
- var- the variable to declare as an attribute
 
- 
declareVaryingDeclares a varying in glsl 1.5 varying are prefixed with the "in" or "out" keyword and not the "varying" keyword. "in" is used for Fragment shader (maybe Geometry shader later) "out" is used for Vertex shader (maybe Geometry shader later)- Overrides:
- declareVaryingin class- Glsl100ShaderGenerator
- Parameters:
- source- the StringBuilder to use
- var- the variable to declare as a varying
- input- a boolean set to true if the varying is an input. This in not used in this implementation, but can be used in overriding implementations.
 
- 
generateUniformsprotected void generateUniforms(StringBuilder source, ShaderGenerationInfo info, Shader.ShaderType type) Description copied from class:ShaderGeneratorgenerates the uniforms declaration for a shader of the given type.- Overrides:
- generateUniformsin class- Glsl100ShaderGenerator
- Parameters:
- source- the source StringBuilder to append generated code.
- info- the ShaderGenerationInfo.
- type- the shader type the uniforms have to be generated for.
 
- 
generateStartOfMainSectionprotected void generateStartOfMainSection(StringBuilder source, ShaderGenerationInfo info, Shader.ShaderType type) generates the start of the shader main section. this method is responsible of appending the "void main(){" in the shader and declaring all global outputs of the shader Shader outputs are declared and initialized inside the main section Fragment shader outputs are declared before the "void main(){" with the "out" keyword. After the "void main(){", the vertex output are declared and initialized and the fragment outputs are declared.- Overrides:
- generateStartOfMainSectionin class- Glsl100ShaderGenerator
- Parameters:
- source- the StringBuilder to append generated code.
- info- the ShaderGenerationInfo.
- type- the shader type the section has to be generated for.
 
- 
generateEndOfMainSectionprotected void generateEndOfMainSection(StringBuilder source, ShaderGenerationInfo info, Shader.ShaderType type) Generates the end of the shader main section. This method is responsible for appending the last "}" in the shader and mapping all global outputs of the shader. outputs are assigned to built in glsl output. then the main section is closed This code accounts for multi render target and correctly output to gl_FragData if several output are declared for the fragment shader only vertex shader output are mapped here, since fragment shader outputs must have been mapped in the main section.- Overrides:
- generateEndOfMainSectionin class- Glsl100ShaderGenerator
- Parameters:
- source- the StringBuilder to append generated code.
- info- the ShaderGenerationInfo.
- type- the shader type the section has to be generated for.
 
- 
initVariableAppend a variable initialization to the code- Parameters:
- source- the StringBuilder to use
- var- the variable to initialize
- initValue- the init value to assign to the variable
 
 
-