Introduced new osg::View, and osg::RenderInfo classes into the core OSG to help
handle scenes with multiple views with elements that need coordinating on a per view basis. Added beginings of new osgText::FadeText class (not functionality yet).
This commit is contained in:
@@ -59,7 +59,10 @@ class OSG_EXPORT BlendColor : public StateAttribute
|
||||
}
|
||||
|
||||
void setConstantColor(const osg::Vec4& color) { _constantColor = color; }
|
||||
inline osg::Vec4 getConstantColor() const { return _constantColor; }
|
||||
|
||||
inline osg::Vec4& getConstantColor() { return _constantColor; }
|
||||
|
||||
inline const osg::Vec4& getConstantColor() const { return _constantColor; }
|
||||
|
||||
virtual void apply(State& state) const;
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
// forward declare View to allow CameraNode to point back to the View that its within
|
||||
class View;
|
||||
|
||||
/** CameraNode - is a subclass of Transform which represents encapsulates the settings of a Camera.
|
||||
*/
|
||||
class OSG_EXPORT CameraNode : public Transform, public CullSettings
|
||||
@@ -40,6 +43,15 @@ class OSG_EXPORT CameraNode : public Transform, public CullSettings
|
||||
|
||||
META_Node(osg, CameraNode);
|
||||
|
||||
/** Set the View that this Camera is part of. */
|
||||
void setView(View* view) { _view = view; }
|
||||
|
||||
/** Get the View that this Camera is part of. */
|
||||
View* getView() { return _view; }
|
||||
|
||||
/** Get the const View that this Camera is part of. */
|
||||
const View* getView() const { return _view; }
|
||||
|
||||
|
||||
/** Sets the clear color. */
|
||||
inline void setClearColor(const Vec4& color) { _clearColor = color; }
|
||||
@@ -359,6 +371,9 @@ class OSG_EXPORT CameraNode : public Transform, public CullSettings
|
||||
|
||||
mutable OpenThreads::Mutex _dataChangeMutex;
|
||||
|
||||
|
||||
View* _view;
|
||||
|
||||
Vec4 _clearColor;
|
||||
GLbitfield _clearMask;
|
||||
ref_ptr<ColorMask> _colorMask;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <osg/Shape>
|
||||
#include <osg/BufferObject>
|
||||
#include <osg/PrimitiveSet>
|
||||
#include <osg/State>
|
||||
#include <osg/RenderInfo>
|
||||
|
||||
|
||||
#ifndef GL_NV_occlusion_query
|
||||
@@ -271,7 +271,7 @@ class OSG_EXPORT Drawable : public Object
|
||||
* \c virtual). Subclasses should override
|
||||
* \c drawImplementation() instead.
|
||||
*/
|
||||
inline void draw(State& state) const;
|
||||
inline void draw(RenderInfo& renderInfo) const;
|
||||
|
||||
/** Immediately compile this \c Drawable into an OpenGL Display List.
|
||||
* @note Operation is ignored if \c _useDisplayList is \c false.
|
||||
@@ -341,8 +341,11 @@ class OSG_EXPORT Drawable : public Object
|
||||
|
||||
META_Object(osg,CullCallback);
|
||||
|
||||
/** do customized cull code, return true if drawable should be culled.*/
|
||||
/** deprecated.*/
|
||||
virtual bool cull(osg::NodeVisitor*, osg::Drawable*, osg::State*) const { return false; }
|
||||
|
||||
/** do customized cull code, return true if drawable should be culled.*/
|
||||
virtual bool cull(osg::NodeVisitor* nv, osg::Drawable* drawable, osg::RenderInfo* renderInfo) const { return cull(nv, drawable, renderInfo? renderInfo->getState():0); }
|
||||
};
|
||||
|
||||
/** Set the CullCallback which allows users to customize the culling of Drawable during the cull traversal.*/
|
||||
@@ -370,8 +373,11 @@ class OSG_EXPORT Drawable : public Object
|
||||
|
||||
META_Object(osg,DrawCallback);
|
||||
|
||||
/** do customized draw code.*/
|
||||
/** Deprecated.*/
|
||||
virtual void drawImplementation(osg::State&,const osg::Drawable*) const {}
|
||||
|
||||
/** do customized draw code.*/
|
||||
virtual void drawImplementation(osg::RenderInfo& renderInfo,const osg::Drawable* drawable) const { drawImplementation(*renderInfo.getState(), drawable); }
|
||||
};
|
||||
|
||||
/** Set the DrawCallback which allows users to attach customize the drawing of existing Drawable object.*/
|
||||
@@ -383,14 +389,15 @@ class OSG_EXPORT Drawable : public Object
|
||||
/** Get the const DrawCallback.*/
|
||||
const DrawCallback* getDrawCallback() const { return _drawCallback.get(); }
|
||||
|
||||
|
||||
/** Deprecated. */
|
||||
virtual void drawImplementation(State&) const {}
|
||||
|
||||
/** drawImplementation(State&) is a pure virtual method for the actual implementation of OpenGL drawing calls, such as vertex arrays and primitives, that
|
||||
* must be implemented in concrete subclasses of the Drawable base class, examples include osg::Geometry and osg::ShapeDrawable.
|
||||
* drawImplementation(State&) is called from the draw(State&) method, with the draw method handling management of OpenGL display lists,
|
||||
* and drawImplementation(State&) handling the actuall drawing itself.
|
||||
* @param state The osg::State object that encapulates the current OpenGL state for the current graphics context. */
|
||||
virtual void drawImplementation(State& state) const = 0;
|
||||
virtual void drawImplementation(RenderInfo& renderInfo) const { drawImplementation(*renderInfo.getState()); }
|
||||
|
||||
|
||||
/** Return a OpenGL display list handle a newly generated or reused from display list cache. */
|
||||
@@ -779,13 +786,13 @@ class OSG_EXPORT Drawable : public Object
|
||||
ref_ptr<DrawCallback> _drawCallback;
|
||||
};
|
||||
|
||||
inline void Drawable::draw(State& state) const
|
||||
inline void Drawable::draw(RenderInfo& renderInfo) const
|
||||
{
|
||||
if (_useDisplayList && !(_supportsVertexBufferObjects && _useVertexBufferObjects && state.isVertexBufferObjectSupported()))
|
||||
if (_useDisplayList && !(_supportsVertexBufferObjects && _useVertexBufferObjects && renderInfo.getState()->isVertexBufferObjectSupported()))
|
||||
{
|
||||
// get the contextID (user defined ID of 0 upwards) for the
|
||||
// current OpenGL context.
|
||||
unsigned int contextID = state.getContextID();
|
||||
unsigned int contextID = renderInfo.getContextID();
|
||||
|
||||
// get the globj for the current contextID.
|
||||
GLuint& globj = _globjList[contextID];
|
||||
@@ -801,9 +808,9 @@ inline void Drawable::draw(State& state) const
|
||||
globj = generateDisplayList(contextID, getGLObjectSizeHint());
|
||||
glNewList( globj, GL_COMPILE );
|
||||
if (_drawCallback.valid())
|
||||
_drawCallback->drawImplementation(state,this);
|
||||
_drawCallback->drawImplementation(renderInfo,this);
|
||||
else
|
||||
drawImplementation(state);
|
||||
drawImplementation(renderInfo);
|
||||
glEndList();
|
||||
|
||||
glCallList( globj);
|
||||
@@ -811,9 +818,9 @@ inline void Drawable::draw(State& state) const
|
||||
globj = generateDisplayList(contextID, getGLObjectSizeHint());
|
||||
glNewList( globj, GL_COMPILE_AND_EXECUTE );
|
||||
if (_drawCallback.valid())
|
||||
_drawCallback->drawImplementation(state,this);
|
||||
_drawCallback->drawImplementation(renderInfo,this);
|
||||
else
|
||||
drawImplementation(state);
|
||||
drawImplementation(renderInfo);
|
||||
glEndList();
|
||||
#endif
|
||||
}
|
||||
@@ -824,9 +831,9 @@ inline void Drawable::draw(State& state) const
|
||||
|
||||
// draw object as nature intended..
|
||||
if (_drawCallback.valid())
|
||||
_drawCallback->drawImplementation(state,this);
|
||||
_drawCallback->drawImplementation(renderInfo,this);
|
||||
else
|
||||
drawImplementation(state);
|
||||
drawImplementation(renderInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ class TexGenNode;
|
||||
class Transform;
|
||||
class CameraNode;
|
||||
class CameraView;
|
||||
class View;
|
||||
|
||||
/** Visitor for type safe operations on osg::Nodes.
|
||||
Based on GOF's Visitor pattern. The NodeVisitor
|
||||
@@ -235,6 +236,7 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
|
||||
virtual void apply(LightSource& node) { apply((Group&)node); }
|
||||
|
||||
virtual void apply(Transform& node) { apply((Group&)node); }
|
||||
virtual void apply(View& node) { apply((Transform&)node); }
|
||||
virtual void apply(CameraNode& node) { apply((Transform&)node); }
|
||||
virtual void apply(CameraView& node) { apply((Transform&)node); }
|
||||
virtual void apply(MatrixTransform& node) { apply((Transform&)node); }
|
||||
|
||||
70
include/osg/RenderInfo
Normal file
70
include/osg/RenderInfo
Normal file
@@ -0,0 +1,70 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSG_RENDERINFO
|
||||
#define OSG_RENDERINFO 1
|
||||
|
||||
#include <osg/State>
|
||||
#include <osg/View>
|
||||
#include <osg/observer_ptr>
|
||||
|
||||
namespace osg {
|
||||
|
||||
class RenderInfo
|
||||
{
|
||||
public:
|
||||
|
||||
RenderInfo():
|
||||
_view(0) {}
|
||||
|
||||
RenderInfo(const RenderInfo& rhs):
|
||||
_state(rhs._state),
|
||||
_view(rhs._view),
|
||||
_userData(rhs._userData) {}
|
||||
|
||||
RenderInfo(State* state, View* view):
|
||||
_state(state),
|
||||
_view(view) {}
|
||||
|
||||
RenderInfo& operator = (const RenderInfo& rhs)
|
||||
{
|
||||
_state = rhs._state;
|
||||
_view = rhs._view;
|
||||
_userData = rhs._userData;
|
||||
return *this;
|
||||
}
|
||||
|
||||
unsigned int getContextID() const { return _state.valid() ? _state->getContextID() : 0; }
|
||||
|
||||
void setState(State* state) { _state = state; }
|
||||
State* getState() { return _state.get(); }
|
||||
const State* getState() const { return _state.get(); }
|
||||
|
||||
void setView(View* view) { _view = view; }
|
||||
View* getView() { return _view.get(); }
|
||||
const View* getView() const { return _view.get(); }
|
||||
|
||||
void setUserData(Referenced* userData) { _userData = userData; }
|
||||
Referenced* getUserData() { return _userData.get(); }
|
||||
const Referenced* getUserData() const { return _userData.get(); }
|
||||
|
||||
protected:
|
||||
|
||||
ref_ptr<State> _state;
|
||||
observer_ptr<View> _view;
|
||||
ref_ptr<Referenced> _userData;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -64,7 +64,7 @@ namespace osg {
|
||||
}
|
||||
|
||||
|
||||
// forward decalr GraphicsContext
|
||||
// forward declare GraphicsContext, View and State
|
||||
class GraphicsContext;
|
||||
|
||||
/** Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,
|
||||
@@ -1531,6 +1531,7 @@ inline void State::applyUniformMap(UniformMap& uniformMap)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -306,12 +306,12 @@ class OSG_EXPORT StateAttribute : public Object
|
||||
|
||||
|
||||
/** apply the OpenGL state attributes.
|
||||
* The global state for the current OpenGL context is passed
|
||||
* The render info for the current OpenGL context is passed
|
||||
* in to allow the StateAttribute to obtain details on the
|
||||
* the current context and state.
|
||||
*/
|
||||
virtual void apply(State&) const = 0;
|
||||
|
||||
virtual void apply(State&) const {}
|
||||
|
||||
/** default to nothing to compile - all state is applied immediately. */
|
||||
virtual void compileGLObjects(State&) const {}
|
||||
|
||||
|
||||
174
include/osg/View
Normal file
174
include/osg/View
Normal file
@@ -0,0 +1,174 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSG_VIEW
|
||||
#define OSG_VIEW 1
|
||||
|
||||
#include <osg/CameraNode>
|
||||
|
||||
#include <OpenThreads/Mutex>
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** View - is a subclass of Transform which encompasses all the cameras that combine to make up a single view of the scene.
|
||||
*/
|
||||
class OSG_EXPORT View : public osg::Transform, public CullSettings
|
||||
{
|
||||
public :
|
||||
|
||||
|
||||
View();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
View(const View&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
|
||||
META_Node(osg, View);
|
||||
|
||||
|
||||
/** Set the projection matrix. Can be thought of as setting the lens of a camera. */
|
||||
inline void setProjectionMatrix(const osg::Matrixf& matrix) { _projectionMatrix.set(matrix); updateCameras(); }
|
||||
|
||||
/** Set the projection matrix. Can be thought of as setting the lens of a camera. */
|
||||
inline void setProjectionMatrix(const osg::Matrixd& matrix) { _projectionMatrix.set(matrix); updateCameras(); }
|
||||
|
||||
/** Set to an orthographic projection. See OpenGL glOrtho for documentation further details.*/
|
||||
void setProjectionMatrixAsOrtho(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Set to a 2D orthographic projection. See OpenGL glOrtho2D documentation for further details.*/
|
||||
void setProjectionMatrixAsOrtho2D(double left, double right,
|
||||
double bottom, double top);
|
||||
|
||||
/** Set to a perspective projection. See OpenGL glFrustum documentation for further details.*/
|
||||
void setProjectionMatrixAsFrustum(double left, double right,
|
||||
double bottom, double top,
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Create a symmetrical perspective projection, See OpenGL gluPerspective documentation for further details.
|
||||
* Aspect ratio is defined as width/height.*/
|
||||
void setProjectionMatrixAsPerspective(double fovy,double aspectRatio,
|
||||
double zNear, double zFar);
|
||||
|
||||
/** Get the projection matrix.*/
|
||||
osg::Matrixd& getProjectionMatrix() { return _projectionMatrix; }
|
||||
|
||||
/** Get the const projection matrix.*/
|
||||
const osg::Matrixd& getProjectionMatrix() const { return _projectionMatrix; }
|
||||
|
||||
/** Get the othographic settings of the orthographic projection matrix.
|
||||
* Returns false if matrix is not an orthographic matrix, where parameter values are undefined.*/
|
||||
bool getProjectionMatrixAsOrtho(double& left, double& right,
|
||||
double& bottom, double& top,
|
||||
double& zNear, double& zFar);
|
||||
|
||||
/** Get the frustum setting of a perspective projection matrix.
|
||||
* Returns false if matrix is not a perspective matrix, where parameter values are undefined.*/
|
||||
bool getProjectionMatrixAsFrustum(double& left, double& right,
|
||||
double& bottom, double& top,
|
||||
double& zNear, double& zFar);
|
||||
|
||||
/** Get the frustum setting of a symmetric perspective projection matrix.
|
||||
* Returns false if matrix is not a perspective matrix, where parameter values are undefined.
|
||||
* Note, if matrix is not a symmetric perspective matrix then the shear will be lost.
|
||||
* Asymmetric matrices occur when stereo, power walls, caves and reality center display are used.
|
||||
* In these configurations one should use the 'getProjectionMatrixAsFrustum' method instead.*/
|
||||
bool getProjectionMatrixAsPerspective(double& fovy,double& aspectRatio,
|
||||
double& zNear, double& zFar);
|
||||
|
||||
|
||||
|
||||
/** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */
|
||||
inline void setViewMatrix(const osg::Matrixf& matrix) { _viewMatrix.set(matrix); dirtyBound(); updateCameras(); }
|
||||
|
||||
/** Set the view matrix. Can be thought of as setting the position of the world relative to the camera in camera coordinates. */
|
||||
inline void setViewMatrix(const osg::Matrixd& matrix) { _viewMatrix.set(matrix); dirtyBound(); updateCameras(); }
|
||||
|
||||
/** Set to the position and orientation of view matrix, using the same convention as gluLookAt. */
|
||||
void setViewMatrixAsLookAt(const osg::Vec3& eye,const osg::Vec3& center,const osg::Vec3& up);
|
||||
|
||||
/** Get the view matrix. */
|
||||
osg::Matrixd& getViewMatrix() { return _viewMatrix; }
|
||||
|
||||
/** Get the const view matrix. */
|
||||
const osg::Matrixd& getViewMatrix() const { return _viewMatrix; }
|
||||
|
||||
/** Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt. */
|
||||
void getViewMatrixAsLookAt(osg::Vec3& eye,osg::Vec3& center,osg::Vec3& up,float lookDistance=1.0f);
|
||||
|
||||
/** Get the inverse view matrix.*/
|
||||
Matrixd getInverseViewMatrix() const;
|
||||
|
||||
|
||||
struct CameraData
|
||||
{
|
||||
CameraData() {}
|
||||
CameraData(osg::CameraNode* camera, const osg::Matrixd& projectionOffset, const osg::Matrixd& viewOffset):
|
||||
_camera(camera), _projectionOffset(projectionOffset), _viewOffset(viewOffset) {}
|
||||
|
||||
CameraData(const CameraData& rhs) :
|
||||
_camera(rhs._camera), _projectionOffset(rhs._projectionOffset), _viewOffset(rhs._viewOffset) {}
|
||||
|
||||
CameraData& operator = (const CameraData& rhs)
|
||||
{
|
||||
_camera = rhs._camera;
|
||||
_projectionOffset = rhs._projectionOffset;
|
||||
_viewOffset = rhs._viewOffset;
|
||||
return *this;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::CameraNode> _camera;
|
||||
osg::Matrixd _projectionOffset;
|
||||
osg::Matrixd _viewOffset;
|
||||
};
|
||||
|
||||
bool addCamera(osg::CameraNode* camera) { return addCamera(camera, osg::Matrix::identity(), osg::Matrix::identity()); }
|
||||
|
||||
bool addCamera(osg::CameraNode* camera, const osg::Matrix& projectionOffset, const osg::Matrix& viewOffse);
|
||||
|
||||
bool removeCamera(unsigned int pos);
|
||||
|
||||
unsigned int getNumCameras() const { return _cameras.size(); }
|
||||
|
||||
CameraNode* getCamera(unsigned int pos) { return _cameras[pos]._camera.get(); }
|
||||
const CameraNode* getCamera(unsigned int pos) const { return _cameras[pos]._camera.get(); }
|
||||
|
||||
CameraData& getCameraData(unsigned int pos) { return _cameras[pos]; }
|
||||
const CameraData& getCameraData(unsigned int pos) const { return _cameras[pos]; }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/** Transform method that must be defined to provide generic interface for scene graph traversals.*/
|
||||
virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const;
|
||||
|
||||
/** Transform method that must be defined to provide generic interface for scene graph traversals.*/
|
||||
virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const;
|
||||
|
||||
|
||||
protected :
|
||||
|
||||
virtual ~View();
|
||||
|
||||
void updateCameras();
|
||||
|
||||
Matrixd _projectionMatrix;
|
||||
Matrixd _viewMatrix;
|
||||
|
||||
typedef std::vector<CameraData> CameraList;
|
||||
CameraList _cameras;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -117,7 +117,7 @@ namespace osgParticle
|
||||
void setNumberOfVertices(unsigned int numVertices) { _numberOfVertices = numVertices; }
|
||||
unsigned int getNumberOfVertices() const { return _numberOfVertices; }
|
||||
|
||||
virtual void drawImplementation(osg::State& state) const;
|
||||
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
|
||||
|
||||
struct Cell
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <osg/FrameStamp>
|
||||
#include <osg/DisplaySettings>
|
||||
#include <osg/CullSettings>
|
||||
#include <osg/View>
|
||||
#include <osg/Matrixd>
|
||||
|
||||
#include <osgProducer/OsgSceneHandler>
|
||||
@@ -233,6 +234,8 @@ class OSGPRODUCER_EXPORT OsgCameraGroup : public Producer::CameraGroup
|
||||
GraphicsContextList _gcList;
|
||||
SceneHandlerList _shvec;
|
||||
|
||||
osg::ref_ptr<osg::View> _view;
|
||||
|
||||
osg::ref_ptr<RealizeCallback> _realizeCallback;
|
||||
|
||||
osg::ref_ptr<osg::DisplaySettings> _ds;
|
||||
|
||||
51
include/osgText/FadeText
Normal file
51
include/osgText/FadeText
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGTEXT_FADETEXT
|
||||
#define OSGTEXT_FADETEXT 1
|
||||
|
||||
#include <osgText/Text>
|
||||
|
||||
namespace osgText {
|
||||
|
||||
|
||||
class OSGTEXT_EXPORT FadeText : public osgText::Text
|
||||
{
|
||||
public:
|
||||
|
||||
FadeText();
|
||||
FadeText(const Text& text,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
META_Object(osgText,FadeText)
|
||||
|
||||
typedef std::map<osg::View*, osg::Vec4 > ViewBlendColourMap;
|
||||
|
||||
ViewBlendColourMap& getViewBlendColourMap() { return _viewBlendColourMap; }
|
||||
const ViewBlendColourMap& getViewBlendColourMap() const { return _viewBlendColourMap; }
|
||||
|
||||
/** Draw the text.*/
|
||||
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~FadeText() {}
|
||||
|
||||
void init();
|
||||
|
||||
mutable ViewBlendColourMap _viewBlendColourMap;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -417,7 +417,7 @@ public:
|
||||
unsigned int getLineCount() const { return _lineCount; }
|
||||
|
||||
/** Draw the text.*/
|
||||
virtual void drawImplementation(osg::State& state) const;
|
||||
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
|
||||
|
||||
/** return false, osgText::Text does not support accept(AttributeFunctor&).*/
|
||||
virtual bool supports(const osg::Drawable::AttributeFunctor&) const { return false; }
|
||||
@@ -567,12 +567,13 @@ protected:
|
||||
void computeColorGradientsOverall() const;
|
||||
void computeColorGradientsPerCharacter() const;
|
||||
|
||||
void drawForegroundText(osg::State& state, const GlyphQuads& glyphquad) const;
|
||||
void renderOnlyForegroundText(osg::State& state) const;
|
||||
void renderWithPolygonOffset(osg::State& state) const;
|
||||
void renderWithNoDepthBuffer(osg::State& state) const;
|
||||
void renderWithDepthRange(osg::State& state) const;
|
||||
void renderWithStencilBuffer(osg::State& state) const;
|
||||
void drawImplementation(osg::State& state, const osg::Vec4& colorMultiplier) const;
|
||||
void drawForegroundText(osg::State& state, const GlyphQuads& glyphquad, const osg::Vec4& colorMultiplier) const;
|
||||
void renderOnlyForegroundText(osg::State& state, const osg::Vec4& colorMultiplier) const;
|
||||
void renderWithPolygonOffset(osg::State& state, const osg::Vec4& colorMultiplier) const;
|
||||
void renderWithNoDepthBuffer(osg::State& state, const osg::Vec4& colorMultiplier) const;
|
||||
void renderWithDepthRange(osg::State& state, const osg::Vec4& colorMultiplier) const;
|
||||
void renderWithStencilBuffer(osg::State& state, const osg::Vec4& colorMultiplier) const;
|
||||
|
||||
BackdropType _backdropType;
|
||||
BackdropImplementation _backdropImplementation;
|
||||
|
||||
@@ -239,9 +239,13 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
}
|
||||
|
||||
|
||||
void setState(osg::State* state) { _state = state; }
|
||||
osg::State* getState() { return _state.get(); }
|
||||
const osg::State* getState() const { return _state.get(); }
|
||||
void setState(osg::State* state) { _renderInfo.setState(state); }
|
||||
osg::State* getState() { return _renderInfo.getState(); }
|
||||
const osg::State* getState() const { return _renderInfo.getState(); }
|
||||
|
||||
void setRenderInfo(osg::RenderInfo& renderInfo) { _renderInfo = renderInfo; }
|
||||
osg::RenderInfo& getRenderInfo() { return _renderInfo; }
|
||||
const osg::RenderInfo& getRenderInfo() const { return _renderInfo; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -283,7 +287,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
|
||||
|
||||
unsigned int _numberOfEncloseOverrideRenderBinDetails;
|
||||
|
||||
osg::ref_ptr<osg::State> _state;
|
||||
osg::RenderInfo _renderInfo;
|
||||
|
||||
|
||||
struct MatrixPlanesDrawables
|
||||
|
||||
@@ -125,13 +125,13 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object
|
||||
|
||||
|
||||
|
||||
virtual void draw(osg::State& state,RenderLeaf*& previous);
|
||||
virtual void draw(osg::RenderInfo& renderInfo,RenderLeaf*& previous);
|
||||
|
||||
virtual void drawImplementation(osg::State& state,RenderLeaf*& previous);
|
||||
virtual void drawImplementation(osg::RenderInfo& renderInfo,RenderLeaf*& previous);
|
||||
|
||||
struct DrawCallback : public osg::Referenced
|
||||
{
|
||||
virtual void drawImplementation(RenderBin* bin,osg::State& state,RenderLeaf*& previous) = 0;
|
||||
virtual void drawImplementation(RenderBin* bin,osg::RenderInfo& renderInfo,RenderLeaf*& previous) = 0;
|
||||
};
|
||||
|
||||
void setDrawCallback(DrawCallback* drawCallback) { _drawCallback = drawCallback; }
|
||||
|
||||
@@ -60,7 +60,7 @@ class OSGUTIL_EXPORT RenderLeaf : public osg::Referenced
|
||||
_depth = 0.0f;
|
||||
}
|
||||
|
||||
virtual void render(osg::State& state,RenderLeaf* previous);
|
||||
virtual void render(osg::RenderInfo& renderInfo,RenderLeaf* previous);
|
||||
|
||||
/// Allow StateGraph to change the RenderLeaf's _parent.
|
||||
friend class osgUtil::StateGraph;
|
||||
|
||||
@@ -127,7 +127,7 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
|
||||
bool getCameraRequiresSetUp() const { return _cameraRequiresSetUp; }
|
||||
|
||||
/** Attempt the set the RenderStage from the Camera settings.*/
|
||||
void runCameraSetUp(osg::State& state);
|
||||
void runCameraSetUp(osg::RenderInfo& renderInfo);
|
||||
|
||||
void setTexture(osg::Texture* texture, unsigned int level = 0, unsigned int face=0) { _texture = texture; _level = level; _face = face; }
|
||||
osg::Texture* getTexture() { return _texture.get(); }
|
||||
@@ -177,19 +177,19 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
|
||||
getPositionalStateContainer()->addPositionedTextureAttribute(textureUnit, matrix,attr);
|
||||
}
|
||||
|
||||
void copyTexture(osg::State& state);
|
||||
void copyTexture(osg::RenderInfo& renderInfo);
|
||||
|
||||
virtual void sort();
|
||||
|
||||
virtual void drawPreRenderStages(osg::State& state,RenderLeaf*& previous);
|
||||
virtual void drawPreRenderStages(osg::RenderInfo& renderInfo,RenderLeaf*& previous);
|
||||
|
||||
virtual void draw(osg::State& state,RenderLeaf*& previous);
|
||||
virtual void draw(osg::RenderInfo& renderInfo,RenderLeaf*& previous);
|
||||
|
||||
virtual void drawInner(osg::State& state,RenderLeaf*& previous, bool& doCopyTexture);
|
||||
virtual void drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, bool& doCopyTexture);
|
||||
|
||||
virtual void drawPostRenderStages(osg::State& state,RenderLeaf*& previous);
|
||||
virtual void drawPostRenderStages(osg::RenderInfo& renderInfo,RenderLeaf*& previous);
|
||||
|
||||
virtual void drawImplementation(osg::State& state,RenderLeaf*& previous);
|
||||
virtual void drawImplementation(osg::RenderInfo& renderInfo,RenderLeaf*& previous);
|
||||
|
||||
|
||||
void addToDependencyList(RenderStage* rs) { addPreRenderStage(rs); }
|
||||
|
||||
@@ -155,7 +155,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
|
||||
/** Set the uniforms that SceneView should set set up on each frame.*/
|
||||
void setActiveUniforms(int activeUniforms) { _activeUniforms = activeUniforms; }
|
||||
|
||||
/** Get the uniforms that SceneView should set set up on each frame.*/
|
||||
/** Get the uniforms that SceneView should set set up on each frame.*/
|
||||
int getActiveUniforms() const { return _activeUniforms; }
|
||||
|
||||
void updateUniforms();
|
||||
@@ -170,10 +170,18 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
|
||||
osg::Light* getLight() { return _light.get(); }
|
||||
const osg::Light* getLight() const { return _light.get(); }
|
||||
|
||||
void setState(osg::State* state) { _state = state; }
|
||||
osg::State* getState() { return _state.get(); }
|
||||
const osg::State* getState() const { return _state.get(); }
|
||||
void setState(osg::State* state) { _renderInfo.setState(state); }
|
||||
osg::State* getState() { return _renderInfo.getState(); }
|
||||
const osg::State* getState() const { return _renderInfo.getState(); }
|
||||
|
||||
void setView(osg::View* view) { _renderInfo.setView(view); }
|
||||
osg::View* getView() { return _renderInfo.getView(); }
|
||||
const osg::View* getView() const { return _renderInfo.getView(); }
|
||||
|
||||
void setRenderInfo(osg::RenderInfo& renderInfo) { _renderInfo = renderInfo; }
|
||||
osg::RenderInfo& getRenderInfo() { return _renderInfo; }
|
||||
const osg::RenderInfo& getRenderInfo() const { return _renderInfo; }
|
||||
|
||||
|
||||
|
||||
/** Set the projection matrix. Can be thought of as setting the lens of a camera. */
|
||||
@@ -470,7 +478,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
|
||||
void clearArea(int x,int y,int width,int height,const osg::Vec4& color);
|
||||
|
||||
osg::ref_ptr<osg::StateSet> _localStateSet;
|
||||
osg::ref_ptr<osg::State> _state;
|
||||
osg::RenderInfo _renderInfo;
|
||||
|
||||
bool _initCalled;
|
||||
osg::ref_ptr<osg::NodeVisitor> _initVisitor;
|
||||
|
||||
Reference in New Issue
Block a user