#include <OSGDVRIsoShader.h>
Inheritance diagram for osg::DVRIsoShader:

Public Types | |
| typedef DVRIsoShaderPtr | Ptr |
| enum | { ShadeModeFieldId = Inherited::NextFieldId, ActiveShadeModeFieldId = ShadeModeFieldId + 1, NextFieldId = ActiveShadeModeFieldId + 1 } |
Public Member Functions | |
| virtual bool | initialize (DVRVolume *volume, DrawActionBase *action) |
| virtual void | activate (DVRVolume *volume, DrawActionBase *action) |
| virtual void | brickActivate (DVRVolume *volume, DrawActionBase *action, Brick *brick) |
| virtual void | deactivate (DVRVolume *volume, DrawActionBase *action) |
| virtual void | cleanup (DVRVolume *volume, DrawActionBase *action) |
| virtual void | renderSlice (DVRVolume *volume, DrawActionBase *action, Real32 *data, UInt32 vertices, UInt32 values) |
| virtual void | renderSlice (DVRVolume *volume, DrawActionBase *action, DVRRenderSlice *clippedSlice) |
| virtual bool | hasRenderCallback (void) |
| virtual bool | useMTSlabs (void) |
Sync | |
| *virtual void | changed (BitVector whichField, UInt32 origin) |
| react to field changes | |
Output | |
| *virtual void | dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const |
| output the instance for debug purposes | |
FieldContainer Get | |
| *virtual FieldContainerType & | getType (void) |
| virtual const FieldContainerType & | getType (void) const |
| virtual UInt32 | getContainerSize (void) const |
Binary Access | |
| *virtual UInt32 | getBinSize (const BitVector &whichField) |
| virtual void | copyToBin (BinaryDataHandler &pMem, const BitVector &whichField) |
| virtual void | copyFromBin (BinaryDataHandler &pMem, const BitVector &whichField) |
Copy | |
| *virtual FieldContainerPtr | shallowCopy (void) const |
Static Public Member Functions | |
Class Get | |
| *static FieldContainerType & | getClassType (void) |
| access the type of the class | |
| static UInt32 | getClassTypeId (void) |
| access the numerical type of the class | |
Construction | |
| *static DVRIsoShaderPtr | create (void) |
| create a new instance of the class | |
| static DVRIsoShaderPtr | createEmpty (void) |
| create an empty new instance of the class, do not copy the prototype | |
Static Public Attributes | |
| static const osg::BitVector | ShadeModeFieldMask |
| static const osg::BitVector | ActiveShadeModeFieldMask |
| static const osg::BitVector | MTInfluenceMask |
| static const BitVector | NextFieldMask |
CoredNodePtr helper | |
| static const bool | isNodeCore = false |
CoredNodePtr helper | |
| static const bool | isNodeCore = false |
Protected Types | |
| typedef std::vector< DirLight > | DirLightList |
| enum | ShadingMode { SM_AUTO = 0, SM_COLORMATRIX_2D, SM_COLORMATRIX_3D, SM_REGISTER_COMBINERS_2D, SM_REGISTER_COMBINERS_MULTI2D, SM_REGISTER_COMBINERS_3D, SM_FRAGMENT_PROGRAM_2D, SM_FRAGMENT_PROGRAM_3D, SM_NONE } |
Protected Member Functions | |
| ImagePtr | createGradientImage (DVRVolumeTexturePtr volTex) |
| bool | checkGLVersion (GLfloat version) |
| bool | isModeSupported (DVRVolume *volume, DrawActionBase *action, UInt8 mode) |
| Checks whether the selected mode is supported. | |
| UInt8 | selectMode (DVRVolume *volume, DrawActionBase *action) |
| Automatically select a shading mode. | |
| bool | tryMode (DVRVolume *volume, DrawActionBase *action, UInt8 mode) |
| Checks whether the selected mode is supported. | |
| void | getLightSources (DirLightList &diffuseLights, DirLightList &specularLights, Color4f &ambientLight) |
| void | getCoveredScreenRect (DVRVolume *volume, DrawActionBase *action, GLfloat screenRect[4]) |
| void | activate_ColorMatrixShading (DVRVolume *volume, DrawActionBase *action) |
| void | deactivate_ColorMatrixShading (DVRVolume *volume, DrawActionBase *action) |
| void | activate_NVRegisterCombinerShading (DVRVolume *volume, DrawActionBase *action) |
| void | deactivate_NVRegisterCombinerShading (DVRVolume *volume, DrawActionBase *action) |
| void | activate_FragmentProgramShading (DVRVolume *volume, DrawActionBase *action) |
| void | deactivate_FragmentProgramShading (DVRVolume *volume, DrawActionBase *action) |
| void | renderSlice_NVRegisterCombinerShading (DVRVolume *volume, DrawActionBase *action, Real32 *data, UInt32 vertices, UInt32 values) |
| void | renderSlice_NVRegisterCombinerShading (DVRVolume *volume, DrawActionBase *action, DVRRenderSlice *clippedSlice) |
| void | renderSlice_FragmentProgramShading (DVRVolume *volume, DrawActionBase *action, Real32 *data, UInt32 vertices, UInt32 values) |
| void | renderSlice_FragmentProgramShading (DVRVolume *volume, DrawActionBase *action, DVRRenderSlice *clippedSlice) |
| void | setupCombinerParametersDiffuse (DVRVolume *volume, DrawActionBase *action) |
| void | setupCombinerParametersSpecular (DVRVolume *volume, DrawActionBase *action) |
| void | initCombiners_IsoSurfaceDiffuse (DrawActionBase *action) |
| void | initCombiners_Diffuse2Combiners (DrawActionBase *action) |
| void | initCombiners_DiffuseMultiCombiners (DrawActionBase *action) |
| void | initCombiners_IsoSurfaceSpecular (DrawActionBase *action) |
| void | initCombiners_Specular2Combiners (DrawActionBase *action) |
| void | initCombiners_SpecularMultiCombiners (DrawActionBase *action) |
Constructors | |
| * | DVRIsoShader (void) |
| Constructor. | |
| DVRIsoShader (const DVRIsoShader &source) | |
| Copy Constructor. | |
Destructors | |
| *virtual | ~DVRIsoShader (void) |
| Destructor. | |
Field Get | |
| *SFInt8 * | getSFShadeMode (void) |
| Get the DVRIsoShader::_sfShadeMode field. | |
| SFInt8 * | getSFActiveShadeMode (void) |
| Get the DVRIsoShader::_sfActiveShadeMode field. | |
| Int8 & | getShadeMode (void) |
| Get the value of the DVRIsoShader::_sfShadeMode field. | |
| const Int8 & | getShadeMode (void) const |
| Get the value of the DVRIsoShader::_sfShadeMode field. | |
| Int8 & | getActiveShadeMode (void) |
| Get the value of the DVRIsoShader::_sfActiveShadeMode field. | |
| const Int8 & | getActiveShadeMode (void) const |
| Get the value of the DVRIsoShader::_sfActiveShadeMode field. | |
Field Set | |
| *void | setShadeMode (const Int8 &value) |
| Set the value of the DVRIsoShader::_sfShadeMode field. | |
| void | setActiveShadeMode (const Int8 &value) |
| Set the value of the DVRIsoShader::_sfActiveShadeMode field. | |
Sync | |
| *void | executeSyncImpl (DVRIsoShaderBase *pOther, const BitVector &whichField) |
| virtual void | executeSync (FieldContainer &other, const BitVector &whichField) |
Sync | |
| *void | executeSyncImpl (DVRShaderBase *pOther, const BitVector &whichField) |
MT Destruction | |
| *virtual void | onDestroy (void) |
MT Destruction | |
| *virtual void | onDestroy (void) |
Protected Attributes | |
| ImagePtr | m_gradientImage |
| bool | m_hasPerStageConstants |
| GLint | m_maxCombiners |
| UInt8 | m_shadingMode |
| FragmentProgramChunkPtr | m_pFragProg |
| Int32 | m_textureId |
| GLint | m_colorWriteMask [4] |
Fields | |
| *SFInt8 | _sfShadeMode |
| SFInt8 | _sfActiveShadeMode |
Static Protected Attributes | |
| static char | _fragProg2D [] |
| static char | _fragProg3D [] |
| static UInt32 | _ARB_multitexture = Window::invalidExtensionID |
| static UInt32 | _EXT_texture3D = Window::invalidExtensionID |
| static UInt32 | _EXT_secondary_color = Window::invalidExtensionID |
| static UInt32 | _NV_register_combiners = Window::invalidExtensionID |
| static UInt32 | _NV_register_combiners2 = Window::invalidExtensionID |
| static UInt32 | _SGI_color_matrix = Window::invalidExtensionID |
| static UInt32 | _ARB_fragment_program = Window::invalidExtensionID |
| static UInt32 | _funcActiveTextureARB |
| static UInt32 | _funcMultiTexCoord2dARB |
| static UInt32 | _funcTexImage3DEXT |
| static UInt32 | _funcCombinerParameteriNV |
| static UInt32 | _funcCombinerParameterfvNV |
| static UInt32 | _funcCombinerStageParameterfvNV |
| static UInt32 | _funcCombinerInputNV |
| static UInt32 | _funcCombinerOutputNV |
| static UInt32 | _funcFinalCombinerInputNV |
| static UInt32 | _funcSecondaryColor3fEXT |
| static UInt32 | _funcSecondaryColor3fvEXT |
Private Types | |
| typedef DVRIsoShaderBase | Inherited |
Private Member Functions | |
| void | operator= (const DVRIsoShader &source) |
Static Private Member Functions | |
| static void | initMethod (void) |
| initialize the static features of the class, e.g. action callbacks | |
Friends | |
| class | FieldContainer |
| class | DVRIsoShaderBase |
Classes | |
| struct | DirLight |
Definition at line 67 of file OSGDVRIsoShader.h.
|
|
Reimplemented from osg::DVRIsoShaderBase. Definition at line 71 of file OSGDVRIsoShader.h. |
|
|
Definition at line 156 of file OSGDVRIsoShader.h. |
|
|
Reimplemented from osg::DVRShaderBase. Definition at line 91 of file OSGDVRIsoShaderBase.h. |
|
|
Definition at line 137 of file OSGDVRIsoShader.h. 00138 { 00139 SM_AUTO = 0, 00140 SM_COLORMATRIX_2D, 00141 SM_COLORMATRIX_3D, 00142 SM_REGISTER_COMBINERS_2D, 00143 SM_REGISTER_COMBINERS_MULTI2D, 00144 SM_REGISTER_COMBINERS_3D, 00145 SM_FRAGMENT_PROGRAM_2D, 00146 SM_FRAGMENT_PROGRAM_3D, 00147 SM_NONE 00148 };
|
|
|
Reimplemented from osg::FieldContainer. Definition at line 93 of file OSGDVRIsoShaderBase.h. 00094 { 00095 ShadeModeFieldId = Inherited::NextFieldId, 00096 ActiveShadeModeFieldId = ShadeModeFieldId + 1, 00097 NextFieldId = ActiveShadeModeFieldId + 1 00098 };
|
|
|
|
Definition at line 188 of file OSGDVRIsoShader.cpp. References m_gradientImage, m_pFragProg, m_shadingMode, m_textureId, osg::NullFC, and SM_NONE. 00188 : 00189 Inherited(source) 00190 { 00191 m_gradientImage = NullFC; 00192 m_shadingMode = SM_NONE; 00193 m_pFragProg = NullFC; 00194 m_textureId = -1; 00195 }
|
|
|
Definition at line 198 of file OSGDVRIsoShader.cpp. References m_gradientImage, m_pFragProg, m_textureId, osg::NullFC, and osg::subRefCP(). 00199 { 00200 if(m_pFragProg != NullFC) 00201 { 00202 subRefCP(m_pFragProg); 00203 00204 m_pFragProg = NullFC; 00205 } 00206 00207 if(m_gradientImage != NullFC) 00208 { 00209 subRefCP(m_gradientImage); 00210 00211 m_gradientImage = NullFC; 00212 } 00213 00214 m_textureId = -1; 00215 }
|
|
||||||||||||
|
Reimplemented from osg::DVRShader. Definition at line 243 of file OSGDVRIsoShader.cpp. References osg::addRefCP(), createGradientImage(), DVRVOLUME_PARAMETER, osg::DVRIsoShaderBase::getShadeMode(), osg::DVRVolume::getTextureManager(), GLenum, m_gradientImage, m_shadingMode, m_textureId, osg::NullFC, osg::TextureManager::registerTexture(), SM_FRAGMENT_PROGRAM_2D, SM_REGISTER_COMBINERS_MULTI2D, osg::subRefCP(), SWARNING, and tryMode(). Referenced by activate(). 00244 { 00245 00246 DVRVolumeTexturePtr vol = DVRVOLUME_PARAMETER(volume, DVRVolumeTexture); 00247 00248 if((volume == NULL) || (vol == NullFC)) 00249 { 00250 SWARNING << "DVRIsoShader - NO Volume" << std::endl; 00251 return false; 00252 } 00253 00254 // Determine shading mechanism 00255 tryMode(volume, action, getShadeMode()); 00256 00257 GLenum nInternalFormat = GL_RGBA; 00258 GLenum nExternalFormat = GL_RGBA; 00259 00260 // create gradient texture 00261 if(m_gradientImage != NullFC) 00262 subRefCP(m_gradientImage); 00263 00264 m_gradientImage = createGradientImage(vol); 00265 00266 addRefCP(m_gradientImage); 00267 00268 if((m_shadingMode == SM_REGISTER_COMBINERS_MULTI2D) || 00269 (m_shadingMode == SM_FRAGMENT_PROGRAM_2D ) ) 00270 { 00271 // init multitexture 00272 m_textureId = volume->getTextureManager().registerTexture( 00273 m_gradientImage, 00274 nInternalFormat, 00275 nExternalFormat, 00276 true, 00277 0, 00278 1); 00279 } 00280 else 00281 { 00282 // init single texture 00283 m_textureId = volume->getTextureManager().registerTexture( 00284 m_gradientImage, 00285 nInternalFormat, 00286 nExternalFormat, 00287 true, 00288 0, 00289 -1); 00290 } 00291 00292 if( m_textureId < 0) 00293 { 00294 SWARNING << "DVRIsoShader - Could not register texture: " 00295 << m_textureId 00296 << std::endl; 00297 00298 subRefCP(m_gradientImage); 00299 00300 return false; 00301 } 00302 00303 return true; 00304 }
|
|
||||||||||||
|
||||||||||||||||
|
Reimplemented from osg::DVRShader. Definition at line 349 of file OSGDVRIsoShader.cpp. References FDEBUG. 00350 { 00351 FDEBUG(("DVRIsoShader::brickActivate - nothing to do\n")); 00352 }
|
|
||||||||||||
|
Reimplemented from osg::DVRShader. Definition at line 356 of file OSGDVRIsoShader.cpp. References deactivate_ColorMatrixShading(), deactivate_FragmentProgramShading(), deactivate_NVRegisterCombinerShading(), m_shadingMode, SM_COLORMATRIX_2D, SM_COLORMATRIX_3D, SM_FRAGMENT_PROGRAM_2D, SM_FRAGMENT_PROGRAM_3D, SM_NONE, SM_REGISTER_COMBINERS_2D, SM_REGISTER_COMBINERS_3D, and SM_REGISTER_COMBINERS_MULTI2D. 00357 { 00358 switch(m_shadingMode) 00359 { 00360 case SM_COLORMATRIX_2D: 00361 case SM_COLORMATRIX_3D: 00362 deactivate_ColorMatrixShading(volume, action); 00363 break; 00364 00365 case SM_REGISTER_COMBINERS_2D: 00366 case SM_REGISTER_COMBINERS_MULTI2D: 00367 case SM_REGISTER_COMBINERS_3D: 00368 deactivate_NVRegisterCombinerShading(volume, action); 00369 break; 00370 00371 case SM_FRAGMENT_PROGRAM_2D: 00372 case SM_FRAGMENT_PROGRAM_3D: 00373 deactivate_FragmentProgramShading(volume, action); 00374 break; 00375 00376 case SM_NONE: 00377 default: 00378 break; 00379 } 00380 }
|
|
||||||||||||
|
Definition at line 384 of file OSGDVRIsoShader.cpp. References osg::DVRVolume::getTextureManager(), m_gradientImage, m_pFragProg, m_textureId, osg::NullFC, osg::subRefCP(), and osg::TextureManager::unregisterTexture(). Referenced by activate(). 00385 { 00386 if(m_pFragProg != NullFC) 00387 { 00388 subRefCP(m_pFragProg); 00389 00390 m_pFragProg = NullFC; 00391 } 00392 00393 if(m_gradientImage != NullFC) 00394 { 00395 subRefCP(m_gradientImage); 00396 00397 m_gradientImage = NullFC; 00398 } 00399 00400 if (m_textureId != -1) 00401 { 00402 volume->getTextureManager().unregisterTexture(m_textureId); 00403 } 00404 }
|
|
||||||||||||||||||||||||
|
Reimplemented from osg::DVRShader. Definition at line 409 of file OSGDVRIsoShader.cpp. References m_shadingMode, renderSlice_FragmentProgramShading(), renderSlice_NVRegisterCombinerShading(), SM_FRAGMENT_PROGRAM_2D, and SM_REGISTER_COMBINERS_MULTI2D. 00414 { 00415 switch(m_shadingMode) 00416 { 00417 case SM_REGISTER_COMBINERS_MULTI2D: 00418 renderSlice_NVRegisterCombinerShading(volume, 00419 action, 00420 data, 00421 vertices, 00422 values); 00423 break; 00424 00425 case SM_FRAGMENT_PROGRAM_2D: 00426 renderSlice_FragmentProgramShading(volume, 00427 action, 00428 data, 00429 vertices, 00430 values); 00431 break; 00432 default: 00433 break; 00434 } 00435 }
|
|
||||||||||||||||
|
Reimplemented from osg::DVRShader. Definition at line 439 of file OSGDVRIsoShader.cpp. References m_shadingMode, renderSlice_FragmentProgramShading(), renderSlice_NVRegisterCombinerShading(), SM_FRAGMENT_PROGRAM_2D, and SM_REGISTER_COMBINERS_MULTI2D. 00442 { 00443 switch(m_shadingMode) 00444 { 00445 case SM_REGISTER_COMBINERS_MULTI2D: 00446 renderSlice_NVRegisterCombinerShading(volume,action,clippedSlice); 00447 break; 00448 00449 case SM_FRAGMENT_PROGRAM_2D: 00450 renderSlice_FragmentProgramShading(volume,action,clippedSlice); 00451 break; 00452 00453 default: 00454 break; 00455 } 00456 }
|
|
|
Reimplemented from osg::DVRShader. Definition at line 461 of file OSGDVRIsoShader.cpp. References m_shadingMode, SM_FRAGMENT_PROGRAM_2D, and SM_REGISTER_COMBINERS_MULTI2D. 00462 { 00463 switch(m_shadingMode) 00464 { 00465 case SM_REGISTER_COMBINERS_MULTI2D: 00466 return true; 00467 00468 case SM_FRAGMENT_PROGRAM_2D: 00469 return true; 00470 00471 default: 00472 break; 00473 } 00474 00475 return false; 00476 }
|
|
|
Reimplemented from osg::DVRShader. Definition at line 480 of file OSGDVRIsoShader.cpp. References m_shadingMode, SM_FRAGMENT_PROGRAM_2D, and SM_REGISTER_COMBINERS_MULTI2D. 00481 { 00482 switch(m_shadingMode) 00483 { 00484 case SM_REGISTER_COMBINERS_MULTI2D: 00485 return true; 00486 00487 case SM_FRAGMENT_PROGRAM_2D: 00488 return true; 00489 00490 default: 00491 break; 00492 } 00493 00494 return false; 00495 }
|
|
||||||||||||
|
Reimplemented from osg::DVRShader. Definition at line 226 of file OSGDVRIsoShader.cpp. References osg::DVRShader::changed(), osg::DVRIsoShaderBase::setActiveShadeMode(), osg::DVRIsoShaderBase::ShadeModeFieldMask, and SM_AUTO. 00227 { 00228 // trigger re-initialization 00229 if(whichField & ShadeModeFieldMask) 00230 setActiveShadeMode(SM_AUTO); 00231 00232 Inherited::changed(whichField, origin); 00233 }
|
|
||||||||||||
|
Reimplemented from osg::DVRShader. Definition at line 236 of file OSGDVRIsoShader.cpp. References SLOG. 00238 { 00239 SLOG << "Dump DVRIsoShader NI" << std::endl; 00240 }
|
|
|
Definition at line 499 of file OSGDVRIsoShader.cpp. References osg::ImageBase::create(), osg::VectorInterface< ValueTypeT, StorageInterfaceT >::length(), m_gradientImage, osg::VectorInterface< ValueTypeT, StorageInterfaceT >::normalize(), and osg::Image::OSG_RGBA_PF. Referenced by initialize(). 00500 { 00501 int resX = (int) volTex->getImage()->getWidth(); 00502 int resY = (int) volTex->getImage()->getHeight(); 00503 int resZ = (int) volTex->getImage()->getDepth(); 00504 00505 int nGradSetSize = resX * resY * resZ * 4; 00506 int zOff = resX * resY; 00507 int yOff = resX; 00508 00509 00510 // Compute the Gradients 00511 UChar8 *volData = volTex->getImage()->getData(); 00512 00513 UChar8 *gradbuffer = new UChar8[nGradSetSize]; 0 |