本文整理汇总了C++中LODNode::getVoxelBox方法的典型用法代码示例。如果您正苦于以下问题:C++ LODNode::getVoxelBox方法的具体用法?C++ LODNode::getVoxelBox怎么用?C++ LODNode::getVoxelBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LODNode
的用法示例。
在下文中一共展示了LODNode::getVoxelBox方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visit
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 );
}
示例2: visit
bool visit(const LODNode& lodNode)
{
const Boxf& worldBox = lodNode.getWorldBox();
if (!_frustum.isInFrustum(worldBox) || _clipPlanes.isOutside(worldBox))
return false;
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;
const auto level = lodNode.getRefLevel();
bool lodVisible = isLODVisible(vmin, worldSpacePerVoxel.find_min()) &&
level >= _minLOD;
if (level == _maxLOD)
lodVisible = true;
if (lodVisible)
_visibles.push_back(lodNode.getNodeId());
return !lodVisible;
}