Changed StateAttribute::getAssociatedModes(std::vector<GLMode>&) across
to StateAttribute::getModeUsage(StateAttribute::ModeUsage&).
This commit is contained in:
@@ -49,9 +49,10 @@ class SG_EXPORT AlphaFunc : public StateAttribute
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_ALPHA_TEST);
|
||||
usage.usesMode(GL_ALPHA_TEST);
|
||||
return true;
|
||||
}
|
||||
|
||||
enum ComparisonFunction {
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <osg/GL>
|
||||
#include <osg/StateAttribute>
|
||||
#include <osg/ref_ptr>
|
||||
#include <osg/buffered_value>
|
||||
#include <osg/Vec4>
|
||||
|
||||
|
||||
@@ -51,9 +50,10 @@ class SG_EXPORT BlendColor : public StateAttribute
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_BLEND);
|
||||
usage.usesMode(GL_BLEND);
|
||||
return true;
|
||||
}
|
||||
|
||||
void setConstantColor(const osg::Vec4& color) { _constantColor = color; }
|
||||
|
||||
@@ -60,9 +60,10 @@ class SG_EXPORT BlendFunc : public StateAttribute
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_BLEND);
|
||||
usage.usesMode(GL_BLEND);
|
||||
return true;
|
||||
}
|
||||
|
||||
enum BlendFuncMode {
|
||||
|
||||
@@ -59,9 +59,10 @@ class SG_EXPORT ClipPlane : public StateAttribute
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back((GLMode)(GL_CLIP_PLANE0+_clipPlaneNum));
|
||||
usage.usesMode((GLMode)(GL_CLIP_PLANE0+_clipPlaneNum));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -54,9 +54,10 @@ class SG_EXPORT CullFace : public StateAttribute
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_CULL_FACE);
|
||||
usage.usesMode(GL_CULL_FACE);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void setMode(Mode mode) { _mode = mode; }
|
||||
|
||||
@@ -67,9 +67,10 @@ class SG_EXPORT Depth : public StateAttribute
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_DEPTH_TEST);
|
||||
usage.usesMode(GL_DEPTH_TEST);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void setFunction(Function func) { _func = func; }
|
||||
|
||||
@@ -64,9 +64,10 @@ class SG_EXPORT Fog : public StateAttribute
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_FOG);
|
||||
usage.usesMode(GL_FOG);
|
||||
return true;
|
||||
}
|
||||
|
||||
enum Mode {
|
||||
|
||||
@@ -136,9 +136,10 @@ class SG_EXPORT FragmentProgram : public StateAttribute
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_FRAGMENT_PROGRAM_ARB);
|
||||
usage.usesMode(GL_FRAGMENT_PROGRAM_ARB);
|
||||
return true;
|
||||
}
|
||||
|
||||
// data access methods.
|
||||
|
||||
@@ -67,9 +67,10 @@ class SG_EXPORT Light : public StateAttribute
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_LIGHT0+_lightnum);
|
||||
usage.usesMode(GL_LIGHT0+_lightnum);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Set which OpenGL light to operate on.*/
|
||||
|
||||
@@ -46,9 +46,10 @@ class SG_EXPORT LineStipple : public StateAttribute
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_LINE_STIPPLE);
|
||||
usage.usesMode(GL_LINE_STIPPLE);
|
||||
return true;
|
||||
}
|
||||
|
||||
void setFactor(GLint factor);
|
||||
|
||||
@@ -79,12 +79,10 @@ class SG_EXPORT Material : public StateAttribute
|
||||
|
||||
Material& operator = (const Material& rhs);
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
// Have to think about the role of _colorMode
|
||||
// in setting the colormaterial... also need to take the
|
||||
// color material enable/disable out of the the apply()...
|
||||
modes.push_back(GL_COLOR_MATERIAL);
|
||||
usage.usesMode(GL_COLOR_MATERIAL);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void apply(State& state) const;
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <osg/GL>
|
||||
#include <osg/StateAttribute>
|
||||
#include <osg/ref_ptr>
|
||||
#include <osg/buffered_value>
|
||||
|
||||
|
||||
#ifndef GL_ARB_multisample
|
||||
@@ -77,8 +76,6 @@ class SG_EXPORT Multisample : public StateAttribute
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& /*modes*/) const {}
|
||||
|
||||
void setSampleCoverage(float coverage, bool invert)
|
||||
{
|
||||
_coverage = coverage;
|
||||
|
||||
@@ -54,9 +54,10 @@ class SG_EXPORT Point : public StateAttribute
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_POINT_SMOOTH);
|
||||
usage.usesMode(GL_POINT_SMOOTH);
|
||||
return true;
|
||||
}
|
||||
|
||||
void setSize(float size);
|
||||
|
||||
@@ -40,7 +40,11 @@ public:
|
||||
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
|
||||
virtual int compare(const StateAttribute& sa) const;
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const;
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
usage.usesMode(GL_POINT_SPRITE_ARB);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool isTextureAttribute() const { return true; }
|
||||
|
||||
|
||||
@@ -49,11 +49,12 @@ class SG_EXPORT PolygonOffset : public StateAttribute
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_POLYGON_OFFSET_FILL);
|
||||
modes.push_back(GL_POLYGON_OFFSET_LINE);
|
||||
modes.push_back(GL_POLYGON_OFFSET_POINT);
|
||||
usage.usesMode(GL_POLYGON_OFFSET_FILL);
|
||||
usage.usesMode(GL_POLYGON_OFFSET_LINE);
|
||||
usage.usesMode(GL_POLYGON_OFFSET_POINT);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void setFactor(float factor) { _factor = factor; }
|
||||
|
||||
@@ -34,9 +34,10 @@ class SG_EXPORT PolygonStipple : public StateAttribute
|
||||
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
|
||||
virtual int compare(const StateAttribute& sa) const;
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_POLYGON_STIPPLE);
|
||||
usage.usesMode(GL_POLYGON_STIPPLE);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** set the mask up, copying 128 bytes (32x32 bitfield) from mask into the local _mask.*/
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <osg/GL>
|
||||
|
||||
#include <typeinfo>
|
||||
#include <vector>
|
||||
|
||||
namespace osg {
|
||||
|
||||
@@ -209,10 +208,17 @@ class SG_EXPORT StateAttribute : public Object
|
||||
bool operator != (const StateAttribute& rhs) const { return compare(rhs)!=0; }
|
||||
|
||||
|
||||
/** return the modes associated with this StateSet*/
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& /*modes*/) const
|
||||
struct ModeUsage
|
||||
{
|
||||
virtual void usesMode(GLMode mode) = 0;
|
||||
virtual void usesTextureMode(GLMode mode) = 0;
|
||||
};
|
||||
|
||||
/** return the modes associated with this StateAttribute.*/
|
||||
virtual bool getModeUsage(ModeUsage&) const
|
||||
{
|
||||
// default to no GLMode's associated with use of the StateAttribute.
|
||||
return false;
|
||||
}
|
||||
|
||||
/** apply the OpenGL state attributes.
|
||||
|
||||
@@ -250,7 +250,6 @@ class SG_EXPORT StateSet : public Object
|
||||
void setMode(ModeList& modeList,StateAttribute::GLMode mode, StateAttribute::GLModeValue value);
|
||||
void setModeToInherit(ModeList& modeList,StateAttribute::GLMode mode);
|
||||
StateAttribute::GLModeValue getMode(const ModeList& modeList,StateAttribute::GLMode mode) const;
|
||||
void setAssociatedModes(ModeList& modeList,const StateAttribute* attribute, StateAttribute::GLModeValue value);
|
||||
|
||||
void setAttribute(AttributeList& attributeList,StateAttribute *attribute, const StateAttribute::OverrideValue value=StateAttribute::OFF);
|
||||
|
||||
|
||||
@@ -60,9 +60,10 @@ class SG_EXPORT Stencil : public StateAttribute
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_STENCIL_TEST);
|
||||
usage.usesMode(GL_STENCIL_TEST);
|
||||
return true;
|
||||
}
|
||||
|
||||
enum Function
|
||||
|
||||
@@ -64,10 +64,10 @@ class SG_EXPORT TexGen : public StateAttribute
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_TEXTURE_GEN_S);
|
||||
modes.push_back(GL_TEXTURE_GEN_T);
|
||||
usage.usesTextureMode(GL_TEXTURE_GEN_S);
|
||||
usage.usesTextureMode(GL_TEXTURE_GEN_T);
|
||||
|
||||
// Not happy with turning all tex gen paramters on
|
||||
// as the OSG currently only supports 2D textures and therefore
|
||||
@@ -79,8 +79,9 @@ class SG_EXPORT TexGen : public StateAttribute
|
||||
// The tidy up is now happening, but will have a think before
|
||||
// resolving the below parameters.
|
||||
|
||||
modes.push_back(GL_TEXTURE_GEN_R);
|
||||
modes.push_back(GL_TEXTURE_GEN_Q);
|
||||
usage.usesTextureMode(GL_TEXTURE_GEN_R);
|
||||
usage.usesTextureMode(GL_TEXTURE_GEN_Q);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void apply(State& state) const;
|
||||
|
||||
@@ -36,9 +36,10 @@ class SG_EXPORT Texture1D : public Texture
|
||||
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
|
||||
virtual int compare(const StateAttribute& rhs) const;
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_TEXTURE_1D);
|
||||
usage.usesTextureMode(GL_TEXTURE_1D);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Set the texture image. */
|
||||
|
||||
@@ -36,9 +36,10 @@ class SG_EXPORT Texture2D : public Texture
|
||||
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
|
||||
virtual int compare(const StateAttribute& rhs) const;
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_TEXTURE_2D);
|
||||
usage.usesTextureMode(GL_TEXTURE_2D);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Set the texture image. */
|
||||
|
||||
@@ -34,9 +34,10 @@ class SG_EXPORT Texture3D : public Texture
|
||||
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
|
||||
virtual int compare(const StateAttribute& rhs) const;
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_TEXTURE_3D);
|
||||
usage.usesTextureMode(GL_TEXTURE_3D);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Set the texture image. */
|
||||
|
||||
@@ -38,9 +38,10 @@ class SG_EXPORT TextureCubeMap : public Texture
|
||||
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
|
||||
virtual int compare(const StateAttribute& rhs) const;
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_TEXTURE_CUBE_MAP);
|
||||
usage.usesTextureMode(GL_TEXTURE_CUBE_MAP);
|
||||
return true;
|
||||
}
|
||||
|
||||
enum Face {
|
||||
|
||||
@@ -38,9 +38,10 @@ class SG_EXPORT TextureRectangle : public Texture
|
||||
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
|
||||
virtual int compare(const StateAttribute& rhs) const;
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_TEXTURE_RECTANGLE_NV);
|
||||
usage.usesTextureMode(GL_TEXTURE_RECTANGLE_NV);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Set the texture image. */
|
||||
|
||||
@@ -136,9 +136,10 @@ class SG_EXPORT VertexProgram : public StateAttribute
|
||||
return 0; // passed all the above comparison macro's, must be equal.
|
||||
}
|
||||
|
||||
virtual void getAssociatedModes(std::vector<GLMode>& modes) const
|
||||
virtual bool getModeUsage(ModeUsage& usage) const
|
||||
{
|
||||
modes.push_back(GL_VERTEX_PROGRAM_ARB);
|
||||
usage.usesMode(GL_VERTEX_PROGRAM_ARB);
|
||||
return true;
|
||||
}
|
||||
|
||||
// data access methods.
|
||||
|
||||
Reference in New Issue
Block a user