Compositor: Attach color and depth render buffers by default

This commit is contained in:
Fernando García Liñán 2021-07-24 19:19:44 +02:00
parent a83048bc37
commit d85205212a

View File

@ -199,7 +199,7 @@ PassBuilder::build(Compositor *compositor, const SGPropertyNode *root,
std::stringstream att_ss; std::stringstream att_ss;
std::string att_bit; std::string att_bit;
// No implicit attachments by default // No implicit attachments by default
att_ss << root->getStringValue("implicit-attachment-mask", ""); att_ss << root->getStringValue("implicit-attachment-mask", "color depth");
while (att_ss >> att_bit) { while (att_ss >> att_bit) {
if (att_bit == "color") implicit_attachments |= osg::DisplaySettings::IMPLICIT_COLOR_BUFFER_ATTACHMENT; if (att_bit == "color") implicit_attachments |= osg::DisplaySettings::IMPLICIT_COLOR_BUFFER_ATTACHMENT;
else if (att_bit == "depth") implicit_attachments |= osg::DisplaySettings::IMPLICIT_DEPTH_BUFFER_ATTACHMENT; else if (att_bit == "depth") implicit_attachments |= osg::DisplaySettings::IMPLICIT_DEPTH_BUFFER_ATTACHMENT;
@ -394,6 +394,11 @@ public:
camera->setViewMatrix(osg::Matrix::identity()); camera->setViewMatrix(osg::Matrix::identity());
camera->setProjectionMatrix(osg::Matrix::ortho2D(0, 1, 0, 1)); camera->setProjectionMatrix(osg::Matrix::ortho2D(0, 1, 0, 1));
// Do not automatically add a depth buffer
camera->setImplicitBufferAttachmentMask(
osg::DisplaySettings::IMPLICIT_COLOR_BUFFER_ATTACHMENT,
osg::DisplaySettings::IMPLICIT_COLOR_BUFFER_ATTACHMENT);
float left = 0.0f, bottom = 0.0f, width = 1.0f, height = 1.0f, scale = 1.0f; float left = 0.0f, bottom = 0.0f, width = 1.0f, height = 1.0f, scale = 1.0f;
const SGPropertyNode *p_geometry = root->getNode("geometry"); const SGPropertyNode *p_geometry = root->getNode("geometry");
if (p_geometry) { if (p_geometry) {