本文整理汇总了C++中ViewportPtr::setBackgroundColor方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewportPtr::setBackgroundColor方法的具体用法?C++ ViewportPtr::setBackgroundColor怎么用?C++ ViewportPtr::setBackgroundColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewportPtr
的用法示例。
在下文中一共展示了ViewportPtr::setBackgroundColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createDepthTarget
RenderTextureTargetPtr createDepthTarget(const CameraPtr& camera, int width, int height)
{
ImageTextureConfig config = ImageTextureConfig::createDefault();
config.width = width;
config.height = height;
config.textureAddressMode = TextureAddressMode_Clamp;
config.format = PixelFormat_DepthComponent24;
TexturePtr texture(new Texture(config));
RenderTextureTargetPtr target;
{
RenderTextureTargetConfig config;
config.texture = texture;
config.attachment = FrameBufferAttachment_Depth;
config.techniqueCategory = TechniqueCategory_DepthRtt;
target.reset(new RenderTextureTarget(config));
{
ViewportPtr viewport = target->addDefaultViewport(m_camera);
viewport->setBackgroundColor(glm::vec4(1,1,1,1));
}
m_window->addRenderTarget(target);
}
return target;
}
示例2: setupScene
//.........这里部分代码省略.........
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
RenderableVolumePtr volume = RenderableVolumeFactory::createRenderableVolume(config);
BOOST_FOREACH(const GVis::RenderableNodePtr& node, volume->nodes)
{
node->translate(-center);
m_visSystem->addRenderableNode(node, renderQueueId);
}
if (m_config.transparent)
{
RenderQueuePtr renderQueue = m_visSystem->getRenderQueue(renderQueueId);
if (renderQueue)
renderQueue->setSortingMode(RenderSortingMode_BackToFront);
}
if (m_config.renderToLowResTarget)
{
int volumeTargetWidth = m_window->getWidth() / 2;
int volumeTargetHeight = m_window->getHeight() / 2;
TexturePtr offscreenTransparentObjectsTexture;
// Create offscreen transparent objects target
{
ImageTextureConfig config = ImageTextureConfig::createDefault();
config.width = volumeTargetWidth;
config.height = volumeTargetHeight;
config.textureAddressMode = TextureAddressMode_Clamp;
offscreenTransparentObjectsTexture.reset(new Texture(config));
{
RenderTextureTargetConfig config;
config.texture = offscreenTransparentObjectsTexture;
config.attachment = FrameBufferAttachment_Color;
RenderTextureTargetPtr target(new RenderTextureTarget(config));
{
ViewportPtr viewport = target->addDefaultViewport(m_camera);
viewport->setRenderQueueIdMask(RenderQueueId_OffscreenTransparentObjects);
viewport->setBackgroundColor(glm::vec4(0,0,0,0));
}
m_window->addRenderTarget(target);
}
}
// Composite offscreen particles
{
TextureUnit textureUnit(offscreenTransparentObjectsTexture, "albedoSampler");
ShaderProgramPtr shader = ShaderProgram::createShaderProgram(ShaderProgramConfig("Shaders/Common/ScreenQuad.vert", "Shaders/Common/SimpleTextured.frag"));
TechniquePtr technique(new Technique(shader));
technique->addTextureUnit(textureUnit);
technique->setAlphaBlendingMode(AlphaBlendingMode_PreMultiplied);
MaterialPtr material(new Material);
material->setTechnique(technique);
{
RectangleConfig config = RectangleConfig::defaultWithSize(glm::vec2(2, 2));
MeshPtr mesh = RectangleMeshFactory::createMesh(config);
GeoPtr geo(new Geo(mesh, material));
RenderableNodePtr renderableNode = RenderableNode::createWithSingleGeo(geo);
m_visSystem->addRenderableNode(renderableNode, RenderQueueId_CompositeOffscreenTransparentObjects);
}
}
}
if (m_config.orbitCam)
{
centerNode.reset(new SceneNode);
centerNode->addChild(m_camera);
m_cameraInputEnabled = false;
}
m_camera->setPosition_parentSpace(glm::vec3(0,0,1.4));
}