14#ifndef OSG_STATEATTRIBUTE
15#define OSG_STATEATTRIBUTE 1
30#define GL_COLOR_SUM 0x8458
48#define META_StateAttribute(library,name,type) \
49 virtual osg::Object* cloneType() const { return new name(); } \
50 virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new name (*this,copyop); } \
51 virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const name *>(obj)!=NULL; } \
52 virtual const char* libraryName() const { return #library; } \
53 virtual const char* className() const { return #name; } \
54 virtual Type getType() const { return type; }
57#define COMPARE_StateAttribute_Types(TYPE,rhs_attribute) \
58 if (this==&rhs_attribute) return 0;\
59 const std::type_info* type_lhs = &typeid(*this);\
60 const std::type_info* type_rhs = &typeid(rhs_attribute);\
61 if (type_lhs->before(*type_rhs)) return -1;\
62 if (*type_lhs != *type_rhs) return 1;\
63 const TYPE& rhs = static_cast<const TYPE&>(rhs_attribute);
69#define COMPARE_StateAttribute_Parameter(parameter) \
70 if (parameter<rhs.parameter) return -1; \
71 if (rhs.parameter<parameter) return 1;
245 virtual const char*
className()
const {
return "StateAttribute"; }
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
T * get(unsigned int contextID)
Definition ContextData:152
Deprecated.
Definition Callback:246
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Object()
Construct an object.
Definition Object:69
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
Base class for state attributes.
Definition StateAttribute:77
GLenum GLMode
GLMode is the value used in glEnable/glDisable(mode)
Definition StateAttribute:81
Values
list values which can be used to set either GLModeValues or OverrideValues.
Definition StateAttribute:99
@ INHERIT
means that GLMode or StateAttribute should be inherited from above.
Definition StateAttribute:109
@ OVERRIDE
Overriding of GLMode's or StateAttributes is enabled, so that state below it is overridden.
Definition StateAttribute:105
@ OFF
means that associated GLMode and Override is disabled.
Definition StateAttribute:101
@ PROTECTED
Protecting of GLMode's or StateAttributes is enabled, so that state from above cannot override this a...
Definition StateAttribute:107
@ ON
means that associated GLMode is enabled and Override is disabled.
Definition StateAttribute:103
ShaderComponent * getShaderComponent()
Definition StateAttribute:304
virtual int compare(const StateAttribute &sa) const =0
Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
ref_ptr< StateAttributeCallback > _eventCallback
Definition StateAttribute:399
void removeParent(osg::StateSet *object)
const StateSet * getParent(unsigned int i) const
Get a single const parent of this StateAttribute.
Definition StateAttribute:295
virtual void compileGLObjects(State &) const
Default to nothing to compile - all state is applied immediately.
Definition StateAttribute:361
TypeMemberPair getTypeMemberPair() const
Return the TypeMemberPair that uniquely identifies this type member.
Definition StateAttribute:270
unsigned int GLModeValue
GLModeValue is used to specify whether a mode is enabled (ON) or disabled (OFF).
Definition StateAttribute:85
void setEventCallback(StateAttributeCallback *ec)
Set the EventCallback which allows users to attach customize the updating of an object during the Eve...
virtual Type getType() const =0
Return the Type identifier of the attribute's class type.
StateSet * getParent(unsigned int i)
Definition StateAttribute:289
unsigned int getNumParents() const
Get the number of parents of this StateAttribute.
Definition StateAttribute:301
virtual void resizeGLObjectBuffers(unsigned int)
Resize any per context GLObject buffers to specified size.
Definition StateAttribute:364
virtual bool isTextureAttribute() const
Return true if StateAttribute is a type which controls texturing and needs to be issued w....
Definition StateAttribute:273
const StateAttributeCallback * getUpdateCallback() const
Get the const UpdateCallback.
Definition StateAttribute:340
virtual Object * clone(const CopyOp &) const =0
Clone an attribute, with Object* return type.
virtual void apply(State &) const
apply the OpenGL state attributes.
Definition StateAttribute:358
ref_ptr< ShaderComponent > _shaderComponent
Definition StateAttribute:396
const ShaderComponent * getShaderComponent() const
Definition StateAttribute:305
Type
Type identifier to differentiate between different state types.
Definition StateAttribute:124
@ TEXGEN
Definition StateAttribute:146
@ ATOMICCOUNTERBUFFERBINDING
Definition StateAttribute:195
@ BLENDEQUATION
Definition StateAttribute:150
@ LIGHT
Definition StateAttribute:137
@ FRONTFACE
Definition StateAttribute:135
@ DEPTH
Definition StateAttribute:154
@ MATERIAL
Definition StateAttribute:129
@ FRAGMENTPROGRAM
Definition StateAttribute:162
@ POLYGONMODE
Definition StateAttribute:127
@ SHADERSTORAGEBUFFERBINDING
Definition StateAttribute:203
@ LINEWIDTH
Definition StateAttribute:140
@ VERTEX_ATTRIB_DIVISOR
Definition StateAttribute:201
@ BLENDCOLOR
Definition StateAttribute:157
@ TEXTURE
Definition StateAttribute:125
@ FRAME_BUFFER_OBJECT
Definition StateAttribute:199
@ OSGNV_PARAMETER_BLOCK
osgNV namespace
Definition StateAttribute:176
@ PATCH_PARAMETER
Definition StateAttribute:197
@ POLYGONOFFSET
Definition StateAttribute:128
@ MULTISAMPLE
Definition StateAttribute:158
@ SCISSOR
Definition StateAttribute:156
@ DEPTHRANGEINDEXED
Definition StateAttribute:208
@ ANTIALIAS
Definition StateAttribute:131
@ POLYGONSTIPPLE
Definition StateAttribute:142
@ FOG
Definition StateAttribute:134
@ CULLFACE
Definition StateAttribute:133
@ BLENDFUNC
Definition StateAttribute:149
@ UNIFORMBUFFERBINDING
Definition StateAttribute:192
@ VALIDATOR
osgFX namespace
Definition StateAttribute:172
@ TEXENV
Definition StateAttribute:144
@ VERTEXPROGRAM
Definition StateAttribute:161
@ OSGNVEXT_TEXTURE_SHADER
Definition StateAttribute:179
@ CLIPCONTROL
Definition StateAttribute:169
@ CAPABILITY
Definition StateAttribute:214
@ STENCIL
Definition StateAttribute:152
@ HINT
Definition StateAttribute:166
@ OSGNVCG_PROGRAM
osgNVCg namespace
Definition StateAttribute:184
@ SAMPLEMASKI
Definition StateAttribute:167
@ TRANSFORMFEEDBACKBUFFERBINDING
Definition StateAttribute:193
@ POINT
Definition StateAttribute:139
@ CLAMPCOLOR
Definition StateAttribute:165
@ COLORMATRIX
Definition StateAttribute:160
@ COLORTABLE
Definition StateAttribute:132
@ TEXENVFILTER
Definition StateAttribute:145
@ TEXMAT
Definition StateAttribute:147
@ SCISSORINDEXED
Definition StateAttribute:209
@ OSGNVSLANG_PROGRAM
Definition StateAttribute:187
@ LOGICOP
Definition StateAttribute:151
@ OSGNVEXT_REGISTER_COMBINERS
Definition StateAttribute:181
@ VIEWPORT
Definition StateAttribute:155
@ OSGNVEXT_VERTEX_PROGRAM
Definition StateAttribute:180
@ PRIMITIVERESTARTINDEX
Definition StateAttribute:168
@ CLIPPLANE
Definition StateAttribute:159
@ COLORMASK
Definition StateAttribute:153
@ POINTSPRITE
Definition StateAttribute:163
@ VIEWMATRIXEXTRACTOR
Definition StateAttribute:173
@ LIGHTMODEL
Definition StateAttribute:148
@ VIEWPORTINDEXED
Definition StateAttribute:207
@ INDIRECTDRAWBUFFERBINDING
Definition StateAttribute:205
@ ALPHAFUNC
Definition StateAttribute:130
@ LINESTIPPLE
Definition StateAttribute:141
@ BINDIMAGETEXTURE
Definition StateAttribute:211
@ SAMPLER
Definition StateAttribute:212
@ OSGNVPARSE_PROGRAM_PARSER
Definition StateAttribute:190
@ PROGRAM
Definition StateAttribute:164
@ SHADEMODEL
Definition StateAttribute:143
ParentList _parents
Definition StateAttribute:379
virtual const char * className() const
Return the name of the attribute's class type.
Definition StateAttribute:245
const ParentList & getParents() const
Get the parent list of this StateAttribute.
Definition StateAttribute:287
ref_ptr< StateAttributeCallback > _updateCallback
Definition StateAttribute:398
virtual StateAttribute * asStateAttribute()
Convert 'this' into a StateAttribute pointer if Object is a StateAttribute, otherwise return 0.
Definition StateAttribute:250
virtual const char * libraryName() const
Return the name of the attribute's library.
Definition StateAttribute:242
friend class osg::StateSet
Definition StateAttribute:380
osg::StateAttributeCallback Callback
Definition StateAttribute:331
std::pair< Type, unsigned int > TypeMemberPair
Simple pairing between an attribute type and the member within that attribute type group.
Definition StateAttribute:218
StateAttribute(const StateAttribute &sa, const CopyOp ©op=CopyOp::SHALLOW_COPY)
Definition StateAttribute:222
StateAttributeCallback * getEventCallback()
Get the non const EventCallback.
Definition StateAttribute:347
const StateAttributeCallback * getEventCallback() const
Get the const EventCallback.
Definition StateAttribute:350
virtual bool checkValidityOfAssociatedModes(osg::State &) const
Check the modes associated with this StateAttribute are supported by current OpenGL drivers,...
Definition StateAttribute:324
virtual bool isSameKindAs(const Object *obj) const
Return true if this and obj are of the same kind of object.
Definition StateAttribute:239
void setShaderComponent(ShaderComponent *sc)
Definition StateAttribute:303
std::vector< StateSet * > ParentList
A vector of osg::StateSet pointers which is used to store the parent(s) of this StateAttribute.
Definition StateAttribute:284
virtual bool getModeUsage(ModeUsage &) const
Return the modes associated with this StateAttribute.
Definition StateAttribute:315
void setUpdateCallback(StateAttributeCallback *uc)
Set the UpdateCallback which allows users to attach customize the updating of an object during the up...
virtual Texture * asTexture()
Fast alternative to dynamic_cast<> for determining if state attribute is a Texture.
Definition StateAttribute:257
virtual Object * cloneType() const =0
Clone the type of an attribute, with Object* return type.
StateAttributeCallback * getUpdateCallback()
Get the non const UpdateCallback.
Definition StateAttribute:337
unsigned int OverrideValue
Override is used to specify the override behavior of StateAttributes from parent to children.
Definition StateAttribute:89
void addParent(osg::StateSet *object)
virtual ~StateAttribute()
Definition StateAttribute:374
virtual void releaseGLObjects(State *=0) const
Release OpenGL objects in specified graphics context if State object is passed, otherwise release Ope...
Definition StateAttribute:369
virtual const StateAttribute * asStateAttribute() const
convert 'const this' into a const StateAttribute pointer if Object is a StateAttribute,...
Definition StateAttribute:254
virtual unsigned int getMember() const
Return the member identifier within the attribute's class type.
Definition StateAttribute:267
virtual const Texture * asTexture() const
Fast alternative to dynamic_cast<> for determining if state attribute is a Texture.
Definition StateAttribute:260
Definition StateAttribute:308
virtual ~ModeUsage()
Definition StateAttribute:309
virtual void usesTextureMode(GLMode mode)=0
virtual void usesMode(GLMode mode)=0
ref_ptr< StateAttribute > attribute
Definition StateAttribute:391
~ReassignToParents()
Destructor then reassigns the attribute to all of the parents.
ParentList parents
Definition StateAttribute:392
ReassignToParents(osg::StateAttribute *att)
Constructor caches and then removes attribute for all of it's parents.
Stores a set of modes and attributes which represent a set of OpenGL state.
Definition StateSet:46
Texture pure virtual base class that encapsulates OpenGL texture functionality common to the various ...
Definition Texture:422
#define NULL
Definition Export:55
#define OSG_EXPORT
Definition Export:39