Package com.jme3.material
Class TechniqueDef
java.lang.Object
com.jme3.material.TechniqueDef
Describes a technique definition.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumDescribes light rendering mode.static enumDefine in what space the light data should be sent to the shader.static enum
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringThe default technique name.static final intVersion #1: Separate shader language for each shader source.
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedSerialization only.TechniqueDef(String name, int sortId) Creates a new technique definition.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddShaderParamDefine(String paramName, VarType paramType, String defineName) Adds a define linked to a material parameter.intaddShaderUnmappedDefine(String defineName, VarType defineType) Add an unmapped define which can only be set by define ID.booleanaddWorldParam(String name) Adds a new world parameter by the given name.clone()Create a define list with the size matching the number of defines on this technique.getDefineIdType(int defineId) Get the type of a particular define.String[]Get the names of all defines declared on this technique definition.VarType[]Get the types of all defines declared on this technique definition.Returns the language of the fragment shader used in this technique.Returns the name of the fragment shader used by the technique, or null if no fragment shader is specified.Returns the light mode.Returns the space in which the light data should be passed to the shader.getLogic()getName()Returns the name of this technique as specified in the J3MD file.Returns the render state that this technique is usingGets therenderer capabilitiesthat are required by this technique.getShader(AssetManager assetManager, EnumSet<Caps> rendererCaps, DefineList defines) getShaderParamDefine(String paramName) Returns the define name which the given material parameter influences.getShaderParamDefineId(String paramName) Get the define ID for a given material parameter.getShaderProgramLanguage(Shader.ShaderType shaderType) Returns the language for each shader programReturns the Enum containing the ShaderProgramLanguages;getShaderProgramName(Shader.ShaderType shaderType) Returns the name for each shader programReturns the Enum containing the ShaderProgramNames;Returns the shadow mode.intReturns the language of the vertex shader used in this technique.Returns the name of the vertex shader used by the technique, or null if no vertex shader is specified.floatreturns the weight of the technique defReturns a list of world parameters that are used by this technique definition.booleanReturns true if this technique should not be used to render.booleanReturns true if this technique uses Shader Nodes, false otherwise.voidread(JmeImporter im) voidsetForcedRenderState(RenderState forcedRenderState) voidsetLightMode(TechniqueDef.LightMode lightMode) Set the light modevoidsetLightSpace(TechniqueDef.LightSpace lightSpace) Sets the space in which the light data should be passed to the shader.voidsetLogic(TechniqueDefLogic logic) voidsetNoRender(boolean noRender) Sets if this technique should not be used to render.voidsetRenderState(RenderState renderState) Sets the render state that this technique is using.voidsetShaderFile(String vertexShader, String fragmentShader, String vertLanguage, String fragLanguage) Sets the shaders that this technique definition will use.voidsetShaderFile(EnumMap<Shader.ShaderType, String> shaderNames, EnumMap<Shader.ShaderType, String> shaderLanguages) Sets the shaders that this technique definition will use.voidsetShaderGenerationInfo(ShaderGenerationInfo shaderGenerationInfo) voidsetShaderNodes(List<ShaderNode> shaderNodes) voidsetShaderPrologue(String shaderPrologue) Set a string which is prepended to every shader used by this technique.voidsetShadowMode(TechniqueDef.ShadowMode shadowMode) Set the shadow mode.toString()voidwrite(JmeExporter ex) 
- 
Field Details- 
SAVABLE_VERSIONpublic static final int SAVABLE_VERSIONVersion #1: Separate shader language for each shader source.- See Also:
 
- 
DEFAULT_TECHNIQUE_NAMEThe default technique name. The technique with this name is selected if no specific technique is requested by the user. Currently set to "Default".- See Also:
 
 
- 
- 
Constructor Details- 
TechniqueDefCreates a new technique definition.Used internally by the J3M/J3MD loader. - Parameters:
- name- The name of the technique
- sortId- a unique ID for sorting
 
- 
TechniqueDefprotected TechniqueDef()Serialization only. Do not use.
 
- 
- 
Method Details- 
getSortIdpublic int getSortId()- Returns:
- A unique sort ID. No other technique definition can have the same ID.
 
- 
getNameReturns the name of this technique as specified in the J3MD file. Default techniques have the nameDEFAULT_TECHNIQUE_NAME.- Returns:
- the name of this technique
 
- 
getLightModeReturns the light mode.- Returns:
- the light mode.
- See Also:
 
- 
setLightModeSet the light mode- Parameters:
- lightMode- the light mode
- See Also:
 
- 
setLogic
- 
getLogic
- 
getShadowModeReturns the shadow mode.- Returns:
- the shadow mode.
 
- 
setShadowModeSet the shadow mode.- Parameters:
- shadowMode- the shadow mode.
- See Also:
 
- 
getRenderStateReturns the render state that this technique is using- Returns:
- the render state that this technique is using
- See Also:
 
- 
setRenderStateSets the render state that this technique is using.- Parameters:
- renderState- the render state that this technique is using.
- See Also:
 
- 
setNoRenderpublic void setNoRender(boolean noRender) Sets if this technique should not be used to render.- Parameters:
- noRender- not render or render ?
- See Also:
 
- 
isNoRenderpublic boolean isNoRender()Returns true if this technique should not be used to render. (e.g. to not render a material with default technique)- Returns:
- true if this technique should not be rendered, false otherwise.
 
- 
isUsingShaderNodespublic boolean isUsingShaderNodes()Returns true if this technique uses Shader Nodes, false otherwise.- Returns:
- true if this technique uses Shader Nodes, false otherwise.
 
- 
getRequiredCapsGets therenderer capabilitiesthat are required by this technique.- Returns:
- the required renderer capabilities
 
- 
setShaderFilepublic void setShaderFile(String vertexShader, String fragmentShader, String vertLanguage, String fragLanguage) Sets the shaders that this technique definition will use.- Parameters:
- vertexShader- The name of the vertex shader
- fragmentShader- The name of the fragment shader
- vertLanguage- The vertex shader language
- fragLanguage- The fragment shader language
 
- 
setShaderPrologueSet a string which is prepended to every shader used by this technique. Typically this is used for preset defines.- Parameters:
- shaderPrologue- The prologue to append before the technique's shaders.
 
- 
getShaderPrologue- Returns:
- the shader prologue which is prepended to every shader.
 
- 
getShaderParamDefineReturns the define name which the given material parameter influences.- Parameters:
- paramName- The parameter name to look up
- Returns:
- The define name
- See Also:
 
- 
getShaderParamDefineIdGet the define ID for a given material parameter.- Parameters:
- paramName- The parameter name to look up
- Returns:
- The define ID, or null if not found.
 
- 
getDefineIdTypeGet the type of a particular define.- Parameters:
- defineId- The define ID to lookup.
- Returns:
- The type of the define, or null if not found.
 
- 
addShaderParamDefineAdds a define linked to a material parameter.Any time the material parameter on the parent material is altered, the appropriate define on the technique will be modified as well. When set, the material parameter will be mapped to an integer define, typically 1if it is set, unless it is an integer or a float, in which case it will be converted into an integer.- Parameters:
- paramName- The name of the material parameter to link to.
- paramType- The type of the material parameter to link to.
- defineName- The name of the define parameter, e.g. USE_LIGHTING
 
- 
addShaderUnmappedDefineAdd an unmapped define which can only be set by define ID. Unmapped defines are used by technique renderers to configure the shader internally before rendering.- Parameters:
- defineName- The define name to create
- defineType- the type for the new define
- Returns:
- The define ID of the created define
 
- 
getDefineNamesGet the names of all defines declared on this technique definition. The defines are returned in order of declaration.- Returns:
- the names of all defines declared.
 
- 
getDefineTypesGet the types of all defines declared on this technique definition. The types are returned in order of declaration.- Returns:
- the types of all defines declared.
 
- 
createDefineListCreate a define list with the size matching the number of defines on this technique.- Returns:
- a define list with the size matching the number of defines on this technique.
 
- 
getShader
- 
setShaderFilepublic void setShaderFile(EnumMap<Shader.ShaderType, String> shaderNames, EnumMap<Shader.ShaderType, String> shaderLanguages) Sets the shaders that this technique definition will use.- Parameters:
- shaderNames- EnumMap containing all shader names for this stage
- shaderLanguages- EnumMap containing all shader languages for this stage
 
- 
getFragmentShaderNameReturns the name of the fragment shader used by the technique, or null if no fragment shader is specified.- Returns:
- the name of the fragment shader to be used.
 
- 
getVertexShaderNameReturns the name of the vertex shader used by the technique, or null if no vertex shader is specified.- Returns:
- the name of the vertex shader to be used.
 
- 
getFragmentShaderLanguageReturns the language of the fragment shader used in this technique.- Returns:
- the name of the language (such as "GLSL100")
 
- 
getVertexShaderLanguageReturns the language of the vertex shader used in this technique.- Returns:
- the name of the language (such as "GLSL100")
 
- 
getShaderProgramLanguageReturns the language for each shader program- Parameters:
- shaderType- Fragment/Vertex/etcetera
- Returns:
- the name of the language
 
- 
getShaderProgramNameReturns the name for each shader program- Parameters:
- shaderType- Fragment/Vertex/etcetera
- Returns:
- the name of the program
 
- 
getWeightpublic float getWeight()returns the weight of the technique def- Returns:
- the weight
 
- 
addWorldParamAdds a new world parameter by the given name.- Parameters:
- name- The world parameter to add.
- Returns:
- True if the world parameter name was found and added to the list of world parameters, false otherwise.
 
- 
getForcedRenderState
- 
setForcedRenderState
- 
getWorldBindingsReturns a list of world parameters that are used by this technique definition.- Returns:
- The list of world parameters
 
- 
write- Specified by:
- writein interface- Savable
- Throws:
- IOException
 
- 
read- Specified by:
- readin interface- Savable
- Throws:
- IOException
 
- 
getShaderNodes
- 
setShaderNodes
- 
getShaderProgramNamesReturns the Enum containing the ShaderProgramNames;- Returns:
- the pre-existing EnumMap
 
- 
getShaderProgramLanguagesReturns the Enum containing the ShaderProgramLanguages;- Returns:
- the pre-existing EnumMap
 
- 
getShaderGenerationInfo
- 
setShaderGenerationInfo
- 
toString
- 
getLightSpaceReturns the space in which the light data should be passed to the shader.- Returns:
- the light space
 
- 
setLightSpaceSets the space in which the light data should be passed to the shader.- Parameters:
- lightSpace- the light space
 
- 
clone- Overrides:
- clonein class- Object
- Throws:
- CloneNotSupportedException
 
 
-