本文整理汇总了C++中ViewportPtr::setRenderQueueIdMask方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewportPtr::setRenderQueueIdMask方法的具体用法?C++ ViewportPtr::setRenderQueueIdMask怎么用?C++ ViewportPtr::setRenderQueueIdMask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewportPtr
的用法示例。
在下文中一共展示了ViewportPtr::setRenderQueueIdMask方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupScene
void setupScene()
{
m_window->getViewports().front()->setRenderQueueIdMask(~RenderQueueId_OffscreenTransparentObjects);
LightPtr light(new Light);
light->setDirection(glm::normalize(glm::vec3(1.5, -1, -0.5)));
light->setPosition(glm::vec3(0, 0.5, 0) + light->getDirection() * -10.0f);
m_visSystem->addLight(light);
// Volume
std::vector<std::string> gridNames;
gridNames.push_back(m_config.densityGridName);
if (!m_config.temperatureGridName.empty())
{
gridNames.push_back(m_config.temperatureGridName);
}
std::vector<openvdb::GridBase::Ptr> baseGrids = loadGridsFromFile(m_config.vdbVilename, gridNames);
openvdb::FloatGrid::Ptr densityGrid = openvdb::gridPtrCast<openvdb::FloatGrid>(baseGrids[0]);
openvdb::FloatGrid::Ptr temperatureGrid;
if (!m_config.temperatureGridName.empty())
{
temperatureGrid = openvdb::gridPtrCast<openvdb::FloatGrid>(baseGrids[1]);
// Rescale temperature field to between 0 and 1
{
float minValue = 99999999999999;
float maxValue = -99999999999999;
for (openvdb::FloatGrid::ValueOnCIter iter = temperatureGrid->cbeginValueOn(); iter.test(); ++iter) {
float value = *iter;
minValue = std::min(minValue, value);
maxValue = std::max(maxValue, value);
}
float scale = 1.0 / (maxValue - minValue);
for (openvdb::FloatGrid::ValueOnIter iter = temperatureGrid->beginValueOn(); iter.test(); ++iter) {
float value = *iter;
value = (value - minValue) * scale;
iter.setValue(value);
}
}
// Ensure both grids have the same hierarchy
{
openvdb::FloatGrid::Ptr resultGrid = openvdb::FloatGrid::create();
resultGrid->tree().combine2(densityGrid->tree(), temperatureGrid->tree(), CopyBIntoA());
temperatureGrid->tree().combine(densityGrid->tree(), CopyBIntoA());
densityGrid = resultGrid;
}
}
std::vector<GridPtr> grids;
GridTextureRolesMap gridTextureRoles;
grids.push_back(GridPtr(new VdbGrid<openvdb::FloatGrid>(densityGrid, 1)));
gridTextureRoles[GridTextureRole_Diffuse] = grids.back();
if (m_config.generateNormals)
{
Vec3UByteGrid::Ptr normalGrid = createNormalGrid(*densityGrid);
grids.push_back(GridPtr(new VdbGrid<Vec3UByteGrid>(normalGrid, 3)));
gridTextureRoles[GridTextureRole_Normal] = grids.back();
}
if (temperatureGrid)
{
grids.push_back(GridPtr(new VdbGrid<openvdb::FloatGrid>(temperatureGrid, 1)));
gridTextureRoles[GridTextureRole_Temperature] = grids.back();
}
openvdb::CoordBBox bbox;
densityGrid->constTree().evalLeafBoundingBox(bbox);
float scale = 1.0f / (float)bbox.extents().asVec3s().length();
glm::vec3 center = toVec3(bbox.getCenter() * scale);
std::ostringstream ss;
ss << "Grid extents: " << bbox.extents().x() << ", " << bbox.extents().y() << ", " << bbox.extents().z();
defaultLogger()->logLine(ss.str());
int renderQueueId;
if (m_config.renderToLowResTarget)
{
renderQueueId = RenderQueueId_OffscreenTransparentObjects;
}
else
{
renderQueueId = getDefaultRenderQueueId();
}
RenderableVolumeConfig config;
config.grids = grids;
config.materialFactory.reset(new SparseVolumeMaterialFactoryI(gridTextureRoles, m_config.transparent, m_config.opacityMultiplier));
config.scale = scale;
config.batchBoxes = !m_config.transparent; // don't batch if we have transparency so we can sort
//.........这里部分代码省略.........