Synch with 20010921

This commit is contained in:
Don BURNS
2001-09-22 02:42:08 +00:00
parent d47b8f9c1f
commit 7ae58df42a
197 changed files with 7867 additions and 6189 deletions

View File

@@ -1,5 +1,5 @@
#ifndef OSGUTIL_NEWCULLVISITOR
#define OSGUTIL_NEWCULLVISITOR 1
#ifndef OSGUTIL_CULLVISITOR
#define OSGUTIL_CULLVISITOR 1
#include <osg/NodeVisitor>
#include <osg/BoundingSphere>
@@ -36,7 +36,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor
CullVisitor();
virtual ~CullVisitor();
void reset();
virtual void reset();
virtual void apply(osg::Node&);
virtual void apply(osg::Geode& node);
@@ -100,33 +100,17 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor
/** Returns the current CullingMode.*/
CullViewState::CullingMode getCullingMode() const;
/** Set the viewport.
* Used to enable the CullVisitor can make decision
* such as based on viewport dimensions,.*/
void setViewport(int x,int y,int width,int height)
{
_view[0] = x;
_view[1] = y;
_view[2] = width;
_view[3] = height;
}
* such as based on viewport dimensions.*/
void setViewport(osg::Viewport* viewport) { _viewport = viewport; }
/** Get the const viewport. */
const osg::Viewport* getViewport() const { return _viewport.get(); }
/** Get the viewport. */
void getViewport(int& x,int& y,int& width,int& height)
{
x = _view[0];
y = _view[1];
width = _view[2];
height = _view[3];
}
/** Set the frame number.*/
inline void setFrameNumber(const int fn) { _frameNumber = fn; }
/** Get the frame number.*/
inline const int getFrameNumber() const { return _frameNumber; }
osg::Viewport* getViewport() { return _viewport.get(); }
void pushCullViewState(const osg::Matrix* matrix=NULL);
void popCullViewState();
@@ -276,8 +260,6 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor
* to generate the impostor texture. */
osg::ImpostorSprite* createImpostorSprite(osg::Impostor& node);
int _frameNumber;
typedef std::vector< osg::ref_ptr<CullViewState> > CullViewStateStack;
CullViewStateStack _viewStateStack;
osg::ref_ptr<CullViewState> _tvs;
@@ -301,7 +283,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor
TransparencySortMode _tsm;
// viewport x,y,width,height respectiveyly.
int _view[4];
osg::ref_ptr<osg::Viewport> _viewport;
bool _impostorActive;
bool _depthSortImpostorSprites;

View File

@@ -30,23 +30,15 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
virtual void reset();
/** Set the viewport of the scene view. */
void setViewport(int x,int y,int width,int height)
{
_view[0] = x;
_view[1] = y;
_view[2] = width;
_view[3] = height;
}
/** Get the viewport of the scene view. */
void getViewport(int& x,int& y,int& width,int& height) const
{
x = _view[0];
y = _view[1];
width = _view[2];
height = _view[3];
}
/** Set the viewport.*/
void setViewport(osg::Viewport* viewport) { _viewport = viewport; }
/** Get the const viewport. */
const osg::Viewport* getViewport() const { return _viewport.get(); }
/** Get the viewport. */
osg::Viewport* getViewport() { return _viewport.get(); }
/** Set the clear mask used in glClear(..).
@@ -132,7 +124,7 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
osg::ref_ptr<osg::Camera> _camera;
// viewport x,y,width,height.
GLint _view[4];
osg::ref_ptr<osg::Viewport> _viewport;
GLbitfield _clearMask;
osg::Vec4 _clearColor;

View File

@@ -5,6 +5,7 @@
#include <osg/StateSet>
#include <osg/Light>
#include <osg/Camera>
#include <osg/FrameStamp>
#include <osgUtil/CullVisitor>
@@ -22,6 +23,11 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
/** Constrcut a default scene view.*/
SceneView();
/** Set scene view to use default global state, light, camera
* and render visitor.
*/
void setDefaults();
/** Set the data which to view. The data will typically be
* an osg::Scene but can be any osg::Node type.
*/
@@ -36,28 +42,37 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
*/
const osg::Node* getSceneData() const { return _sceneData.get(); }
/** Set the viewport of the scene view. */
/** Set the viewport of the scene view to use specfied osg::Viewport. */
void setViewport(osg::Viewport* viewport)
{
if (viewport) _viewport = viewport;
else
{
// ensure that _viewport is always valid.
_viewport = new osg::Viewport;
}
}
/** Set the viewport of the scene view to specified dimensions. */
void setViewport(int x,int y,int width,int height)
{
_view[0] = x;
_view[1] = y;
_view[2] = width;
_view[3] = height;
_viewport->setViewport(x,y,width,height);
}
/** Get the const viewport. */
const osg::Viewport* getViewport() const { return _viewport.get(); }
/** Get the viewport. */
osg::Viewport* getViewport() { return _viewport.get(); }
/** Get the viewport of the scene view. */
void getViewport(int& x,int& y,int& width,int& height)
{
x = _view[0];
y = _view[1];
width = _view[2];
height = _view[3];
_viewport->getViewport(x,y,width,height);
}
/** Set scene view to use default global state, light, camera
* and render visitor.
*/
void setDefaults();
/** Set the background color used in glClearColor().
Defaults to an off blue color.*/
@@ -155,6 +170,14 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
bool projectObjectIntoWindow(const osg::Vec3& object,osg::Vec3& window) const;
/** Set the frame stamp for the current frame.*/
inline void setFrameStamp(osg::FrameStamp* fs) { _frameStamp = fs; }
/** Set the frame stamp for the current frame.*/
inline const osg::FrameStamp* getFrameStamp() const { return _frameStamp.get(); }
/** do app traversal of attached scene graph using App NodeVisitor.*/
virtual void app();
@@ -179,6 +202,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
osg::ref_ptr<osgUtil::RenderGraph> _rendergraph;
osg::ref_ptr<osgUtil::RenderStage> _renderStage;
osg::ref_ptr<osg::FrameStamp> _frameStamp;
bool _need_compile;
bool _calc_nearfar;
@@ -190,14 +214,12 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
float _lodBias;
// viewport x,y,width,height respectiveyly.
GLint _view[4];
osg::ref_ptr<osg::Viewport> _viewport;
LightingMode _lightingMode;
bool _prioritizeTextures;
int _frameNumber;
};
};

View File

@@ -44,6 +44,8 @@ class OSGUTIL_EXPORT Tesselator
struct VertexIndexSet
{
VertexIndexSet() {}
VertexIndexSet(Tesselator* tess,const osg::Vec3& vec,osg::uint index)
{
set(tess,vec,index);

View File

@@ -39,16 +39,16 @@ class OSGUTIL_EXPORT VisualsRequirementsVisitor : public osg::NodeVisitor
const bool requiresDepthBuffer() const { return _requiresDepthBuffer; }
void setMinumumNumAlphaBits(const unsigned int bits) { _minimumNumberAlphaBits = bits; }
void setMinimumNumAlphaBits(const unsigned int bits) { _minimumNumberAlphaBits = bits; }
const unsigned int getMinumumNumAlphaBits() const { return _minimumNumberAlphaBits; }
const unsigned int getMinimumNumAlphaBits() const { return _minimumNumberAlphaBits; }
const bool requiresAlphaBuffer() const { return _minimumNumberAlphaBits!=0; }
void setMinumumNumStencilBits(const unsigned int bits) { _minimumNumberStencilBits = bits; }
void setMinimumNumStencilBits(const unsigned int bits) { _minimumNumberStencilBits = bits; }
const unsigned int getMinumumNumStencilBits() const { return _minimumNumberStencilBits; }
const unsigned int getMinimumNumStencilBits() const { return _minimumNumberStencilBits; }
const bool requiresStencilBuffer() const { return _minimumNumberStencilBits!=0; }