From Farshid Lashkari,

"I've made some changes to osg which I think make it easier to control
the render order of CameraNode's. Instead of using the built-in orders
(PRE_RENDER, POST_RENDER, NESTED_RENDER), you can specify an integer
order. Values less than zero are pre rendered in order. Values greater
than zero are post rendered in order. And a value of 0 is equivalent
to NESTED_RENDER.

The changes should be fully backward compatible. Also, I changed the
RenderStageList type from a vector to a list because I needed to be
able to insert values anywhere in the list.

The reason I made these changes was because I wanted to be able to set
the render order of a CameraNode at runtime without having to reorder
it in the scenegraph."

and later in the final submission message (relating to what has been finally been merged)    :

"I've rethought my implementation and came up with something a little
better. The setRenderOrder will continue to take an enum, but will
have an optional orderNum parameter which can be both positive and
negative. I think this method is more intuitive and flexible."
This commit is contained in:
Robert Osfield
2006-09-04 13:15:08 +00:00
parent 5212d66cab
commit daa54a3b09
4 changed files with 49 additions and 17 deletions

View File

@@ -181,11 +181,14 @@ class OSG_EXPORT CameraNode : public Transform, public CullSettings
/** Set the rendering order of this camera's subgraph relative to any camera that this subgraph is nested within.
* For rendering to a texture, one typically uses PRE_RENDER.
* For Head Up Displays, one would typically use POST_RENDER.*/
void setRenderOrder(RenderOrder order) { _renderOrder = order; }
void setRenderOrder(RenderOrder order, int orderNum = 0) { _renderOrder = order; _renderOrderNum = orderNum; }
/** Get the rendering order of this camera's subgraph relative to any camera that this subgraph is nested within.*/
RenderOrder getRenderOrder() const { return _renderOrder; }
/** Get the rendering order number of this camera relative to any sibling cameras in this subgraph.*/
int getRenderOrderNum() const { return _renderOrderNum; }
/** Return true if this Camera is set up as a render to texture camera, i.e. it has textures assigned to it.*/
bool isRenderToTextureCamera() const;
@@ -366,6 +369,7 @@ class OSG_EXPORT CameraNode : public Transform, public CullSettings
Matrixd _viewMatrix;
RenderOrder _renderOrder;
int _renderOrderNum;
GLenum _drawBuffer;
GLenum _readBuffer;