osg相机排序规则

osg在很多地方对获取到的多个相机通过Camera::setRenderOrder函数进行排序设置。该函数如下:

cpp 复制代码
        enum RenderOrder
        {
            PRE_RENDER,
            NESTED_RENDER,
            POST_RENDER
        };

        /** 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, int orderNum = 0) { _renderOrder = order; _renderOrderNum = orderNum; }

排序原则根据摄像机的渲染顺序而定(setRenderOrder函数的第1个参数)。设置为 PRE_RENDER级别的摄像机排序在最前,而POST_RENDER级别的摄像机排序在最后;同 一级别(即setRenderOrder函数的第1个参数相同)的摄像机根据setRenderOrder函数中传入的第2个参数设置先后顺序,第2个参数较小的摄像机 在前。