Class MaterialPass
- java.lang.Object
-
- be.yildizgames.module.graphic.material.MaterialPass
-
public abstract class MaterialPass extends Object
A material technique can be composed of several pass.- Author:
- Grégory Van den Borre
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMaterialPass.BlendModeBlend the pass with the rest of the scene.static classMaterialPass.SceneBlendDifferent options for scene blending transparency.static classMaterialPass.TransparencyThe transparency can be computed in different ways, they are exposed in this enum.
-
Constructor Summary
Constructors Modifier Constructor Description protectedMaterialPass()Full constructor.protectedMaterialPass(List<TextureUnit> unitList, MaterialPass.Transparency transparency, MaterialPass.BlendMode blend)Copy constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description TextureUnitcreateUnit()Create a texture unit for this pass.protected abstract TextureUnitcreateUnitImpl(int index)Create the unit in implementation.MaterialPassdisableLight()The lights will no longer affect the material pass.protected abstract voiddisableLightImpl()Disable the light for this material in implementation.MaterialPassenableColor(boolean show)Show or hide colors for this pass units.protected abstract voidenableColorImpl(boolean show)Enable or disable color in implementation.MaterialPass.BlendModegetBlendMode()MaterialPass.TransparencygetTransparency()TextureUnitgetUnit(int index)MaterialPasspassProjectionMatrixToVertexShader()Pass the projection matrix to the 'projectionMatrix' vertex shader parameter.MaterialPasspassViewMatrixToVertexShader()Pass the view matrix to the 'viewMatrix' vertex shader parameter.MaterialPasssetAmbient(be.yildizgames.module.color.Color color)Set the ambient color value.protected abstract voidsetAmbientImpl(be.yildizgames.module.color.Color color)Set the ambient color in implementation.MaterialPasssetBlendMode(MaterialPass.BlendMode mode)Apply a blend mode to the pass.protected abstract MaterialPasssetBlendModeImpl(MaterialPass.BlendMode mode)Set the blend mode in implementation.abstract MaterialPasssetDepthWrite(boolean enable)Enable or disable the depth write.MaterialPasssetDiffuse(be.yildizgames.module.color.Color color)Set a diffuse color.protected abstract voidsetDiffuseImpl(be.yildizgames.module.color.Color color)Set the diffuse color in implementation.abstract MaterialPasssetEmissive(be.yildizgames.module.color.Color color)Set the emissive color.MaterialPasssetFragmentShader(FragmentShader shader)Set a shader fragment program to this pass.abstract MaterialPasssetFragmentShader(String name)Set a shader fragment program to this pass.abstract MaterialPasssetFragmentShaderParameter(ShaderParamColor param)Set the parameters for a fragment program.abstract MaterialPasssetFragmentShaderParameter(ShaderParamFloat param)Set the parameters for a fragment program.abstract MaterialPasssetFragmentShaderParameter(ShaderParamFloat2 param)Set the parameters for a fragment program.abstract MaterialPasssetFragmentShaderParameter(ShaderParamFloat3 param)Set the parameters for a fragment program.abstract MaterialPasssetFragmentShaderParameter(ShaderParamFloat4 param)Set the parameters for a fragment program.MaterialPasssetFragmentShaderParameter(String name, float... f)abstract MaterialPasssetFragmentShaderParameterAuto(String name, ShaderConstantType auto)Set the auto parameters for a fragment program.abstract MaterialPasssetFragmentShaderParameterAuto(String name, ShaderConstantType auto, int param)Set the auto parameters for a fragment program.abstract MaterialPasssetSceneBlend(MaterialPass.SceneBlend blend1, MaterialPass.SceneBlend blend2)The the scene blending.MaterialPasssetTransparency(MaterialPass.Transparency capability)Modify the transparent capability of this pass.protected abstract MaterialPasssetTransparentCapabilityImpl(MaterialPass.Transparency capability)Set the transparent capability in implementation.MaterialPasssetVertexShader(VertexShader shader)Set a shader fragment program to this pass.abstract MaterialPasssetVertexShader(String name)Set a shader vertex program to this pass.abstract MaterialPasssetVertexShaderParameter(ShaderParamColor param)Set the parameters for a fragment program.abstract MaterialPasssetVertexShaderParameter(ShaderParamFloat param)Set the parameters for a vertex program.abstract MaterialPasssetVertexShaderParameter(ShaderParamFloat2 param)Set the parameters for a vertex program.abstract MaterialPasssetVertexShaderParameter(ShaderParamFloat3 param)Set the parameters for a vertex program.abstract MaterialPasssetVertexShaderParameter(ShaderParamFloat4 param)Set the parameters for a vertex program.MaterialPasssetVertexShaderParameter(String name, float... f)abstract MaterialPasssetVertexShaderParameterAuto(String name, ShaderConstantType auto)Set the auto parameters for a vertex program.abstract MaterialPasssetVertexShaderParameterAuto(String name, ShaderConstantType auto, int param)Set the auto parameters for a vertex program.
-
-
-
Constructor Detail
-
MaterialPass
protected MaterialPass()
Full constructor.
-
MaterialPass
protected MaterialPass(List<TextureUnit> unitList, MaterialPass.Transparency transparency, MaterialPass.BlendMode blend)
Copy constructor.- Parameters:
unitList- List of associated texture units.transparency- Transparency value.blend- Blend mode value.
-
-
Method Detail
-
createUnit
public final TextureUnit createUnit()
Create a texture unit for this pass.- Returns:
- The created texture unit.
-
setDiffuse
public final MaterialPass setDiffuse(be.yildizgames.module.color.Color color)
Set a diffuse color.- Parameters:
color- Diffuse color value.- Returns:
- This object.
-
enableColor
public final MaterialPass enableColor(boolean show)
Show or hide colors for this pass units.- Parameters:
show-trueto show,falseto hide.- Returns:
- This object.
-
disableLight
public final MaterialPass disableLight()
The lights will no longer affect the material pass.- Returns:
- This object.
-
disableLightImpl
protected abstract void disableLightImpl()
Disable the light for this material in implementation.
-
setSceneBlend
public abstract MaterialPass setSceneBlend(MaterialPass.SceneBlend blend1, MaterialPass.SceneBlend blend2)
The the scene blending.- Parameters:
blend1- Source blending factor.blend2- Destination blending factor.- Returns:
- This object.
-
setAmbient
public final MaterialPass setAmbient(be.yildizgames.module.color.Color color)
Set the ambient color value.- Parameters:
color- Ambient color to use.- Returns:
- This object.
-
createUnitImpl
protected abstract TextureUnit createUnitImpl(int index)
Create the unit in implementation.- Parameters:
index- Associated index.- Returns:
- The new Texture unit.
-
enableColorImpl
protected abstract void enableColorImpl(boolean show)
Enable or disable color in implementation.- Parameters:
show-truewill enable the color,falsewill disable it.
-
setDiffuseImpl
protected abstract void setDiffuseImpl(be.yildizgames.module.color.Color color)
Set the diffuse color in implementation.- Parameters:
color- Diffuse color value.
-
setAmbientImpl
protected abstract void setAmbientImpl(be.yildizgames.module.color.Color color)
Set the ambient color in implementation.- Parameters:
color- Ambient color value.
-
getUnit
public final TextureUnit getUnit(int index)
- Parameters:
index- Texture unit index.- Returns:
- The texture unit.
-
setTransparency
public final MaterialPass setTransparency(MaterialPass.Transparency capability)
Modify the transparent capability of this pass.- Parameters:
capability- New capability value.- Returns:
- This object.
-
setBlendMode
public final MaterialPass setBlendMode(MaterialPass.BlendMode mode)
Apply a blend mode to the pass.- Parameters:
mode- Mode to use.- Returns:
- This object.
-
getTransparency
public final MaterialPass.Transparency getTransparency()
-
getBlendMode
public final MaterialPass.BlendMode getBlendMode()
-
passViewMatrixToVertexShader
public final MaterialPass passViewMatrixToVertexShader()
Pass the view matrix to the 'viewMatrix' vertex shader parameter. This is refreshed every frame automatically.- Returns:
- This object for chaining.
-
passProjectionMatrixToVertexShader
public final MaterialPass passProjectionMatrixToVertexShader()
Pass the projection matrix to the 'projectionMatrix' vertex shader parameter. This is refreshed every frame automatically.- Returns:
- This object for chaining.
-
setTransparentCapabilityImpl
protected abstract MaterialPass setTransparentCapabilityImpl(MaterialPass.Transparency capability)
Set the transparent capability in implementation.- Parameters:
capability- Value to set.- Returns:
- This object for chaining.
-
setBlendModeImpl
protected abstract MaterialPass setBlendModeImpl(MaterialPass.BlendMode mode)
Set the blend mode in implementation.- Parameters:
mode- Mode to apply.- Returns:
- This object for chaining.
-
setEmissive
public abstract MaterialPass setEmissive(be.yildizgames.module.color.Color color)
Set the emissive color.- Parameters:
color- Color to set as emissive.- Returns:
- This object for chaining.
-
setDepthWrite
public abstract MaterialPass setDepthWrite(boolean enable)
Enable or disable the depth write.- Parameters:
enable-trueto enable,falseto disable.- Returns:
- This object.
-
setVertexShader
public abstract MaterialPass setVertexShader(String name)
Set a shader vertex program to this pass.- Parameters:
name- Program name.- Returns:
- This object.
-
setFragmentShader
public abstract MaterialPass setFragmentShader(String name)
Set a shader fragment program to this pass.- Parameters:
name- Program name.- Returns:
- This object.
-
setFragmentShader
public final MaterialPass setFragmentShader(FragmentShader shader)
Set a shader fragment program to this pass.- Parameters:
shader- Shader to set.- Returns:
- This object for chaining.
-
setVertexShader
public final MaterialPass setVertexShader(VertexShader shader)
Set a shader fragment program to this pass.- Parameters:
shader- Shader to set.- Returns:
- This object for chaining.
-
setFragmentShaderParameter
public final MaterialPass setFragmentShaderParameter(String name, float... f)
-
setVertexShaderParameter
public final MaterialPass setVertexShaderParameter(String name, float... f)
-
setFragmentShaderParameter
public abstract MaterialPass setFragmentShaderParameter(ShaderParamFloat4 param)
Set the parameters for a fragment program.- Parameters:
param- Parameter param.- Returns:
- This object for chaining.
-
setFragmentShaderParameter
public abstract MaterialPass setFragmentShaderParameter(ShaderParamFloat3 param)
Set the parameters for a fragment program.- Parameters:
param- Parameter param.- Returns:
- This object for chaining.
-
setFragmentShaderParameter
public abstract MaterialPass setFragmentShaderParameter(ShaderParamFloat2 param)
Set the parameters for a fragment program.- Parameters:
param- Parameter param.- Returns:
- This object for chaining.
-
setFragmentShaderParameter
public abstract MaterialPass setFragmentShaderParameter(ShaderParamFloat param)
Set the parameters for a fragment program.- Parameters:
param- Parameter param.- Returns:
- This object for chaining.
-
setFragmentShaderParameter
public abstract MaterialPass setFragmentShaderParameter(ShaderParamColor param)
Set the parameters for a fragment program.- Parameters:
param- Parameter param.- Returns:
- This object for chaining.
-
setFragmentShaderParameterAuto
public abstract MaterialPass setFragmentShaderParameterAuto(String name, ShaderConstantType auto)
Set the auto parameters for a fragment program.- Parameters:
name- Parameter name.auto- Parameter automatically updated from graphic engine.- Returns:
- This object for chaining.
-
setFragmentShaderParameterAuto
public abstract MaterialPass setFragmentShaderParameterAuto(String name, ShaderConstantType auto, int param)
Set the auto parameters for a fragment program.- Parameters:
name- Parameter name.auto- Parameter automatically updated from graphic engine.param- Additional parameter.- Returns:
- This object for chaining.
-
setVertexShaderParameter
public abstract MaterialPass setVertexShaderParameter(ShaderParamFloat4 param)
Set the parameters for a vertex program.- Parameters:
param- Parameter param.- Returns:
- This object for chaining.
-
setVertexShaderParameter
public abstract MaterialPass setVertexShaderParameter(ShaderParamFloat3 param)
Set the parameters for a vertex program.- Parameters:
param- Parameter param.- Returns:
- This object for chaining.
-
setVertexShaderParameter
public abstract MaterialPass setVertexShaderParameter(ShaderParamFloat2 param)
Set the parameters for a vertex program.- Parameters:
param- Parameter param.- Returns:
- This object for chaining.
-
setVertexShaderParameter
public abstract MaterialPass setVertexShaderParameter(ShaderParamFloat param)
Set the parameters for a vertex program.- Parameters:
param- Parameter param.- Returns:
- This object for chaining.
-
setVertexShaderParameter
public abstract MaterialPass setVertexShaderParameter(ShaderParamColor param)
Set the parameters for a fragment program.- Parameters:
param- Parameter param.- Returns:
- This object for chaining.
-
setVertexShaderParameterAuto
public abstract MaterialPass setVertexShaderParameterAuto(String name, ShaderConstantType auto, int param)
Set the auto parameters for a vertex program.- Parameters:
name- Parameter name.auto- Parameter automatically updated from graphic engine.param- Additional parameter.- Returns:
- This object for chaining.
-
setVertexShaderParameterAuto
public abstract MaterialPass setVertexShaderParameterAuto(String name, ShaderConstantType auto)
Set the auto parameters for a vertex program.- Parameters:
name- Parameter name.auto- Parameter automatically updated from graphic engine.- Returns:
- This object for chaining.
-
-