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:
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intView Mode Composite Constant:protected static final intView Mode Composite-Surface Constant:protected static final intprotected static final intView Mode DRR Constant:protected float[][]protected float[]protected float[]protected ClassificationWidgetState[]protected booleanprotected booleanprotected floatprotected floatprotected intprotected intprotected intprotected intprotected intprotected intIndicates which shader to use (MIP, DDR, CMP, SUR, CMP_SUR, MULTIHISTO):protected WildMagic.LibFoundation.Mathematics.ColorRGBAprotected WildMagic.LibGraphics.Shaders.PixelShaderPixelShader program and data for Composite mode:protected ModelRGBprotected WildMagic.LibGraphics.Rendering.TextureReference to the SceneImage texture:protected VolumeImageShared volume data and textures.protected VolumeImageShared volume data and textures.protected WildMagic.LibGraphics.Shaders.VertexShaderprotected static final intView Mode MIP Constant:protected static intprotected static intprotected static intprivate static final longprotected static final intView 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_PLANESFields inherited from class WildMagic.LibGraphics.Effects.ShaderEffect
m_iPassQuantity, m_kAlphaState, m_kCompiledPrograms, m_kPShader, m_kVShader -
Constructor Summary
ConstructorsConstructorDescriptionVolumeShaderEffectMultiPass(VolumeImage kVolumeImageA, VolumeImage kVolumeImageB, WildMagic.LibGraphics.Rendering.Texture kSceneTarget) Creates a new VolumeShaderEffect object. -
Method Summary
Modifier and TypeMethodDescriptionvoidBlend(float fBlend) Sets the blend factor shader parameter between imageA and imageB.voidCMPMode()Change to the Composite mode pixel shader program.protected voidThe 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.floatbooleanvoidMIPMode()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.voidvoidReload(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(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 voidvoidSetCustomBlend(int iBlendEquation, int iLogicOp, int iSrcBlend, int iDstBlend, WildMagic.LibFoundation.Mathematics.ColorRGBA kColor) protected voidvoidSetGlobalState(int iPass, WildMagic.LibGraphics.Rendering.Renderer pkRenderer, boolean bPrimaryEffect) voidSetGradientMagnitude(boolean bShow) Enables/Disables gradient magnitude filter.booleanSets the light type for the given light.voidsetMaxLength(float length) voidvoidintsetVolumeSamples(float fSample) voidChange to the Surface mode pixel shader program.voidSURMode()Change to the Composite Surface mode pixel shader program.protected voidvoidMethods 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, setVolumeMatrixMethods 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, SetVShaderMethods inherited from class WildMagic.LibGraphics.Effects.Effect
DrawMethods inherited from class WildMagic.LibGraphics.ObjectSystem.GraphicsObject
GetID, GetName, GetNextID, GetObjectByIDBase, GetObjectByNameBase, SetNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface WildMagic.LibGraphics.ObjectSystem.StreamInterface
GetDiskUsed, Link, Load, Register, Save
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
MIP
protected static final int MIPView Mode MIP Constant:- See Also:
-
DRR
protected static final int DRRView Mode DRR Constant:- See Also:
-
CMP
protected static final int CMPView Mode Composite Constant:- See Also:
-
SUR
protected static final int SURView Mode Surface Constant:- See Also:
-
CMP_SUR
protected static final int CMP_SURView Mode Composite-Surface Constant:- See Also:
-
CUSTOM
protected static final int CUSTOM- See Also:
-
ms_MaxLights
protected static int ms_MaxLights -
ms_iNumLev
protected static int ms_iNumLev -
ms_iMaxSamples
protected static int ms_iMaxSamples -
m_kVolumeImageA
Shared volume data and textures. -
m_kVolumeImageB
Shared volume data and textures. -
m_kPShaderCMP
protected WildMagic.LibGraphics.Shaders.PixelShader m_kPShaderCMPPixelShader program and data for Composite mode: -
m_iWhichShader
protected int m_iWhichShaderIndicates which shader to use (MIP, DDR, CMP, SUR, CMP_SUR, MULTIHISTO): -
m_kSceneTarget
protected WildMagic.LibGraphics.Rendering.Texture m_kSceneTargetReference to the SceneImage texture: -
m_aafLight
protected float[][] m_aafLight -
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
-
m_bGradientMag
protected boolean m_bGradientMag -
m_fSamples
protected float m_fSamples
-
-
Constructor Details
-
VolumeShaderEffectMultiPass
public VolumeShaderEffectMultiPass(VolumeImage kVolumeImageA, VolumeImage kVolumeImageB, WildMagic.LibGraphics.Rendering.Texture kSceneTarget) Creates a new VolumeShaderEffect object.- Parameters:
kVolumeImageB- second VolumeImage.kSceneTarget- the SceneImage texture with the back-facing polygon texture coordinates.kImageA- the VolumeImage containing the data and textures for rendering.
-
-
Method Details
-
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
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
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
-
setRGBTB
-
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
-
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
-