Added support for osg_FrameNumber, osg_FrameTime, osg_ViewMatrix, osg_InverseViewMatrix
into SceneView, controlled via a setActiveUniforms(.) method.
This commit is contained in:
@@ -307,6 +307,9 @@ class OSG_EXPORT StateSet : public Object
|
||||
* Returns NULL if no matching Uniform is contained within StateSet.*/
|
||||
Uniform* getUniform(const std::string& name);
|
||||
|
||||
/** Get Uniform for specified name, if one is not available create it, add it to this StateSet and return a pointer to it.*/
|
||||
Uniform* getOrCreateUniform(const std::string& name, Uniform::Type type);
|
||||
|
||||
/** Get const Uniform for specified name.
|
||||
* Returns NULL if no matching Uniform is contained within StateSet.*/
|
||||
const Uniform* getUniform(const std::string& name) const;
|
||||
|
||||
@@ -153,7 +153,7 @@ class OSG_EXPORT Uniform : public Object
|
||||
|
||||
public:
|
||||
Uniform();
|
||||
Uniform( const char* name, Type type );
|
||||
Uniform( const std::string& name, Type type );
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
||||
Uniform(const Uniform& rhs, const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
|
||||
@@ -123,7 +123,6 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
|
||||
const osg::Vec4& getClearColor() const { return _clearColor; }
|
||||
|
||||
|
||||
|
||||
void setGlobalStateSet(osg::StateSet* state) { _globalStateSet = state; }
|
||||
osg::StateSet* getGlobalStateSet() { return _globalStateSet.get(); }
|
||||
const osg::StateSet* getGlobalStateSet() const { return _globalStateSet.get(); }
|
||||
@@ -131,6 +130,28 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
|
||||
void setLocalStateSet(osg::StateSet* state) { _localStateSet = state; }
|
||||
osg::StateSet* getLocalStateSet() { return _localStateSet.get(); }
|
||||
const osg::StateSet* getLocalStateSet() const { return _localStateSet.get(); }
|
||||
|
||||
enum ActiveUniforms
|
||||
{
|
||||
FRAME_NUMBER_UNIFORM = 0x1,
|
||||
FRAME_TIME_UNIFORM = 0x2,
|
||||
VIEW_MATRIX_UNIFORM = 0x4,
|
||||
INVERSE_VIEW_MATRIX_UNIFORM = 0x8,
|
||||
DEFAULT_UNIFORMS = FRAME_NUMBER_UNIFORM |
|
||||
FRAME_TIME_UNIFORM |
|
||||
VIEW_MATRIX_UNIFORM |
|
||||
INVERSE_VIEW_MATRIX_UNIFORM,
|
||||
ALL_UNIFORMS = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
/** Set the uniforms that SceneView should set set up on each frame.*/
|
||||
void setActiveUniforms(int activeUniforms) { _activeUniforms = activeUniforms; }
|
||||
|
||||
/** Set the uniforms that SceneView should set set up on each frame.*/
|
||||
int getActiveUniforms(int activeUniforms) const { return _activeUniforms; }
|
||||
|
||||
void updateUniforms();
|
||||
|
||||
|
||||
typedef Options LightingMode;
|
||||
|
||||
@@ -486,6 +507,8 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting
|
||||
|
||||
bool _requiresFlush;
|
||||
|
||||
int _activeUniforms;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user