#include <OSGDVRIsoShader.h>

Public Types | |
| enum | { ShadeModeFieldId = Inherited::NextFieldId, ActiveShadeModeFieldId = ShadeModeFieldId + 1, NextFieldId = ActiveShadeModeFieldId + 1 } |
| typedef DVRIsoShaderPtr | Ptr |
| enum | { NextFieldId = 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 |
Get Instance Type Information | |
| UInt32 | getTypeId (void) const |
| UInt16 | getGroupId (void) const |
| const Char8 * | getTypeName (void) const |
| Field * | getField (UInt32 fieldId) |
| Field * | getField (const Char8 *fieldName) |
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 | |
Get Class Type Information | |
| static UInt16 | getClassGroupId (void) |
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 |
Protected Types | |
| 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 } |
| typedef std::vector< DirLight > | DirLightList |
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) |
Sync | |
| void | executeSyncImpl (FieldContainer *pOther, const BitVector &whichField) |
MT Edit | |
| template<class FieldTypeT> | |
| void | beginEditX (const BitVector &whichField, FieldTypeT &field) |
| template<class FieldTypeT> | |
| void | endEditX (const BitVector &whichField, FieldTypeT &field) |
MT Construction | |
| void | onCreate (const FieldContainer *source=NULL) |
| void | onCreateAspect (const FieldContainer *aspect0, const FieldContainer *source=NULL) |
MT Destruction | |
| virtual void | onDestroy (void) |
Static Protected Member Functions | |
Create Fieldcontainer | |
| template<class ObjectPtrT> | |
| static void | newPtr (ObjectPtrT &result, const typename ObjectPtrT::StoredObjectType *prototypeP) |
| template<class ObjectPtrT> | |
| static void | newPtr (ObjectPtrT &result) |
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 |
Member | |
| UInt32 | _shares |
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.
typedef DVRIsoShaderBase osg::DVRIsoShader::Inherited [private] |
typedef std::vector<DirLight> osg::DVRIsoShader::DirLightList [protected] |
Definition at line 156 of file OSGDVRIsoShader.h.
typedef DVRIsoShaderPtr osg::DVRIsoShaderBase::Ptr [inherited] |
enum osg::DVRIsoShader::ShadingMode [protected] |
| SM_AUTO | |
| 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 |
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 };
anonymous enum [inherited] |
Definition at line 93 of file OSGDVRIsoShaderBase.h.
00094 { 00095 ShadeModeFieldId = Inherited::NextFieldId, 00096 ActiveShadeModeFieldId = ShadeModeFieldId + 1, 00097 NextFieldId = ActiveShadeModeFieldId + 1 00098 };
anonymous enum [inherited] |
| DVRIsoShader::DVRIsoShader | ( | void | ) | [protected] |
Definition at line 117 of file OSGDVRIsoShader.cpp.
References _ARB_fragment_program, _ARB_multitexture, _EXT_secondary_color, _EXT_texture3D, _funcActiveTextureARB, _funcCombinerInputNV, _funcCombinerOutputNV, _funcCombinerParameterfvNV, _funcCombinerParameteriNV, _funcCombinerStageParameterfvNV, _funcFinalCombinerInputNV, _funcMultiTexCoord2dARB, _funcSecondaryColor3fEXT, _funcSecondaryColor3fvEXT, _funcTexImage3DEXT, _NV_register_combiners, _NV_register_combiners2, _SGI_color_matrix, GL_FUNC_TEXIMAGE3D, m_gradientImage, m_pFragProg, m_shadingMode, m_textureId, osg::NullFC, OSG_DLSYM_UNDERSCORE, osg::Window::registerExtension(), osg::Window::registerFunction(), and SM_NONE.
00117 : 00118 Inherited() 00119 { 00120 m_gradientImage = NullFC; 00121 m_shadingMode = SM_NONE; 00122 m_pFragProg = NullFC; 00123 m_textureId = -1; 00124 00125 // Do this here, will change in future for OpenSG as a whole 00126 _ARB_multitexture = 00127 Window::registerExtension("GL_ARB_multitexture" ); 00128 00129 _EXT_texture3D = 00130 Window::registerExtension("GL_EXT_texture3D" ); 00131 00132 _EXT_secondary_color = 00133 Window::registerExtension("GL_EXT_secondary_color" ); 00134 00135 _NV_register_combiners = 00136 Window::registerExtension("GL_NV_register_combiners" ); 00137 00138 _NV_register_combiners2 = 00139 Window::registerExtension("GL_NV_register_combiners2"); 00140 00141 _SGI_color_matrix = 00142 Window::registerExtension("GL_SGI_color_matrix" ); 00143 00144 _ARB_fragment_program = 00145 Window::registerExtension("GL_ARB_fragment_program" ); 00146 00147 00148 _funcActiveTextureARB = 00149 Window::registerFunction(OSG_DLSYM_UNDERSCORE"glActiveTextureARB", 00150 _ARB_multitexture); 00151 00152 _funcMultiTexCoord2dARB = 00153 Window::registerFunction(OSG_DLSYM_UNDERSCORE"glMultiTexCoord2dARB", 00154 _ARB_multitexture); 00155 00156 _funcTexImage3DEXT = 00157 Window::registerFunction(GL_FUNC_TEXIMAGE3D, 00158 _EXT_texture3D, 0x0102); 00159 00160 _funcCombinerParameteriNV = 00161 Window::registerFunction(OSG_DLSYM_UNDERSCORE"glCombinerParameteriNV", 00162 _NV_register_combiners); 00163 00164 _funcCombinerParameterfvNV = 00165 Window::registerFunction(OSG_DLSYM_UNDERSCORE"glCombinerParameterfvNV", 00166 _NV_register_combiners); 00167 00168 _funcCombinerStageParameterfvNV = 00169 Window::registerFunction( 00170 OSG_DLSYM_UNDERSCORE"glCombinerStageParameterfvNV", 00171 _NV_register_combiners); 00172 00173 _funcSecondaryColor3fEXT = 00174 Window::registerFunction(OSG_DLSYM_UNDERSCORE"glSecondaryColor3fEXT", 00175 _EXT_secondary_color); 00176 00177 _funcSecondaryColor3fvEXT = 00178 Window::registerFunction(OSG_DLSYM_UNDERSCORE"glSecondaryColor3fvEXT", 00179 _EXT_secondary_color); 00180 00181 _funcCombinerInputNV = 00182 Window::registerFunction(OSG_DLSYM_UNDERSCORE"glCombinerInputNV", 00183 _NV_register_combiners); 00184 00185 _funcCombinerOutputNV = 00186 Window::registerFunction(OSG_DLSYM_UNDERSCORE"glCombinerOutputNV", 00187 _NV_register_combiners); 00188 00189 _funcFinalCombinerInputNV = 00190 Window::registerFunction(OSG_DLSYM_UNDERSCORE"glFinalCombinerInputNV", 00191 _NV_register_combiners); 00192 00193 }
| DVRIsoShader::DVRIsoShader | ( | const DVRIsoShader & | source | ) | [protected] |
Definition at line 196 of file OSGDVRIsoShader.cpp.
References m_gradientImage, m_pFragProg, m_shadingMode, m_textureId, osg::NullFC, and SM_NONE.
00196 : 00197 Inherited(source) 00198 { 00199 m_gradientImage = NullFC; 00200 m_shadingMode = SM_NONE; 00201 m_pFragProg = NullFC; 00202 m_textureId = -1; 00203 }
| DVRIsoShader::~DVRIsoShader | ( | void | ) | [protected, virtual] |
Definition at line 206 of file OSGDVRIsoShader.cpp.
References m_gradientImage, m_pFragProg, m_textureId, osg::NullFC, and osg::subRefCP().
00207 { 00208 if(m_pFragProg != NullFC) 00209 { 00210 subRefCP(m_pFragProg); 00211 00212 m_pFragProg = NullFC; 00213 } 00214 00215 if(m_gradientImage != NullFC) 00216 { 00217 subRefCP(m_gradientImage); 00218 00219 m_gradientImage = NullFC; 00220 } 00221 00222 m_textureId = -1; 00223 }
| bool DVRIsoShader::initialize | ( | DVRVolume * | volume, | |
| DrawActionBase * | action | |||
| ) | [virtual] |
Reimplemented from osg::DVRShader.
Definition at line 251 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().
00252 { 00253 00254 DVRVolumeTexturePtr vol = DVRVOLUME_PARAMETER(volume, DVRVolumeTexture); 00255 00256 if((volume == NULL) || (vol == NullFC)) 00257 { 00258 SWARNING << "DVRIsoShader - NO Volume" << std::endl; 00259 return false; 00260 } 00261 00262 // Determine shading mechanism 00263 tryMode(volume, action, getShadeMode()); 00264 00265 GLenum nInternalFormat = GL_RGBA; 00266 GLenum nExternalFormat = GL_RGBA; 00267 00268 // create gradient texture 00269 if(m_gradientImage != NullFC) 00270 subRefCP(m_gradientImage); 00271 00272 m_gradientImage = createGradientImage(vol); 00273 00274 addRefCP(m_gradientImage); 00275 00276 if((m_shadingMode == SM_REGISTER_COMBINERS_MULTI2D) || 00277 (m_shadingMode == SM_FRAGMENT_PROGRAM_2D ) ) 00278 { 00279 // init multitexture 00280 m_textureId = volume->getTextureManager().registerTexture( 00281 m_gradientImage, 00282 nInternalFormat, 00283 nExternalFormat, 00284 true, 00285 0, 00286 1); 00287 } 00288 else 00289 { 00290 // init single texture 00291 m_textureId = volume->getTextureManager().registerTexture( 00292 m_gradientImage, 00293 nInternalFormat, 00294 nExternalFormat, 00295 true, 00296 0, 00297 -1); 00298 } 00299 00300 if( m_textureId < 0) 00301 { 00302 SWARNING << "DVRIsoShader - Could not register texture: " 00303 << m_textureId 00304 << std::endl; 00305 00306 subRefCP(m_gradientImage); 00307 00308 return false; 00309 } 00310 00311 return true; 00312 }
| void DVRIsoShader::activate | ( | DVRVolume * | volume, | |
| DrawActionBase * | action | |||
| ) | [virtual] |
Reimplemented from osg::DVRShader.
Definition at line 316 of file OSGDVRIsoShader.cpp.
References activate_ColorMatrixShading(), activate_FragmentProgramShading(), activate_NVRegisterCombinerShading(), osg::beginEditCP(), cleanup(), osg::endEditCP(), osg::DVRIsoShaderBase::getActiveShadeMode(), initialize(), m_shadingMode, osg::DVRVolumeBase::ShaderFieldMask, SM_AUTO, 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.
00317 { 00318 // reinitialize if hardware mode has not yet been chosen or mode 00319 // has changed 00320 00321 if(getActiveShadeMode() == SM_AUTO) 00322 { 00323 cleanup (volume, action); 00324 initialize(volume, action); 00325 00326 // notify volume about shader changed 00327 beginEditCP(DVRVolumePtr(volume), DVRVolume::ShaderFieldMask); 00328 endEditCP(DVRVolumePtr (volume), DVRVolume::ShaderFieldMask); 00329 } 00330 00331 switch(m_shadingMode) 00332 { 00333 case SM_COLORMATRIX_2D: 00334 case SM_COLORMATRIX_3D: 00335 activate_ColorMatrixShading(volume, action); 00336 break; 00337 00338 case SM_REGISTER_COMBINERS_2D: 00339 case SM_REGISTER_COMBINERS_MULTI2D: 00340 case SM_REGISTER_COMBINERS_3D: 00341 activate_NVRegisterCombinerShading(volume, action); 00342 break; 00343 00344 case SM_FRAGMENT_PROGRAM_2D: 00345 case SM_FRAGMENT_PROGRAM_3D: 00346 activate_FragmentProgramShading(volume, action); 00347 break; 00348 00349 case SM_NONE: 00350 default: 00351 break; 00352 } 00353 }
| void DVRIsoShader::brickActivate | ( | DVRVolume * | volume, | |
| DrawActionBase * | action, | |||
| Brick * | brick | |||
| ) | [virtual] |
Reimplemented from osg::DVRShader.
Definition at line 357 of file OSGDVRIsoShader.cpp.
References FDEBUG.
00358 { 00359 FDEBUG(("DVRIsoShader::brickActivate - nothing to do\n")); 00360 }
| void DVRIsoShader::deactivate | ( | DVRVolume * | volume, | |
| DrawActionBase * | action | |||
| ) | [virtual] |
Reimplemented from osg::DVRShader.
Definition at line 364 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.
00365 { 00366 switch(m_shadingMode) 00367 { 00368 case SM_COLORMATRIX_2D: 00369 case SM_COLORMATRIX_3D: 00370 deactivate_ColorMatrixShading(volume, action); 00371 break; 00372 00373 case SM_REGISTER_COMBINERS_2D: 00374 case SM_REGISTER_COMBINERS_MULTI2D: 00375 case SM_REGISTER_COMBINERS_3D: 00376 deactivate_NVRegisterCombinerShading(volume, action); 00377 break; 00378 00379 case SM_FRAGMENT_PROGRAM_2D: 00380 case SM_FRAGMENT_PROGRAM_3D: 00381 deactivate_FragmentProgramShading(volume, action); 00382 break; 00383 00384 case SM_NONE: 00385 default: 00386 break; 00387 } 00388 }
| void DVRIsoShader::cleanup | ( | DVRVolume * | volume, | |
| DrawActionBase * | action | |||
| ) | [virtual] |
Definition at line 392 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().
00393 { 00394 if(m_pFragProg != NullFC) 00395 { 00396 subRefCP(m_pFragProg); 00397 00398 m_pFragProg = NullFC; 00399 } 00400 00401 if(m_gradientImage != NullFC) 00402 { 00403 subRefCP(m_gradientImage); 00404 00405 m_gradientImage = NullFC; 00406 } 00407 00408 if (m_textureId != -1) 00409 { 00410 volume->getTextureManager().unregisterTexture(m_textureId); 00411 } 00412 }
| void DVRIsoShader::renderSlice | ( | DVRVolume * | volume, | |
| DrawActionBase * | action, | |||
| Real32 * | data, | |||
| UInt32 | vertices, | |||
| UInt32 | values | |||
| ) | [virtual] |
Reimplemented from osg::DVRShader.
Definition at line 417 of file OSGDVRIsoShader.cpp.
References m_shadingMode, renderSlice_FragmentProgramShading(), renderSlice_NVRegisterCombinerShading(), SM_FRAGMENT_PROGRAM_2D, and SM_REGISTER_COMBINERS_MULTI2D.
00422 { 00423 switch(m_shadingMode) 00424 { 00425 case SM_REGISTER_COMBINERS_MULTI2D: 00426 renderSlice_NVRegisterCombinerShading(volume, 00427 action, 00428 data, 00429 vertices, 00430 values); 00431 break; 00432 00433 case SM_FRAGMENT_PROGRAM_2D: 00434 renderSlice_FragmentProgramShading(volume, 00435 action, 00436 data, 00437 vertices, 00438 values); 00439 break; 00440 default: 00441 break; 00442 } 00443 }
| void DVRIsoShader::renderSlice | ( | DVRVolume * | volume, | |
| DrawActionBase * | action, | |||
| DVRRenderSlice * | clippedSlice | |||
| ) | [virtual] |
Reimplemented from osg::DVRShader.
Definition at line 447 of file OSGDVRIsoShader.cpp.
References m_shadingMode, renderSlice_FragmentProgramShading(), renderSlice_NVRegisterCombinerShading(), SM_FRAGMENT_PROGRAM_2D, and SM_REGISTER_COMBINERS_MULTI2D.
00450 { 00451 switch(m_shadingMode) 00452 { 00453 case SM_REGISTER_COMBINERS_MULTI2D: 00454 renderSlice_NVRegisterCombinerShading(volume,action,clippedSlice); 00455 break; 00456 00457 case SM_FRAGMENT_PROGRAM_2D: 00458 renderSlice_FragmentProgramShading(volume,action,clippedSlice); 00459 break; 00460 00461 default: 00462 break; 00463 } 00464 }
| bool DVRIsoShader::hasRenderCallback | ( | void | ) | [virtual] |
Reimplemented from osg::DVRShader.
Definition at line 469 of file OSGDVRIsoShader.cpp.
References m_shadingMode, SM_FRAGMENT_PROGRAM_2D, and SM_REGISTER_COMBINERS_MULTI2D.
00470 { 00471 switch(m_shadingMode) 00472 { 00473 case SM_REGISTER_COMBINERS_MULTI2D: 00474 return true; 00475 00476 case SM_FRAGMENT_PROGRAM_2D: 00477 return true; 00478 00479 default: 00480 break; 00481 } 00482 00483 return false; 00484 }
| bool DVRIsoShader::useMTSlabs | ( | void | ) | [virtual] |
Reimplemented from osg::DVRShader.
Definition at line 488 of file OSGDVRIsoShader.cpp.
References m_shadingMode, SM_FRAGMENT_PROGRAM_2D, and SM_REGISTER_COMBINERS_MULTI2D.
00489 { 00490 switch(m_shadingMode) 00491 { 00492 case SM_REGISTER_COMBINERS_MULTI2D: 00493 return true; 00494 00495 case SM_FRAGMENT_PROGRAM_2D: 00496 return true; 00497 00498 default: 00499 break; 00500 } 00501 00502 return false; 00503 }
Reimplemented from osg::DVRShader.
Definition at line 234 of file OSGDVRIsoShader.cpp.
References osg::DVRShader::changed(), osg::DVRIsoShaderBase::setActiveShadeMode(), osg::DVRIsoShaderBase::ShadeModeFieldMask, and SM_AUTO.
00235 { 00236 // trigger re-initialization 00237 if(whichField & ShadeModeFieldMask) 00238 setActiveShadeMode(SM_AUTO); 00239 00240 Inherited::changed(whichField, origin); 00241 }
Reimplemented from osg::DVRShader.
Definition at line 244 of file OSGDVRIsoShader.cpp.
References SLOG.
00246 { 00247 SLOG << "Dump DVRIsoShader NI" << std::endl; 00248 }
| ImagePtr DVRIsoShader::createGradientImage | ( | DVRVolumeTexturePtr | volTex | ) | [protected] |
Definition at line 507 of file OSGDVRIsoShader.cpp.
References osg::ImageBase::create(), m_gradientImage, and osg::Image::OSG_RGBA_PF.
Referenced by initialize().
00508 { 00509 int resX = (int) volTex->getImage()->getWidth(); 00510 int resY = (int) volTex->getImage()->getHeight(); 00511 int resZ = (int) volTex->getImage()->getDepth(); 00512 00513 int nGradSetSize = resX * resY * resZ * 4; 00514 int zOff = resX * resY; 00515 int yOff = resX; 00516 00517 00518 // Compute the Gradients 00519 UChar8 *volData = volTex->getImage()->getData(); 00520 00521 UChar8 *gradbuffer = new UChar8[nGradSetSize]; 00522 00523 Vec3f gradient; 00524 00525 for(int z = 0 ; z < resZ ; z++) 00526 { 00527 for(int y = 0 ; y < resY ; y++) 00528 { 00529 for(int x = 0 ; x < resX ; x++) 00530 { 00531 00532 if(x == 0) 00533 { 00534 gradient = Vec3f(-1.0, 0.0, 0.0); 00535 } 00536 else if (x == resX-1) 00537 { 00538 gradient = Vec3f( 1.0, 0.0, 0.0); 00539 } 00540 else if (y == 0) 00541 { 00542 gradient = Vec3f(0.0, -1.0, 0.0); 00543 } 00544 else if (y == resY-1) 00545 { 00546 gradient = Vec3f(0.0, 1.0, 0.0); 00547 } 00548 else if (z == 0) 00549 { 00550 gradient = Vec3f(0.0, 0.0, -1.0); 00551 } else if (z == resZ-1) 00552 { 00553 gradient = Vec3f(0.0, 0.0, 1.0); 00554 } 00555 else 00556 { 00557 UChar8 &dataXl = 00558 volData[z * zOff + y * yOff + x - 1]; 00559 00560 UChar8 &dataXr = 00561 volData[z * zOff + y * yOff + x + 1]; 00562 00563 UChar8 &dataYb = 00564 volData[z * zOff + (y - 1) * yOff + x ]; 00565 00566 UChar8 &dataYt = 00567 volData[z * zOff + (y + 1) * yOff + x ]; 00568 00569 UChar8 &dataZf = 00570 volData[(z - 1) * zOff + y * yOff + x ]; 00571 00572 UChar8 &dataZn = 00573 volData[(z + 1) * zOff + y * yOff + x ]; 00574 00575 gradient = Vec3f((float)(dataXl - dataXr), 00576 (float)(dataYb - dataYt), 00577 (float)(dataZf - dataZn)); 00578 00579 if(gradient.length() != 0.0) 00580 gradient.normalize(); 00581 00582 } 00583 00584 gradbuffer[4 * (z * zOff + y * yOff + x) ] 00585 = (UChar8) (127.0 + gradient[0] * 127.0); // R 00586 00587 gradbuffer[4 * (z * zOff + y * yOff + x) + 1] 00588 = (UChar8) (127.0 + gradient[1] * 127.0); // G 00589 00590 gradbuffer[4 * (z * zOff + y * yOff + x) + 2] 00591 = (UChar8) (127.0 + gradient[2] * 127.0); // B 00592 00593 gradbuffer[4 * (z * zOff + y * yOff + x) + 3] 00594 = volData[z * zOff + y * yOff + x ]; // A 00595 00596 } // for x 00597 00598 } // for y 00599 00600 } // for z 00601 00602 ImagePtr m_gradientImage = Image::create(); 00603 00604 m_gradientImage->set(Image::OSG_RGBA_PF, 00605 resX, 00606 resY, 00607 resZ, 00608 1, 00609 1, 00610 0.0, 00611 gradbuffer); 00612 00613 delete [] gradbuffer; 00614 00615 return m_gradientImage; 00616 }
| bool DVRIsoShader::checkGLVersion | ( | GLfloat | version | ) | [protected] |
Definition at line 705 of file OSGDVRIsoShader.cpp.
Referenced by isModeSupported().
00706 { 00707 char *versionString = (char*) glGetString(GL_VERSION); 00708 00709 if(atof(versionString) >= minVersion) 00710 return true; 00711 else 00712 return false; 00713 }
| bool DVRIsoShader::isModeSupported | ( | DVRVolume * | volume, | |
| DrawActionBase * | action, | |||
| UInt8 | mode | |||
| ) | [protected] |
Definition at line 784 of file OSGDVRIsoShader.cpp.
References _ARB_fragment_program, _ARB_multitexture, _EXT_texture3D, _NV_register_combiners, _SGI_color_matrix, checkGLVersion(), osg::DVRVolumeBase::getTextures2D(), osg::DrawActionBase::getWindow(), osg::Window::hasExtension(), SLOG, SM_COLORMATRIX_2D, SM_COLORMATRIX_3D, SM_FRAGMENT_PROGRAM_2D, SM_FRAGMENT_PROGRAM_3D, SM_NONE, SM_REGISTER_COMBINERS_2D, SM_REGISTER_COMBINERS_3D, SM_REGISTER_COMBINERS_MULTI2D, and SWARNING.
Referenced by selectMode(), and tryMode().
00787 { 00788 Window *win = action->getWindow(); 00789 00790 if(!win) 00791 { 00792 SWARNING << "DVRIsoShader - No valid window" << std::endl; 00793 return false; 00794 } 00795 00796 GLint numStencil; 00797 bool forceTexture2D = false; 00798 bool forceTexture3D = false; 00799 00800 if(volume->getTextures2D() == 1) 00801 { 00802 forceTexture2D = true; 00803 SLOG << "DVRIsoShader - 2D textures forced" << std::endl; 00804 } 00805 else if(volume->getTextures2D() == 0) 00806 { 00807 forceTexture3D = true; 00808 SLOG << "DVRIsoShader - 3D textures forced" << std::endl; 00809 } 00810 00811 switch(mode) 00812 { 00813 case SM_COLORMATRIX_2D: 00814 glGetIntegerv(GL_STENCIL_BITS, &numStencil); 00815 00816 return 00817 numStencil > 0 && 00818 (win->hasExtension(_SGI_color_matrix) || 00819 checkGLVersion(1.2) ) && 00820 !forceTexture3D; 00821 00822 case SM_COLORMATRIX_3D: 00823 glGetIntegerv(GL_STENCIL_BITS,&numStencil); 00824 00825 return 00826 numStencil > 0 && 00827 win->hasExtension(_EXT_texture3D) && 00828 (win->hasExtension(_SGI_color_matrix) || 00829 checkGLVersion(1.2) ) && 00830 !forceTexture2D; 00831 00832 case SM_REGISTER_COMBINERS_2D: 00833 return 00834 win->hasExtension(_NV_register_combiners) && !forceTexture3D; 00835 00836 case SM_REGISTER_COMBINERS_MULTI2D: 00837 return 00838 win->hasExtension(_ARB_multitexture ) && 00839 win->hasExtension(_NV_register_combiners) && 00840 !forceTexture3D; 00841 00842 case SM_REGISTER_COMBINERS_3D: 00843 return 00844 win->hasExtension(_EXT_texture3D ) && 00845 win->hasExtension(_NV_register_combiners) && 00846 !forceTexture2D; 00847 00848 case SM_FRAGMENT_PROGRAM_2D: 00849 return 00850 win->hasExtension(_ARB_multitexture ) && 00851 win->hasExtension(_ARB_fragment_program) && 00852 !forceTexture3D; 00853 00854 case SM_FRAGMENT_PROGRAM_3D: 00855 return 00856 win->hasExtension(_EXT_texture3D ) && 00857 win->hasExtension(_ARB_fragment_program) && 00858 !forceTexture2D; 00859 00860 case SM_NONE: 00861 return true; 00862 00863 default: 00864 break; 00865 } 00866 00867 return false; 00868 }
| UInt8 DVRIsoShader::selectMode | ( | DVRVolume * | volume, | |
| DrawActionBase * | action | |||
| ) | [protected] |
Definition at line 717 of file OSGDVRIsoShader.cpp.
References FINFO, isModeSupported(), SM_COLORMATRIX_2D, SM_COLORMATRIX_3D, SM_FRAGMENT_PROGRAM_2D, SM_FRAGMENT_PROGRAM_3D, SM_NONE, SM_REGISTER_COMBINERS_2D, SM_REGISTER_COMBINERS_3D, SM_REGISTER_COMBINERS_MULTI2D, and SWARNING.
Referenced by tryMode().
00718 { 00719 if(isModeSupported(volume, action, SM_FRAGMENT_PROGRAM_3D)) 00720 { 00721 FINFO(("DVRIsoShader - Autoselect: Using 3D textures and " 00722 "fragment program...\n")); 00723 00724 return SM_FRAGMENT_PROGRAM_3D; 00725 } 00726 00727 if(isModeSupported(volume, action, SM_FRAGMENT_PROGRAM_2D)) 00728 { 00729 FINFO(("DVRIsoShader - Autoselect: Using 2D textures and " 00730 "fragment program...\n")); 00731 00732 return SM_FRAGMENT_PROGRAM_2D; 00733 } 00734 00735 if(isModeSupported(volume, action, SM_REGISTER_COMBINERS_3D)) 00736 { 00737 FINFO(("DVRIsoShader - Autoselect: Using 3D textures and " 00738 "register combiners...\n")); 00739 00740 return SM_REGISTER_COMBINERS_3D; 00741 } 00742 00743 if(isModeSupported(volume, action, SM_REGISTER_COMBINERS_MULTI2D)) 00744 { 00745 FINFO(("DVRIsoShader - Autoselect: Using 2D multi textures and " 00746 "register combiners...\n")); 00747 00748 return SM_REGISTER_COMBINERS_MULTI2D; 00749 } 00750 00751 if(isModeSupported(volume, action, SM_REGISTER_COMBINERS_2D)) 00752 { 00753 FINFO(("DVRIsoShader - Autoselect: Using 2D textures and " 00754 "register combiners...\n")); 00755 00756 return SM_REGISTER_COMBINERS_2D; 00757 } 00758 00759 if(isModeSupported(volume, action, SM_COLORMATRIX_3D)) 00760 { 00761 FINFO(("DVRIsoShader - Autoselect: Using 3D textures and " 00762 "color matrix...\n")); 00763 00764 return SM_COLORMATRIX_3D; 00765 } 00766 00767 if(isModeSupported(volume, action, SM_COLORMATRIX_2D)) 00768 { 00769 FINFO(("DVRIsoShader - Autoselect: Using 2D textures and " 00770 "color matrix...\n")); 00771 00772 return SM_COLORMATRIX_2D; 00773 } 00774 00775 SWARNING << "DVRIsoShader - None of the implemented shading algorithms" 00776 <<std::endl 00777 <<"is supported by this hardware!" 00778 <<std::endl; 00779 00780 return SM_NONE; 00781 }
| bool DVRIsoShader::tryMode | ( | DVRVolume * | volume, | |
| DrawActionBase * | action, | |||
| UInt8 | mode | |||
| ) | [protected] |
Definition at line 871 of file OSGDVRIsoShader.cpp.
References isModeSupported(), m_shadingMode, selectMode(), osg::DVRIsoShaderBase::setActiveShadeMode(), SM_AUTO, SM_NONE, and SWARNING.
Referenced by initialize().
00874 { 00875 if(mode != SM_AUTO) 00876 { 00877 // A certain mode has been selected 00878 if(isModeSupported( volume, action, mode )) 00879 { 00880 SWARNING << "DVRIsoShader - User specified shading mode " 00881 << int(mode) 00882 << std::endl; 00883 00884 m_shadingMode = mode; 00885 } 00886 else 00887 { 00888 SWARNING << "DVRIsoShader - Unsupported shading mode requested " 00889 << int(mode) 00890 << " disabling shading" 00891 << std::endl; 00892 00893 m_shadingMode = SM_NONE; 00894 } 00895 } 00896 else 00897 { 00898 // Use automatic mode selection 00899 m_shadingMode = selectMode(volume, action); 00900 } 00901 00902 setActiveShadeMode(m_shadingMode); 00903 00904 return m_shadingMode == mode; 00905 }
| void DVRIsoShader::getLightSources | ( | DirLightList & | diffuseLights, | |
| DirLightList & | specularLights, | |||
| Color4f & | ambientLight | |||
| ) | [protected] |
Definition at line 620 of file OSGDVRIsoShader.cpp.
References osg::Color4< ValueTypeT >::clear(), osg::DVRIsoShader::DirLight::color, osg::DVRIsoShader::DirLight::dir, and GLenum.
Referenced by activate_FragmentProgramShading(), deactivate_ColorMatrixShading(), setupCombinerParametersDiffuse(), and setupCombinerParametersSpecular().
00623 { 00624 ambientLight .clear(); 00625 diffuseLights .clear(); 00626 specularLights.clear(); 00627 00628 GLint maxNumLights; 00629 00630 glGetIntegerv(GL_MAX_LIGHTS, &maxNumLights); 00631 00632 GLfloat lightPos [4]; 00633 GLfloat diffuseColor [4]; 00634 GLfloat specularColor[4]; 00635 GLfloat ambientColor [4]; 00636 00637 for(int i = 0; i < maxNumLights; i++) 00638 { 00639 if(glIsEnabled(GLenum(GL_LIGHT0 + i))) 00640 { 00641 glGetLightfv(GLenum(GL_LIGHT0 + i), GL_POSITION, lightPos ); 00642 glGetLightfv(GLenum(GL_LIGHT0 + i), GL_AMBIENT, ambientColor ); 00643 glGetLightfv(GLenum(GL_LIGHT0 + i), GL_DIFFUSE, diffuseColor ); 00644 glGetLightfv(GLenum(GL_LIGHT0 + i), GL_SPECULAR, specularColor); 00645 00646 // SLOG << "LightSource: " << i << " enabled" << std::endl; 00647 00648 // check for directional light 00649 // homogenous coordinate = 0 -> infinity ! 00650 if(1.0 == lightPos[3] + 1.0) 00651 { 00652 DirLight light; 00653 00654 // set global light direction 00655 light.dir.setValues(lightPos[0],lightPos[1],lightPos[2]); 00656 00657 // SLOG << "Pos: " << i << " :" << light.dir << std::endl; 00658 00659 // diffuse 00660 if(diffuseColor[0] > 1e-6 || 00661 diffuseColor[1] > 1e-6 || 00662 diffuseColor[2] > 1e-6) 00663 { 00664 light.color = Color4f(diffuseColor[0], 00665 diffuseColor[1], 00666 diffuseColor[2], 00667 0.0f); 00668 00669 diffuseLights.push_back(light); 00670 } 00671 00672 // specular 00673 if(specularColor[0] > 1e-6 || 00674 specularColor[1] > 1e-6 || 00675 specularColor[2] > 1e-6) 00676 { 00677 light.color = Color4f(specularColor[0], 00678 specularColor[1], 00679 specularColor[2], 00680 0.0f); 00681 00682 specularLights.push_back(light); 00683 } 00684 00685 // ambient 00686 for(unsigned int i = 0; i < 4; i++) 00687 { 00688 ambientLight[i] += ambientColor[i]; 00689 } 00690 } 00691 } 00692 } 00693 00694 // global ambient 00695 glGetFloatv(GL_LIGHT_MODEL_AMBIENT,ambientColor); 00696 00697 for(unsigned int i = 0; i < 4; i++) 00698 { 00699 ambientLight[i] += ambientColor[i]; 00700 } 00701 }
| void DVRIsoShader::getCoveredScreenRect | ( | DVRVolume * | volume, | |
| DrawActionBase * | action, | |||
| GLfloat | screenRect[4] | |||
| ) | [protected] |
Definition at line 284 of file OSGDVRIsoShaderColorMatrix.cpp.
References DVRVOLUME_PARAMETER, osg::Action::getActNode(), osg::DrawActionBase::getCamera(), osg::DrawActionBase::getCameraToWorld(), osg::Viewport::getPixelHeight(), osg::Viewport::getPixelWidth(), osg::Camera::getProjection(), osg::Camera::getProjectionTranslation(), osg::DrawActionBase::getViewport(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::TransformationMatrix< ValueTypeT >::multFullMatrixPnt(), osg::TransformationMatrix< ValueTypeT >::multLeft(), and osg::NullFC.
Referenced by deactivate_ColorMatrixShading().
00287 { 00288 int vpSize[2]; 00289 00290 vpSize[0] = action->getViewport()->getPixelWidth(); 00291 vpSize[1] = action->getViewport()->getPixelHeight(); 00292 00293 DVRVolumeTexturePtr tex = DVRVOLUME_PARAMETER(volume, DVRVolumeTexture); 00294 00295 if(tex != NullFC) 00296 { 00297 00298 Matrix4f modelMatrix = action->getActNode()->getToWorld(); 00299 Matrix4f viewMatrix = action->getCameraToWorld(); 00300 00301 viewMatrix.invert(); 00302 00303 Matrix4f prjTranslationMatrix; 00304 00305 action->getCamera()->getProjectionTranslation(prjTranslationMatrix, 00306 vpSize[0], 00307 vpSize[1]); 00308 Matrix4f prjMatrix; 00309 00310 action->getCamera()->getProjection(prjMatrix, 00311 vpSize[0], 00312 vpSize[1]); 00313 00314 Matrix4f toScreenMatrix = modelMatrix; 00315 00316 toScreenMatrix.multLeft(viewMatrix); 00317 toScreenMatrix.multLeft(prjTranslationMatrix); 00318 toScreenMatrix.multLeft(prjMatrix); 00319 00320 00321 Vec3f & res = tex->getResolution(); 00322 Vec3f & slice = tex->getSliceThickness(); 00323 00324 Pnt3f minBB(-0.5f * res[0] * slice[0], 00325 -0.5f * res[1] * slice[1], 00326 -0.5f * res[2] * slice[2]); 00327 00328 Pnt3f maxBB(-minBB); 00329 00330 Pnt3f BB[8] = 00331 { 00332 Pnt3f(minBB[0],minBB[1],minBB[2]), 00333 Pnt3f(maxBB[0],minBB[1],minBB[2]), 00334 Pnt3f(maxBB[0],maxBB[1],minBB[2]), 00335 Pnt3f(minBB[0],maxBB[1],minBB[2]), 00336 Pnt3f(minBB[0],minBB[1],maxBB[2]), 00337 Pnt3f(maxBB[0],minBB[1],maxBB[2]), 00338 Pnt3f(maxBB[0],maxBB[1],maxBB[2]), 00339 Pnt3f(minBB[0],maxBB[1],maxBB[2]) 00340 }; 00341 00342 00343 Pnt3f tBB; 00344 toScreenMatrix.multFullMatrixPnt(BB[0],tBB); 00345 00346 screenRect[0] = tBB[0]; 00347 screenRect[1] = tBB[1]; 00348 screenRect[2] = tBB[0]; 00349 screenRect[3] = tBB[1]; 00350 00351 // get min,max coordinates 00352 for(unsigned int i = 1; i < 8; i++) 00353 { 00354 toScreenMatrix.multFullMatrixPnt(BB[i],tBB); 00355 00356 if(tBB[0] < screenRect[0]) 00357 { 00358 screenRect[0] = tBB[0]; 00359 } 00360 else if(tBB[0] > screenRect[2]) 00361 { 00362 screenRect[2] = tBB[0]; 00363 } 00364 00365 if(tBB[1] < screenRect[1]) 00366 { 00367 screenRect[1] = tBB[1]; 00368 } 00369 else if(tBB[1] > screenRect[3]) 00370 { 00371 screenRect[3] = tBB[1]; 00372 } 00373 } 00374 00375 // clamp covered rectangle to viewport 00376 for(unsigned int i = 0; i < 4; i++) 00377 { 00378 if(screenRect[i] < -1.0) 00379 screenRect[i] = -1.0; 00380 else if(screenRect[i] > 1.0) 00381 screenRect[i] = 1.0; 00382 } 00383 } 00384 else 00385 { 00386 // something wrong with initialization - do not copy anything 00387 screenRect[0] = screenRect[1] = screenRect[2] = screenRect[3] = 0; 00388 } 00389 }
| void DVRIsoShader::activate_ColorMatrixShading | ( | DVRVolume * | volume, | |
| DrawActionBase * | action | |||
| ) | [protected] |
Definition at line 18 of file OSGDVRIsoShaderColorMatrix.cpp.
References DVRVOLUME_PARAMETER, osg::DVRVolumeBase::getDoTextures(), m_colorWriteMask, osg::NullFC, and SWARNING.
Referenced by activate().
00020 { 00021 DVRVolumeTexturePtr vol = DVRVOLUME_PARAMETER(volume, 00022 DVRVolumeTexture); 00023 00024 DVRIsoSurfacePtr isoParam = DVRVOLUME_PARAMETER(volume, 00025 DVRIsoSurface); 00026 00027 if((volume == NULL) || (vol == NullFC)) 00028 { 00029 SWARNING << "NO Volume ..." << std::endl; 00030 return; 00031 } 00032 00033 Real32 isoValue; 00034 UInt32 alphaMode; 00035 00036 // get parameters from isosurface attachment if available 00037 if(isoParam!=NullFC) 00038 { 00039 isoValue = isoParam->getIsoValue (); 00040 alphaMode = isoParam->getAlphaMode(); 00041 } 00042 else 00043 { 00044 isoValue = 1.0; 00045 alphaMode = GL_GREATER; 00046 } 00047 00048 glPushAttrib(GL_COLOR_BUFFER_BIT | 00049 GL_ENABLE_BIT | 00050 GL_DEPTH_BUFFER_BIT | 00051 GL_STENCIL_BUFFER_BIT | 00052 GL_POLYGON_BIT | 00053 GL_PIXEL_MODE_BIT); 00054 00055 if(volume->getDoTextures()) 00056 { 00057 00058 glGetIntegerv(GL_COLOR_WRITEMASK,m_colorWriteMask); 00059 00060 // draw color 1 for MODULATE 00061 glColor4f(1.0, 1.0, 1.0, 1.0); 00062 00063 // Enable Alpha Test for isosurface 00064 glEnable(GL_ALPHA_TEST); 00065 glAlphaFunc(alphaMode, isoValue); 00066 00067 // no blending and lighting 00068 glDisable(GL_BLEND); 00069 glDisable(GL_LIGHTING); 00070 00071 // setup stencil buffer 00072 // to mask the "volume region" 00073 glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_FALSE); 00074 glEnable(GL_STENCIL_TEST); 00075 glClearStencil(0xFF); 00076 glStencilMask(0xFF); 00077 glClear(GL_STENCIL_BUFFER_BIT); 00078 glStencilFunc(GL_ALWAYS, 0x0, 0x1); // write always 00079 glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO); 00080 } 00081 00082 }
| void DVRIsoShader::deactivate_ColorMatrixShading | ( | DVRVolume * | volume, | |
| DrawActionBase * | action | |||
| ) | [protected] |
Definition at line 85 of file OSGDVRIsoShaderColorMatrix.cpp.
References getCoveredScreenRect(), osg::DVRVolumeBase::getDoTextures(), getLightSources(), osg::Viewport::getPixelBottom(), osg::Viewport::getPixelLeft(), osg::Viewport::getPixelRight(), osg::Viewport::getPixelTop(), osg::DrawActionBase::getViewport(), m_colorWriteMask, osg::osgceil(), osg::osgfloor(), and osg::Slicer::rotateToLocal().
Referenced by deactivate().
00087 { 00088 if(volume->getDoTextures()) 00089 { 00090 00091 glDisable(GL_DEPTH_TEST); 00092 glDisable(GL_ALPHA_TEST); 00093 glDepthMask(GL_FALSE); 00094 glDisable(GL_LIGHTING); 00095 00096 glStencilFunc(GL_EQUAL, 0x0, 0xFF); 00097 glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP); 00098 00099 Color4f diffuseLightColor; 00100 Vec3f diffuseDir; 00101 00102 DirLightList diffuseLights; 00103 DirLightList specularLights; 00104 Color4f ambientLight(0.0f,0.0f,0.0f,0.0f); 00105 00106 getLightSources(diffuseLights,specularLights,ambientLight); 00107 00108 // use the first available diffuse lightsource for shading 00109 if(diffuseLights.empty()) 00110 { 00111 diffuseLightColor[0] = 0.0f; 00112 diffuseLightColor[1] = 0.0f; 00113 diffuseLightColor[2] = 0.0f; 00114 diffuseLightColor[3] = 0.0f; 00115 } 00116 else 00117 { 00118 diffuseLightColor = diffuseLights.begin()->color; 00119 00120 Slicer::rotateToLocal(action, 00121 diffuseLights.begin()->dir, 00122 diffuseDir); 00123 } 00124 00125 // store the matrix mode 00126 GLint oldMatrixMode; 00127 glGetIntegerv(GL_MATRIX_MODE, &oldMatrixMode); 00128 00129 // store alpha scale and bias 00130 GLfloat oldAlphaBias; 00131 GLfloat oldAlphaScale; 00132 00133 glGetFloatv(GL_ALPHA_BIAS, &oldAlphaBias); 00134 glGetFloatv(GL_ALPHA_SCALE, &oldAlphaScale); 00135 00136 // ensure alpha is 1 00137 glPixelTransferf(GL_ALPHA_SCALE, 0.00001f); 00138 glPixelTransferf(GL_ALPHA_BIAS, 0.999999f); 00139 00140 // compute shading 00141 00142 // switch to color matrix mode to compute diffuse shading 00143 glMatrixMode(GL_COLOR); 00144 00145 // push actual color matrix 00146 glPushMatrix(); 00147 00148 GLfloat colorMatV[16]; 00149 00150 // set light color 00151 colorMatV[0] = m_colorWriteMask[0] ? diffuseLightColor[0] : 0.0f; 00152 colorMatV[1] = 0.0f; 00153 colorMatV[2] = 0.0f; 00154 colorMatV[3] = 0.0f; 00155 00156 colorMatV[4] = 0.0f; 00157 colorMatV[5] = m_colorWriteMask[1] ? diffuseLightColor[1] : 0.0f; 00158 colorMatV[6] = 0.0f; 00159 colorMatV[7] = 0.0f; 00160 00161 colorMatV[8] = 0.0f; 00162 colorMatV[9] = 0.0f; 00163 colorMatV[10] = m_colorWriteMask[2] ? diffuseLightColor[2] : 0.0f; 00164 colorMatV[11] = 0.0f; 00165 00166 colorMatV[12] = m_colorWriteMask[0] ? ambientLight[0] : 0.0f; 00167 colorMatV[13] = m_colorWriteMask[1] ? ambientLight[1] : 0.0f; 00168 colorMatV[14] = m_colorWriteMask[2] ? ambientLight[2] : 0.0f; 00169 colorMatV[15] = 1.0f; 00170 00171 glLoadMatrixf(colorMatV); 00172 00173 // set light direction for computation of cosine-term 00174 colorMatV[0] = diffuseDir[0]; 00175 colorMatV[1] = diffuseDir[0]; 00176 colorMatV[2] = diffuseDir[0]; 00177 //colorMatV[3] = 0.0f; 00178 00179 colorMatV[4] = diffuseDir[1]; 00180 colorMatV[5] = diffuseDir[1]; 00181 colorMatV[6] = diffuseDir[1]; 00182 //colorMatV[7] = 0.0f; 00183 00184 colorMatV[8] = diffuseDir[2]; 00185 colorMatV[9] = diffuseDir[2]; 00186 colorMatV[10] = diffuseDir[2]; 00187 //colorMatV[11] = 0.0f; 00188 00189 colorMatV[12] = 0.0f; 00190 colorMatV[13] = 0.0f; 00191 colorMatV[14] = 0.0f; 00192 //colorMatV[15] = 1.0f; 00193 00194 glMultMatrixf(colorMatV); 00195 00196 // rescale/bias gradients 00197 colorMatV[0] = 2.0f; 00198 colorMatV[1] = 0.0f; 00199 colorMatV[2] = 0.0f; 00200 00201 colorMatV[3] = 0.0f; 00202 00203 colorMatV[4] = 0.0f; 00204 colorMatV[5] = 2.0f; 00205 colorMatV[6] = 0.0f; 00206 00207 colorMatV[7] = 0.0f; 00208 00209 colorMatV[8] = 0.0f; 00210 colorMatV[9] = 0.0f; 00211 colorMatV[10] = 2.0f; 00212 00213 colorMatV[11] = 0.0f; 00214 00215 colorMatV[12] = -1.0f; 00216 colorMatV[13] = -1.0f; 00217 colorMatV[14] = -1.0f; 00218 00219 colorMatV[15] = 1.0f; 00220 00221 // set the color matrix on top of the stack 00222 glMultMatrixf(colorMatV); 00223 00224 // compute shading 00225 GLint drawBuf; 00226 glGetIntegerv(GL_DRAW_BUFFER, &drawBuf); 00227 glReadBuffer(drawBuf); 00228 00229 // get covered screen rect in device coordinates 00230 GLfloat screenS[4]; 00231 getCoveredScreenRect(volume,action,screenS); 00232 00233 GLint vpOrigin[2]; 00234 GLint vpSize[2]; 00235 00236 vpOrigin[0] = action->getViewport()->getPixelLeft(); 00237 vpOrigin[1] = action->getViewport()->getPixelBottom(); 00238 00239 vpSize[0] = 00240 action->getViewport()->getPixelRight() - 00241 action->getViewport()->getPixelLeft (); 00242 00243 vpSize[1] = 00244 action->getViewport()->getPixelTop () - 00245 action->getViewport()->getPixelBottom(); 00246 00247 // compute covered pixels 00248 GLint sr[4]; 00249 00250 sr[0] = (GLint) osgfloor(vpOrigin[0]+(screenS[0]+1.0f)*(vpSize[0]/2)); 00251 sr[1] = (GLint) osgfloor(vpOrigin[1]+(screenS[1]+1.0f)*(vpSize[1]/2)); 00252 sr[2] = (GLint) osgceil (vpOrigin[0]+(screenS[2]+1.0f)*(vpSize[0]/2)); 00253 sr[3] = (GLint) osgceil (vpOrigin[1]+(screenS[3]+1.0f)*(vpSize[1]/2)); 00254 00255 // copy covered pixels 00256 glMatrixMode(GL_MODELVIEW); 00257 glPushMatrix(); 00258 glLoadIdentity(); 00259 glMatrixMode(GL_PROJECTION); 00260 glPushMatrix(); 00261 glLoadIdentity(); 00262 glRasterPos2f(screenS[0],screenS[1]); 00263 glCopyPixels(sr[0],sr[1],sr[2]-sr[0]+1,sr[3]-sr[1]+1, GL_COLOR); 00264 glPopMatrix(); 00265 glMatrixMode(GL_MODELVIEW); 00266 glPopMatrix(); 00267 00268 // restore alpha bias and scale 00269 glPixelTransferf(GL_ALPHA_BIAS, oldAlphaBias); 00270 glPixelTransferf(GL_ALPHA_SCALE, oldAlphaScale); 00271 00272 // restore old color matrix 00273 glMatrixMode(GL_COLOR); 00274 glPopMatrix(); 00275 00276 // restore old matrix mode 00277 glMatrixMode(oldMatrixMode); 00278 00279 } 00280 00281 glPopAttrib(); 00282 }
| void DVRIsoShader::activate_NVRegisterCombinerShading | ( | DVRVolume * | volume, | |
| DrawActionBase * | action | |||
| ) | [protected] |
Definition at line 1820 of file OSGDVRIsoShaderNVRegisterCombiners.cpp.
References _funcActiveTextureARB, _NV_register_combiners2, DVRVOLUME_PARAMETER, FINFO, osg::DVRVolumeBase::getDoTextures(), osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GL_MAX_GENERAL_COMBINERS_NV, GL_REGISTER_COMBINERS_NV, GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, osg::Window::hasExtension(), initCombiners_IsoSurfaceDiffuse(), initCombiners_IsoSurfaceSpecular(), m_hasPerStageConstants, m_maxCombiners, m_shadingMode, osg::NullFC, setupCombinerParametersDiffuse(), setupCombinerParametersSpecular(), and SM_REGISTER_COMBINERS_MULTI2D.
Referenced by activate().
01822 { 01823 if(volume->getDoTextures()) 01824 { 01825 Window *win = action->getWindow(); 01826 01827 glGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV, &m_maxCombiners); 01828 FINFO(("DVRIsoShader - found %d general register combiners\n", 01829 m_maxCombiners)); 01830 01831 if(win->hasExtension(_NV_register_combiners2)) 01832 { 01833 FINFO(("DVRIsoShader - found per (register combiner) " 01834 "stage constants\n")); 01835 01836 m_hasPerStageConstants = true; 01837 } 01838 else 01839 { 01840 FINFO(("DVRIsoShader - no per (register combiner) " 01841 "stage constants available\n")); 01842 01843 m_hasPerStageConstants = false; 01844 } 01845 01846 ActiveTextureARBFunc ActiveTextureARB = 01847 (ActiveTextureARBFunc) win->getFunction(_funcActiveTextureARB); 01848 01849 // get parameters from isosurface attachment if available 01850 Real32 isoValue; 01851 UInt32 alphaMode; 01852 bool doSpecular; 01853 DVRIsoSurfacePtr isoParam = DVRVOLUME_PARAMETER(volume, 01854 DVRIsoSurface); 01855 if(isoParam != NullFC) 01856 { 01857 isoValue = isoParam->getIsoValue (); 01858 alphaMode = isoParam->getAlphaMode (); 01859 doSpecular = isoParam->getSpecularLighting(); 01860 } 01861 else 01862 { 01863 isoValue = 1.0; 01864 alphaMode = GL_GREATER; 01865 doSpecular = false; 01866 } 01867 01868 // push the relevant parts of the current OpenGL state 01869 glPushAttrib(GL_ENABLE_BIT | 01870 GL_COLOR_BUFFER_BIT | 01871 GL_DEPTH_BUFFER_BIT | 01872 GL_POLYGON_BIT | 01873 GL_TEXTURE_BIT ); 01874 01875 // enable register combiners 01876 glEnable(GL_REGISTER_COMBINERS_NV); 01877 01878 // enable multitextures 01879 if(m_shadingMode == SM_REGISTER_COMBINERS_MULTI2D) 01880 { 01881 ActiveTextureARB(GL_TEXTURE0_ARB); 01882 ActiveTextureARB(GL_TEXTURE1_ARB); 01883 } 01884 01885 // case NV_ISOSURFACE_SHADED: 01886 01887 glDisable(GL_BLEND); 01888 glDisable(GL_LIGHTING); 01889 01890 01891 // enable alpha test 01892 glEnable (GL_ALPHA_TEST ); 01893 glAlphaFunc(alphaMode, isoValue); 01894 01895 // initialize combiner setup 01896 if(doSpecular) 01897 { 01898 setupCombinerParametersSpecular (volume, 01899 action); 01900 initCombiners_IsoSurfaceSpecular(action); 01901 } 01902 else 01903 { 01904 setupCombinerParametersDiffuse (volume, 01905 action); 01906 initCombiners_IsoSurfaceDiffuse(action); 01907 } 01908 01909 // case NV_ISOSURFACE_SHADED_2SIDED: 01910 // if (fIsoOpacity < 1.0) { 01911 // // TRANSPARENT_ISO SURFACE 01912 // // write opacity value into destination alpha 01913 // glClearColor(0.0, 0.0, 0.0, fIsoOpacity), 01914 // glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); 01915 // glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 01916 // glBlendFunc(GL_DST_ALPHA,GL_ONE_MINUS_DST_ALPHA); 01917 // glEnable(GL_BLEND); 01918 // }else { 01919 // glDisable(GL_BLEND); 01920 // } 01921 } 01922 }
| void DVRIsoShader::deactivate_NVRegisterCombinerShading | ( | DVRVolume * | volume, | |
| DrawActionBase * | action | |||
| ) | [protected] |
Definition at line 2186 of file OSGDVRIsoShaderNVRegisterCombiners.cpp.
References osg::DVRVolumeBase::getDoTextures(), GL_PER_STAGE_CONSTANTS_NV, GL_REGISTER_COMBINERS_NV, m_hasPerStageConstants, and m_maxCombiners.
Referenced by deactivate().
02188 { 02189 if(volume->getDoTextures()) 02190 { 02191 glDisable(GL_REGISTER_COMBINERS_NV); 02192 02193 if((m_maxCombiners > 2) && m_hasPerStageConstants) 02194 glDisable(GL_PER_STAGE_CONSTANTS_NV); 02195 02196 glDisable(GL_ALPHA_TEST); 02197 02198 glPopAttrib(); 02199 } 02200 }
| void DVRIsoShader::activate_FragmentProgramShading | ( | DVRVolume * | volume, | |
| DrawActionBase * | action | |||
| ) | [protected] |
Definition at line 24 of file OSGDVRIsoShaderARBFragmentProgram.cpp.
References _fragProg2D, _fragProg3D, osg::addRefCP(), osg::beginEditCP(), osg::FragmentProgramChunkBase::create(), cToV(), DVRVOLUME_PARAMETER, osg::endEditCP(), FDEBUG, FFATAL, getLightSources(), osg::Slicer::getSlicingDirection(), m_pFragProg, m_shadingMode, osg::VectorInterface< ValueTypeT, StorageInterfaceT >::normalize(), osg::NullFC, osg::ProgramChunkBase::ParamValuesFieldMask, osg::Slicer::rotateToLocal(), SM_FRAGMENT_PROGRAM_2D, and SM_FRAGMENT_PROGRAM_3D.
Referenced by activate().
00026 { 00027 // Initialize the fragment program 00028 if(m_pFragProg == NullFC) 00029 { 00030 FDEBUG(("Initializing fragment program ")); 00031 m_pFragProg = FragmentProgramChunk::create(); 00032 00033 addRefCP( m_pFragProg ); 00034 00035 FDEBUG((" - DONE\n")); 00036 00037 // Load the appropriate program 00038 switch(m_shadingMode) 00039 { 00040 case SM_FRAGMENT_PROGRAM_3D: 00041 // SLOG << "Loading ... isoFragProg3D.asm" << std::endl; 00042 00043 beginEditCP(m_pFragProg); 00044 { 00045 m_pFragProg->setProgram(_fragProg3D); 00046 // m_pFragProg->read( "isoFragProg3D.asm" ); 00047 } 00048 endEditCP (m_pFragProg); 00049 00050 break; 00051 00052 case SM_FRAGMENT_PROGRAM_2D: 00053 00054 // SLOG << "Loading ... isoFragProg2D.asm" << std::endl; 00055 00056 beginEditCP(m_pFragProg); 00057 { 00058 m_pFragProg->setProgram(_fragProg2D); 00059 // m_pFragProg->read( "isoFragProg2D.asm" ); 00060 } 00061 endEditCP(m_pFragProg); 00062 00063 break; 00064 00065 default: 00066 FFATAL(("Texture mode for fragment programs not supported " 00067 "by DVRSimpleLUTShader")); 00068 return; 00069 // break; 00070 } 00071 } 00072 00073 // get parameters from isosurface attachment if available 00074 Real32 isoValue; 00075 UInt32 alphaMode; 00076 bool doSpecular; 00077 00078 DVRIsoSurfacePtr isoParam = DVRVOLUME_PARAMETER(volume, DVRIsoSurface); 00079 00080 if(isoParam != NullFC) 00081 { 00082 isoValue = isoParam->getIsoValue (); 00083 alphaMode = isoParam->getAlphaMode (); 00084 doSpecular = isoParam->getSpecularLighting(); 00085 } 00086 else 00087 { 00088 isoValue = 1.0; 00089 alphaMode = GL_GREATER; 00090 doSpecular = false; 00091 } 00092 00093 unsigned int maxDiffuseLights = 6; // Hard-coded in the fragment program 00094 unsigned int maxSpecularLights = 6; 00095 00096 // Set light parameters 00097 DirLightList diffuseLights; 00098 DirLightList specularLights; 00099 Color4f ambientLight; 00100 00101 getLightSources(diffuseLights, specularLights, ambientLight); 00102 00103 beginEditCP(m_pFragProg, ProgramChunk::ParamValuesFieldMask); 00104 { 00105 m_pFragProg->setParameter((short int) 0, 00106 cToV(ambientLight)); // ambient color 00107 00108 // Diffuse lights 00109 unsigned int i; 00110 00111 DirLightList::iterator l = diffuseLights.begin(); 00112 00113 for(i = 0; i < maxDiffuseLights && l != diffuseLights.end(); i++) 00114 { 00115 Vec3f tmp; 00116 00117 Slicer::rotateToLocal(action,l->dir,tmp); 00118 00119 tmp.normalize(); 00120 00121 // diffuse direction 00122 m_pFragProg->setParameter(1 + 2 * i, Vec4f(tmp)); 00123 00124 // diffuse color 00125 m_pFragProg->setParameter(1 + 2 * i + 1, cToV(l->color)); 00126 00127 ++l; 00128 } 00129 00130 for(; i < maxDiffuseLights; i++) 00131 { 00132 // diffuse direction 00133 m_pFragProg->setParameter(1 + 2 * i, Vec4f(0, 0, 0, 0)); 00134 00135 // diffuse color 00136 m_pFragProg->setParameter(1 + 2 * i + 1, Vec4f(0, 0, 0, 0)); 00137 } 00138 00139 // Specular lights 00140 unsigned int firstSpecId = 1 + 2 * maxDiffuseLights; 00141 00142 i = 0; 00143 00144 if(doSpecular) 00145 { 00146 // get and classify the slicing direction 00147 Vec3f viewDir; 00148 00149 Slicer::getSlicingDirection(action, &viewDir); 00150 00151 viewDir.normalize(); 00152 00153 DirLightList::iterator ls = specularLights.begin(); 00154 00155 for(i = 0; 00156 i < maxSpecularLights && ls != specularLights.end(); 00157 i++) 00158 { 00159 Vec3f tmp; 00160 00161 Slicer::rotateToLocal(action,ls->dir,tmp); 00162 00163 tmp.normalize(); 00164 00165 // calc halfway 00166 tmp += viewDir; 00167 tmp.normalize(); 00168 00169 // halfway vector 00170 m_pFragProg->setParameter(firstSpecId + 2 * i, 00171 Vec4f(tmp)); 00172 // specular color 00173 m_pFragProg->setParameter(firstSpecId + 2 * i + 1, 00174 cToV(ls->color)); 00175 00176 ++ls; 00177 } 00178 } 00179 00180 for(; i < maxSpecularLights; i++) 00181 { 00182 // specular direction 00183 m_pFragProg->setParameter(firstSpecId + 2 * i, 00184 Vec4f(0, 0, 0, 0)); 00185 00186 // specular color 00187 m_pFragProg->setParameter(firstSpecId + 2 * i + 1, 00188 Vec4f(0, 0, 0, 0)); 00189 } 00190 } 00191 endEditCP(m_pFragProg, ProgramChunk::ParamValuesFieldMask); 00192 00193 00194 glPushAttrib(GL_ENABLE_BIT); 00195 00196 // activate fragment program chunk 00197 m_pFragProg->activate(action); 00198 00199 // no blending and lighting 00200 glDisable(GL_BLEND ); 00201 glDisable(GL_LIGHTING); 00202 00203 // Enable Alpha Test for isosurface 00204 glEnable (GL_ALPHA_TEST ); 00205 glAlphaFunc(alphaMode, isoValue); 00206 }
| void DVRIsoShader::deactivate_FragmentProgramShading | ( | DVRVolume * | volume, | |
| DrawActionBase * | action | |||
| ) | [protected] |
Definition at line 209 of file OSGDVRIsoShaderARBFragmentProgram.cpp.
References m_pFragProg.
Referenced by deactivate().
00212 { 00213 glPopAttrib(); 00214 00215 // de-activate fragment program chunk 00216 m_pFragProg->deactivate(action); 00217 }
| void DVRIsoShader::renderSlice_NVRegisterCombinerShading | ( | DVRVolume * | volume, | |
| DrawActionBase * | action, | |||
| Real32 * | data, | |||
| UInt32 | vertices, | |||
| UInt32 | values | |||
| ) | [protected] |
Definition at line 1924 of file OSGDVRIsoShaderNVRegisterCombiners.cpp.
References _funcCombinerParameterfvNV, _funcCombinerStageParameterfvNV, _funcMultiTexCoord2dARB, DVRVOLUME_PARAMETER, osg::DVRVolumeBase::getDoTextures(), osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GL_COMBINER0_NV, GL_CONSTANT_COLOR0_NV, GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, m_hasPerStageConstants, m_maxCombiners, osg::NullFC, and SWARNING.
Referenced by renderSlice().
01930 { 01931 if(values < 6) 01932 { 01933 SWARNING << "DVRIsoShader::renderSlice - insufficient values" 01934 << std::endl; 01935 return; 01936 } 01937 01938 Window *win = action->getWindow(); 01939 01940 // get extension functions 01941 CombinerParameterfvNVFunc CombinerParameterfvNV = 01942 (CombinerParameterfvNVFunc) win->getFunction( 01943 _funcCombinerParameterfvNV); 01944 01945 MultiTexCoord2dARBFunc MultiTexCoord2dARB = 01946 (MultiTexCoord2dARBFunc) win->getFunction(_funcMultiTexCoord2dARB); 01947 01948 // set interpolation factor 01949 01950 bool doSpecular; 01951 01952 DVRIsoSurfacePtr isoParam = DVRVOLUME_PARAMETER(volume, DVRIsoSurface); 01953 01954 if(isoParam != NullFC) 01955 { 01956 doSpecular = isoParam->getSpecularLighting(); 01957 } 01958 else 01959 { 01960 doSpecular = false; 01961 } 01962 01963 if( ((doSpecular && (m_maxCombiners > 2)) || (m_maxCombiners > 5)) && 01964 m_hasPerStageConstants ) 01965 { 01966 CombinerStageParameterfvNVFunc CombinerStageParameterfvNV = 01967 (CombinerStageParameterfvNVFunc) win->getFunction( 01968 _funcCombinerStageParameterfvNV); 01969 01970 GLfloat col[4] = 01971 { 01972 0.0f, 0.0f, 0.0f, data[5] 01973 }; 01974 01975 CombinerStageParameterfvNV(GL_COMBINER0_NV, 01976 GL_CONSTANT_COLOR0_NV, 01977 col); 01978 } 01979 else 01980 { 01981 GLfloat col[4]; 01982 01983 glGetFloatv(GL_CONSTANT_COLOR0_NV,col); 01984 01985 col[3] = data[5]; 01986 01987 CombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, col); 01988 } 01989 01990 if(volume->getDoTextures()) 01991 { 01992 glBegin(GL_TRIANGLE_FAN); 01993 } 01994 else 01995 { 01996 glColor4f(1.0, 1.0, 1.0, 1.0); 01997 glBegin (GL_LINE_LOOP); 01998 } 01999 02000 // draw polygon 02001 for(UInt32 i = 0; i < vertices; i++) 02002 { 02003 Real32 * vert = data + i * values; 02004 02005 MultiTexCoord2dARB(GL_TEXTURE0_ARB, vert[3], vert[4]); 02006 MultiTexCoord2dARB(GL_TEXTURE1_ARB, vert[3], vert[4]); 02007 02008 glVertex3f(vert[0], vert[1], vert[2]); 02009 } 02010 glEnd(); 02011 }
| void DVRIsoShader::renderSlice_NVRegisterCombinerShading | ( | DVRVolume * | volume, | |
| DrawActionBase * | action, | |||
| DVRRenderSlice * | clippedSlice | |||
| ) | [protected] |
Definition at line 2014 of file OSGDVRIsoShaderNVRegisterCombiners.cpp.
References _funcCombinerParameterfvNV, _funcCombinerStageParameterfvNV, _funcMultiTexCoord2dARB, DVRVOLUME_PARAMETER, osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GL_COMBINER0_NV, GL_CONSTANT_COLOR0_NV, GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, m_hasPerStageConstants, m_maxCombiners, osg::NullFC, osg::DVRRenderSlice::orientation, osg::DVRRenderSlice::XY, osg::DVRRenderSlice::XZ, and osg::DVRRenderSlice::YZ.
02018 { 02019 Window *win = action->getWindow(); 02020 02021 // get extension functions 02022 CombinerParameterfvNVFunc CombinerParameterfvNV = 02023 (CombinerParameterfvNVFunc) win->getFunction( 02024 _funcCombinerParameterfvNV); 02025 02026 MultiTexCoord2dARBFunc MultiTexCoord2dARB = 02027 (MultiTexCoord2dARBFunc) win->getFunction(_funcMultiTexCoord2dARB); 02028 02029 // set interpolation factor 02030 bool doSpecular; 02031 DVRIsoSurfacePtr isoParam = DVRVOLUME_PARAMETER(volume, DVRIsoSurface); 02032 02033 if(isoParam != NullFC) 02034 { 02035 doSpecular = isoParam->getSpecularLighting(); 02036 } 02037 else 02038 { 02039 doSpecular = false; 02040 } 02041 02042 GLfloat intFactor = 0; 02043 02044 switch(clippedSlice->orientation) 02045 { 02046 case DVRRenderSlice::XY: 02047 intFactor = 02048 Real32((*(*clippedSlice->begin())->vertices.begin())[5]); 02049 break; 02050 02051 case DVRRenderSlice::XZ: 02052 intFactor = 02053 Real32((*(*clippedSlice->begin())->vertices.begin())[4]); 02054 break; 02055 02056 case DVRRenderSlice::YZ: 02057 intFactor = 02058 Real32((*(*clippedSlice->begin())->vertices.begin())[3]); 02059 break; 02060 02061 default: 02062 break; 02063 } 02064 02065 if( ((doSpecular && (m_maxCombiners > 2)) || (m_maxCombiners > 5)) && 02066 m_hasPerStageConstants ) 02067 { 02068 CombinerStageParameterfvNVFunc CombinerStageParameterfvNV = 02069 (CombinerStageParameterfvNVFunc) win->getFunction( 02070 _funcCombinerStageParameterfvNV); 02071 02072 GLfloat col[4] = 02073 { 02074 0.0f, 0.0f, 0.0f, intFactor 02075 }; 02076 02077 CombinerStageParameterfvNV(GL_COMBINER0_NV, 02078 GL_CONSTANT_COLOR0_NV, 02079 col); 02080 } 02081 else 02082 { 02083 GLfloat col[4]; 02084 02085 glGetFloatv(GL_CONSTANT_COLOR0_NV,col); 02086 02087 col[3] = intFactor; 02088 02089 CombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, col); 02090 } 02091 02092 switch(clippedSlice->orientation) 02093 { 02094 case DVRRenderSlice::XY: 02095 02096 for(std::vector<DVRRenderSlicePrimitive*>::const_iterator prim = 02097 clippedSlice->begin(); 02098 02099 prim != clippedSlice->end(); 02100 ++prim) 02101 { 02102 glBegin((*prim)->type); 02103 02104 std::vector<GLdouble*>::const_iterator vert = 02105 (*prim)->vertices.begin(); 02106 02107 for(; vert != (*prim)->vertices.end(); vert++) 02108 { 02109 MultiTexCoord2dARB(GL_TEXTURE0_ARB, 02110 (*vert)[3], 02111 (*vert)[4]); 02112 02113 MultiTexCoord2dARB(GL_TEXTURE1_ARB, 02114 (*vert)[3], 02115 (*vert)[4]); 02116 02117 glVertex3dv(*vert); 02118 } 02119 glEnd(); 02120 } 02121 break; 02122 02123 case DVRRenderSlice::XZ: 02124 02125 for(std::vector<DVRRenderSlicePrimitive*>::const_iterator prim = 02126 clippedSlice->begin(); 02127 02128 prim != clippedSlice->end(); 02129 ++prim) 02130 { 02131 glBegin((*prim)->type); 02132 02133 std::vector<GLdouble*>::const_iterator vert = 02134 (*prim)->vertices.begin(); 02135 02136 for(; vert != (*prim)->vertices.end(); vert++) 02137 { 02138 MultiTexCoord2dARB(GL_TEXTURE0_ARB, 02139 (*vert)[3], 02140 (*vert)[5]); 02141 02142 MultiTexCoord2dARB(GL_TEXTURE1_ARB, 02143 (*vert)[3], 02144 (*vert)[5]); 02145 02146 glVertex3dv(*vert); 02147 } 02148 glEnd(); 02149 } 02150 break; 02151 02152 case DVRRenderSlice::YZ: 02153 02154 for(std::vector<DVRRenderSlicePrimitive*>::const_iterator prim = 02155 clippedSlice->begin(); 02156 02157 prim != clippedSlice->end(); 02158 ++prim) 02159 { 02160 glBegin((*prim)->type); 02161 02162 std::vector<GLdouble*>::const_iterator vert = 02163 (*prim)->vertices.begin(); 02164 02165 for(; vert != (*prim)->vertices.end(); vert++) 02166 { 02167 MultiTexCoord2dARB(GL_TEXTURE0_ARB, 02168 (*vert)[4], 02169 (*vert)[5]); 02170 02171 MultiTexCoord2dARB(GL_TEXTURE1_ARB, 02172 (*vert)[4], 02173 (*vert)[5]); 02174 02175 glVertex3dv(*vert); 02176 } 02177 glEnd(); 02178 } 02179 break; 02180 02181 default: 02182 break; 02183 } 02184 }
| void DVRIsoShader::renderSlice_FragmentProgramShading | ( | DVRVolume * | volume, | |
| DrawActionBase * | action, | |||
| Real32 * | data, | |||
| UInt32 | vertices, | |||
| UInt32 | values | |||
| ) | [protected] |
Definition at line 220 of file OSGDVRIsoShaderARBFragmentProgram.cpp.
References SLOG.
Referenced by renderSlice().
00226 { 00227 SLOG << "DVRIsoShader::renderSlice for fragment program shading NI" 00228 << std::endl; 00229 }
| void DVRIsoShader::renderSlice_FragmentProgramShading | ( | DVRVolume * | volume, | |
| DrawActionBase * | action, | |||
| DVRRenderSlice * | clippedSlice | |||
| ) | [protected] |
Definition at line 232 of file OSGDVRIsoShaderARBFragmentProgram.cpp.
References SLOG.
00236 { 00237 SLOG << "DVRIsoShader::renderSlice for fragment program shading NI" 00238 << std::endl; 00239 }
| void DVRIsoShader::setupCombinerParametersDiffuse | ( | DVRVolume * | volume, | |
| DrawActionBase * | action | |||
| ) | [protected] |
Definition at line 1469 of file OSGDVRIsoShaderNVRegisterCombiners.cpp.
References _funcCombinerParameterfvNV, _funcCombinerStageParameterfvNV, _funcSecondaryColor3fvEXT, osg::Window::getFunction(), getLightSources(), osg::Color4< ValueTypeT >::getValuesRGBA(), osg::DrawActionBase::getWindow(), GL_COMBINER0_NV, GL_COMBINER1_NV, GL_COMBINER2_NV, GL_COMBINER3_NV, GL_CONSTANT_COLOR0_NV, GL_CONSTANT_COLOR1_NV, GL_PER_STAGE_CONSTANTS_NV, GLenum, m_hasPerStageConstants, m_maxCombiners, osg::VectorInterface< ValueTypeT, StorageInterfaceT >::normalize(), and osg::Slicer::rotateToLocal().
Referenced by activate_NVRegisterCombinerShading().
01471 { 01472 01473 Window *win = action->getWindow(); 01474 01475 CombinerParameterfvNVFunc CombinerParameterfvNV = 01476 (CombinerParameterfvNVFunc) win->getFunction( 01477 _funcCombinerParameterfvNV); 01478 01479 SecondaryColor3fvEXTFunc SecondaryColor3fvEXT = 01480 (SecondaryColor3fvEXTFunc) win->getFunction(_funcSecondaryColor3fvEXT); 01481 01482 CombinerStageParameterfvNVFunc CombinerStageParameterfvNV = 01483 (CombinerStageParameterfvNVFunc) win->getFunction( 01484 _funcCombinerStageParameterfvNV); 01485 01486 01487 DirLightList diffuseLights; 01488 DirLightList specularLights; 01489 Color4f ambientLight; 01490 01491 getLightSources(diffuseLights, specularLights, ambientLight); 01492 01493 // check for max. supported diffuse lightsources 01494 unsigned int maxDiffuseLights = 2; 01495 01496 if((m_maxCombiners > 5) && m_hasPerStageConstants) 01497 { 01498 maxDiffuseLights = 4 + 2 * ((m_maxCombiners - 5) / 3); 01499 } 01500 01501 // get light sources 01502 Color4f *diffuseColor = new Color4f[maxDiffuseLights]; 01503 Vec4f *diffuseDir = new Vec4f[maxDiffuseLights]; 01504 01505 unsigned int i; 01506 01507 DirLightList::iterator l = diffuseLights.begin(); 01508 01509 for(i = 0; i < maxDiffuseLights && l != diffuseLights.end(); i++) 01510 { 01511 Vec3f tmp; 01512 01513 diffuseColor[i] = l->color; 01514 01515 Slicer::rotateToLocal(action,l->dir,tmp); 01516 01517 tmp.normalize(); 01518 01519 diffuseDir[i].setValues(0.5f + 0.5f * tmp[0], 01520 0.5f + 0.5f * tmp[1], 01521 0.5f + 0.5f * tmp[2], 01522 0.0f ); 01523 l++; 01524 } 01525 01526 while(i < maxDiffuseLights) 01527 { 01528 diffuseColor[i] = Color4f(0.0f, 0.0f, 0.0f, 1.0f); 01529 01530 i++; 01531 } 01532 01533 if((m_maxCombiners > 5) && m_hasPerStageConstants) 01534 { 01535 // use all available combiners 01536 01537 glEnable(GL_PER_STAGE_CONSTANTS_NV); 01538 01539 // set constant for slice interpolation 01540 CombinerStageParameterfvNV(GL_COMBINER0_NV, 01541 GL_CONSTANT_COLOR0_NV, 01542 diffuseDir[0].getValues()); 01543 01544 // set direction of first two lights 01545 CombinerStageParameterfvNV(GL_COMBINER1_NV, 01546 GL_CONSTANT_COLOR0_NV, 01547 diffuseDir[0].getValues()); 01548 01549 CombinerStageParameterfvNV(GL_COMBINER1_NV, 01550 GL_CONSTANT_COLOR1_NV, 01551 diffuseDir[1].getValues()); 01552 01553 // set color for first two lights 01554 CombinerStageParameterfvNV(GL_COMBINER2_NV, 01555 GL_CONSTANT_COLOR0_NV, 01556 diffuseColor[0].getValuesRGBA()); 01557 01558 CombinerStageParameterfvNV(GL_COMBINER2_NV, 01559 GL_CONSTANT_COLOR1_NV, 01560 diffuseColor[1].getValuesRGBA()); 01561 01562 Int32 i; 01563 01564 // set values for all lights 01565 // float ones[4] = {1.0f,1.0f,1.0f,1.0f}; 01566 01567 for(i = 0; i < (m_maxCombiners-5)/3; i++) 01568 { 01569 // set direction next two lights 01570 CombinerStageParameterfvNV(GLenum(GL_COMBINER3_NV + i * 3), 01571 GL_CONSTANT_COLOR0_NV, 01572 diffuseDir[2 + 2 * i].getValues()); 01573 01574 CombinerStageParameterfvNV(GLenum(GL_COMBINER3_NV + i * 3), 01575 GL_CONSTANT_COLOR1_NV, 01576 diffuseDir[3 + 2 * i].getValues()); 01577 01578 // set color for next two lights 01579 CombinerStageParameterfvNV( 01580 GLenum(GL_COMBINER3_NV + i * 3 + 1), 01581 GL_CONSTANT_COLOR0_NV, 01582 diffuseColor[2 + 2 * i].getValuesRGBA()); 01583 01584 CombinerStageParameterfvNV( 01585 GLenum(GL_COMBINER3_NV + i * 3 + 1), 01586 GL_CONSTANT_COLOR1_NV, 01587 diffuseColor[3 + 2 * i].getValuesRGBA()); 01588 } 01589 01590 // set direction for last two lights 01591 CombinerStageParameterfvNV(GLenum(GL_COMBINER3_NV + i * 3), 01592 GL_CONSTANT_COLOR0_NV, 01593 diffuseDir[2 + 2 * i].getValues()); 01594 01595 CombinerStageParameterfvNV(GLenum(GL_COMBINER3_NV + i * 3), 01596 GL_CONSTANT_COLOR1_NV, 01597 diffuseDir[3 + 2 * i].getValues()); 01598 01599 // set color for last two lights 01600 CombinerStageParameterfvNV(GLenum(GL_COMBINER3_NV + i * 3 +1), 01601 GL_CONSTANT_COLOR0_NV, 01602 diffuseColor[2 + 2 * i].getValuesRGBA()); 01603 01604 CombinerStageParameterfvNV(GLenum(GL_COMBINER3_NV + i * 3 + 1), 01605 GL_CONSTANT_COLOR1_NV, 01606 diffuseColor[3 + 2 * i].getValuesRGBA()); 01607 01608 // set additional ambient lighting 01609 SecondaryColor3fvEXT(ambientLight.getValuesRGBA()); 01610 } 01611 else 01612 { 01613 // use only two general combiners 01614 01615 // set primary color = color of light 0 01616 glColor3fv(diffuseColor[0].getValuesRGBA()); 01617 01618 // set constant color 0 = direction of light 0 01619 CombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, 01620 diffuseDir[0].getValues()); 01621 01622 // set secondary color = color of light 1 01623 SecondaryColor3fvEXT(diffuseColor[1].getValuesRGBA()); 01624 01625 // set constant color 1 = direction of light 1 01626 CombinerParameterfvNV(GL_CONSTANT_COLOR1_NV, 01627 diffuseDir[1].getValues()); 01628 } 01629 01630 delete [] diffuseColor; 01631 delete [] diffuseDir; 01632 01633 }
| void DVRIsoShader::setupCombinerParametersSpecular | ( | DVRVolume * | volume, | |
| DrawActionBase * | action | |||
| ) | [protected] |
Definition at line 1635 of file OSGDVRIsoShaderNVRegisterCombiners.cpp.
References _funcCombinerParameterfvNV, _funcCombinerStageParameterfvNV, _funcSecondaryColor3fvEXT, osg::Window::getFunction(), getLightSources(), osg::Slicer::getSlicingDirection(), osg::Color4< ValueTypeT >::getValuesRGBA(), osg::DrawActionBase::getWindow(), GL_COMBINER1_NV, GL_COMBINER2_NV, GL_COMBINER3_NV, GL_COMBINER4_NV, GL_COMBINER5_NV, GL_COMBINER7_NV, GL_CONSTANT_COLOR0_NV, GL_CONSTANT_COLOR1_NV, GL_PER_STAGE_CONSTANTS_NV, m_hasPerStageConstants, m_maxCombiners, osg::VectorInterface< ValueTypeT, StorageInterfaceT >::normalize(), and osg::Slicer::rotateToLocal().
Referenced by activate_NVRegisterCombinerShading().
01637 { 01638 01639 Window *win = action->getWindow(); 01640 01641 CombinerParameterfvNVFunc CombinerParameterfvNV = 01642 (CombinerParameterfvNVFunc) win->getFunction( 01643 _funcCombinerParameterfvNV); 01644 01645 SecondaryColor3fvEXTFunc SecondaryColor3fvEXT = 01646 (SecondaryColor3fvEXTFunc) win->getFunction(_funcSecondaryColor3fvEXT); 01647 01648 CombinerStageParameterfvNVFunc CombinerStageParameterfvNV = 01649 (CombinerStageParameterfvNVFunc) win->getFunction( 01650 _funcCombinerStageParameterfvNV); 01651 01652 DirLightList diffuseLights; 01653 DirLightList specularLights; 01654 Color4f ambientLight; 01655 01656 getLightSources(diffuseLights, specularLights, ambientLight); 01657 01658 // get light source params 01659 Vec4f diffuseDir [3]; 01660 Vec4f halfway [3]; 01661 Color4f diffuseColor [3]; 01662 Color4f specularColor[3]; 01663 01664 unsigned int i; 01665 01666 // get diffuse lights 01667 DirLightList::iterator ld = diffuseLights.begin(); 01668 01669 for(i = 0; i < 3 && ld != diffuseLights.end(); i++) 01670 { 01671 Vec3f tmp; 01672 01673 diffuseColor[i] = ld->color; 01674 01675 Slicer::rotateToLocal(action,ld->dir,tmp); 01676 01677 tmp.normalize(); 01678 01679 diffuseDir[i].setValues(0.5f + 0.5f * tmp[0], 01680 0.5f + 0.5f * tmp[1], 01681 0.5f + 0.5f * tmp[2], 01682 0.0f); 01683 ld++; 01684 } 01685 01686 while(i < 3) 01687 { 01688 diffuseColor[i] = Color4f(0.0f, 0.0f, 0.0f, 1.0f); 01689 diffuseDir [i] = Vec4f (0.0f, 0.0f, 0.0f, 0.0f); 01690 01691 i++; 01692 } 01693 01694 // get and classify the slicing direction 01695 Vec3f viewDir; 01696 01697 Slicer::getSlicingDirection(action, &viewDir); 01698 01699 viewDir.normalize(); 01700 01701 // get specular lights 01702 DirLightList::iterator ls = specularLights.begin(); 01703 01704 for(i = 0; i < 3 && ls != specularLights.end(); i++) 01705 { 01706 Vec3f tmp; 01707 01708 specularColor[i] = ls->color; 01709 01710 Slicer::rotateToLocal(action,ls->dir,tmp); 01711 01712 tmp.normalize(); 01713 01714 // calc halfway 01715 tmp += viewDir; 01716 tmp.normalize(); 01717 01718 halfway[i].setValues(0.5f + 0.5f * tmp[0], 01719 0.5f + 0.5f * tmp[1], 01720 0.5f + 0.5f * tmp[2], 01721 0.0f); 01722 01723 ls++; 01724 } 01725 01726 while(i < 3) 01727 { 01728 specularColor[i] = Color4f(0.0f, 0.0f, 0.0f, 1.0f); 01729 halfway[i] = Vec4f (0.0f, 0.0f, 0.0f, 0.0f); 01730 01731 i++; 01732 } 01733 01734 if((m_maxCombiners >= 8) && m_hasPerStageConstants) 01735 { 01736 // set lightsource colors 01737 01738 glEnable(GL_PER_STAGE_CONSTANTS_NV); 01739 01740 // set halfway vector light 0 01741 CombinerStageParameterfvNV(GL_COMBINER1_NV, 01742 GL_CONSTANT_COLOR1_NV, 01743 halfway[0].getValues()); 01744 01745 // set diffuse dir light 0 01746 glColor4fv(diffuseDir[0].getValues()); 01747 01748 // set halfway vector light 1 01749 CombinerStageParameterfvNV(GL_COMBINER2_NV, 01750 GL_CONSTANT_COLOR0_NV, 01751 halfway[1].getValues()); 01752 01753 // set halfway vector light 2 01754 CombinerStageParameterfvNV(GL_COMBINER2_NV, 01755 GL_CONSTANT_COLOR1_NV, 01756 halfway[2].getValues()); 01757 01758 // set diffuse dir light 1 01759 CombinerStageParameterfvNV(GL_COMBINER3_NV, 01760 GL_CONSTANT_COLOR0_NV, 01761 diffuseDir[1].getValues()); 01762 01763 // set diffuse dir light 2 01764 CombinerStageParameterfvNV(GL_COMBINER3_NV, 01765 GL_CONSTANT_COLOR1_NV, 01766 diffuseDir[2].getValues()); 01767 01768 // set diffuse color light 1 01769 CombinerStageParameterfvNV(GL_COMBINER4_NV, 01770 GL_CONSTANT_COLOR0_NV, 01771 diffuseColor[1].getValuesRGBA()); 01772 01773 // set diffuse color light 2 01774 CombinerStageParameterfvNV(GL_COMBINER4_NV, 01775 GL_CONSTANT_COLOR1_NV, 01776 diffuseColor[2].getValuesRGBA()); 01777 01778 // set specular color light 1 01779 CombinerStageParameterfvNV(GL_COMBINER5_NV, 01780 GL_CONSTANT_COLOR0_NV, 01781 specularColor[1].getValuesRGBA()); 01782 01783 // set specular color light 2 01784 CombinerStageParameterfvNV(GL_COMBINER5_NV, 01785 GL_CONSTANT_COLOR1_NV, 01786 specularColor[2].getValuesRGBA()); 01787 01788 // set specular color light 0 01789 CombinerStageParameterfvNV(GL_COMBINER7_NV, 01790 GL_CONSTANT_COLOR0_NV, 01791 specularColor[0].getValuesRGBA()); 01792 01793 // set diffuse color light 0 01794 CombinerStageParameterfvNV(GL_COMBINER7_NV, 01795 GL_CONSTANT_COLOR1_NV, 01796 diffuseColor[0].getValuesRGBA()); 01797 } 01798 else 01799 { 01800 // we can only use white lightsources due to limited register 01801 // combiner ressources, 01802 // so at least scale them 01803 01804 diffuseDir[0] *= diffuseColor [0][0]; 01805 halfway [0] *= specularColor[0][0]; 01806 01807 // set constant color 0 = halfway 01808 CombinerParameterfvNV(GL_CONSTANT_COLOR1_NV, halfway[0].getValues()); 01809 01810 // set direction of diffuse light 01811 glColor3f(0.5f + 0.5f * diffuseDir[0][0], 01812 0.5f + 0.5f * diffuseDir[0][1], 01813 0.5f + 0.5f * diffuseDir[0][2]); 01814 } 01815 01816 // set ambient light 01817 SecondaryColor3fvEXT(ambientLight.getValuesRGBA()); 01818 }
| void DVRIsoShader::initCombiners_IsoSurfaceDiffuse | ( | DrawActionBase * | action | ) | [protected] |
Definition at line 58 of file OSGDVRIsoShaderNVRegisterCombiners.cpp.
References _funcCombinerInputNV, _funcCombinerOutputNV, _funcCombinerParameteriNV, osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GL_COMBINER0_NV, GL_COMBINER1_NV, GL_CONSTANT_COLOR0_NV, GL_CONSTANT_COLOR1_NV, GL_DISCARD_NV, GL_EXPAND_NORMAL_NV, GL_NUM_GENERAL_COMBINERS_NV, GL_SIGNED_IDENTITY_NV, GL_SPARE0_NV, GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, GL_UNSIGNED_IDENTITY_NV, GL_UNSIGNED_INVERT_NV, GL_VARIABLE_A_NV, GL_VARIABLE_B_NV, GL_VARIABLE_C_NV, GL_VARIABLE_D_NV, initCombiners_Diffuse2Combiners(), initCombiners_DiffuseMultiCombiners(), m_hasPerStageConstants, and m_maxCombiners.
Referenced by activate_NVRegisterCombinerShading().
00059 { 00060 Window *win = action->getWindow(); 00061 00062 // get extension functions 00063 CombinerParameteriNVFunc CombinerParameteriNV = 00064 (CombinerParameteriNVFunc) win->getFunction(_funcCombinerParameteriNV); 00065 00066 CombinerInputNVFunc CombinerInputNV = 00067 (CombinerInputNVFunc) win->getFunction (_funcCombinerInputNV ); 00068 00069 CombinerOutputNVFunc CombinerOutputNV = 00070 (CombinerOutputNVFunc) win->getFunction (_funcCombinerOutputNV ); 00071 00072 if((m_maxCombiners > 7) && m_hasPerStageConstants) 00073 { 00074 // use all available combiners for diffuse shading 00075 CombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 00076 5 + 3 * ((m_maxCombiners-5) / 3)); 00077 } 00078 else 00079 { 00080 CombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 2); 00081 } 00082 00083 // first general combiner : interpolate between two slices 00084 00085 // RGB Portion 00086 // ----------- 00087 00088 // A <- scaled/biased gradients 00089 CombinerInputNV(GL_COMBINER0_NV, // stage 00090 GL_RGB, // portion 00091 GL_VARIABLE_A_NV, // variable 00092 GL_TEXTURE0_ARB, // input 00093 GL_EXPAND_NORMAL_NV, // mapping 00094 GL_RGB); // componentUsage 00095 00096 // B <- interpolation factor 00097 CombinerInputNV(GL_COMBINER0_NV, 00098 GL_RGB, 00099 GL_VARIABLE_B_NV, 00100 GL_CONSTANT_COLOR0_NV, 00101 GL_UNSIGNED_INVERT_NV, 00102 GL_ALPHA); // usage: Alpha 00103 00104 // C <- scaled/biased gradients 00105 CombinerInputNV(GL_COMBINER0_NV, 00106 GL_RGB, 00107 GL_VARIABLE_C_NV, 00108 GL_TEXTURE1_ARB, 00109 GL_EXPAND_NORMAL_NV, 00110 GL_RGB); 00111 00112 // D <- interpolation factor 00113 CombinerInputNV(GL_COMBINER0_NV, 00114 GL_RGB, 00115 GL_VARIABLE_D_NV, 00116 GL_CONSTANT_COLOR0_NV, 00117 GL_UNSIGNED_IDENTITY_NV, 00118 GL_ALPHA); // usage Alpha 00119 00120 // Alpha Portion 00121 // ------------- 00122 00123 // A <- alpha values 00124 CombinerInputNV(GL_COMBINER0_NV, 00125 GL_ALPHA, 00126 GL_VARIABLE_A_NV, 00127 GL_TEXTURE0_ARB, 00128 GL_UNSIGNED_IDENTITY_NV, 00129 GL_ALPHA); 00130 00131 // B <- interpolation factor 00132 CombinerInputNV(GL_COMBINER0_NV, 00133 GL_ALPHA, 00134 GL_VARIABLE_B_NV, 00135 GL_CONSTANT_COLOR0_NV, 00136 GL_UNSIGNED_INVERT_NV, 00137 GL_ALPHA); 00138 00139 // C <- alpha values 00140 CombinerInputNV(GL_COMBINER0_NV, 00141 GL_ALPHA, 00142 GL_VARIABLE_C_NV, 00143 GL_TEXTURE1_ARB, 00144 GL_UNSIGNED_IDENTITY_NV, 00145 GL_ALPHA); 00146 00147 // D <- interpolation factor 00148 CombinerInputNV(GL_COMBINER0_NV, 00149 GL_ALPHA, 00150 GL_VARIABLE_D_NV, 00151 GL_CONSTANT_COLOR0_NV, 00152 GL_UNSIGNED_IDENTITY_NV, 00153 GL_ALPHA); 00154 00155 // first general combiner output 00156 00157 // Spare0(RGB) <- interpolated gradients 00158 CombinerOutputNV(GL_COMBINER0_NV, // stage 00159 GL_RGB, // portion 00160 GL_DISCARD_NV, // abOutput 00161 GL_DISCARD_NV, // cdOutput 00162 GL_SPARE0_NV, // sumOutput 00163 GL_NONE, // scale 00164 GL_NONE, // bias 00165 GL_FALSE, // abDotProduct 00166 GL_FALSE, // cdDotproduct 00167 GL_FALSE); // muxSum 00168 00169 // Spare0(A) <- interpolated alpha 00170 CombinerOutputNV(GL_COMBINER0_NV, 00171 GL_ALPHA, 00172 GL_DISCARD_NV, 00173 GL_DISCARD_NV, 00174 GL_SPARE0_NV, 00175 GL_NONE, 00176 GL_NONE, 00177 GL_FALSE, 00178 GL_FALSE, 00179 GL_FALSE); 00180 00181 00182 // second general combiner: compute dot products 00183 00184 // RGB-Portion 00185 // ----------- 00186 00187 // A(RGB) = interpolated gradients 00188 CombinerInputNV(GL_COMBINER1_NV, // stage 00189 GL_RGB, // portion 00190 GL_VARIABLE_A_NV, // variable 00191 GL_SPARE0_NV, // input 00192 GL_SIGNED_IDENTITY_NV, // mapping 00193 GL_RGB); // componentUsage 00194 00195 // B(RGB) = diffuse dir light 0 00196 CombinerInputNV(GL_COMBINER1_NV, 00197 GL_RGB, 00198 GL_VARIABLE_B_NV, 00199 GL_CONSTANT_COLOR0_NV, 00200 GL_EXPAND_NORMAL_NV, 00201 GL_RGB); 00202 00203 // C(RGB) = interpolated gradients 00204 CombinerInputNV(GL_COMBINER1_NV, // stage 00205 GL_RGB, // portion 00206 GL_VARIABLE_C_NV, // variable 00207 GL_SPARE0_NV, // input 00208 GL_SIGNED_IDENTITY_NV, // mapping 00209 GL_RGB); // componentUsage 00210 00211 // D(RGB) = diffuse dir light 2 00212 CombinerInputNV(GL_COMBINER1_NV, 00213 GL_RGB, 00214 GL_VARIABLE_D_NV, 00215 GL_CONSTANT_COLOR1_NV, 00216 GL_EXPAND_NORMAL_NV, 00217 GL_RGB); 00218 00219 // second general combiner output 00220 00221 // Spare0(RGB) = <A|B> 00222 CombinerOutputNV(GL_COMBINER1_NV, // stage 00223 GL_RGB, // portion 00224 GL_TEXTURE0_ARB, // abOutput 00225 GL_TEXTURE1_ARB, // cdOutput 00226 GL_DISCARD_NV, // sumOutput 00227 GL_NONE, // scale 00228 GL_NONE, // bias 00229 GL_TRUE, // abDotProduct 00230 GL_TRUE, // cdDotproduct 00231 GL_FALSE); // muxSum 00232 00233 CombinerOutputNV(GL_COMBINER1_NV, // stage 00234 GL_ALPHA, // portion 00235 GL_DISCARD_NV, // abOutput 00236 GL_DISCARD_NV, // cdOutput 00237 GL_DISCARD_NV, // sumOutput 00238 GL_NONE, // scale 00239 GL_NONE, // bias 00240 GL_FALSE, // abDotProduct 00241 GL_FALSE, // cdDotproduct 00242 GL_FALSE); // muxSum 00243 00244 // use more than 2 general combiners/lightsources 00245 if((m_maxCombiners > 7) && m_hasPerStageConstants) 00246 { 00247 initCombiners_DiffuseMultiCombiners(action); 00248 } 00249 else 00250 { 00251 initCombiners_Diffuse2Combiners(action); 00252 } 00253 }
| void DVRIsoShader::initCombiners_Diffuse2Combiners | ( | DrawActionBase * | action | ) | [protected] |
Definition at line 255 of file OSGDVRIsoShaderNVRegisterCombiners.cpp.
References _funcFinalCombinerInputNV, osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GL_E_TIMES_F_NV, GL_PRIMARY_COLOR_NV, GL_SECONDARY_COLOR_NV, GL_SPARE0_NV, GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, GL_UNSIGNED_IDENTITY_NV, GL_VARIABLE_A_NV, GL_VARIABLE_B_NV, GL_VARIABLE_C_NV, GL_VARIABLE_D_NV, GL_VARIABLE_E_NV, GL_VARIABLE_F_NV, and GL_VARIABLE_G_NV.
Referenced by initCombiners_IsoSurfaceDiffuse().
00256 { 00257 Window *win = action->getWindow(); 00258 00259 FinalCombinerInputNVFunc FinalCombinerInputNV = 00260 (FinalCombinerInputNVFunc) win->getFunction(_funcFinalCombinerInputNV); 00261 00262 // final combiner input: multiply with light color and add if we 00263 // have only 2 general combiners 00264 00265 FinalCombinerInputNV(GL_VARIABLE_A_NV, 00266 GL_TEXTURE0_ARB, 00267 GL_UNSIGNED_IDENTITY_NV, 00268 GL_RGB); 00269 00270 FinalCombinerInputNV(GL_VARIABLE_B_NV, 00271 GL_PRIMARY_COLOR_NV, 00272 GL_UNSIGNED_IDENTITY_NV, 00273 GL_RGB); 00274 00275 FinalCombinerInputNV(GL_VARIABLE_C_NV, 00276 GL_ZERO, 00277 GL_UNSIGNED_IDENTITY_NV, 00278 GL_RGB); 00279 00280 FinalCombinerInputNV(GL_VARIABLE_E_NV, 00281 GL_TEXTURE1_ARB, 00282 GL_UNSIGNED_IDENTITY_NV, 00283 GL_RGB); 00284 00285 FinalCombinerInputNV(GL_VARIABLE_F_NV, 00286 GL_SECONDARY_COLOR_NV, 00287 GL_UNSIGNED_IDENTITY_NV, 00288 GL_RGB); 00289 00290 FinalCombinerInputNV(GL_VARIABLE_D_NV, 00291 GL_E_TIMES_F_NV, 00292 GL_UNSIGNED_IDENTITY_NV, 00293 GL_RGB); 00294 00295 // Alpha component 00296 // G(A) = Spare0 00297 FinalCombinerInputNV(GL_VARIABLE_G_NV, 00298 GL_SPARE0_NV, 00299 GL_UNSIGNED_IDENTITY_NV, 00300 GL_ALPHA); 00301 }
| void DVRIsoShader::initCombiners_DiffuseMultiCombiners | ( | DrawActionBase * | action | ) | [protected] |
Definition at line 303 of file OSGDVRIsoShaderNVRegisterCombiners.cpp.
References _funcCombinerInputNV, _funcCombinerOutputNV, _funcFinalCombinerInputNV, osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GL_COMBINER2_NV, GL_COMBINER3_NV, GL_CONSTANT_COLOR0_NV, GL_CONSTANT_COLOR1_NV, GL_DISCARD_NV, GL_EXPAND_NORMAL_NV, GL_SIGNED_IDENTITY_NV, GL_SPARE0_NV, GL_SPARE0_PLUS_SECONDARY_COLOR_NV, GL_SPARE1_NV, GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, GL_UNSIGNED_IDENTITY_NV, GL_UNSIGNED_INVERT_NV, GL_VARIABLE_A_NV, GL_VARIABLE_B_NV, GL_VARIABLE_C_NV, GL_VARIABLE_D_NV, GL_VARIABLE_G_NV, GLenum, and m_maxCombiners.
Referenced by initCombiners_IsoSurfaceDiffuse().
00304 { 00305 00306 Window *win = action->getWindow(); 00307 00308 CombinerInputNVFunc CombinerInputNV = 00309 (CombinerInputNVFunc) win->getFunction (_funcCombinerInputNV ); 00310 00311 CombinerOutputNVFunc CombinerOutputNV = 00312 (CombinerOutputNVFunc) win->getFunction (_funcCombinerOutputNV ); 00313 00314 FinalCombinerInputNVFunc FinalCombinerInputNV = 00315 (FinalCombinerInputNVFunc) win->getFunction(_funcFinalCombinerInputNV); 00316 00317 // third general combiner: apply light color to first 2 lightsources 00318 00319 // RGB-Portion 00320 // ----------- 00321 00322 CombinerInputNV(GL_COMBINER2_NV, // stage 00323 GL_RGB, // portion 00324 GL_VARIABLE_A_NV, // variable 00325 GL_TEXTURE0_ARB, // input 00326 GL_UNSIGNED_IDENTITY_NV, // mapping 00327 GL_RGB); // componentUsage 00328 00329 CombinerInputNV(GL_COMBINER2_NV, 00330 GL_RGB, 00331 GL_VARIABLE_B_NV, 00332 GL_CONSTANT_COLOR0_NV, 00333 GL_UNSIGNED_IDENTITY_NV, 00334 GL_RGB); 00335 00336 CombinerInputNV(GL_COMBINER2_NV, // stage 00337 GL_RGB, // portion 00338 GL_VARIABLE_C_NV, // variable 00339 GL_TEXTURE1_ARB, // input 00340 GL_UNSIGNED_IDENTITY_NV, // mapping 00341 GL_RGB); // componentUsage 00342 00343 CombinerInputNV(GL_COMBINER2_NV, 00344 GL_RGB, 00345 GL_VARIABLE_D_NV, 00346 GL_CONSTANT_COLOR1_NV, 00347 GL_UNSIGNED_IDENTITY_NV, 00348 GL_RGB); 00349 00350 CombinerOutputNV(GL_COMBINER2_NV, // stage 00351 GL_RGB, // portion 00352 GL_DISCARD_NV, // abOutput 00353 GL_DISCARD_NV, // cdOutput 00354 GL_SPARE1_NV, // sumOutput 00355 GL_NONE, // scale 00356 GL_NONE, // bias 00357 GL_FALSE, // abDotProduct 00358 GL_FALSE, // cdDotproduct 00359 GL_FALSE); // muxSum 00360 00361 CombinerOutputNV(GL_COMBINER2_NV, // stage 00362 GL_ALPHA, // portion 00363 GL_DISCARD_NV, // abOutput 00364 GL_DISCARD_NV, // cdOutput 00365 GL_DISCARD_NV, // sumOutput 00366 GL_NONE, // scale 00367 GL_NONE, // bias 00368 GL_FALSE, // abDotProduct 00369 GL_FALSE, // cdDotproduct 00370 GL_FALSE); // muxSum 00371 00372 Int32 i; 00373 00374 for(i = 0; i < (m_maxCombiners - 5) / 3; i++) 00375 { 00376 // compute dot products 00377 00378 CombinerInputNV(GLenum(GL_COMBINER3_NV + i * 3), // stage 00379 GL_RGB, // portion 00380 GL_VARIABLE_A_NV, // variable 00381 GL_SPARE0_NV, // input 00382 GL_SIGNED_IDENTITY_NV, // mapping 00383 GL_RGB); // componentUsage 00384 00385 CombinerInputNV(GLenum(GL_COMBINER3_NV + i * 3), // stage 00386 GL_RGB, // portion 00387 GL_VARIABLE_B_NV, // variable 00388 GL_CONSTANT_COLOR0_NV, // input 00389 GL_EXPAND_NORMAL_NV, // mapping 00390 GL_RGB); // usage 00391 00392 CombinerInputNV(GLenum(GL_COMBINER3_NV + i * 3), // stage 00393 GL_RGB, // portion 00394 GL_VARIABLE_C_NV, // variable 00395 GL_SPARE0_NV, // input 00396 GL_SIGNED_IDENTITY_NV, // mapping 00397 GL_RGB); // componentUsage 00398 00399 CombinerInputNV(GLenum(GL_COMBINER3_NV + i * 3), // stage 00400 GL_RGB, // portion 00401 GL_VARIABLE_D_NV, // variable 00402 GL_CONSTANT_COLOR1_NV, // input 00403 GL_EXPAND_NORMAL_NV, // mapping 00404 GL_RGB); // componentUsage 00405 00406 CombinerOutputNV(GLenum(GL_COMBINER3_NV + i * 3), // stage 00407 GL_RGB, // portion 00408 GL_TEXTURE0_ARB, // abOutput 00409 GL_TEXTURE1_ARB, // cdOutput 00410 GL_DISCARD_NV, // sumOutput 00411 GL_NONE, // scale 00412 GL_NONE, // bias 00413 GL_TRUE, // abDotProduct 00414 GL_TRUE, // cdDotproduct 00415 GL_FALSE); // muxSum 00416 00417 CombinerOutputNV(GLenum(GL_COMBINER3_NV + i * 3), // stage 00418 GL_ALPHA, // portion 00419 GL_DISCARD_NV, // abOutput 00420 GL_DISCARD_NV, // cdOutput 00421 GL_DISCARD_NV, // sumOutput 00422 GL_NONE, // scale 00423 GL_NONE, // bias 00424 GL_FALSE, // abDotProduct 00425 GL_FALSE, // cdDotproduct 00426 GL_FALSE); // muxSum 00427 00428 // apply light color and sum up 00429 00430 CombinerInputNV(GLenum(GL_COMBINER3_NV + i * 3 +1), // stage 00431 GL_RGB, // portion 00432 GL_VARIABLE_A_NV, // variable 00433 GL_TEXTURE0_ARB, // input 00434 GL_UNSIGNED_IDENTITY_NV, // mapping 00435 GL_RGB); // componentUsage 00436 00437 CombinerInputNV(GLenum(GL_COMBINER3_NV + i * 3 + 1), // stage 00438 GL_RGB, // portion 00439 GL_VARIABLE_B_NV, // variable 00440 GL_CONSTANT_COLOR0_NV, // input 00441 GL_UNSIGNED_IDENTITY_NV, // mapping 00442 GL_RGB); // usage 00443 00444 CombinerInputNV(GLenum(GL_COMBINER3_NV + i * 3 + 1), // stage 00445 GL_RGB, // portion 00446 GL_VARIABLE_C_NV, // variable 00447 GL_TEXTURE1_ARB, // input 00448 GL_UNSIGNED_IDENTITY_NV, // mapping 00449 GL_RGB); // componentUsage 00450 00451 CombinerInputNV( 00452 GLenum(GL_COMBINER3_NV+i*3+1), // stage 00453 GL_RGB, // portion 00454 GL_VARIABLE_D_NV, // variable 00455 GL_CONSTANT_COLOR1_NV, // input 00456 GL_UNSIGNED_IDENTITY_NV, // mapping 00457 GL_RGB); // componentUsage 00458 00459 CombinerOutputNV(GLenum(GL_COMBINER3_NV + i * 3 + 1), // stage 00460 GL_RGB, // portion 00461 GL_DISCARD_NV, // abOutput 00462 GL_DISCARD_NV, // cdOutput 00463 GL_TEXTURE0_ARB, // sumOutput 00464 GL_NONE, // scale 00465 GL_NONE, // bias 00466 GL_FALSE, // abDotProduct 00467 GL_FALSE, // cdDotproduct 00468 GL_FALSE); // muxSum 00469 00470 CombinerOutputNV(GLenum(GL_COMBINER3_NV + i * 3 + 1), // stage 00471 GL_ALPHA, // portion 00472 GL_DISCARD_NV, // abOutput 00473 GL_DISCARD_NV, // cdOutput 00474 GL_DISCARD_NV, // sumOutput 00475 GL_NONE, // scale 00476 GL_NONE, // bias 00477 GL_FALSE, // abDotProduct 00478 GL_FALSE, // cdDotproduct 00479 GL_FALSE); // muxSum 00480 00481 // sum up with previous step 00482 00483 CombinerInputNV(GLenum(GL_COMBINER3_NV + i * 3 + 2), // stage 00484 GL_RGB, // portion 00485 GL_VARIABLE_A_NV, // variable 00486 GL_SPARE1_NV, // input 00487 GL_UNSIGNED_IDENTITY_NV, // mapping 00488 GL_RGB); // componentUsage 00489 00490 CombinerInputNV(GLenum(GL_COMBINER3_NV + i * 3 + 2), // stage 00491 GL_RGB, // portion 00492 GL_VARIABLE_B_NV, // variable 00493 GL_ZERO, // input 00494 GL_UNSIGNED_INVERT_NV, // mapping 00495 GL_RGB); // usage 00496 00497 CombinerInputNV(GLenum(GL_COMBINER3_NV + i * 3 + 2), // stage 00498 GL_RGB, // portion 00499 GL_VARIABLE_C_NV, // variable 00500 GL_TEXTURE0_ARB, // input 00501 GL_UNSIGNED_IDENTITY_NV, // mapping 00502 GL_RGB); // componentUsage 00503 00504 CombinerInputNV(GLenum(GL_COMBINER3_NV + i * 3 + 2), // stage 00505 GL_RGB, // portion 00506 GL_VARIABLE_D_NV, // variable 00507 GL_ZERO, // input 00508 GL_UNSIGNED_INVERT_NV, // mapping 00509 GL_RGB); // componentUsage 00510 00511 CombinerOutputNV(GLenum(GL_COMBINER3_NV + i * 3 + 2), // stage 00512 GL_RGB, // portion 00513 GL_DISCARD_NV, // abOutput 00514 GL_DISCARD_NV, // cdOutput 00515 GL_SPARE1_NV, // sumOutput 00516 GL_NONE, // scale 00517 GL_NONE, // bias 00518 GL_FALSE, // abDotProduct 00519 GL_FALSE, // cdDotproduct 00520 GL_FALSE); // muxSum 00521 00522 CombinerOutputNV(GLenum(GL_COMBINER3_NV + i *3 + 2), // stage 00523 GL_ALPHA, // portion 00524 GL_DISCARD_NV, // abOutput 00525 GL_DISCARD_NV, // cdOutput 00526 GL_DISCARD_NV, // sumOutput 00527 GL_NONE, // scale 00528 GL_NONE, // bias 00529 GL_FALSE, // abDotProduct 00530 GL_FALSE, // cdDotproduct 00531 GL_FALSE); // muxSum 00532 00533 } 00534 00535 // special case: last two general combiners -> 00536 // summation done with final combiner 00537 00538 // compute dot products 00539 00540 CombinerInputNV(GLenum(GL_COMBINER3_NV+i*3), // stage 00541 GL_RGB, // portion 00542 GL_VARIABLE_A_NV, // variable 00543 GL_SPARE0_NV, // input 00544 GL_SIGNED_IDENTITY_NV, // mapping 00545 GL_RGB); // componentUsage 00546 00547 CombinerInputNV(GLenum(GL_COMBINER3_NV+i*3), // stage 00548 GL_RGB, // portion 00549 GL_VARIABLE_B_NV, // variable 00550 GL_CONSTANT_COLOR0_NV, // input 00551 GL_EXPAND_NORMAL_NV, // mapping 00552 GL_RGB); // usage 00553 00554 CombinerInputNV(GLenum(GL_COMBINER3_NV+i*3), // stage 00555 GL_RGB, // portion 00556 GL_VARIABLE_C_NV, // variable 00557 GL_SPARE0_NV, // input 00558 GL_SIGNED_IDENTITY_NV, // mapping 00559 GL_RGB); // componentUsage 00560 00561 CombinerInputNV(GLenum(GL_COMBINER3_NV+i*3), // stage 00562 GL_RGB, // portion 00563 GL_VARIABLE_D_NV, // variable 00564 GL_CONSTANT_COLOR1_NV, // input 00565 GL_EXPAND_NORMAL_NV, // mapping 00566 GL_RGB); // componentUsage 00567 00568 CombinerOutputNV(GLenum(GL_COMBINER3_NV+i*3), // stage 00569 GL_RGB, // portion 00570 GL_TEXTURE0_ARB, // abOutput 00571 GL_TEXTURE1_ARB, // cdOutput 00572 GL_DISCARD_NV, // sumOutput 00573 GL_NONE, // scale 00574 GL_NONE, // bias 00575 GL_TRUE, // abDotProduct 00576 GL_TRUE, // cdDotproduct 00577 GL_FALSE); // muxSum 00578 00579 CombinerOutputNV(GLenum(GL_COMBINER3_NV+i*3), // stage 00580 GL_ALPHA, // portion 00581 GL_DISCARD_NV, // abOutput 00582 GL_DISCARD_NV, // cdOutput 00583 GL_DISCARD_NV, // sumOutput 00584 GL_NONE, // scale 00585 GL_NONE, // bias 00586 GL_FALSE, // abDotProduct 00587 GL_FALSE, // cdDotproduct 00588 GL_FALSE); // muxSum 00589 00590 // apply light color and sum up 00591 00592 CombinerInputNV(GLenum(GL_COMBINER3_NV + i * 3 + 1), // stage 00593 GL_RGB, // portion 00594 GL_VARIABLE_A_NV, // variable 00595 GL_TEXTURE0_ARB, // input 00596 GL_UNSIGNED_IDENTITY_NV, // mapping 00597 GL_RGB); // componentUsage 00598 00599 CombinerInputNV(GLenum(GL_COMBINER3_NV + i * 3 + 1), // stage 00600 GL_RGB, // portion 00601 GL_VARIABLE_B_NV, // variable 00602 GL_CONSTANT_COLOR0_NV, // input 00603 GL_UNSIGNED_IDENTITY_NV, // mapping 00604 GL_RGB); // usage 00605 00606 CombinerInputNV(GLenum(GL_COMBINER3_NV + i * 3 + 1), // stage 00607 GL_RGB, // portion 00608 GL_VARIABLE_C_NV, // variable 00609 GL_TEXTURE1_ARB, // input 00610 GL_UNSIGNED_IDENTITY_NV, // mapping 00611 GL_RGB); // componentUsage 00612 00613 CombinerInputNV(GLenum(GL_COMBINER3_NV + i * 3 + 1), // stage 00614 GL_RGB, // portion 00615 GL_VARIABLE_D_NV, // variable 00616 GL_CONSTANT_COLOR1_NV, // input 00617 GL_UNSIGNED_IDENTITY_NV, // mapping 00618 GL_RGB); // componentUsage 00619 00620 CombinerOutputNV(GLenum(GL_COMBINER3_NV + i * 3 + 1), // stage 00621 GL_RGB, // portion 00622 GL_DISCARD_NV, // abOutput 00623 GL_DISCARD_NV, // cdOutput 00624 GL_SPARE0_NV, // sumOutput 00625 GL_NONE, // scale 00626 GL_NONE, // bias 00627 GL_FALSE, // abDotProduct 00628 GL_FALSE, // cdDotproduct 00629 GL_FALSE); // muxSum 00630 00631 CombinerOutputNV(GLenum(GL_COMBINER3_NV + i * 3 + 1), // stage 00632 GL_ALPHA, // portion 00633 GL_DISCARD_NV, // abOutput 00634 GL_DISCARD_NV, // cdOutput 00635 GL_DISCARD_NV, // sumOutput 00636 GL_NONE, // scale 00637 GL_NONE, // bias 00638 GL_FALSE, // abDotProduct 00639 GL_FALSE, // cdDotproduct 00640 GL_FALSE); // muxSum 00641 00642 00643 // final combiner input: sum up 00644 00645 FinalCombinerInputNV(GL_VARIABLE_A_NV, 00646 GL_ZERO, 00647 GL_UNSIGNED_INVERT_NV, 00648 GL_RGB); 00649 00650 FinalCombinerInputNV(GL_VARIABLE_B_NV, 00651 GL_SPARE1_NV, 00652 GL_UNSIGNED_IDENTITY_NV, 00653 GL_RGB); 00654 00655 FinalCombinerInputNV(GL_VARIABLE_C_NV, 00656 GL_ZERO, 00657 GL_UNSIGNED_IDENTITY_NV, 00658 GL_RGB); 00659 00660 FinalCombinerInputNV(GL_VARIABLE_D_NV, 00661 GL_SPARE0_PLUS_SECONDARY_COLOR_NV, 00662 GL_UNSIGNED_IDENTITY_NV, 00663 GL_RGB); 00664 00665 // Alpha component 00666 // A = Spare0(A) 00667 FinalCombinerInputNV(GL_VARIABLE_G_NV, 00668 GL_SPARE0_NV, 00669 GL_UNSIGNED_IDENTITY_NV, 00670 GL_ALPHA); 00671 }
| void DVRIsoShader::initCombiners_IsoSurfaceSpecular | ( | DrawActionBase * | action | ) | [protected] |
Definition at line 675 of file OSGDVRIsoShaderNVRegisterCombiners.cpp.
References _funcCombinerInputNV, _funcCombinerOutputNV, _funcCombinerParameteriNV, osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GL_COMBINER0_NV, GL_COMBINER1_NV, GL_CONSTANT_COLOR0_NV, GL_CONSTANT_COLOR1_NV, GL_DISCARD_NV, GL_EXPAND_NORMAL_NV, GL_NUM_GENERAL_COMBINERS_NV, GL_PRIMARY_COLOR_NV, GL_SIGNED_IDENTITY_NV, GL_SPARE0_NV, GL_SPARE1_NV, GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, GL_UNSIGNED_IDENTITY_NV, GL_UNSIGNED_INVERT_NV, GL_VARIABLE_A_NV, GL_VARIABLE_B_NV, GL_VARIABLE_C_NV, GL_VARIABLE_D_NV, initCombiners_Specular2Combiners(), initCombiners_SpecularMultiCombiners(), m_hasPerStageConstants, and m_maxCombiners.
Referenced by activate_NVRegisterCombinerShading().
00676 { 00677 Window *win = action->getWindow(); 00678 00679 CombinerParameteriNVFunc CombinerParameteriNV = 00680 (CombinerParameteriNVFunc) win->getFunction(_funcCombinerParameteriNV); 00681 00682 CombinerInputNVFunc CombinerInputNV = 00683 (CombinerInputNVFunc) win->getFunction (_funcCombinerInputNV ); 00684 00685 CombinerOutputNVFunc CombinerOutputNV = 00686 (CombinerOutputNVFunc) win->getFunction (_funcCombinerOutputNV ); 00687 00688 if(m_hasPerStageConstants && m_maxCombiners >= 8) 00689 { 00690 CombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 8); 00691 } 00692 else 00693 { 00694 CombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 2); 00695 } 00696 00697 // first general combiner input: interpolate beween two slices 00698 // interpolated gradients in text0 00699 00700 // RGB Portion Combiner 0 00701 // interpolate gradients 00702 00703 // A <- interpolation factor 00704 CombinerInputNV(GL_COMBINER0_NV, // stage 00705 GL_RGB, // portion 00706 GL_VARIABLE_A_NV, // variable 00707 GL_CONSTANT_COLOR0_NV, // input 00708 GL_UNSIGNED_INVERT_NV, // mapping 00709 GL_ALPHA); // componentUsage 00710 00711 // B <- packed gradients (0) 00712 CombinerInputNV(GL_COMBINER0_NV, 00713 GL_RGB, 00714 GL_VARIABLE_B_NV, 00715 GL_TEXTURE0_ARB, 00716 GL_EXPAND_NORMAL_NV, 00717 GL_RGB); 00718 00719 // C <- interpolation factor 00720 CombinerInputNV(GL_COMBINER0_NV, 00721 GL_RGB, 00722 GL_VARIABLE_C_NV, 00723 GL_CONSTANT_COLOR0_NV, 00724 GL_UNSIGNED_IDENTITY_NV, 00725 GL_ALPHA); 00726 00727 // D <- packed gradients (1) 00728 CombinerInputNV(GL_COMBINER0_NV, 00729 GL_RGB, 00730 GL_VARIABLE_D_NV, 00731 GL_TEXTURE1_ARB, 00732 GL_EXPAND_NORMAL_NV, 00733 GL_RGB); 00734 00735 00736 // Combiner 0, Alpha Portion 00737 // interpolate alpha values 00738 00739 // A <- interpolation factor 00740 CombinerInputNV(GL_COMBINER0_NV, // stage 00741 GL_ALPHA, // portion 00742 GL_VARIABLE_A_NV, // variable 00743 GL_CONSTANT_COLOR0_NV, // input 00744 GL_UNSIGNED_INVERT_NV, // mapping 00745 GL_ALPHA); // componentUsage 00746 00747 // B <- alpha value (0) 00748 CombinerInputNV(GL_COMBINER0_NV, 00749 GL_ALPHA, 00750 GL_VARIABLE_B_NV, 00751 GL_TEXTURE0_ARB, 00752 GL_UNSIGNED_IDENTITY_NV, 00753 GL_ALPHA); 00754 00755 // C <- interpolation factor 00756 CombinerInputNV(GL_COMBINER0_NV, 00757 GL_ALPHA, 00758 GL_VARIABLE_C_NV, 00759 GL_CONSTANT_COLOR0_NV, 00760 GL_UNSIGNED_IDENTITY_NV, 00761 GL_ALPHA); 00762 00763 // D <- alpha value (0) 00764 CombinerInputNV(GL_COMBINER0_NV, 00765 GL_ALPHA, 00766 GL_VARIABLE_D_NV, 00767 GL_TEXTURE1_ARB, 00768 GL_UNSIGNED_IDENTITY_NV, 00769 GL_ALPHA); 00770 00771 00772 // first general combiner output (RGB) 00773 // put interpolated gradients in TEX0 00774 00775 // interpolated gradients -> TEX0 00776 CombinerOutputNV(GL_COMBINER0_NV, // stage 00777 GL_RGB, // portion 00778 GL_DISCARD_NV, // abOutput 00779 GL_DISCARD_NV, // cdOutput 00780 GL_TEXTURE0_ARB, // sumOutput 00781 GL_NONE, // scale 00782 GL_NONE, // bias 00783 GL_FALSE, // abDotProduct 00784 GL_FALSE, // cdDotproduct 00785 GL_FALSE); // muxSum 00786 00787 // first general combiner output (ALPHA) 00788 // put interpolated alpha in TEX0 00789 00790 // interpolated alpha -> TEX0 00791 CombinerOutputNV(GL_COMBINER0_NV, 00792 GL_ALPHA, 00793 GL_DISCARD_NV, 00794 GL_DISCARD_NV, 00795 GL_TEXTURE0_ARB, 00796 GL_NONE, 00797 GL_NONE, 00798 GL_FALSE, 00799 GL_FALSE, 00800 GL_FALSE); 00801 00802 00803 // second general combiner: 00804 // compute dotproducts for first (specular/diffuse) lightsource 00805 00806 // RGB Portion 00807 00808 // A <- interpolated gradients 00809 CombinerInputNV(GL_COMBINER1_NV, // stage 00810 GL_RGB, // portion 00811 GL_VARIABLE_A_NV, // variable 00812 GL_TEXTURE0_ARB, // input 00813 GL_SIGNED_IDENTITY_NV, // mapping 00814 GL_RGB); // componentUsage 00815 00816 // B <- diffuse dir light0 00817 CombinerInputNV(GL_COMBINER1_NV, // stage 00818 GL_RGB, // portion 00819 GL_VARIABLE_B_NV, // variable 00820 GL_PRIMARY_COLOR_NV, // input 00821 GL_EXPAND_NORMAL_NV, // mapping 00822 GL_RGB); // componentUsage 00823 00824 // C <- interpolated gradients 00825 CombinerInputNV(GL_COMBINER1_NV, // stage 00826 GL_RGB, // portion 00827 GL_VARIABLE_C_NV, // variable 00828 GL_TEXTURE0_ARB, // input 00829 GL_SIGNED_IDENTITY_NV, // mapping 00830 GL_RGB); // componentUsage 00831 00832 // D <- halfway vector light0 00833 CombinerInputNV(GL_COMBINER1_NV, // stage 00834 GL_RGB, // portion 00835 GL_VARIABLE_D_NV, // variable 00836 GL_CONSTANT_COLOR1_NV, // input 00837 GL_EXPAND_NORMAL_NV, // mapping 00838 GL_RGB); // componentUsage 00839 00840 00841 // second general combiner output 00842 // put dotproducts for first (specular/diffuse) lightsource in SPARE0 00843 00844 // two dot products (diffuse->SPARE0, specular->SPARE1) 00845 CombinerOutputNV(GL_COMBINER1_NV, // stage 00846 GL_RGB, // portion 00847 GL_SPARE0_NV, // abOutput 00848 GL_SPARE1_NV, // cdOutput 00849 GL_DISCARD_NV, // sumOutput 00850 GL_NONE, // scale 00851 GL_NONE, // bias 00852 GL_TRUE, // abDotProduct 00853 GL_TRUE, // cdDotproduct 00854 GL_FALSE); // muxSum 00855 00856 // no operation for alpha 00857 CombinerOutputNV(GL_COMBINER1_NV, // stage 00858 GL_ALPHA, // portion 00859 GL_DISCARD_NV, // abOutput 00860 GL_DISCARD_NV, // cdOutput 00861 GL_DISCARD_NV, // sumOutput 00862 GL_NONE, // scale 00863 GL_NONE, // bias 00864 GL_FALSE, // abDotProduct 00865 GL_FALSE, // cdDotproduct 00866 GL_FALSE); // muxSum 00867 00868 // use max. available combiners for shading 00869 if((m_maxCombiners > 2) && m_hasPerStageConstants) 00870 { 00871 initCombiners_SpecularMultiCombiners(action); 00872 } 00873 else 00874 { 00875 initCombiners_Specular2Combiners(action); 00876 } 00877 }
| void DVRIsoShader::initCombiners_Specular2Combiners | ( | DrawActionBase * | action | ) | [protected] |
Definition at line 879 of file OSGDVRIsoShaderNVRegisterCombiners.cpp.
References _funcFinalCombinerInputNV, osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GL_E_TIMES_F_NV, GL_SPARE0_PLUS_SECONDARY_COLOR_NV, GL_SPARE1_NV, GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_VARIABLE_A_NV, GL_VARIABLE_B_NV, GL_VARIABLE_C_NV, GL_VARIABLE_D_NV, GL_VARIABLE_E_NV, GL_VARIABLE_F_NV, and GL_VARIABLE_G_NV.
Referenced by initCombiners_IsoSurfaceSpecular().
00880 { 00881 Window *win = action->getWindow(); 00882 00883 FinalCombinerInputNVFunc FinalCombinerInputNV = 00884 (FinalCombinerInputNVFunc) win->getFunction(_funcFinalCombinerInputNV); 00885 00886 // final combiner input 00887 00888 // E <- <grad,halfway> 00889 FinalCombinerInputNV(GL_VARIABLE_E_NV, 00890 GL_SPARE1_NV, 00891 GL_UNSIGNED_IDENTITY_NV, 00892 GL_RGB); 00893 00894 // F <- <grad,halfway> 00895 FinalCombinerInputNV(GL_VARIABLE_F_NV, 00896 GL_SPARE1_NV, 00897 GL_UNSIGNED_IDENTITY_NV, 00898 GL_RGB); 00899 00900 // A <- <grad,halfway>^2 00901 FinalCombinerInputNV(GL_VARIABLE_A_NV, 00902 GL_E_TIMES_F_NV, 00903 GL_UNSIGNED_IDENTITY_NV, 00904 GL_RGB); 00905 00906 // B <- <grad,halfway>^2 00907 FinalCombinerInputNV(GL_VARIABLE_B_NV, 00908 GL_E_TIMES_F_NV, 00909 GL_UNSIGNED_IDENTITY_NV, 00910 GL_RGB); 00911 00912 // C <- zero 00913 FinalCombinerInputNV(GL_VARIABLE_C_NV, 00914 GL_ZERO, 00915 GL_UNSIGNED_IDENTITY_NV, 00916 GL_RGB); 00917 00918 // D <- ambient + diffuse 00919 FinalCombinerInputNV(GL_VARIABLE_D_NV, 00920 GL_SPARE0_PLUS_SECONDARY_COLOR_NV, 00921 GL_UNSIGNED_IDENTITY_NV, 00922 GL_RGB); 00923 00924 // Alpha component 00925 FinalCombinerInputNV(GL_VARIABLE_G_NV, 00926 GL_TEXTURE0_ARB, 00927 GL_UNSIGNED_IDENTITY_NV, 00928 GL_ALPHA); 00929 00930 }
| void DVRIsoShader::initCombiners_SpecularMultiCombiners | ( | DrawActionBase * | action | ) | [protected] |
Definition at line 932 of file OSGDVRIsoShaderNVRegisterCombiners.cpp.
References _funcCombinerInputNV, _funcCombinerOutputNV, _funcFinalCombinerInputNV, osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GL_COMBINER2_NV, GL_COMBINER3_NV, GL_COMBINER4_NV, GL_COMBINER5_NV, GL_COMBINER6_NV, GL_COMBINER7_NV, GL_CONSTANT_COLOR0_NV, GL_CONSTANT_COLOR1_NV, GL_DISCARD_NV, GL_EXPAND_NORMAL_NV, GL_SIGNED_IDENTITY_NV, GL_SPARE0_NV, GL_SPARE0_PLUS_SECONDARY_COLOR_NV, GL_SPARE1_NV, GL_TEXTURE0_ARB, GL_TEXTURE1_ARB, GL_UNSIGNED_IDENTITY_NV, GL_UNSIGNED_INVERT_NV, GL_VARIABLE_A_NV, GL_VARIABLE_B_NV, GL_VARIABLE_C_NV, GL_VARIABLE_D_NV, and GL_VARIABLE_G_NV.
Referenced by initCombiners_IsoSurfaceSpecular().
00933 { 00934 Window *win = action->getWindow(); 00935 00936 CombinerInputNVFunc CombinerInputNV = 00937 (CombinerInputNVFunc) win->getFunction (_funcCombinerInputNV ); 00938 00939 CombinerOutputNVFunc CombinerOutputNV = 00940 (CombinerOutputNVFunc) win->getFunction (_funcCombinerOutputNV ); 00941 00942 FinalCombinerInputNVFunc FinalCombinerInputNV = 00943 (FinalCombinerInputNVFunc) win->getFunction(_funcFinalCombinerInputNV); 00944 00945 // third general combiner: 00946 // compute dotproducts for specular fraction of second and third 00947 // lightsource 00948 00949 // RGB Portion 00950 00951 // A <- interpolated gradients 00952 CombinerInputNV(GL_COMBINER2_NV, // stage 00953 GL_RGB, // portion 00954 GL_VARIABLE_A_NV, // variable 00955 GL_TEXTURE0_ARB, // input 00956 GL_SIGNED_IDENTITY_NV, // mapping 00957 GL_RGB); // componentUsage 00958 00959 // B <- halfway vector light 1 00960 CombinerInputNV(GL_COMBINER2_NV, // stage 00961 GL_RGB, // portion 00962 GL_VARIABLE_B_NV, // variable 00963 GL_CONSTANT_COLOR0_NV, // input 00964 GL_EXPAND_NORMAL_NV, // mapping 00965 GL_RGB); // componentUsage 00966 00967 // C <- interpolated gradients 00968 CombinerInputNV(GL_COMBINER2_NV, // stage 00969 GL_RGB, // portion 00970 GL_VARIABLE_C_NV, // variable 00971 GL_TEXTURE0_ARB, // input 00972 GL_SIGNED_IDENTITY_NV, // mapping 00973 GL_RGB); // componentUsage 00974 00975 // D <- halfway vector light 2 00976 CombinerInputNV(GL_COMBINER2_NV, // stage 00977 GL_RGB, // portion 00978 GL_VARIABLE_D_NV, // variable 00979 GL_CONSTANT_COLOR1_NV, // input 00980 GL_EXPAND_NORMAL_NV, // mapping 00981 GL_RGB); // componentUsage 00982 00983 // ALPHA portion 00984 00985 // A <- specular coeff of light 0 00986 CombinerInputNV(GL_COMBINER2_NV, // stage 00987 GL_ALPHA, // portion 00988 GL_VARIABLE_A_NV, // variable 00989 GL_SPARE1_NV, // input 00990 GL_UNSIGNED_IDENTITY_NV, // mapping 00991 GL_BLUE); // componentUsage 00992 00993 // B <- specular coeff of light 0 00994 CombinerInputNV(GL_COMBINER2_NV, // stage 00995 GL_ALPHA, // portion 00996 GL_VARIABLE_B_NV, // variable 00997 GL_SPARE1_NV, // input 00998 GL_UNSIGNED_IDENTITY_NV, // mapping 00999 GL_BLUE); // componentUsage 01000 01001 // third general combiner output 01002 01003 // two dot products for specular coeffs of light 1 and light 2 01004 CombinerOutputNV(GL_COMBINER2_NV, // stage 01005 GL_RGB, // portion 01006 GL_TEXTURE1_ARB, // abOutput 01007 GL_SPARE1_NV, // cdOutput 01008 GL_DISCARD_NV, // sumOutput 01009 GL_NONE, // scale 01010 GL_NONE, // bias 01011 GL_TRUE, // abDotProduct 01012 GL_TRUE, // cdDotproduct 01013 GL_FALSE); // muxSum 01014 01015 // square specular coeff of light 0 01016 CombinerOutputNV(GL_COMBINER2_NV, // stage 01017 GL_ALPHA, // portion 01018 GL_SPARE0_NV, // abOutput 01019 GL_DISCARD_NV, // cdOutput 01020 GL_DISCARD_NV, // sumOutput 01021 GL_NONE, // scale 01022 GL_NONE, // bias 01023 GL_FALSE, // abDotProduct 01024 GL_FALSE, // cdDotproduct 01025 GL_FALSE); // muxSum 01026 01027 01028 // 4th general combiner: 01029 // compute dot products for diffuse fraction of second and third 01030 // lightsource 01031 01032 // RGB Portion 01033 01034 // A <- interpolated gradients 01035 CombinerInputNV(GL_COMBINER3_NV, // stage 01036 GL_RGB, // portion 01037 GL_VARIABLE_A_NV, // variable 01038 GL_TEXTURE0_ARB, // input 01039 GL_SIGNED_IDENTITY_NV, // mapping 01040 GL_RGB); // componentUsage 01041 01042 // B <- diffuse dir light 1 01043 CombinerInputNV(GL_COMBINER3_NV, // stage 01044 GL_RGB, // portion 01045 GL_VARIABLE_B_NV, // variable 01046 GL_CONSTANT_COLOR0_NV, // input 01047 GL_EXPAND_NORMAL_NV, // mapping 01048 GL_RGB); // componentUsage 01049 01050 // C <- interpolated gradients 01051 CombinerInputNV(GL_COMBINER3_NV, // stage 01052 GL_RGB, // portion 01053 GL_VARIABLE_C_NV, // variable 01054 GL_TEXTURE0_ARB, // input 01055 GL_SIGNED_IDENTITY_NV, // mapping 01056 GL_RGB); // componentUsage 01057 01058 // D <- diffuse dir light 2 01059 CombinerInputNV(GL_COMBINER3_NV, // stage 01060 GL_RGB, // portion 01061 GL_VARIABLE_D_NV, // variable 01062 GL_CONSTANT_COLOR1_NV, // input 01063 GL_EXPAND_NORMAL_NV, // mapping 01064 GL_RGB); // componentUsage 01065 01066 // ALPHA portion 01067 01068 // A <- specular coeff of light 1 01069 CombinerInputNV(GL_COMBINER3_NV, // stage 01070 GL_ALPHA, // portion 01071 GL_VARIABLE_A_NV, // variable 01072 GL_TEXTURE1_ARB, // input 01073 GL_UNSIGNED_IDENTITY_NV, // mapping 01074 GL_BLUE); // componentUsage 01075 01076 // B <- specular coeff of light 1 01077 CombinerInputNV(GL_COMBINER3_NV, // stage 01078 GL_ALPHA, // portion 01079 GL_VARIABLE_B_NV, // variable 01080 GL_TEXTURE1_ARB, // input 01081 GL_UNSIGNED_IDENTITY_NV, // mapping 01082 GL_BLUE); // componentUsage 01083 01084 // C <- specular coeff of light 2 01085 CombinerInputNV(GL_COMBINER3_NV, // stage 01086 GL_ALPHA, // portion 01087 GL_VARIABLE_B_NV, // variable 01088 GL_SPARE1_NV, // input 01089 GL_UNSIGNED_IDENTITY_NV, // mapping 01090 GL_BLUE); // componentUsage 01091 01092 // D <- specular coeff of light 2 01093 CombinerInputNV(GL_COMBINER3_NV, // stage 01094 GL_ALPHA, // portion 01095 GL_VARIABLE_D_NV, // variable 01096 GL_SPARE1_NV, // input 01097 GL_UNSIGNED_IDENTITY_NV, // mapping 01098 GL_BLUE); // componentUsage 01099 01100 // 4th general combiner output 01101 // two dot products for diffuse coeffs of light 1 and light 2 01102 01103 CombinerOutputNV(GL_COMBINER3_NV, // stage 01104 GL_RGB, // portion 01105 GL_TEXTURE1_ARB, // abOutput 01106 GL_SPARE1_NV, // cdOutput 01107 GL_DISCARD_NV, // sumOutput 01108 GL_NONE, // scale 01109 GL_NONE, // bias 01110 GL_TRUE, // abDotProduct 01111 GL_TRUE, // cdDotproduct 01112 GL_FALSE); // muxSum 01113 01114 // square specular coeffs of light 1 and light 2 01115 CombinerOutputNV(GL_COMBINER3_NV, // stage 01116 GL_ALPHA, // portion 01117 GL_TEXTURE1_ARB, // abOutput 01118 GL_SPARE1_NV, // cdOutput 01119 GL_DISCARD_NV, // sumOutput 01120 GL_NONE, // scale 01121 GL_NONE, // bias 01122 GL_FALSE, // abDotProduct 01123 GL_FALSE, // cdDotproduct 01124 GL_FALSE); // muxSum 01125 01126 // 5th general combiner: 01127 // compute products for diffuse fraction of second and third lightsource 01128 // and sum up 01129 01130 // RGB Portion 01131 01132 // A <- diffuse coeff of light 1 01133 CombinerInputNV(GL_COMBINER4_NV, // stage 01134 GL_RGB, // portion 01135 GL_VARIABLE_A_NV, // variable 01136 GL_TEXTURE1_ARB, // input 01137 GL_UNSIGNED_IDENTITY_NV, // mapping 01138 GL_RGB); // componentUsage 01139 01140 // B <- diffuse color light 1 01141 CombinerInputNV(GL_COMBINER4_NV, // stage 01142 GL_RGB, // portion 01143 GL_VARIABLE_B_NV, // variable 01144 GL_CONSTANT_COLOR0_NV, // input 01145 GL_UNSIGNED_IDENTITY_NV, // mapping 01146 GL_RGB); // componentUsage 01147 01148 // C <- diffuse coeff of light 2 01149 CombinerInputNV(GL_COMBINER4_NV, // stage 01150 GL_RGB, // portion 01151 GL_VARIABLE_C_NV, // variable 01152 GL_SPARE1_NV, // input 01153 GL_UNSIGNED_IDENTITY_NV, // mapping 01154 GL_RGB); // componentUsage 01155 01156 // D <- diffuse color light 2 01157 CombinerInputNV(GL_COMBINER4_NV, // stage 01158 GL_RGB, // portion 01159 GL_VARIABLE_D_NV, // variable 01160 GL_CONSTANT_COLOR1_NV, // input 01161 GL_UNSIGNED_IDENTITY_NV, // mapping 01162 GL_RGB); // componentUsage 01163 01164 // ALPHA portion 01165 01166 // A <- squared specular coeff of light 1 01167 CombinerInputNV(GL_COMBINER4_NV, // stage 01168 GL_ALPHA, // portion 01169 GL_VARIABLE_A_NV, // variable 01170 GL_TEXTURE1_ARB, // input 01171 GL_UNSIGNED_IDENTITY_NV, // mapping 01172 GL_ALPHA); // componentUsage 01173 01174 // B <- squared specular coeff of light 1 01175 CombinerInputNV(GL_COMBINER4_NV, // stage 01176 GL_ALPHA, // portion 01177 GL_VARIABLE_B_NV, // variable 01178 GL_TEXTURE1_ARB, // input 01179 GL_UNSIGNED_IDENTITY_NV, // mapping 01180 GL_ALPHA); // componentUsage 01181 01182 // C <- squared specular coeff of light 2 01183 CombinerInputNV(GL_COMBINER4_NV, // stage 01184 GL_ALPHA, // portion 01185 GL_VARIABLE_B_NV, // variable 01186 GL_SPARE1_NV, // input 01187 GL_UNSIGNED_IDENTITY_NV, // mapping 01188 GL_ALPHA); // componentUsage 01189 01190 // D <- squared specular coeff of light 2 01191 CombinerInputNV(GL_COMBINER4_NV, // stage 01192 GL_ALPHA, // portion 01193 GL_VARIABLE_D_NV, // variable 01194 GL_SPARE1_NV, // input 01195 GL_UNSIGNED_IDENTITY_NV, // mapping 01196 GL_ALPHA); // componentUsage 01197 01198 // 5th general combiner output 01199 01200 // two products for diffuse color of light 1 and light 2 and sum up 01201 CombinerOutputNV(GL_COMBINER4_NV, // stage 01202 GL_RGB, // portion 01203 GL_DISCARD_NV, // abOutput 01204 GL_DISCARD_NV, // cdOutput 01205 GL_SPARE1_NV, // sumOutput 01206 GL_NONE, // scale 01207 GL_NONE, // bias 01208 GL_FALSE, // abDotProduct 01209 GL_FALSE, // cdDotproduct 01210 GL_FALSE); // muxSum 01211 01212 // square squared specular coeffs of light 1 and light 2 01213 CombinerOutputNV(GL_COMBINER4_NV, // stage 01214 GL_ALPHA, // portion 01215 GL_TEXTURE1_ARB, // abOutput 01216 GL_SPARE1_NV, // cdOutput 01217 GL_DISCARD_NV, // sumOutput 01218 GL_NONE, // scale 01219 GL_NONE, // bias 01220 GL_FALSE, // abDotProduct 01221 GL_FALSE, // cdDotproduct 01222 GL_FALSE); // muxSum 01223 01224 01225 // 6th general combiner: 01226 // compute products for color of specular fraction of second and third lightsource 01227 // and sum up 01228 01229 // RGB Portion 01230 01231 // A <- ^4 specular coeff of light 1 01232 CombinerInputNV(GL_COMBINER5_NV, // stage 01233 GL_RGB, // portion 01234 GL_VARIABLE_A_NV, // variable 01235 GL_TEXTURE1_ARB, // input 01236 GL_UNSIGNED_IDENTITY_NV, // mapping 01237 GL_ALPHA); // componentUsage 01238 01239 // B <- specular color light 1 01240 CombinerInputNV(GL_COMBINER5_NV, // stage 01241 GL_RGB, // portion 01242 GL_VARIABLE_B_NV, // variable 01243 GL_CONSTANT_COLOR0_NV, // input 01244 GL_UNSIGNED_IDENTITY_NV, // mapping 01245 GL_RGB); // componentUsage 01246 01247 // C <- ^4 specular coeff of light 2 01248 CombinerInputNV(GL_COMBINER5_NV, // stage 01249 GL_RGB, // portion 01250 GL_VARIABLE_C_NV, // variable 01251 GL_SPARE1_NV, // input 01252 GL_UNSIGNED_IDENTITY_NV, // mapping 01253 GL_ALPHA); // componentUsage 01254 01255 // D <- specular color light 2 01256 CombinerInputNV(GL_COMBINER5_NV, // stage 01257 GL_RGB, // portion 01258 GL_VARIABLE_D_NV, // variable 01259 GL_CONSTANT_COLOR1_NV, // input 01260 GL_UNSIGNED_IDENTITY_NV, // mapping 01261 GL_RGB); // componentUsage 01262 01263 // ALPHA portion 01264 01265 // A <- squared specular coeff of light 0 01266 CombinerInputNV(GL_COMBINER5_NV, // stage 01267 GL_ALPHA, // portion 01268 GL_VARIABLE_A_NV, // variable 01269 GL_SPARE0_NV, // input 01270 GL_UNSIGNED_IDENTITY_NV, // mapping 01271 GL_ALPHA); // componentUsage 01272 01273 // B <- squared specular coeff of light 0 01274 CombinerInputNV(GL_COMBINER5_NV, // stage 01275 GL_ALPHA, // portion 01276 GL_VARIABLE_B_NV, // variable 01277 GL_SPARE0_NV, // input 01278 GL_UNSIGNED_IDENTITY_NV, // mapping 01279 GL_ALPHA); // componentUsage 01280 01281 // 6th general combiner output 01282 01283 // two products for specular color of light 1 and light 2 and sum up 01284 CombinerOutputNV(GL_COMBINER5_NV, // stage 01285 GL_RGB, // portion 01286 GL_DISCARD_NV, // abOutput 01287 GL_DISCARD_NV, // cdOutput 01288 GL_TEXTURE1_ARB, // sumOutput 01289 GL_NONE, // scale 01290 GL_NONE, // bias 01291 GL_FALSE, // abDotProduct 01292 GL_FALSE, // cdDotproduct 01293 GL_FALSE); // muxSum 01294 01295 // square squared specular coeffs of light 0 01296 CombinerOutputNV(GL_COMBINER5_NV, // stage 01297 GL_ALPHA, // portion 01298 GL_SPARE0_NV, // abOutput 01299 GL_DISCARD_NV, // cdOutput 01300 GL_DISCARD_NV, // sumOutput 01301 GL_NONE, // scale 01302 GL_NONE, // bias 01303 GL_FALSE, // abDotProduct 01304 GL_FALSE, // cdDotproduct 01305 GL_FALSE); // muxSum 01306 01307 01308 // 7th general combiner: 01309 // compute sum of contribution second and third lightsource 01310 01311 // RGB Portion 01312 01313 // A <- diffuse contribution from light1 and light 2 01314 CombinerInputNV(GL_COMBINER6_NV, // stage 01315 GL_RGB, // portion 01316 GL_VARIABLE_A_NV, // variable 01317 GL_SPARE1_NV, // input 01318 GL_UNSIGNED_IDENTITY_NV, // mapping 01319 GL_RGB); // componentUsage 01320 01321 // B <- (1,1,1) 01322 CombinerInputNV(GL_COMBINER6_NV, // stage 01323 GL_RGB, // portion 01324 GL_VARIABLE_B_NV, // variable 01325 GL_ZERO, // input 01326 GL_UNSIGNED_INVERT_NV, // mapping 01327 GL_RGB); // componentUsage 01328 01329 // C <- specular contribution of light 1 and light 2 01330 CombinerInputNV(GL_COMBINER6_NV, // stage 01331 GL_RGB, // portion 01332 GL_VARIABLE_C_NV, // variable 01333 GL_TEXTURE1_ARB, // input 01334 GL_UNSIGNED_IDENTITY_NV, // mapping 01335 GL_RGB); // componentUsage 01336 01337 // D <- (1,1,1) 01338 CombinerInputNV(GL_COMBINER6_NV, // stage 01339 GL_RGB, // portion 01340 GL_VARIABLE_D_NV, // variable 01341 GL_ZERO, // input 01342 GL_UNSIGNED_INVERT_NV, // mapping 01343 GL_RGB); // componentUsage 01344 01345 // 7th general combiner output 01346 01347 // sum up diffuse and specular contributions of light 1 and 2 01348 CombinerOutputNV(GL_COMBINER6_NV, // stage 01349 GL_RGB, // portion 01350 GL_DISCARD_NV, // abOutput 01351 GL_DISCARD_NV, // cdOutput 01352 GL_SPARE1_NV, // sumOutput 01353 GL_NONE, // scale 01354 GL_NONE, // bias 01355 GL_FALSE, // abDotProduct 01356 GL_FALSE, // cdDotproduct 01357 GL_FALSE); // muxSum 01358 01359 // nothing todo 01360 CombinerOutputNV(GL_COMBINER6_NV, // stage 01361 GL_ALPHA, // portion 01362 GL_DISCARD_NV, // abOutput 01363 GL_DISCARD_NV, // cdOutput 01364 GL_DISCARD_NV, // sumOutput 01365 GL_NONE, // scale 01366 GL_NONE, // bias 01367 GL_FALSE, // abDotProduct 01368 GL_FALSE, // cdDotproduct 01369 GL_FALSE); // muxSum 01370 01371 // 8th general combiner: 01372 // apply colors and compute sum of contribution first lightsource 01373 01374 // RGB Portion 01375 01376 // A <- ^4 specular coeff of light0 01377 CombinerInputNV(GL_COMBINER7_NV, // stage 01378 GL_RGB, // portion 01379 GL_VARIABLE_A_NV, // variable 01380 GL_SPARE0_NV, // input 01381 GL_UNSIGNED_IDENTITY_NV, // mapping 01382 GL_ALPHA); // componentUsage 01383 01384 // B <- specular color of light0 01385 CombinerInputNV(GL_COMBINER7_NV, // stage 01386 GL_RGB, // portion 01387 GL_VARIABLE_B_NV, // variable 01388 GL_CONSTANT_COLOR0_NV, // input 01389 GL_UNSIGNED_IDENTITY_NV, // mapping 01390 GL_RGB); // componentUsage 01391 01392 // C <- diffuse coeff of light 0 01393 CombinerInputNV(GL_COMBINER7_NV, // stage 01394 GL_RGB, // portion 01395 GL_VARIABLE_C_NV, // variable 01396 GL_SPARE0_NV, // input 01397 GL_UNSIGNED_IDENTITY_NV, // mapping 01398 GL_RGB); // componentUsage 01399 01400 // D <- diffuse color of light 0 01401 CombinerInputNV(GL_COMBINER7_NV, // stage 01402 GL_RGB, // portion 01403 GL_VARIABLE_D_NV, // variable 01404 GL_CONSTANT_COLOR1_NV, // input 01405 GL_UNSIGNED_IDENTITY_NV, // mapping 01406 GL_RGB); // componentUsage 01407 01408 // 7th general combiner output 01409 01410 // sum up diffuse and specular contribution of light 0 01411 CombinerOutputNV(GL_COMBINER7_NV, // stage 01412 GL_RGB, // portion 01413 GL_DISCARD_NV, // abOutput 01414 GL_DISCARD_NV, // cdOutput 01415 GL_SPARE0_NV, // sumOutput 01416 GL_NONE, // scale 01417 GL_NONE, // bias 01418 GL_FALSE, // abDotProduct 01419 GL_FALSE, // cdDotproduct 01420 GL_FALSE); // muxSum 01421 01422 // nothing todo 01423 CombinerOutputNV(GL_COMBINER7_NV, // stage 01424 GL_ALPHA, // portion 01425 GL_DISCARD_NV, // abOutput 01426 GL_DISCARD_NV, // cdOutput 01427 GL_DISCARD_NV, // sumOutput 01428 GL_NONE, // scale 01429 GL_NONE, // bias 01430 GL_FALSE, // abDotProduct 01431 GL_FALSE, // cdDotproduct 01432 GL_FALSE); // muxSum 01433 01434 01435 // final combiner input 01436 // sum up contributions of all lightsources 01437 01438 // A <- contribution of light 1 and light 2 01439 FinalCombinerInputNV(GL_VARIABLE_A_NV, 01440 GL_SPARE1_NV, 01441 GL_UNSIGNED_IDENTITY_NV, 01442 GL_RGB); 01443 01444 // B <- (1,1,1) 01445 FinalCombinerInputNV(GL_VARIABLE_B_NV, 01446 GL_ZERO, 01447 GL_UNSIGNED_INVERT_NV, 01448 GL_RGB); 01449 01450 // C <- zero 01451 FinalCombinerInputNV(GL_VARIABLE_C_NV, 01452 GL_ZERO, 01453 GL_UNSIGNED_IDENTITY_NV, 01454 GL_RGB); 01455 01456 // D <- ambient + contribution of light 0 01457 FinalCombinerInputNV(GL_VARIABLE_D_NV, 01458 GL_SPARE0_PLUS_SECONDARY_COLOR_NV, 01459 GL_UNSIGNED_IDENTITY_NV, 01460 GL_RGB); 01461 01462 // Alpha component 01463 FinalCombinerInputNV(GL_VARIABLE_G_NV, 01464 GL_TEXTURE0_ARB, 01465 GL_UNSIGNED_IDENTITY_NV, 01466 GL_ALPHA); 01467 }
| void DVRIsoShader::initMethod | ( | void | ) | [static, private] |
| void osg::DVRIsoShader::operator= | ( | const DVRIsoShader & | source | ) | [private] |
| osg::FieldContainerType & osg::DVRIsoShaderBase::getClassType | ( | void | ) | [inline, static, inherited] |
Reimplemented from osg::DVRShaderBase.
Definition at line 58 of file OSGDVRIsoShaderBase.inl.
References osg::DVRIsoShaderBase::_type.
Referenced by osg::DVRIsoShaderBase::create().
00059 { 00060 return _type; 00061 }
| osg::UInt32 osg::DVRIsoShaderBase::getClassTypeId | ( | void | ) | [inline, static, inherited] |
Reimplemented from osg::DVRShaderBase.
Definition at line 65 of file OSGDVRIsoShaderBase.inl.
References osg::DVRIsoShaderBase::_type, and osg::TypeBase::getId().
00066 { 00067 return _type.getId(); 00068 }
| FieldContainerType & DVRIsoShaderBase::getType | ( | void | ) | [virtual, inherited] |
Reimplemented from osg::DVRShaderBase.
Definition at line 117 of file OSGDVRIsoShaderBase.cpp.
References osg::DVRIsoShaderBase::_type.
00118 { 00119 return _type; 00120 }
| const FieldContainerType & DVRIsoShaderBase::getType | ( | void | ) | const [virtual, inherited] |
Reimplemented from osg::DVRShaderBase.
Definition at line 122 of file OSGDVRIsoShaderBase.cpp.
References osg::DVRIsoShaderBase::_type.
00123 { 00124 return _type; 00125 }
| UInt32 DVRIsoShaderBase::getContainerSize | ( | void | ) | const [virtual, inherited] |
Reimplemented from osg::DVRShaderBase.
Definition at line 137 of file OSGDVRIsoShaderBase.cpp.
00138 { 00139 return sizeof(DVRIsoShader); 00140 }
Reimplemented from osg::DVRShaderBase.
Definition at line 201 of file OSGDVRIsoShaderBase.cpp.
References osg::DVRIsoShaderBase::_sfActiveShadeMode, osg::DVRIsoShaderBase::_sfShadeMode, osg::DVRIsoShaderBase::ActiveShadeModeFieldMask, osg::SField< FieldTypeT, fieldNameSpace >::getBinSize(), osg::DVRShaderBase::getBinSize(), osg::FieldBits::NoField, and osg::DVRIsoShaderBase::ShadeModeFieldMask.
00202 { 00203 UInt32 returnValue = Inherited::getBinSize(whichField); 00204 00205 if(FieldBits::NoField != (ShadeModeFieldMask & whichField)) 00206 { 00207 returnValue += _sfShadeMode.getBinSize(); 00208 } 00209 00210 if(FieldBits::NoField != (ActiveShadeModeFieldMask & whichField)) 00211 { 00212 returnValue += _sfActiveShadeMode.getBinSize(); 00213 } 00214 00215 00216 return returnValue; 00217 }
| void DVRIsoShaderBase::copyToBin | ( | BinaryDataHandler & | pMem, | |
| const BitVector & | whichField | |||
| ) | [virtual, inherited] |
Reimplemented from osg::DVRShaderBase.
Definition at line 219 of file OSGDVRIsoShaderBase.cpp.
References osg::DVRIsoShaderBase::_sfActiveShadeMode, osg::DVRIsoShaderBase::_sfShadeMode, osg::DVRIsoShaderBase::ActiveShadeModeFieldMask, osg::SField< FieldTypeT, fieldNameSpace >::copyToBin(), osg::DVRShaderBase::copyToBin(), osg::FieldBits::NoField, and osg::DVRIsoShaderBase::ShadeModeFieldMask.
00221 { 00222 Inherited::copyToBin(pMem, whichField); 00223 00224 if(FieldBits::NoField != (ShadeModeFieldMask & whichField)) 00225 { 00226 _sfShadeMode.copyToBin(pMem); 00227 } 00228 00229 if(FieldBits::NoField != (ActiveShadeModeFieldMask & whichField)) 00230 { 00231 _sfActiveShadeMode.copyToBin(pMem); 00232 } 00233 00234 00235 }
| void DVRIsoShaderBase::copyFromBin | ( | BinaryDataHandler & | pMem, | |
| const BitVector & | whichField | |||
| ) | [virtual, inherited] |
Reimplemented from osg::DVRShaderBase.
Definition at line 237 of file OSGDVRIsoShaderBase.cpp.
References osg::DVRIsoShaderBase::_sfActiveShadeMode, osg::DVRIsoShaderBase::_sfShadeMode, osg::DVRIsoShaderBase::ActiveShadeModeFieldMask, osg::SField< FieldTypeT, fieldNameSpace >::copyFromBin(), osg::DVRShaderBase::copyFromBin(), osg::FieldBits::NoField, and osg::DVRIsoShaderBase::ShadeModeFieldMask.
00239 { 00240 Inherited::copyFromBin(pMem, whichField); 00241 00242 if(FieldBits::NoField != (ShadeModeFieldMask & whichField)) 00243 { 00244 _sfShadeMode.copyFromBin(pMem); 00245 } 00246 00247 if(FieldBits::NoField != (ActiveShadeModeFieldMask & whichField)) 00248 { 00249 _sfActiveShadeMode.copyFromBin(pMem); 00250 } 00251 00252 00253 }
| DVRIsoShaderPtr osg::DVRIsoShaderBase::create | ( | void | ) | [inline, static, inherited] |
Definition at line 72 of file OSGDVRIsoShaderBase.inl.
References osg::DVRIsoShaderBase::getClassType(), osg::NullFC, and osg::DVRIsoShaderBase::shallowCopy().
00073 { 00074 DVRIsoShaderPtr fc; 00075 00076 if(getClassType().getPrototype() != OSG::NullFC) 00077 { 00078 fc = DVRIsoShaderPtr::dcast( 00079 getClassType().getPrototype()-> shallowCopy()); 00080 } 00081 00082 return fc; 00083 }
| DVRIsoShaderPtr osg::DVRIsoShaderBase::createEmpty | ( | void | ) | [inline, static, inherited] |
Definition at line 87 of file OSGDVRIsoShaderBase.inl.
References osg::FieldContainer::newPtr().
00088 { 00089 DVRIsoShaderPtr returnValue; 00090 00091 newPtr(returnValue); 00092 00093 return returnValue; 00094 }
| FieldContainerPtr DVRIsoShaderBase::shallowCopy | ( | void | ) | const [virtual, inherited] |
Implements osg::FieldContainer.
Definition at line 128 of file OSGDVRIsoShaderBase.cpp.
References osg::FieldContainer::newPtr().
Referenced by osg::DVRIsoShaderBase::create().
00129 { 00130 DVRIsoShaderPtr returnValue; 00131 00132 newPtr(returnValue, dynamic_cast<const DVRIsoShader *>(this)); 00133 00134 return returnValue; 00135 }
| SFInt8 * osg::DVRIsoShaderBase::getSFShadeMode | ( | void | ) | [inline, protected, inherited] |
Definition at line 101 of file OSGDVRIsoShaderBase.inl.
References osg::DVRIsoShaderBase::_sfShadeMode.
00102 { 00103 return &_sfShadeMode; 00104 }
| SFInt8 * osg::DVRIsoShaderBase::getSFActiveShadeMode | ( | void | ) | [inline, protected, inherited] |
Definition at line 108 of file OSGDVRIsoShaderBase.inl.
References osg::DVRIsoShaderBase::_sfActiveShadeMode.
00109 { 00110 return &_sfActiveShadeMode; 00111 }
| Int8 & osg::DVRIsoShaderBase::getShadeMode | ( | void | ) | [inline, protected, inherited] |
Definition at line 116 of file OSGDVRIsoShaderBase.inl.
References osg::DVRIsoShaderBase::_sfShadeMode, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().
Referenced by initialize().
00117 { 00118 return _sfShadeMode.getValue(); 00119 }
| const Int8 & osg::DVRIsoShaderBase::getShadeMode | ( | void | ) | const [inline, protected, inherited] |
Definition at line 123 of file OSGDVRIsoShaderBase.inl.
References osg::DVRIsoShaderBase::_sfShadeMode, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().
00124 { 00125 return _sfShadeMode.getValue(); 00126 }
| Int8 & osg::DVRIsoShaderBase::getActiveShadeMode | ( | void | ) | [inline, protected, inherited] |
Definition at line 137 of file OSGDVRIsoShaderBase.inl.
References osg::DVRIsoShaderBase::_sfActiveShadeMode, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().
Referenced by activate().
00138 { 00139 return _sfActiveShadeMode.getValue(); 00140 }
| const Int8 & osg::DVRIsoShaderBase::getActiveShadeMode | ( | void | ) | const [inline, protected, inherited] |
Definition at line 144 of file OSGDVRIsoShaderBase.inl.
References osg::DVRIsoShaderBase::_sfActiveShadeMode, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().
00145 { 00146 return _sfActiveShadeMode.getValue(); 00147 }
| void osg::DVRIsoShaderBase::setShadeMode | ( | const Int8 & | value | ) | [inline, protected, inherited] |
Definition at line 130 of file OSGDVRIsoShaderBase.inl.
References osg::DVRIsoShaderBase::_sfShadeMode, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().
00131 { 00132 _sfShadeMode.setValue(value); 00133 }
| void osg::DVRIsoShaderBase::setActiveShadeMode | ( | const Int8 & | value | ) | [inline, protected, inherited] |
Definition at line 151 of file OSGDVRIsoShaderBase.inl.
References osg::DVRIsoShaderBase::_sfActiveShadeMode, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().
Referenced by changed(), and tryMode().
00152 { 00153 _sfActiveShadeMode.setValue(value); 00154 }
| void DVRIsoShaderBase::executeSyncImpl | ( | DVRIsoShaderBase * | pOther, | |
| const BitVector & | whichField | |||
| ) | [protected, inherited] |
Definition at line 256 of file OSGDVRIsoShaderBase.cpp.
References osg::DVRIsoShaderBase::_sfActiveShadeMode, osg::DVRIsoShaderBase::_sfShadeMode, osg::DVRIsoShaderBase::ActiveShadeModeFieldMask, osg::DVRShaderBase::executeSyncImpl(), osg::FieldBits::NoField, osg::DVRIsoShaderBase::ShadeModeFieldMask, and osg::SField< FieldTypeT, fieldNameSpace >::syncWith().
Referenced by osg::DVRIsoShaderBase::executeSync().
00258 { 00259 00260 Inherited::executeSyncImpl(pOther, whichField); 00261 00262 if(FieldBits::NoField != (ShadeModeFieldMask & whichField)) 00263 _sfShadeMode.syncWith(pOther->_sfShadeMode); 00264 00265 if(FieldBits::NoField != (ActiveShadeModeFieldMask & whichField)) 00266 _sfActiveShadeMode.syncWith(pOther->_sfActiveShadeMode); 00267 00268 00269 }
| void DVRShaderBase::executeSyncImpl | ( | DVRShaderBase * | pOther, | |
| const BitVector & | whichField | |||
| ) | [protected, inherited] |
Definition at line 182 of file OSGDVRShaderBase.cpp.
References osg::FieldContainer::executeSyncImpl().
Referenced by osg::DVRShaderBase::executeSync(), osg::DVRSimpleShaderBase::executeSyncImpl(), and osg::DVRIsoShaderBase::executeSyncImpl().
00184 { 00185 00186 Inherited::executeSyncImpl(pOther, whichField); 00187 00188 00189 }
| void osg::FieldContainer::executeSyncImpl | ( | FieldContainer * | pOther, | |
| const BitVector & | whichField | |||
| ) | [inline, protected, inherited] |
Definition at line 333 of file OSGFieldContainerImpl.inl.
Referenced by osg::StateBase::executeSyncImpl(), osg::DVRShaderBase::executeSyncImpl(), osg::DVRClipGeometryBase::executeSyncImpl(), osg::AttachmentContainer::executeSyncImpl(), and osg::Attachment::executeSyncImpl().
| void DVRIsoShaderBase::executeSync | ( | FieldContainer & | other, | |
| const BitVector & | whichField | |||
| ) | [protected, virtual, inherited] |
Reimplemented from osg::DVRShaderBase.
Definition at line 144 of file OSGDVRIsoShaderBase.cpp.
References osg::DVRIsoShaderBase::executeSyncImpl().
00146 { 00147 this->executeSyncImpl((DVRIsoShaderBase *) &other, whichField); 00148 }
| UInt16 osg::FieldContainer::getClassGroupId | ( | void | ) | [inline, static, inherited] |
Definition at line 71 of file OSGFieldContainerImpl.inl.
References osg::FieldContainer::_type, and osg::FieldContainerType::getGroupId().
00072 { 00073 return _type.getGroupId(); 00074 }
| UInt32 osg::FieldContainer::getTypeId | ( | void | ) | const [inline, inherited] |
Definition at line 77 of file OSGFieldContainerImpl.inl.
References osg::TypeBase::getId(), and osg::FieldContainer::getType().
Referenced by osg::TextureChunk::changeFrom(), and osg::CubeTextureChunk::changeFrom().
00078 { 00079 return getType().getId(); 00080 }
| UInt16 osg::FieldContainer::getGroupId | ( | void | ) | const [inline, inherited] |
Definition at line 83 of file OSGFieldContainerImpl.inl.
References osg::FieldContainerType::getGroupId(), and osg::FieldContainer::getType().
Referenced by osg::fcptrAttributeMap(), osg::Image::setAttachmentField(), and osg::stringAttributeMap().
00084 { 00085 return getType().getGroupId(); 00086 }
| const Char8 * osg::FieldContainer::getTypeName | ( | void | ) | const [inline, inherited] |
Definition at line 89 of file OSGFieldContainerImpl.inl.
References osg::TypeBase::getCName(), and osg::FieldContainer::getType().
00090 { 00091 return getType().getCName(); 00092 }
Generic Field Access
Definition at line 95 of file OSGFieldContainerImpl.inl.
References osg::FieldDescription::getField(), osg::FieldContainerType::getFieldDescription(), and osg::FieldContainer::getType().
Referenced by osg::QFCItem::expand(), osg::VRMLShapeDesc::getFieldAndDesc(), osg::QFieldViewBase::getFieldPtr(), osg::QFieldEditorBase::getFieldPtr(), osg::getParentsField(), and osg::QFCItem::setup().
00096 { 00097 const FieldDescription *desc = getType().getFieldDescription(fieldId); 00098 00099 return desc ? desc->getField(*this) : NULL; 00100 }
Generic Field Access
Definition at line 103 of file OSGFieldContainerImpl.inl.
References osg::FieldContainerType::findFieldDescription(), osg::FieldDescription::getField(), and osg::FieldContainer::getType().
00104 { 00105 const FieldDescription *desc =getType().findFieldDescription(fieldName); 00106 00107 return desc ? desc->getField(*this) : NULL; 00108 }
| void osg::FieldContainer::newPtr | ( | ObjectPtrT & | result, | |
| const typename ObjectPtrT::StoredObjectType * | prototypeP | |||
| ) | [inline, static, protected, inherited] |
Definition at line 138 of file OSGFieldContainerImpl.inl.
References osg::ChangeList::addCreated(), osg::PThreadBase::getAspect(), osg::PThreadBase::getCurrentChangeList(), osg::ThreadManager::getNumAspects(), osg::FieldContainerFactory::registerFieldContainer(), and osg::FieldContainerFactory::the().
Referenced by osg::XWindowBase::createEmpty(), osg::WIN32WindowBase::createEmpty(), osg::ViewportBase::createEmpty(), osg::VertexProgramChunkBase::createEmpty(), osg::TwoSidedLightingChunkBase::createEmpty(), osg::TransformChunkBase::createEmpty(), osg::TransformBase::createEmpty(), osg::TileCameraDecoratorBase::createEmpty(), osg::TextureTransformChunkBase::createEmpty(), osg::TextureGrabForegroundBase::createEmpty(), osg::TextureGrabBackgroundBase::createEmpty(), osg::TextureChunkBase::createEmpty(), osg::TextureBackgroundBase::createEmpty(), osg::TexGenChunkBase::createEmpty(), osg::SwitchMaterialBase::createEmpty(), osg::SwitchBase::createEmpty(), osg::SurfaceBase::createEmpty(), osg::StringAttributeMapBase::createEmpty(), osg::StereoBufferViewportBase::createEmpty(), osg::StencilChunkBase::createEmpty(), osg::StateSortingGroupBase::createEmpty(), osg::StateBase::createEmpty(), osg::SpotLightBase::createEmpty(), osg::SortFirstWindowBase::createEmpty(), osg::SolidBackgroundBase::createEmpty(), osg::SlicesBase::createEmpty(), osg::SkyBackgroundBase::createEmpty(), osg::SimpleTexturedMaterialBase::createEmpty(), osg::SimpleStatisticsForegroundBase::createEmpty(), osg::SimpleMaterialBase::createEmpty(), osg::SHLParameterChunkBase::createEmpty(), osg::SHLChunkBase::createEmpty(), osg::ShearedStereoCameraDecoratorBase::createEmpty(), osg::ShaderParameterVec4fBase::createEmpty(), osg::ShaderParameterVec3fBase::createEmpty(), osg::ShaderParameterVec2fBase::createEmpty(), osg::ShaderParameterStringBase::createEmpty(), osg::ShaderParameterRealBase::createEmpty(), osg::ShaderParameterMVec4fBase::createEmpty(), osg::ShaderParameterMVec3fBase::createEmpty(), osg::ShaderParameterMVec2fBase::createEmpty(), osg::ShaderParameterMRealBase::createEmpty(), osg::ShaderParameterMMatrixBase::createEmpty(), osg::ShaderParameterMIntBase::createEmpty(), osg::ShaderParameterMatrixBase::createEmpty(), osg::ShaderParameterIntBase::createEmpty(), osg::ShaderParameterBoolBase::createEmpty(), osg::ScreenGroupBase::createEmpty(), osg::SClipPlaneChunkBase::createEmpty(), osg::ResolutionDisplayFilterBase::createEmpty(), osg::RenderOptionsBase::createEmpty(), osg::RegisterCombinersChunkBase::createEmpty(), osg::QTWindowBase::createEmpty(), osg::ProxyGroupBase::createEmpty(), osg::ProjectionCameraDecoratorBase::createEmpty(), osg::PolygonForegroundBase::createEmpty(), osg::PolygonChunkBase::createEmpty(), osg::PolygonBackgroundBase::createEmpty(), osg::PointLightBase::createEmpty(), osg::PointChunkBase::createEmpty(), osg::PhongMaterialBase::createEmpty(), osg::PerspectiveCameraBase::createEmpty(), osg::PassiveWindowBase::createEmpty(), osg::PassiveViewportBase::createEmpty(), osg::PassiveBackgroundBase::createEmpty(), osg::ParticlesBase::createEmpty(), osg::OrthographicCameraBase::createEmpty(), osg::OffCenterPerspectiveCameraBase::createEmpty(), osg::MultiPassMaterialBase::createEmpty(), osg::MultiDisplayWindowBase::createEmpty(), osg::MatrixCameraDecoratorBase::createEmpty(), osg::MatrixCameraBase::createEmpty(), osg::MaterialPoolBase::createEmpty(), osg::MaterialGroupBase::createEmpty(), osg::MaterialChunkBase::createEmpty(), osg::LogicOpChunkBase::createEmpty(), osg::LineChunkBase::createEmpty(), osg::LightModelChunkBase::createEmpty(), osg::LightEnvBase::createEmpty(), osg::LightChunkBase::createEmpty(), osg::InverseTransformBase::createEmpty(), osg::InlineBase::createEmpty(), osg::ImageForegroundBase::createEmpty(), osg::ImageBase::createEmpty(), osg::ImageBackgroundBase::createEmpty(), osg::GroupBase::createEmpty(), osg::GraphicStatisticsForegroundBase::createEmpty(), osg::GradientBackgroundBase::createEmpty(), osg::GrabForegroundBase::createEmpty(), osg::GLUTWindowBase::createEmpty(), osg::GeometryBase::createEmpty(), osg::FresnelMaterialBase::createEmpty(), osg::FragmentProgramChunkBase::createEmpty(), osg::FileGrabForegroundBase::createEmpty(), osg::FCPtrAttributeMapBase::createEmpty(), osg::FBOViewportBase::createEmpty(), osg::FatBorderChunkBase::createEmpty(), osg::DVRVolumeTextureBase::createEmpty(), osg::DVRVolumeBase::createEmpty(), osg::DVRSimpleShaderBase::createEmpty(), osg::DVRSimpleLUTShaderBase::createEmpty(), osg::DVRMtexLUTShaderBase::createEmpty(), osg::DVRLookupTableBase::createEmpty(), osg::DVRIsoSurfaceBase::createEmpty(), osg::DVRIsoShaderBase::createEmpty(), osg::DVRGeometryBase::createEmpty(), osg::DVRClipObjectsBase::createEmpty(), osg::DVRClipGeometryBase::createEmpty(), osg::DVRAppearanceBase::createEmpty(), osg::DistortionDisplayFilterBase::createEmpty(), osg::DistanceLODBase::createEmpty(), osg::DisplayFilterForegroundBase::createEmpty(), osg::DisplayCalibrationBase::createEmpty(), osg::DirectionalLightBase::createEmpty(), osg::DepthClearBackgroundBase::createEmpty(), osg::DepthChunkBase::createEmpty(), osg::CubeTextureChunkBase::createEmpty(), osg::ComponentTransformBase::createEmpty(), osg::ColorMaskChunkBase::createEmpty(), osg::ColorDisplayFilterBase::createEmpty(), osg::ColorBufferViewportBase::createEmpty(), osg::ClusterWindowBase::createEmpty(), osg::ClipPlaneChunkBase::createEmpty(), osg::ClipPlaneBase::createEmpty(), osg::ChunkMaterialBase::createEmpty(), osg::BlendChunkBase::createEmpty(), osg::BillboardBase::createEmpty(), osg::XWindowBase::shallowCopy(), osg::WIN32WindowBase::shallowCopy(), osg::ViewportBase::shallowCopy(), osg::VertexProgramChunkBase::shallowCopy(), osg::TwoSidedLightingChunkBase::shallowCopy(), osg::TransformChunkBase::shallowCopy(), osg::TransformBase::shallowCopy(), osg::TileCameraDecoratorBase::shallowCopy(), osg::TextureTransformChunkBase::shallowCopy(), osg::TextureGrabForegroundBase::shallowCopy(), osg::TextureGrabBackgroundBase::shallowCopy(), osg::TextureChunkBase::shallowCopy(), osg::TextureBackgroundBase::shallowCopy(), osg::TexGenChunkBase::shallowCopy(), osg::SwitchMaterialBase::shallowCopy(), osg::SwitchBase::shallowCopy(), osg::SurfaceBase::shallowCopy(), osg::StringAttributeMapBase::shallowCopy(), osg::StereoBufferViewportBase::shallowCopy(), osg::StencilChunkBase::shallowCopy(), osg::StateSortingGroupBase::shallowCopy(), osg::StateBase::shallowCopy(), osg::SpotLightBase::shallowCopy(), osg::SortFirstWindowBase::shallowCopy(), osg::SolidBackgroundBase::shallowCopy(), osg::SlicesBase::shallowCopy(), osg::SkyBackgroundBase::shallowCopy(), osg::SimpleTexturedMaterialBase::shallowCopy(), osg::SimpleStatisticsForegroundBase::shallowCopy(), osg::SimpleMaterialBase::shallowCopy(), osg::SHLParameterChunkBase::shallowCopy(), osg::SHLChunkBase::shallowCopy(), osg::ShearedStereoCameraDecoratorBase::shallowCopy(), osg::ShaderParameterVec4fBase::shallowCopy(), osg::ShaderParameterVec3fBase::shallowCopy(), osg::ShaderParameterVec2fBase::shallowCopy(), osg::ShaderParameterStringBase::shallowCopy(), osg::ShaderParameterRealBase::shallowCopy(), osg::ShaderParameterMVec4fBase::shallowCopy(), osg::ShaderParameterMVec3fBase::shallowCopy(), osg::ShaderParameterMVec2fBase::shallowCopy(), osg::ShaderParameterMRealBase::shallowCopy(), osg::ShaderParameterMMatrixBase::shallowCopy(), osg::ShaderParameterMIntBase::shallowCopy(), osg::ShaderParameterMatrixBase::shallowCopy(), osg::ShaderParameterIntBase::shallowCopy(), osg::ShaderParameterBoolBase::shallowCopy(), osg::ScreenGroupBase::shallowCopy(), osg::SClipPlaneChunkBase::shallowCopy(), osg::ResolutionDisplayFilterBase::shallowCopy(), osg::RenderOptionsBase::shallowCopy(), osg::RegisterCombinersChunkBase::shallowCopy(), osg::QTWindowBase::shallowCopy(), osg::ProxyGroupBase::shallowCopy(), osg::ProjectionCameraDecoratorBase::shallowCopy(), osg::PolygonForegroundBase::shallowCopy(), osg::PolygonChunkBase::shallowCopy(), osg::PolygonBackgroundBase::shallowCopy(), osg::PointLightBase::shallowCopy(), osg::PointChunkBase::shallowCopy(), osg::PhongMaterialBase::shallowCopy(), osg::PerspectiveCameraBase::shallowCopy(), osg::PassiveWindowBase::shallowCopy(), osg::PassiveViewportBase::shallowCopy(), osg::PassiveBackgroundBase::shallowCopy(), osg::ParticlesBase::shallowCopy(), osg::OrthographicCameraBase::shallowCopy(), osg::OffCenterPerspectiveCameraBase::shallowCopy(), osg::MultiPassMaterialBase::shallowCopy(), osg::MultiDisplayWindowBase::shallowCopy(), osg::MatrixCameraDecoratorBase::shallowCopy(), osg::MatrixCameraBase::shallowCopy(), osg::MaterialPoolBase::shallowCopy(), osg::MaterialGroupBase::shallowCopy(), osg::MaterialChunkBase::shallowCopy(), osg::LogicOpChunkBase::shallowCopy(), osg::LineChunkBase::shallowCopy(), osg::LightModelChunkBase::shallowCopy(), osg::LightEnvBase::shallowCopy(), osg::LightChunkBase::shallowCopy(), osg::InverseTransformBase::shallowCopy(), osg::InlineBase::shallowCopy(), osg::ImageForegroundBase::shallowCopy(), osg::ImageBase::shallowCopy(), osg::ImageBackgroundBase::shallowCopy(), osg::GroupBase::shallowCopy(), osg::GraphicStatisticsForegroundBase::shallowCopy(), osg::GradientBackgroundBase::shallowCopy(), osg::GrabForegroundBase::shallowCopy(), osg::GLUTWindowBase::shallowCopy(), osg::GeometryBase::shallowCopy(), osg::FresnelMaterialBase::shallowCopy(), osg::FragmentProgramChunkBase::shallowCopy(), osg::FileGrabForegroundBase::shallowCopy(), osg::FCPtrAttributeMapBase::shallowCopy(), osg::FBOViewportBase::shallowCopy(), osg::FatBorderChunkBase::shallowCopy(), osg::DVRVolumeTextureBase::shallowCopy(), osg::DVRVolumeBase::shallowCopy(), osg::DVRSimpleShaderBase::shallowCopy(), osg::DVRSimpleLUTShaderBase::shallowCopy(), osg::DVRMtexLUTShaderBase::shallowCopy(), osg::DVRLookupTableBase::shallowCopy(), osg::DVRIsoSurfaceBase::shallowCopy(), osg::DVRIsoShaderBase::shallowCopy(), osg::DVRGeometryBase::shallowCopy(), osg::DVRClipObjectsBase::shallowCopy(), osg::DVRClipGeometryBase::shallowCopy(), osg::DVRAppearanceBase::shallowCopy(), osg::DistortionDisplayFilterBase::shallowCopy(), osg::DistanceLODBase::shallowCopy(), osg::DisplayFilterForegroundBase::shallowCopy(), osg::DisplayCalibrationBase::shallowCopy(), osg::DirectionalLightBase::shallowCopy(), osg::DepthClearBackgroundBase::shallowCopy(), osg::DepthChunkBase::shallowCopy(), osg::CubeTextureChunkBase::shallowCopy(), osg::ComponentTransformBase::shallowCopy(), osg::ColorMaskChunkBase::shallowCopy(), osg::ColorDisplayFilterBase::shallowCopy(), osg::ColorBufferViewportBase::shallowCopy(), osg::ClusterWindowBase::shallowCopy(), osg::ClipPlaneChunkBase::shallowCopy(), osg::ClipPlaneBase::shallowCopy(), osg::ChunkMaterialBase::shallowCopy(), osg::BlendChunkBase::shallowCopy(), and osg::BillboardBase::shallowCopy().
00141 { 00142 typedef typename ObjectPtrT::StoredObjectType ObjectType; 00143 00144 UInt8 *pTmp; 00145 00146 result._containerSize = sizeof(ObjectType); 00147 00148 pTmp = 00149 static_cast<UInt8 *>(operator new( 00150 sizeof(Int32) + // ReferenceCount 00151 sizeof(UInt32) + // ContainerId 00152 sizeof(ObjectType) * ThreadManager::getNumAspects())); 00153 00154 *(reinterpret_cast<Int32 *>(pTmp)) = 0; 00155 00156 pTmp += sizeof(Int32); 00157 00158 result._storeP = (pTmp + sizeof(UInt32)); 00159 00160 #ifdef OSG_DEBUG_FCPTR 00161 result._typedStoreP = reinterpret_cast<FieldContainer *>(result._storeP); 00162 #endif 00163 00164 *(reinterpret_cast<UInt32 *>(pTmp)) = 00165 FieldContainerFactory::the()->registerFieldContainer(result); 00166 00167 Thread::getCurrentChangeList()->addCreated( 00168 *(reinterpret_cast<UInt32 *>(pTmp))); 00169 00170 pTmp += sizeof(UInt32); 00171 00172 ObjectType *aObject = reinterpret_cast<ObjectType *>(pTmp); 00173 00174 for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++) 00175 { 00176 pTmp = 00177 reinterpret_cast<UInt8 *>(new (pTmp) ObjectType(*prototypeP)); 00178 00179 pTmp += sizeof(ObjectType); 00180 } 00181 00182 result->onCreate(prototypeP); 00183 00184 for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++) 00185 { 00186 aObject[i].onCreateAspect(aObject, prototypeP); 00187 } 00188 00189 #if defined(OSG_GV_BETA) && defined(OSG_DBG_MEM) 00190 00191 fprintf(stderr, "GV_MEM_FC_DBG : (%u) cc (%p|%u)\n", 00192 Thread::getAspect(), 00193 result._storeP, 00194 // ObjectType::getClassType().getCName(), 00195 ObjectType::getClassType().getId()); 00196 #endif 00197 00198 #ifdef OSG_DEBUG_TYPED_FCPTR 00199 result.updateTypedStore(); 00200 #endif 00201 }
| void osg::FieldContainer::newPtr | ( | ObjectPtrT & | result | ) | [inline, static, protected, inherited] |
Definition at line 204 of file OSGFieldContainerImpl.inl.
References osg::ChangeList::addCreated(), osg::PThreadBase::getAspect(), osg::PThreadBase::getCurrentChangeList(), osg::ThreadManager::getNumAspects(), osg::FieldContainerFactory::registerFieldContainer(), and osg::FieldContainerFactory::the().
00205 { 00206 typedef typename ObjectPtrT::StoredObjectType ObjectType; 00207 00208 UInt8 *pTmp; 00209 00210 result._containerSize = sizeof(ObjectType); 00211 00212 pTmp = 00213 static_cast<UInt8 *>(operator new( 00214 sizeof(Int32) + // ReferenceCount 00215 sizeof(UInt32) + // ContainerId 00216 sizeof(ObjectType) * ThreadManager::getNumAspects())); 00217 00218 *(reinterpret_cast<Int32 *>(pTmp)) = 0; 00219 00220 pTmp += sizeof(Int32); 00221 00222 result._storeP = (pTmp + sizeof(UInt32)); 00223 00224 #ifdef OSG_DEBUG_FCPTR 00225 result._typedStoreP = reinterpret_cast<FieldContainer *>(result._storeP); 00226 #endif 00227 00228 *(reinterpret_cast<UInt32 *>(pTmp)) = 00229 FieldContainerFactory::the()->registerFieldContainer(result); 00230 00231 Thread::getCurrentChangeList()->addCreated( 00232 *(reinterpret_cast<UInt32 *>(pTmp))); 00233 00234 pTmp += sizeof(UInt32); 00235 00236 ObjectType *aObject = reinterpret_cast<ObjectType *>(pTmp); 00237 00238 for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++) 00239 { 00240 pTmp = reinterpret_cast<UInt8 *>(new (pTmp) ObjectType()); 00241 00242 pTmp += sizeof(ObjectType); 00243 } 00244 00245 result->onCreate(); 00246 00247 for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++) 00248 { 00249 aObject[i].onCreateAspect(aObject); 00250 } 00251 00252 #if defined(OSG_GV_BETA) && defined(OSG_DBG_MEM) 00253 fprintf(stderr, "GV_MEM_FC_DBG : (%u) c (%p|%u)\n", 00254 Thread::getAspect(), 00255 result._storeP, 00256 // ObjectType::getClassType().getCName(), 00257 ObjectType::getClassType().getId()); 00258 #endif 00259 00260 #ifdef OSG_DEBUG_TYPED_FCPTR 00261 result.updateTypedStore(); 00262 #endif 00263 }
| void osg::FieldContainer::beginEditX | ( | const BitVector & | whichField, | |
| FieldTypeT & | field | |||
| ) | [inline, protected, inherited] |
| void osg::FieldContainer::endEditX | ( | const BitVector & | whichField, | |
| FieldTypeT & | field | |||
| ) | [inline, protected, inherited] |
Definition at line 291 of file OSGFieldContainerImpl.inl.
References osg::endEditCP().
00292 { 00293 FieldContainerPtr tmpPtr(this); 00294 endEditCP(tmpPtr, whichField); 00295 }
| void osg::FieldContainer::onCreate | ( | const FieldContainer * | source = NULL |
) | [inline, protected, inherited] |
Definition at line 318 of file OSGFieldContainerImpl.inl.
Referenced by osg::ShaderParameterChunk::onCreate().
| void osg::FieldContainer::onCreateAspect | ( | const FieldContainer * | aspect0, | |
| const FieldContainer * | source = NULL | |||
| ) | [inline, protected, inherited] |
| void FieldContainer::onDestroy | ( | void | ) | [protected, virtual, inherited] |
Reimplemented in osg::NodeCore, osg::Attachment, osg::Geometry, osg::Surface, osg::MaterialPool, osg::CubeTextureChunk, osg::TextureChunk, osg::FBOViewport, osg::Window, osg::ShaderParameterChunk, and osg::SHLChunk.
Definition at line 98 of file OSGFieldContainer.cpp.
friend class FieldContainer [friend] |
friend class DVRIsoShaderBase [friend] |
Definition at line 343 of file OSGDVRIsoShader.h.
ImagePtr osg::DVRIsoShader::m_gradientImage [protected] |
Definition at line 159 of file OSGDVRIsoShader.h.
Referenced by cleanup(), createGradientImage(), DVRIsoShader(), initialize(), and ~DVRIsoShader().
bool osg::DVRIsoShader::m_hasPerStageConstants [protected] |
Definition at line 161 of file OSGDVRIsoShader.h.
Referenced by activate_NVRegisterCombinerShading(), deactivate_NVRegisterCombinerShading(), initCombiners_IsoSurfaceDiffuse(), initCombiners_IsoSurfaceSpecular(), renderSlice_NVRegisterCombinerShading(), setupCombinerParametersDiffuse(), and setupCombinerParametersSpecular().
GLint osg::DVRIsoShader::m_maxCombiners [protected] |
Definition at line 162 of file OSGDVRIsoShader.h.
Referenced by activate_NVRegisterCombinerShading(), deactivate_NVRegisterCombinerShading(), initCombiners_DiffuseMultiCombiners(), initCombiners_IsoSurfaceDiffuse(), initCombiners_IsoSurfaceSpecular(), renderSlice_NVRegisterCombinerShading(), setupCombinerParametersDiffuse(), and setupCombinerParametersSpecular().
UInt8 osg::DVRIsoShader::m_shadingMode [protected] |
Definition at line 164 of file OSGDVRIsoShader.h.
Referenced by activate(), activate_FragmentProgramShading(), activate_NVRegisterCombinerShading(), deactivate(), DVRIsoShader(), hasRenderCallback(), initialize(), renderSlice(), tryMode(), and useMTSlabs().
Definition at line 166 of file OSGDVRIsoShader.h.
Referenced by activate_FragmentProgramShading(), cleanup(), deactivate_FragmentProgramShading(), DVRIsoShader(), and ~DVRIsoShader().
Int32 osg::DVRIsoShader::m_textureId [protected] |
Definition at line 168 of file OSGDVRIsoShader.h.
Referenced by cleanup(), DVRIsoShader(), initialize(), and ~DVRIsoShader().
GLint osg::DVRIsoShader::m_colorWriteMask[4] [protected] |
Definition at line 170 of file OSGDVRIsoShader.h.
Referenced by activate_ColorMatrixShading(), and deactivate_ColorMatrixShading().
char DVRIsoShader::_fragProg2D [static, protected] |
char DVRIsoShader::_fragProg3D [static, protected] |
UInt32 DVRIsoShader::_ARB_multitexture = Window::invalidExtensionID [static, protected] |
Definition at line 312 of file OSGDVRIsoShader.h.
Referenced by DVRIsoShader(), and isModeSupported().
UInt32 DVRIsoShader::_EXT_texture3D = Window::invalidExtensionID [static, protected] |
Definition at line 313 of file OSGDVRIsoShader.h.
Referenced by DVRIsoShader(), and isModeSupported().
UInt32 DVRIsoShader::_EXT_secondary_color = Window::invalidExtensionID [static, protected] |
UInt32 DVRIsoShader::_NV_register_combiners = Window::invalidExtensionID [static, protected] |
Definition at line 316 of file OSGDVRIsoShader.h.
Referenced by DVRIsoShader(), and isModeSupported().
UInt32 DVRIsoShader::_NV_register_combiners2 = Window::invalidExtensionID [static, protected] |
Definition at line 317 of file OSGDVRIsoShader.h.
Referenced by activate_NVRegisterCombinerShading(), and DVRIsoShader().
UInt32 DVRIsoShader::_SGI_color_matrix = Window::invalidExtensionID [static, protected] |
Definition at line 319 of file OSGDVRIsoShader.h.
Referenced by DVRIsoShader(), and isModeSupported().
UInt32 DVRIsoShader::_ARB_fragment_program = Window::invalidExtensionID [static, protected] |
Definition at line 321 of file OSGDVRIsoShader.h.
Referenced by DVRIsoShader(), and isModeSupported().
UInt32 DVRIsoShader::_funcActiveTextureARB [static, protected] |
Initial value:
Definition at line 324 of file OSGDVRIsoShader.h.
Referenced by activate_NVRegisterCombinerShading(), and DVRIsoShader().
UInt32 DVRIsoShader::_funcMultiTexCoord2dARB [static, protected] |
Initial value:
Definition at line 325 of file OSGDVRIsoShader.h.
Referenced by DVRIsoShader(), and renderSlice_NVRegisterCombinerShading().
UInt32 DVRIsoShader::_funcTexImage3DEXT [static, protected] |
UInt32 DVRIsoShader::_funcCombinerParameteriNV [static, protected] |
Initial value:
Definition at line 328 of file OSGDVRIsoShader.h.
Referenced by DVRIsoShader(), initCombiners_IsoSurfaceDiffuse(), and initCombiners_IsoSurfaceSpecular().
UInt32 DVRIsoShader::_funcCombinerParameterfvNV [static, protected] |
Initial value:
Definition at line 329 of file OSGDVRIsoShader.h.
Referenced by DVRIsoShader(), renderSlice_NVRegisterCombinerShading(), setupCombinerParametersDiffuse(), and setupCombinerParametersSpecular().
UInt32 DVRIsoShader::_funcCombinerStageParameterfvNV [static, protected] |
Initial value:
Definition at line 330 of file OSGDVRIsoShader.h.
Referenced by DVRIsoShader(), renderSlice_NVRegisterCombinerShading(), setupCombinerParametersDiffuse(), and setupCombinerParametersSpecular().
UInt32 DVRIsoShader::_funcCombinerInputNV [static, protected] |
Initial value:
Definition at line 331 of file OSGDVRIsoShader.h.
Referenced by DVRIsoShader(), initCombiners_DiffuseMultiCombiners(), initCombiners_IsoSurfaceDiffuse(), initCombiners_IsoSurfaceSpecular(), and initCombiners_SpecularMultiCombiners().
UInt32 DVRIsoShader::_funcCombinerOutputNV [static, protected] |
Initial value:
Definition at line 332 of file OSGDVRIsoShader.h.
Referenced by DVRIsoShader(), initCombiners_DiffuseMultiCombiners(), initCombiners_IsoSurfaceDiffuse(), initCombiners_IsoSurfaceSpecular(), and initCombiners_SpecularMultiCombiners().
UInt32 DVRIsoShader::_funcFinalCombinerInputNV [static, protected] |
Initial value:
Definition at line 333 of file OSGDVRIsoShader.h.
Referenced by DVRIsoShader(), initCombiners_Diffuse2Combiners(), initCombiners_DiffuseMultiCombiners(), initCombiners_Specular2Combiners(), and initCombiners_SpecularMultiCombiners().
UInt32 DVRIsoShader::_funcSecondaryColor3fEXT [static, protected] |
UInt32 DVRIsoShader::_funcSecondaryColor3fvEXT [static, protected] |
Initial value:
Definition at line 336 of file OSGDVRIsoShader.h.
Referenced by DVRIsoShader(), setupCombinerParametersDiffuse(), and setupCombinerParametersSpecular().
const osg::BitVector DVRIsoShaderBase::ShadeModeFieldMask [static, inherited] |
Initial value:
(TypeTraits<BitVector>::One << DVRIsoShaderBase::ShadeModeFieldId)
Definition at line 100 of file OSGDVRIsoShaderBase.h.
Referenced by changed(), osg::DVRIsoShaderBase::copyFromBin(), osg::DVRIsoShaderBase::copyToBin(), osg::DVRIsoShaderBase::executeSyncImpl(), and osg::DVRIsoShaderBase::getBinSize().
const osg::BitVector DVRIsoShaderBase::ActiveShadeModeFieldMask [static, inherited] |
Initial value:
(TypeTraits<BitVector>::One << DVRIsoShaderBase::ActiveShadeModeFieldId)
Definition at line 101 of file OSGDVRIsoShaderBase.h.
Referenced by osg::DVRIsoShaderBase::copyFromBin(), osg::DVRIsoShaderBase::copyToBin(), osg::DVRIsoShaderBase::executeSyncImpl(), and osg::DVRIsoShaderBase::getBinSize().
const osg::BitVector DVRIsoShaderBase::MTInfluenceMask [static, inherited] |
Initial value:
(Inherited::MTInfluenceMask) |
(static_cast<BitVector>(0x0) << Inherited::NextFieldId)
Reimplemented from osg::DVRShaderBase.
Definition at line 104 of file OSGDVRIsoShaderBase.h.
Int8 DVRIsoShaderBase::_sfShadeMode [protected, inherited] |
Debug field to manually select a hardware method
Definition at line 164 of file OSGDVRIsoShaderBase.h.
Referenced by osg::DVRIsoShaderBase::copyFromBin(), osg::DVRIsoShaderBase::copyToBin(), osg::DVRIsoShaderBase::executeSyncImpl(), osg::DVRIsoShaderBase::getBinSize(), osg::DVRIsoShaderBase::getSFShadeMode(), osg::DVRIsoShaderBase::getShadeMode(), and osg::DVRIsoShaderBase::setShadeMode().
Int8 DVRIsoShaderBase::_sfActiveShadeMode [protected, inherited] |
READ ONLY - The currently active hardware method
Definition at line 165 of file OSGDVRIsoShaderBase.h.
Referenced by osg::DVRIsoShaderBase::copyFromBin(), osg::DVRIsoShaderBase::copyToBin(), osg::DVRIsoShaderBase::executeSyncImpl(), osg::DVRIsoShaderBase::getActiveShadeMode(), osg::DVRIsoShaderBase::getBinSize(), osg::DVRIsoShaderBase::getSFActiveShadeMode(), and osg::DVRIsoShaderBase::setActiveShadeMode().
const BitVector osg::FieldContainer::NextFieldMask [static, inherited] |
Initial value:
(TypeTraits<BitVector>::One << NextFieldId)
Definition at line 75 of file OSGFieldContainerImpl.h.
const bool osg::FieldContainer::isNodeCore = false [static, inherited] |
UInt32 osg::FieldContainer::_shares [protected, inherited] |
Definition at line 199 of file OSGFieldContainerImpl.h.
1.5.5