Class VolumeShaderEffectMultiPass

  • All Implemented Interfaces:
    java.io.Serializable, WildMagic.LibGraphics.ObjectSystem.NameIdInterface, WildMagic.LibGraphics.ObjectSystem.StreamInterface
    Direct Known Subclasses:
    VolumeShaderEffectMultiPassDynamic, VSEMD_MultipleImages

    public class VolumeShaderEffectMultiPass
    extends VolumeClipEffect
    implements WildMagic.LibGraphics.ObjectSystem.StreamInterface
    VolumeShaderEffect is the workhorse of the GPU-based rendering in MIPAV. It manages several Cg shaders for volume rendering. Each of the different volume modes MIP, DDR, Composite, Surface, and Composite Surface are implemented with different Cg shaders. The volume data and lookup table information are stored and passed to the shaders as texture images; VolumeShaderEffect manages these images. All UserConstant shader parameters are also managed by the VolumeShaderEffect class.
    See Also:
    Serialized Form
    • Field Detail

      • CMP_SUR

        protected static final int CMP_SUR
        View Mode Composite-Surface Constant:
        See Also:
        Constant Field Values
      • ms_MaxLights

        protected static int ms_MaxLights
      • ms_iNumLev

        protected static int ms_iNumLev
      • ms_iMaxSamples

        protected static int ms_iMaxSamples
      • m_kVolumeImageA

        protected VolumeImage m_kVolumeImageA
        Shared volume data and textures.
      • m_kVolumeImageB

        protected VolumeImage m_kVolumeImageB
        Shared volume data and textures.
      • m_kPShaderCMP

        protected WildMagic.LibGraphics.Shaders.PixelShader m_kPShaderCMP
        PixelShader program and data for Composite mode:
      • m_iWhichShader

        protected int m_iWhichShader
        Indicates which shader to use (MIP, DDR, CMP, SUR, CMP_SUR, MULTIHISTO):
      • m_kSceneTarget

        protected WildMagic.LibGraphics.Rendering.Texture m_kSceneTarget
        Reference to the SceneImage texture:
      • m_aafLight

        protected float[][] m_aafLight
      • m_iUsedWidgets

        protected int m_iUsedWidgets
      • m_iPasses

        protected int m_iPasses
      • m_pkVShader

        protected WildMagic.LibGraphics.Shaders.VertexShader m_pkVShader
      • m_bMultiHisto

        protected boolean m_bMultiHisto
      • m_iBlend

        protected int m_iBlend
      • m_iSrcBlend

        protected int m_iSrcBlend
      • m_iDstBlend

        protected int m_iDstBlend
      • m_kBlendColor

        protected WildMagic.LibFoundation.Mathematics.ColorRGBA m_kBlendColor
      • m_fMaxLength

        protected float m_fMaxLength
      • m_afBlendParam

        protected float[] m_afBlendParam
      • m_afABBlendParam

        protected float[] m_afABBlendParam
      • m_bGradientMag

        protected boolean m_bGradientMag
      • m_fSamples

        protected float m_fSamples
    • Constructor Detail

      • VolumeShaderEffectMultiPass

        public VolumeShaderEffectMultiPass​(VolumeImage kVolumeImageA,
                                           VolumeImage kVolumeImageB,
                                           WildMagic.LibGraphics.Rendering.Texture kSceneTarget)
        Creates a new VolumeShaderEffect object.
        Parameters:
        kImageA - the VolumeImage containing the data and textures for rendering.
        kVolumeImageB - second VolumeImage.
        kSceneTarget - the SceneImage texture with the back-facing polygon texture coordinates.
    • Method Detail

      • Blend

        public void Blend​(float fBlend)
        Sets the blend factor shader parameter between imageA and imageB.
        Parameters:
        fBlend - blend factor (range = 0-1).
      • CMPMode

        public void CMPMode()
        Change to the Composite mode pixel shader program.
      • DRRMode

        public void DRRMode()
        Change to the DDR mode pixel shader program.
      • MIPMode

        public void MIPMode()
        Change to the MIP mode pixel shader program.
      • MULTIHISTOMode

        public void MULTIHISTOMode​(boolean bOn)
        Change to the Multi-histogram mode pixel shader program.
      • OnLoadPrograms

        public void OnLoadPrograms​(int iPass,
                                   WildMagic.LibGraphics.Shaders.Program pkVProgram,
                                   WildMagic.LibGraphics.Shaders.Program pkPProgram,
                                   WildMagic.LibGraphics.Shaders.Program pkCProgram)
        This function is called in LoadPrograms once the shader programs are created. Set up the user variable data sources.
        Overrides:
        OnLoadPrograms in class VolumeClipEffect
        Parameters:
        iPass - the ith rendering pass
      • printProgram

        public void printProgram()
      • Reload

        public void Reload​(WildMagic.LibGraphics.Rendering.Renderer kRenderer)
        Reload the current shader programs from disk, compile and parse and send to the GPU.
        Parameters:
        kRenderer - the Renderer object displaying the scene-graph which will apply the shader programs.
      • SaveStrings

        public WildMagic.LibGraphics.ObjectSystem.StringTree SaveStrings​(java.lang.String acTitle)
        Write this object into a StringTree for the scene-graph visualization.
        Specified by:
        SaveStrings in interface WildMagic.LibGraphics.ObjectSystem.StreamInterface
        Overrides:
        SaveStrings in class WildMagic.LibGraphics.Effects.ShaderEffect
        Parameters:
        acTitle - the header for this object in the StringTree.
        Returns:
        StringTree containing a String-based representation of this object and it's children.
      • SelfShadow

        public void SelfShadow​(boolean bShadow)
        Enables/Disables self-shadowing for the Surface mode.
        Parameters:
        bShadow - self-shadowing on/off.
      • getABBlend

        public float getABBlend()
      • setABBlend

        public void setABBlend​(float fBlend)
        Sets the blend factor shader parameter between imageA and imageB.
        Parameters:
        fBlend - blend factor (range = 0-1).
      • SetBackgroundColor

        public void SetBackgroundColor​(WildMagic.LibFoundation.Mathematics.ColorRGBA kColor)
        Sets the background color.
        Parameters:
        kColor - new background color.
      • SetCustomBlend

        public void SetCustomBlend​(int iBlendEquation,
                                   int iLogicOp,
                                   int iSrcBlend,
                                   int iDstBlend,
                                   WildMagic.LibFoundation.Mathematics.ColorRGBA kColor)
      • GetGradientMagnitude

        public boolean GetGradientMagnitude()
      • SetGradientMagnitude

        public void SetGradientMagnitude​(boolean bShow)
        Enables/Disables gradient magnitude filter.
        Parameters:
        bShow - gradient magnitude filter on/off.
      • SetLight

        public boolean SetLight​(java.lang.String kLightType,
                                float[] afType)
        Sets the light type for the given light.
        Parameters:
        kLightType - the name of the light to set (Light0, Light1, etc.)
        afType - the type of light (Ambient = 0, Directional = 1, Point = 2, Spot = 3).
      • setMaxLength

        public void setMaxLength​(float length)
      • setRGBTA

        public void setRGBTA​(ModelRGB RGBT)
      • setRGBTB

        public void setRGBTB​(ModelRGB RGBT)
      • setVolumeSamples

        public int setVolumeSamples​(float fSample)
      • SURFASTMode

        public void SURFASTMode()
        Change to the Surface mode pixel shader program.
        Parameters:
        kRenderer - the Renderer displaying the scene-graph, to which the new shader program is passed.
      • SURMode

        public void SURMode()
        Change to the Composite Surface mode pixel shader program.
        Parameters:
        kRenderer - the Renderer displaying the scene-graph, to which the new shader program is passed.
      • updateLevWidgetState

        public void updateLevWidgetState​(java.util.Vector<ClassificationWidget> kLWS)
      • updateLevWidgetState

        protected void updateLevWidgetState()
      • SetDefaultAlphaState

        protected void SetDefaultAlphaState()
        Overrides:
        SetDefaultAlphaState in class WildMagic.LibGraphics.Effects.ShaderEffect
      • CreateVolumeTexture

        protected void CreateVolumeTexture()
        The VolumeShaderEffect.CreateVolumeTexture() function constructs and initializes the vertex and pixel shader programs for volume rendering. The vertex shader is the same for each rendering type: MIP, DDR, Composite, Surface, and Composite Surface. The pixel shaders are different for each.
      • SetColorImage

        protected void SetColorImage​(WildMagic.LibGraphics.Shaders.Program pkPProgram)
        Sets the IsColor shader parameter values.
      • setCurrentShader

        protected void setCurrentShader()
      • RestoreGlobalState

        public void RestoreGlobalState​(int iPass,
                                       WildMagic.LibGraphics.Rendering.Renderer pkRenderer,
                                       boolean bPrimaryEffect)
        Overrides:
        RestoreGlobalState in class WildMagic.LibGraphics.Effects.ShaderEffect
      • SetGlobalState

        public void SetGlobalState​(int iPass,
                                   WildMagic.LibGraphics.Rendering.Renderer pkRenderer,
                                   boolean bPrimaryEffect)
        Overrides:
        SetGlobalState in class WildMagic.LibGraphics.Effects.ShaderEffect