Compositor: Move cull mask setter to a separate function
This commit is contained in:
parent
fa40a6d1b8
commit
ccebbc4bb3
@ -160,17 +160,6 @@ Compositor::update(const osg::Matrix &view_matrix,
|
|||||||
const osg::Matrix &proj_matrix)
|
const osg::Matrix &proj_matrix)
|
||||||
{
|
{
|
||||||
for (auto &pass : _passes) {
|
for (auto &pass : _passes) {
|
||||||
if (pass->inherit_cull_mask) {
|
|
||||||
osg::Camera *camera = pass->camera;
|
|
||||||
osg::Camera *view_camera = _view->getCamera();
|
|
||||||
camera->setCullMask(pass->cull_mask
|
|
||||||
& view_camera->getCullMask());
|
|
||||||
camera->setCullMaskLeft(pass->cull_mask
|
|
||||||
& view_camera->getCullMaskLeft());
|
|
||||||
camera->setCullMaskRight(pass->cull_mask
|
|
||||||
& view_camera->getCullMaskRight());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pass->update_callback.valid())
|
if (pass->update_callback.valid())
|
||||||
pass->update_callback->updatePass(*pass.get(), view_matrix, proj_matrix);
|
pass->update_callback->updatePass(*pass.get(), view_matrix, proj_matrix);
|
||||||
}
|
}
|
||||||
@ -257,6 +246,19 @@ Compositor::resized()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Compositor::setCullMask(osg::Node::NodeMask cull_mask)
|
||||||
|
{
|
||||||
|
for (auto &pass : _passes) {
|
||||||
|
if (pass->inherit_cull_mask) {
|
||||||
|
osg::Camera *camera = pass->camera;
|
||||||
|
camera->setCullMask(pass->cull_mask & cull_mask);
|
||||||
|
camera->setCullMaskLeft(pass->cull_mask & cull_mask);
|
||||||
|
camera->setCullMaskRight(pass->cull_mask & cull_mask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Compositor::addBuffer(const std::string &name, Buffer *buffer)
|
Compositor::addBuffer(const std::string &name, Buffer *buffer)
|
||||||
{
|
{
|
||||||
|
@ -100,6 +100,8 @@ public:
|
|||||||
|
|
||||||
void resized();
|
void resized();
|
||||||
|
|
||||||
|
void setCullMask(osg::Node::NodeMask cull_mask);
|
||||||
|
|
||||||
osg::View *getView() const { return _view; }
|
osg::View *getView() const { return _view; }
|
||||||
|
|
||||||
osg::GraphicsContext *getGraphicsContext() const { return _gc; }
|
osg::GraphicsContext *getGraphicsContext() const { return _gc; }
|
||||||
|
@ -52,6 +52,7 @@ PropStringMap<BufferFormat> buffer_format_map {
|
|||||||
{"r32f", {GL_R32F, GL_RED, GL_FLOAT}},
|
{"r32f", {GL_R32F, GL_RED, GL_FLOAT}},
|
||||||
{"rg16f", {GL_RG16F, GL_RG, GL_FLOAT}},
|
{"rg16f", {GL_RG16F, GL_RG, GL_FLOAT}},
|
||||||
{"rg32f", {GL_RG32F, GL_RG, GL_FLOAT}},
|
{"rg32f", {GL_RG32F, GL_RG, GL_FLOAT}},
|
||||||
|
{"r11g11b10f", {GL_R11F_G11F_B10F_EXT, GL_RGB, GL_FLOAT}},
|
||||||
{"depth16", {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}},
|
{"depth16", {GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT}},
|
||||||
{"depth24", {GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT}},
|
{"depth24", {GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT}},
|
||||||
{"depth32f", {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}},
|
{"depth32f", {GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT}},
|
||||||
|
Loading…
Reference in New Issue
Block a user