Renamed osg::CameraNode to osg::Camera, cleaned up osg::View.

Added beginnings of new osgViewer::Scene,View,Viewer,CompositeViewer and GraphicsWindowProxy files.
This commit is contained in:
Robert Osfield
2006-11-27 14:52:07 +00:00
parent b82e521444
commit fd2ffeb310
110 changed files with 2257 additions and 1466 deletions

View File

@@ -28,7 +28,7 @@ void CURRENT_CLASS::init()
_active = true;
_numCameras = 0;
setCullingActive(false);
_renderOrder = osg::CameraNode::POST_RENDER;
_renderOrder = osg::Camera::POST_RENDER;
_clearColorBuffer = true;
}
@@ -42,7 +42,7 @@ void CURRENT_CLASS::setClearColorBuffer(bool clear)
{
_clearColorBuffer = clear;
// Update the render order for the first CameraNode if it exists
// Update the render order for the first Camera if it exists
if(!_cameraList.empty())
{
if(clear)
@@ -52,11 +52,11 @@ void CURRENT_CLASS::setClearColorBuffer(bool clear)
}
}
void CURRENT_CLASS::setRenderOrder(osg::CameraNode::RenderOrder order)
void CURRENT_CLASS::setRenderOrder(osg::Camera::RenderOrder order)
{
_renderOrder = order;
// Update the render order for existing CameraNodes
// Update the render order for existing Cameras
unsigned int numCameras = _cameraList.size();
for(unsigned int i = 0; i < numCameras; i++)
{
@@ -104,18 +104,18 @@ void CURRENT_CLASS::traverse(osg::NodeVisitor &nv)
_children[i]->accept(*(_distAccumulator.get()));
}
// Step 2: Compute the near and far distances for every CameraNode that
// Step 2: Compute the near and far distances for every Camera that
// should be used to render the scene.
_distAccumulator->computeCameraPairs();
// Step 3: Create the CameraNodes, and add them as children.
// Step 3: Create the Cameras, and add them as children.
DistanceAccumulator::PairList& camPairs = _distAccumulator->getCameraPairs();
_numCameras = camPairs.size(); // Get the number of cameras
// Create the CameraNodes, and add them as children.
// Create the Cameras, and add them as children.
if(_numCameras > 0)
{
osg::CameraNode *currCam;
osg::Camera *currCam;
DistanceAccumulator::DistancePair currPair;
for(i = 0; i < _numCameras; i++)
@@ -147,7 +147,7 @@ bool CURRENT_CLASS::insertChild(unsigned int index, osg::Node *child)
{
if(!Group::insertChild(index, child)) return false; // Insert child
// Insert child into each CameraNode
// Insert child into each Camera
unsigned int totalCameras = _cameraList.size();
for(unsigned int i = 0; i < totalCameras; i++)
{
@@ -161,7 +161,7 @@ bool CURRENT_CLASS::removeChildren(unsigned int pos, unsigned int numRemove)
{
if(!Group::removeChildren(pos, numRemove)) return false; // Remove child
// Remove child from each CameraNode
// Remove child from each Camera
unsigned int totalCameras = _cameraList.size();
for(unsigned int i = 0; i < totalCameras; i++)
{
@@ -174,7 +174,7 @@ bool CURRENT_CLASS::setChild(unsigned int i, osg::Node *node)
{
if(!Group::setChild(i, node)) return false; // Set child
// Set child for each CameraNode
// Set child for each Camera
unsigned int totalCameras = _cameraList.size();
for(unsigned int j = 0; j < totalCameras; j++)
{
@@ -183,16 +183,16 @@ bool CURRENT_CLASS::setChild(unsigned int i, osg::Node *node)
return true;
}
osg::CameraNode* CURRENT_CLASS::createOrReuseCamera(const osg::Matrix& proj,
osg::Camera* CURRENT_CLASS::createOrReuseCamera(const osg::Matrix& proj,
double znear, double zfar,
const unsigned int &camNum)
{
if(_cameraList.size() <= camNum) _cameraList.resize(camNum+1);
osg::CameraNode *camera = _cameraList[camNum].get();
osg::Camera *camera = _cameraList[camNum].get();
if(!camera) // Create a new CameraNode
if(!camera) // Create a new Camera
{
camera = new osg::CameraNode;
camera = new osg::Camera;
camera->setCullingActive(false);
camera->setRenderOrder(_renderOrder);
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
@@ -206,7 +206,7 @@ osg::CameraNode* CURRENT_CLASS::createOrReuseCamera(const osg::Matrix& proj,
else
camera->setClearMask(GL_DEPTH_BUFFER_BIT);
// Add our children to the new CameraNode's children
// Add our children to the new Camera's children
unsigned int numChildren = _children.size();
for(unsigned int i = 0; i < numChildren; i++)
{

View File

@@ -2,7 +2,7 @@
#define _OF_DEPTHPARTITIONNODE_
#include "DistanceAccumulator.h"
#include <osg/CameraNode>
#include <osg/Camera>
#define CURRENT_CLASS DepthPartitionNode
/**********************************************************
@@ -28,13 +28,13 @@ class CURRENT_CLASS : public osg::Group
inline bool getActive() const { return _active; }
/** Specify whether the color buffer should be cleared before the first
CameraNode draws it's scene. */
Camera draws it's scene. */
void setClearColorBuffer(bool clear);
inline bool getClearColorBuffer() const { return _clearColorBuffer; }
/** Specify the render order for each CameraNode */
void setRenderOrder(osg::CameraNode::RenderOrder order);
inline osg::CameraNode::RenderOrder getRenderOrder() const
/** Specify the render order for each Camera */
void setRenderOrder(osg::Camera::RenderOrder order);
inline osg::Camera::RenderOrder getRenderOrder() const
{ return _renderOrder; }
/** Set/get the maximum depth that the scene will be traversed to.
@@ -48,7 +48,7 @@ class CURRENT_CLASS : public osg::Group
/** Override update and cull traversals */
virtual void traverse(osg::NodeVisitor &nv);
/** Catch child management functions so the CameraNodes can be informed
/** Catch child management functions so the Cameras can be informed
of added or removed children. */
virtual bool addChild(osg::Node *child);
virtual bool insertChild(unsigned int index, osg::Node *child);
@@ -56,14 +56,14 @@ class CURRENT_CLASS : public osg::Group
virtual bool setChild(unsigned int i, osg::Node *node);
protected:
typedef std::vector< osg::ref_ptr<osg::CameraNode> > CameraList;
typedef std::vector< osg::ref_ptr<osg::Camera> > CameraList;
~CURRENT_CLASS();
void init();
// Creates a new CameraNode object with default settings
osg::CameraNode* createOrReuseCamera(const osg::Matrix& proj,
// Creates a new Camera object with default settings
osg::Camera* createOrReuseCamera(const osg::Matrix& proj,
double znear, double zfar,
const unsigned int &camNum);
@@ -72,13 +72,13 @@ class CURRENT_CLASS : public osg::Group
// The NodeVisitor that computes cameras for the scene
osg::ref_ptr<DistanceAccumulator> _distAccumulator;
osg::CameraNode::RenderOrder _renderOrder;
osg::Camera::RenderOrder _renderOrder;
bool _clearColorBuffer;
// Cameras that should be used to draw the scene. These cameras
// will be reused on every frame in order to save time and memory.
CameraList _cameraList;
unsigned int _numCameras; // Number of CameraNodes actually being used
unsigned int _numCameras; // Number of Cameras actually being used
};
#undef CURRENT_CLASS

View File

@@ -73,7 +73,7 @@ void CURRENT_CLASS::pushDistancePair(double zNear, double zFar)
}
/** Return true if the node should be traversed, and false if the bounding sphere
of the node is small enough to be rendered by one CameraNode. If the latter
of the node is small enough to be rendered by one Camera. If the latter
is true, then store the node's near & far plane distances. */
bool CURRENT_CLASS::shouldContinueTraversal(osg::Node &node)
{