本文整理汇总了C++中LODNode::getNodeId方法的典型用法代码示例。如果您正苦于以下问题:C++ LODNode::getNodeId方法的具体用法?C++ LODNode::getNodeId怎么用?C++ LODNode::getNodeId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LODNode
的用法示例。
在下文中一共展示了LODNode::getNodeId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadTextureToGPU
bool loadTextureToGPU(const LODNode& lodNode, const DataSource& dataSource,
const TexturePool& texturePool,
const ConstDataObjectPtr& data) const
{
#ifdef LIVRE_DEBUG_RENDERING
std::cout << "Upload " << lodNode.getNodeId().getLevel() << ' '
<< lodNode.getRelativePosition() << " to "
<< _textureState.textureId << std::endl;
#endif
const Vector3ui& overlap = dataSource.getVolumeInfo().overlap;
const Vector3ui& voxSizeVec = lodNode.getBlockSize() + overlap * 2;
_textureState.bind();
glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, voxSizeVec[0], voxSizeVec[1],
voxSizeVec[2], texturePool.getFormat(),
texturePool.getTextureType(), data->getDataPtr());
const GLenum glErr = glGetError();
if (glErr != GL_NO_ERROR)
{
LBERROR << "Error loading the texture into GPU, error number : "
<< glErr << std::endl;
return false;
}
return true;
}
示例2: 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 );
}
示例3: 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;
}