Class ClassificationWidgetEffect

  • All Implemented Interfaces:
    java.io.Serializable, WildMagic.LibGraphics.ObjectSystem.NameIdInterface, WildMagic.LibGraphics.ObjectSystem.StreamInterface

    public class ClassificationWidgetEffect
    extends WildMagic.LibGraphics.Effects.TextureEffect
    implements java.io.Serializable
    This class sets up and communicates with the GLSL shader program used to render the interior of the widget in the multi-histogram panel. The parameters that control how the widget is rendered in the multi-histogram panel are also used to determine how the widget is applied to the volume rendered data in the GLSL volume renderer shader program. Those parameters are encapsulated in the ClassificationWidgetState class which is used to pass the information on to the volume render GLSL program. This class sets up the histogram tool GLSL shader programs for rendering the widgets directly.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String computeAlphaCircle
      GLSL computeAlpha function definition for the circle widgets:
      private static java.lang.String computeAlphaSquare
      GLSL computeAlpha function definition for the square widgets:
      private static java.lang.String computeAlphaTriangle
      GLSL computeAlpha function definition for the triangle widgets:
      private static java.lang.String computeClosestPoint
      GLSL support function definition for the triangle widgets:
      private static java.lang.String intersect
      GLSL support function definition for the triangle widgets:
      private java.lang.String m_kCurrentText
      Current GLSL code for the widget program.
      private WildMagic.LibGraphics.Rendering.Texture m_kLUTMap
      color look-up table Texture:
      private java.lang.String m_kLUTName
      color look-up table name.
      private WildMagic.LibGraphics.Rendering.Texture m_kTexture
      Texture used in the histogram.
      private ClassificationWidgetState m_kWidgetState
      Current state of the widget encapsulated in the GLSL parameters needed for the Volume renderer GLSL program:
      private java.lang.String mainPixelShader1
      First part of the GLSL code for the pixel shader program for all widgets:
      private java.lang.String mainPixelShader2
      GLSL main code part 2 for all widget types.
      private java.lang.String mainPixelShaderCircle
      GLSL function call for the circle widget:
      private java.lang.String mainPixelShaderSquare
      GLSL function call for the square widget:
      private java.lang.String mainPixelShaderTriangle
      GLSL function call for the triangle widget:
      private static java.lang.String multiHistogramFunctions
      combined GLSL code for the histogram widgets:
      private static long serialVersionUID  
      • Fields inherited from class WildMagic.LibGraphics.Effects.ShaderEffect

        m_iPassQuantity, m_kAlphaState, m_kCompiledPrograms, m_kPShader, m_kVShader
    • Constructor Summary

      Constructors 
      Constructor Description
      ClassificationWidgetEffect​(WildMagic.LibGraphics.Rendering.Texture kTexture, int type)
      Creates a new ClassificationWidgetEffect with the texture specified.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void checkProgramText()  
      protected void computeUniformVariables()
      Computes the input parameters to the GLSL shader program based on the ClassificationWidgetState and passes them to the program to render the widget in the multi-histogram panel.
      private java.lang.String createProgramText()  
      void dispose()  
      WildMagic.LibFoundation.Mathematics.ColorRGBA GetColor()
      Returns the color of the widget color transfer function.
      int GetLUTIndex()
      Returns the index of the color look-up table color map.
      static java.lang.String getMultiHistogramFunctions()
      Returns the combined GLSL code and support functions for the histogram widgets.
      ClassificationWidgetState getState()
      Returns the current ClassificationWidgetState GLSL Shader program parameters.
      void readObject​(java.io.ObjectInputStream in)
      Read this object from disk.
      void SetAlpha​(float fA)
      Sets the alpha value of the widget.
      void setBoundary​(float fAlpha)
      Sets the contribution of the 2nd derivative to the volume rendering.
      void SetCenter​(float fX, float fY)
      Sets the Center of the widget for the GLSL program.
      void SetColor​(float fR, float fG, float fB, float fA)
      Sets the color of the widget color transfer function.
      void SetLeftLine​(float fX1, float fY1, float fX2, float fY2)
      Sets the left-line parameter to the GLSL Shader Program.
      void SetLUT​(WildMagic.LibGraphics.Rendering.Texture kMap, int index, boolean bReverse)  
      void SetMidLine​(float fX1, float fY1, float fX2, float fY2)
      Sets the mid-line parameter to the GLSL Shader Program.
      void SetRadius​(float fRX, float fRY)  
      void SetRightLine​(float fX1, float fY1, float fX2, float fY2)
      Sets the right-line parameter to the GLSL Shader Program.
      void SetShift​(float fX, float fY)  
      void setState​(ClassificationWidgetState kState)
      Sets the ClassificationWidgetState, representing the GLSL shader program parameters.
      void UpdateColor()
      Updates the color in the GLSL shader program used to render the ClassificationWidget.
      void writeObject​(java.io.ObjectOutputStream out)
      Stream this object to disk.
      • Methods inherited from class WildMagic.LibGraphics.Effects.TextureEffect

        GetDiskUsed, Link, Load, Register, Save, SaveStrings
      • Methods inherited from class WildMagic.LibGraphics.Effects.ShaderEffect

        GetAllObjectsByName, GetBlending, GetCProgram, GetObjectByID, GetObjectByName, GetPassQuantity, GetPProgram, GetSamplerInformation, GetTexture, GetTexture, GetTextureQuantity, GetVProgram, LoadPrograms, LoadResources, OnLoadPrograms, OnReleasePrograms, ReleasePrograms, ReleaseResources, RestoreGlobalState, SetCProgram, SetDefaultAlphaState, SetGlobalState, SetPassQuantity, SetPShader, SetVShader
      • Methods inherited from class WildMagic.LibGraphics.Effects.Effect

        Draw
      • Methods inherited from class WildMagic.LibGraphics.ObjectSystem.GraphicsObject

        GetID, GetName, GetNextID, GetObjectByIDBase, GetObjectByNameBase, SetName
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • m_kWidgetState

        private ClassificationWidgetState m_kWidgetState
        Current state of the widget encapsulated in the GLSL parameters needed for the Volume renderer GLSL program:
      • m_kTexture

        private WildMagic.LibGraphics.Rendering.Texture m_kTexture
        Texture used in the histogram.
      • m_kLUTName

        private java.lang.String m_kLUTName
        color look-up table name.
      • m_kLUTMap

        private WildMagic.LibGraphics.Rendering.Texture m_kLUTMap
        color look-up table Texture:
      • mainPixelShader1

        private java.lang.String mainPixelShader1
        First part of the GLSL code for the pixel shader program for all widgets:
      • mainPixelShaderTriangle

        private java.lang.String mainPixelShaderTriangle
        GLSL function call for the triangle widget:
      • mainPixelShaderSquare

        private java.lang.String mainPixelShaderSquare
        GLSL function call for the square widget:
      • mainPixelShaderCircle

        private java.lang.String mainPixelShaderCircle
        GLSL function call for the circle widget:
      • mainPixelShader2

        private java.lang.String mainPixelShader2
        GLSL main code part 2 for all widget types.
      • computeAlphaTriangle

        private static java.lang.String computeAlphaTriangle
        GLSL computeAlpha function definition for the triangle widgets:
      • computeAlphaSquare

        private static java.lang.String computeAlphaSquare
        GLSL computeAlpha function definition for the square widgets:
      • computeClosestPoint

        private static java.lang.String computeClosestPoint
        GLSL support function definition for the triangle widgets:
      • intersect

        private static java.lang.String intersect
        GLSL support function definition for the triangle widgets:
      • computeAlphaCircle

        private static java.lang.String computeAlphaCircle
        GLSL computeAlpha function definition for the circle widgets:
      • multiHistogramFunctions

        private static java.lang.String multiHistogramFunctions
        combined GLSL code for the histogram widgets:
      • m_kCurrentText

        private java.lang.String m_kCurrentText
        Current GLSL code for the widget program.
    • Constructor Detail

      • ClassificationWidgetEffect

        public ClassificationWidgetEffect​(WildMagic.LibGraphics.Rendering.Texture kTexture,
                                          int type)
        Creates a new ClassificationWidgetEffect with the texture specified.
        Parameters:
        kTexture - input histogram Texture.
        type - Classification widget type.
    • Method Detail

      • getMultiHistogramFunctions

        public static java.lang.String getMultiHistogramFunctions()
        Returns the combined GLSL code and support functions for the histogram widgets. This code is also used in the GLSL programs for the volume renderer.
        Returns:
      • dispose

        public void dispose()
        Overrides:
        dispose in class WildMagic.LibGraphics.Effects.ShaderEffect
      • GetColor

        public WildMagic.LibFoundation.Mathematics.ColorRGBA GetColor()
        Returns the color of the widget color transfer function.
        Returns:
        the color of the widget color transfer function.
      • GetLUTIndex

        public int GetLUTIndex()
        Returns the index of the color look-up table color map.
        Returns:
        the index of the color look-up table color map.
      • getState

        public ClassificationWidgetState getState()
        Returns the current ClassificationWidgetState GLSL Shader program parameters.
        Returns:
        the current ClassificationWidgetState GLSL Shader program parameters.
      • readObject

        public void readObject​(java.io.ObjectInputStream in)
                        throws java.io.IOException,
                               java.lang.ClassNotFoundException
        Read this object from disk.
        Parameters:
        in -
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • SetAlpha

        public void SetAlpha​(float fA)
        Sets the alpha value of the widget.
        Parameters:
        fAlpha -
      • setBoundary

        public void setBoundary​(float fAlpha)
        Sets the contribution of the 2nd derivative to the volume rendering.
        Parameters:
        fAlpha - the contribution of the 2nd derivative to the volume rendering.
      • SetCenter

        public void SetCenter​(float fX,
                              float fY)
        Sets the Center of the widget for the GLSL program.
        Parameters:
        fX -
        fY -
      • SetColor

        public void SetColor​(float fR,
                             float fG,
                             float fB,
                             float fA)
        Sets the color of the widget color transfer function.
        Parameters:
        the - color of the widget color transfer function.
      • SetLeftLine

        public void SetLeftLine​(float fX1,
                                float fY1,
                                float fX2,
                                float fY2)
        Sets the left-line parameter to the GLSL Shader Program.
        Parameters:
        fX1 - bottom x-coordinate in Texture Coordinates.
        fY1 - bottom y-coordinate in Texture Coordinates.
        fX2 - top x-coordinate in Texture Coordinates.
        fY2 - top y-coordinate in Texture Coordinates.
      • SetLUT

        public void SetLUT​(WildMagic.LibGraphics.Rendering.Texture kMap,
                           int index,
                           boolean bReverse)
      • SetMidLine

        public void SetMidLine​(float fX1,
                               float fY1,
                               float fX2,
                               float fY2)
        Sets the mid-line parameter to the GLSL Shader Program.
        Parameters:
        fX1 - bottom x-coordinate in Texture Coordinates.
        fY1 - bottom y-coordinate in Texture Coordinates.
        fX2 - top x-coordinate in Texture Coordinates.
        fY2 - top y-coordinate in Texture Coordinates.
      • SetRadius

        public void SetRadius​(float fRX,
                              float fRY)
      • SetRightLine

        public void SetRightLine​(float fX1,
                                 float fY1,
                                 float fX2,
                                 float fY2)
        Sets the right-line parameter to the GLSL Shader Program.
        Parameters:
        fX1 - bottom x-coordinate in Texture Coordinates.
        fY1 - bottom y-coordinate in Texture Coordinates.
        fX2 - top x-coordinate in Texture Coordinates.
        fY2 - top y-coordinate in Texture Coordinates.
      • SetShift

        public void SetShift​(float fX,
                             float fY)
      • setState

        public void setState​(ClassificationWidgetState kState)
        Sets the ClassificationWidgetState, representing the GLSL shader program parameters.
        Parameters:
        kState - ClassificationWidgetState, representing the GLSL shader program parameters.
      • UpdateColor

        public void UpdateColor()
        Updates the color in the GLSL shader program used to render the ClassificationWidget.
      • writeObject

        public void writeObject​(java.io.ObjectOutputStream out)
                         throws java.io.IOException
        Stream this object to disk.
        Parameters:
        out -
        Throws:
        java.io.IOException
      • computeUniformVariables

        protected void computeUniformVariables()
        Computes the input parameters to the GLSL shader program based on the ClassificationWidgetState and passes them to the program to render the widget in the multi-histogram panel.
      • checkProgramText

        private void checkProgramText()
      • createProgramText

        private java.lang.String createProgramText()