OSG_USING_NAMESPACE #ifndef OSG_2_PREP /*! \ingroup GrpSystemDrawablesGeometryFunctions Draw the given DynamicVolume using direct OpenGL calls. */ OSG_SYSTEMLIB_DLLMAPPING void OSG::drawVolume(const DynamicVolume &volume) { const Volume *v = &volume.getInstance(); const BoxVolume *bv; const SphereVolume *sv; const CylinderVolume *cv; const FrustumVolume *fv; if((bv = dynamic_cast<const BoxVolume*>(v))) { drawVolume(*bv); } else if((sv = dynamic_cast<const SphereVolume*>(v))) { drawVolume(*sv); } else if((cv = dynamic_cast<const CylinderVolume*>(v))) { drawVolume(*cv); } else if((fv = dynamic_cast<const FrustumVolume*>(v))) { drawVolume(*fv); } }
Action::ResultE RenderAction::stop(ResultE res) { #ifdef OSG_RENPART_DUMP_PAR fprintf(stderr, "Stop\n"); fflush(stderr); #endif Inherited::stop(res); if(!_doCullOnly) { drawBuffer(_currentBuffer); if(getVolumeDrawing()) drawVolume(_oFrustum); } if(_pViewarea != NULL && _pViewarea->getRenderOptions() != NULL) { _pViewarea->getRenderOptions()->deactivate(this); } else if(_pWindow != NULL && _pWindow->getRenderOptions() != NULL) { _pWindow->getRenderOptions()->deactivate(this); } return Action::Continue; }
int32_t remoteVolumeCallback(uint32_t service) { static uint8_t volume = 0; uint32_t volumeTDP = 0; static uint8_t swap = 0; // printf("Astreamhandle: %d\n", globHandle->aStreamHandle); if (service == VOLUME_PLUS) { volume++; volume = volume >= 10 ? 10 : volume; drawVolume(volume); Player_Volume_Get(globHandle->playerHandle, &volumeTDP); printf("\tTDP volume: %d %x\n", volumeTDP, volumeTDP); volumeTDP++; Player_Volume_Set(globHandle->playerHandle, volumeTDP); } if (service == VOLUME_MINUS) { if (volume != 0) volume--; Player_Volume_Get(globHandle->playerHandle, &volumeTDP); printf("\tTDP volume: %d %x \n", volumeTDP, volumeTDP); volumeTDP--; Player_Volume_Set(globHandle->playerHandle, volumeTDP); drawVolume(volume); } if (service == VOLUME_MUTE) { if (swap == 0) { drawVolume(0); swap = 1; } else { drawVolume(volume); swap = 0; } } }
Action::ResultE RenderAction::stop(ResultE res) { #ifdef OSG_RENPART_DUMP_PAR fprintf(stderr, "Stop\n"); fflush(stderr); #endif Inherited::stop(res); if(!_doCullOnly) { drawBuffer(_currentBuffer); if(getVolumeDrawing()) drawVolume(_oFrustum); if(_pStatistics != NULL) { UInt32 uiNMatrix = 0; UInt32 uiNState = 0; UInt32 uiNShader = 0; UInt32 uiNShaderParam = 0; UInt32 uiNTriangles = 0; for(UInt32 i = 0; i < _vRenderPartitions[_currentBuffer].size(); ++i) { uiNMatrix += _vRenderPartitions[ _currentBuffer][i]->getNumMatrixChanges(); uiNState += _vRenderPartitions[ _currentBuffer][i]->getNumStateChanges(); uiNShader += _vRenderPartitions[ _currentBuffer][i]->getNumShaderChanges(); uiNShaderParam += _vRenderPartitions[ _currentBuffer][i]->getNumShaderParamChanges(); uiNTriangles += _vRenderPartitions[_currentBuffer][i]->getNumTriangles(); } _pStatistics->getElem(statNMatrices )->set(uiNMatrix ); _pStatistics->getElem(statNStates )->set(uiNState ); _pStatistics->getElem(statNShaders )->set(uiNShader ); _pStatistics->getElem(statNShaderParams)->set(uiNShaderParam); _pStatistics->getElem(statNTriangles )->set(uiNTriangles); } } if(_pViewport != NULL && _pViewport->getRenderOptions() != NULL) { _pViewport->getRenderOptions()->deactivate(this); } else if(_pWindow != NULL && _pWindow->getRenderOptions() != NULL) { _pWindow->getRenderOptions()->deactivate(this); } return Action::Continue; }