Class VolumeShaderEffectMultiPass
- java.lang.Object
-
- WildMagic.LibGraphics.ObjectSystem.GraphicsObject
-
- WildMagic.LibGraphics.Effects.Effect
-
- WildMagic.LibGraphics.Effects.ShaderEffect
-
- gov.nih.mipav.view.renderer.WildMagic.Render.VolumeClipEffect
-
- gov.nih.mipav.view.renderer.WildMagic.Render.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 Summary
Fields Modifier and Type Field Description protected static intCMPView Mode Composite Constant:protected static intCMP_SURView Mode Composite-Surface Constant:protected static intCUSTOMprotected static intDRRView Mode DRR Constant:protected float[][]m_aafLightprotected float[]m_afABBlendParamprotected float[]m_afBlendParamprotected ClassificationWidgetState[]m_akLevWidgetprotected booleanm_bGradientMagprotected booleanm_bMultiHistoprotected floatm_fMaxLengthprotected floatm_fSamplesprotected intm_iBlendprotected intm_iDstBlendprotected intm_iPassesprotected intm_iSrcBlendprotected intm_iUsedWidgetsprotected intm_iWhichShaderIndicates which shader to use (MIP, DDR, CMP, SUR, CMP_SUR, MULTIHISTO):protected WildMagic.LibFoundation.Mathematics.ColorRGBAm_kBlendColorprotected WildMagic.LibGraphics.Shaders.PixelShaderm_kPShaderCMPPixelShader program and data for Composite mode:protected ModelRGBm_kRGBTprotected WildMagic.LibGraphics.Rendering.Texturem_kSceneTargetReference to the SceneImage texture:protected VolumeImagem_kVolumeImageAShared volume data and textures.protected VolumeImagem_kVolumeImageBShared volume data and textures.protected WildMagic.LibGraphics.Shaders.VertexShaderm_pkVShaderprotected static intMIPView Mode MIP Constant:protected static intms_iMaxSamplesprotected static intms_iNumLevprotected static intms_MaxLightsprivate static longserialVersionUIDprotected static intSURView Mode Surface Constant:-
Fields inherited from class gov.nih.mipav.view.renderer.WildMagic.Render.VolumeClipEffect
CLIP_A, CLIP_A_INV, CLIP_EYE, CLIP_EYE_INV, CLIP_X, CLIP_X_INV, CLIP_Y, CLIP_Y_INV, CLIP_Z, CLIP_Z_INV, m_aafClipData, m_afClipAll, m_afClipOBBAxis0, m_afClipOBBAxis1, m_afClipOBBAxis2, m_afClipOBBExtent, m_afClipSphereCenter, m_afClipSphereScale, m_afDoClip, m_afVolumeMatrix, m_bClipOBB, m_bClipSphere, MAX_CLIP_PLANES
-
-
Constructor Summary
Constructors Constructor Description VolumeShaderEffectMultiPass(VolumeImage kVolumeImageA, VolumeImage kVolumeImageB, WildMagic.LibGraphics.Rendering.Texture kSceneTarget)Creates a new VolumeShaderEffect object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidBlend(float fBlend)Sets the blend factor shader parameter between imageA and imageB.voidCMPMode()Change to the Composite mode pixel shader program.protected voidCreateVolumeTexture()The VolumeShaderEffect.CreateVolumeTexture() function constructs and initializes the vertex and pixel shader programs for volume rendering.voiddispose()memory cleanup.voidDRRMode()Change to the DDR mode pixel shader program.floatgetABBlend()booleanGetGradientMagnitude()voidMIPMode()Change to the MIP mode pixel shader program.voidMULTIHISTOMode(boolean bOn)Change to the Multi-histogram mode pixel shader program.voidOnLoadPrograms(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.voidprintProgram()voidReload(WildMagic.LibGraphics.Rendering.Renderer kRenderer)Reload the current shader programs from disk, compile and parse and send to the GPU.voidRestoreGlobalState(int iPass, WildMagic.LibGraphics.Rendering.Renderer pkRenderer, boolean bPrimaryEffect)WildMagic.LibGraphics.ObjectSystem.StringTreeSaveStrings(java.lang.String acTitle)Write this object into a StringTree for the scene-graph visualization.voidSelfShadow(boolean bShadow)Enables/Disables self-shadowing for the Surface mode.voidsetABBlend(float fBlend)Sets the blend factor shader parameter between imageA and imageB.voidSetBackgroundColor(WildMagic.LibFoundation.Mathematics.ColorRGBA kColor)Sets the background color.protected voidSetColorImage(WildMagic.LibGraphics.Shaders.Program pkPProgram)Sets the IsColor shader parameter values.protected voidsetCurrentShader()voidSetCustomBlend(int iBlendEquation, int iLogicOp, int iSrcBlend, int iDstBlend, WildMagic.LibFoundation.Mathematics.ColorRGBA kColor)protected voidSetDefaultAlphaState()voidSetGlobalState(int iPass, WildMagic.LibGraphics.Rendering.Renderer pkRenderer, boolean bPrimaryEffect)voidSetGradientMagnitude(boolean bShow)Enables/Disables gradient magnitude filter.booleanSetLight(java.lang.String kLightType, float[] afType)Sets the light type for the given light.voidsetMaxLength(float length)voidsetRGBTA(ModelRGB RGBT)voidsetRGBTB(ModelRGB RGBT)intsetVolumeSamples(float fSample)voidSURFASTMode()Change to the Surface mode pixel shader program.voidSURMode()Change to the Composite Surface mode pixel shader program.protected voidupdateLevWidgetState()voidupdateLevWidgetState(java.util.Vector<ClassificationWidget> kLWS)-
Methods inherited from class gov.nih.mipav.view.renderer.WildMagic.Render.VolumeClipEffect
getClip, getClipArb, getClipArbInv, getClipEnable, getClipEye, getClipEyeInv, getClipInv, getClipInvEnable, isClip, isClipAE, isClipOBB, isClipSphere, ResetClip, SetClip, SetClipArb, SetClipArbInv, SetClipEye, SetClipEyeInv, SetClipOBB, SetClipSphere, setVolumeMatrix
-
Methods inherited from class WildMagic.LibGraphics.Effects.ShaderEffect
GetAllObjectsByName, GetBlending, GetCProgram, GetDiskUsed, GetObjectByID, GetObjectByName, GetPassQuantity, GetPProgram, GetSamplerInformation, GetTexture, GetTexture, GetTextureQuantity, GetVProgram, Link, Load, LoadPrograms, LoadResources, OnReleasePrograms, Register, ReleasePrograms, ReleaseResources, Save, SetCProgram, SetPassQuantity, SetPShader, SetVShader
-
Methods inherited from class WildMagic.LibGraphics.ObjectSystem.GraphicsObject
GetID, GetName, GetNextID, GetObjectByIDBase, GetObjectByNameBase, SetName
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
MIP
protected static final int MIP
View Mode MIP Constant:- See Also:
- Constant Field Values
-
DRR
protected static final int DRR
View Mode DRR Constant:- See Also:
- Constant Field Values
-
CMP
protected static final int CMP
View Mode Composite Constant:- See Also:
- Constant Field Values
-
SUR
protected static final int SUR
View Mode Surface Constant:- See Also:
- Constant Field Values
-
CMP_SUR
protected static final int CMP_SUR
View Mode Composite-Surface Constant:- See Also:
- Constant Field Values
-
CUSTOM
protected static final int CUSTOM
- 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_akLevWidget
protected ClassificationWidgetState[] m_akLevWidget
-
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_kRGBT
protected ModelRGB m_kRGBT
-
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.
-
dispose
public void dispose()
memory cleanup.- Overrides:
disposein classVolumeClipEffect
-
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:
OnLoadProgramsin classVolumeClipEffect- 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:
SaveStringsin interfaceWildMagic.LibGraphics.ObjectSystem.StreamInterface- Overrides:
SaveStringsin classWildMagic.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:
SetDefaultAlphaStatein classWildMagic.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:
RestoreGlobalStatein classWildMagic.LibGraphics.Effects.ShaderEffect
-
SetGlobalState
public void SetGlobalState(int iPass, WildMagic.LibGraphics.Rendering.Renderer pkRenderer, boolean bPrimaryEffect)- Overrides:
SetGlobalStatein classWildMagic.LibGraphics.Effects.ShaderEffect
-
-