Class MaterialPass


  • public abstract class MaterialPass
    extends Object
    A material technique can be composed of several pass.
    Author:
    Grégory Van den Borre
    • Constructor Detail

      • MaterialPass

        protected MaterialPass()
        Full constructor.
    • 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 - true to show, false to 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.
      • 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 - true will enable the color, false will 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.
      • 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 - true to enable, false to 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.