From Paul Martz, "This change address the following issue: an app opens a Viewer on a multidisplay system, configured to setUpViewAcrossAllDisplays, with a non-default clear mask. In this case, OSG failed to propagate the clear mask to the slave Cameras, resulting in the clear mask being ignored. To fix this issue, this revision adds a new CullSettings::VariablesMask bit, CLEAR_MASK, to explicitly control inheritance of the clear mask. This bit is set by default, which means that the clear mask now inherits by default, whereas previously it did not."

This commit is contained in:
Robert Osfield 2009-11-27 15:32:43 +00:00
parent 9ce90775c2
commit 36b5e59019
4 changed files with 31 additions and 19 deletions

View File

@ -84,7 +84,7 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
/** Set the clear mask used in glClear(..).
* Defaults to GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT. */
inline void setClearMask(GLbitfield mask) { _clearMask = mask; }
inline void setClearMask(GLbitfield mask) { _clearMask = mask; applyMaskAction(CLEAR_MASK); }
/** Get the clear mask.*/
inline GLbitfield getClearMask() const { return _clearMask; }

View File

@ -58,24 +58,25 @@ class OSG_EXPORT CullSettings
enum VariablesMask
{
COMPUTE_NEAR_FAR_MODE = 0x00000001,
CULLING_MODE = 0x00000002,
LOD_SCALE = 0x00000004,
SMALL_FEATURE_CULLING_PIXEL_SIZE = 0x00000008,
CLAMP_PROJECTION_MATRIX_CALLBACK = 0x00000010,
NEAR_FAR_RATIO = 0x00000020,
IMPOSTOR_ACTIVE = 0x00000040,
DEPTH_SORT_IMPOSTOR_SPRITES = 0x00000080,
IMPOSTOR_PIXEL_ERROR_THRESHOLD = 0x00000100,
NUM_FRAMES_TO_KEEP_IMPOSTORS_SPRITES = 0x00000200,
CULL_MASK = 0x00000400,
CULL_MASK_LEFT = 0x00000800,
CULL_MASK_RIGHT = 0x00001000,
CLEAR_COLOR = 0x00002000,
LIGHTING_MODE = 0x00004000,
LIGHT = 0x00008000,
DRAW_BUFFER = 0x00010000,
READ_BUFFER = 0x00020000,
COMPUTE_NEAR_FAR_MODE = (0x1 << 0),
CULLING_MODE = (0x1 << 1),
LOD_SCALE = (0x1 << 2),
SMALL_FEATURE_CULLING_PIXEL_SIZE = (0x1 << 3),
CLAMP_PROJECTION_MATRIX_CALLBACK = (0x1 << 4),
NEAR_FAR_RATIO = (0x1 << 5),
IMPOSTOR_ACTIVE = (0x1 << 6),
DEPTH_SORT_IMPOSTOR_SPRITES = (0x1 << 7),
IMPOSTOR_PIXEL_ERROR_THRESHOLD = (0x1 << 8),
NUM_FRAMES_TO_KEEP_IMPOSTORS_SPRITES = (0x1 << 9),
CULL_MASK = (0x1 << 10),
CULL_MASK_LEFT = (0x1 << 11),
CULL_MASK_RIGHT = (0x1 << 12),
CLEAR_COLOR = (0x1 << 13),
CLEAR_MASK = (0x1 << 14),
LIGHTING_MODE = (0x1 << 15),
LIGHT = (0x1 << 16),
DRAW_BUFFER = (0x1 << 17),
READ_BUFFER = (0x1 << 18),
NO_VARIABLES = 0x00000000,
ALL_VARIABLES = 0xFFFFFFFF

View File

@ -397,6 +397,9 @@ void Camera::inheritCullSettings(const CullSettings& settings, unsigned int inhe
if (inheritanceMask & CLEAR_COLOR)
_clearColor = camera->_clearColor;
if (inheritanceMask & CLEAR_MASK)
_clearMask = camera->_clearMask;
if (inheritanceMask & DRAW_BUFFER)
_drawBuffer = camera->_drawBuffer;

View File

@ -1304,6 +1304,14 @@ void CullVisitor::apply(osg::Camera& camera)
{
rtts->setClearColor(camera.getClearColor());
}
if (camera.getInheritanceMask() & CLEAR_MASK)
{
rtts->setClearMask(previous_stage->getClearMask());
}
else
{
rtts->setClearMask(camera.getClearMask());
}
// set the color mask.