void visit( DashRenderNode& renderNode, VisitState& state ) final { const LODNode& lodNode = renderNode.getLODNode(); if( !renderNode.isInFrustum( )) state.setVisitChild( false ); if( renderNode.isLODVisible( )) { currentVisibleSet_.insert( lodNode.getNodeId().getId( )); state.setVisitChild( false ); } }
void visit( const LODNode& lodNode, VisitState& state ) { const Boxf& worldBox = lodNode.getWorldBox(); if( !_frustum.isInFrustum( worldBox ) || _clipPlanes.isClipped( worldBox )) { state.setVisitChild( false ); return; } Vector3f vmin, vmax; const Plane& nearPlane = _frustum.getNearPlane(); worldBox.computeNearFar( nearPlane, vmin, vmax ); Vector4f hVmin = vmin; hVmin[ 3 ] = 1.0f; Vector4f hVmax = vmax; hVmax[ 3 ] = 1.0f; // The bounding box intersects the plane if( _frustum.getNearPlane().dot( hVmin ) < 0 || _frustum.getNearPlane().dot( hVmax ) < 0 ) { // Where eye direction intersects with near plane vmin = _frustum.getEyePos() - _frustum.getViewDir() * _frustum.nearPlane(); } const Vector3f& voxelBox = lodNode.getVoxelBox().getSize(); const Vector3f& worldSpacePerVoxel = worldBox.getSize() / voxelBox; bool lodVisible = isLODVisible( vmin, worldSpacePerVoxel.find_min( )); const VolumeInformation& volInfo = _dataSource.getVolumeInfo(); const uint32_t depth = volInfo.rootNode.getDepth(); lodVisible = ( lodVisible && lodNode.getRefLevel() >= _minLOD ) || ( lodNode.getRefLevel() == _maxLOD ) || ( lodNode.getRefLevel() == depth - 1 ); if( lodVisible ) _visibles.push_back( lodNode.getNodeId( )); state.setVisitChild( !lodVisible ); }
void TextureLoaderVisitor::visit( DashRenderNode& renderNode, VisitState& state ) { const LODNode& lodNode = renderNode.getLODNode(); if( !lodNode.isValid( )) return; if( !renderNode.isInFrustum( )) { state.setVisitChild( false ); return; } if( !renderNode.isLODVisible( )) return; state.setVisitChild( false ); const ConstCacheObjectPtr texPtr = renderNode.getTextureObject(); if( texPtr->isLoaded( )) return; TextureObject& texture = _cache.getNodeTexture( lodNode.getNodeId().getId( )); if( texture.isLoaded() ) { renderNode.setTextureObject( &texture ); _output->commit( CONNECTION_ID ); return; } else { const ConstCacheObjectPtr textureData = renderNode.getTextureDataObject(); if( textureData->isLoaded( )) { #ifdef _ITT_DEBUG_ __itt_task_begin ( ittTextureLoadDomain, __itt_null, __itt_null, ittTextureLoadTask ); #endif //_ITT_DEBUG_ TextureObject& lodTexture = _cache.getNodeTexture( lodNode.getNodeId().getId( )); lodTexture.setTextureDataObject( static_cast< const TextureDataObject * >( textureData.get() ) ); lodTexture.cacheLoad(); #ifdef _ITT_DEBUG_ __itt_task_end( ittTextureLoadDomain ); #endif //_ITT_DEBUG_ renderNode.setTextureObject( &lodTexture ); renderNode.setTextureDataObject( TextureDataObject::getEmptyPtr() ); _output->commit( CONNECTION_ID ); _needRedraw = true; } else { _allLoaded = false; LBVERB << "Texture data not loaded:" << lodNode.getNodeId() << std::endl; } } if( !isSynchronous( )) // only in asynchronous mode state.setBreakTraversal( _input->dataWaitingOnInput( CONNECTION_ID )); }