Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# osg::Uniform Class Reference

Uniform encapsulates glUniform values. More...

Inheritance diagram for osg::Uniform:

[legend]
List of all members.

## Public Types
typedef std::vector< StateSet * > | ParentList
| A vector of osg::StateSet pointers which is used to store the parent(s) of this Uniform, the parents could be osg::Node or osg::Drawable.
enum | Type { FLOAT = GL_FLOAT, FLOAT_VEC2 = GL_FLOAT_VEC2, FLOAT_VEC3 = GL_FLOAT_VEC3, FLOAT_VEC4 = GL_FLOAT_VEC4, INT = GL_INT, INT_VEC2 = GL_INT_VEC2, INT_VEC3 = GL_INT_VEC3, INT_VEC4 = GL_INT_VEC4, BOOL = GL_BOOL, BOOL_VEC2 = GL_BOOL_VEC2, BOOL_VEC3 = GL_BOOL_VEC3, BOOL_VEC4 = GL_BOOL_VEC4, FLOAT_MAT2 = GL_FLOAT_MAT2, FLOAT_MAT3 = GL_FLOAT_MAT3, FLOAT_MAT4 = GL_FLOAT_MAT4, SAMPLER_1D = GL_SAMPLER_1D, SAMPLER_2D = GL_SAMPLER_2D, SAMPLER_3D = GL_SAMPLER_3D, SAMPLER_CUBE = GL_SAMPLER_CUBE, SAMPLER_1D_SHADOW = GL_SAMPLER_1D_SHADOW, SAMPLER_2D_SHADOW = GL_SAMPLER_2D_SHADOW, UNDEFINED = -1 }
## Public Member Functions
| Uniform ()
| Uniform (Type type, const std::string &name)
| Uniform (const Uniform &rhs, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
| Copy constructor using CopyOp to manage deep vs shallow copy.
| META_Object (osg, Uniform)
bool | setType (Type t)
| Set the type of glUniform.
const Type | getType () const
| Get the type of glUniform as enum.
void | setName (const std::string &name)
| Set the name of the glUniform, checking to make sure its only set once.
| Uniform (const char *name, float f)
| convenient construction w/ assignment
| Uniform (const char *name, int i)
| Uniform (const char *name, bool b)
| Uniform (const char *name, const osg::Vec2 &v2)
| Uniform (const char *name, const osg::Vec3 &v3)
| Uniform (const char *name, const osg::Vec4 &v4)
| Uniform (const char *name, const osg::Matrix2 &m2)
| Uniform (const char *name, const osg::Matrix3 &m3)
| Uniform (const char *name, const osg::Matrixf &m4)
| Uniform (const char *name, const osg::Matrixd &m4)
| Uniform (const char *name, int i0, int i1)
| Uniform (const char *name, int i0, int i1, int i2)
| Uniform (const char *name, int i0, int i1, int i2, int i3)
| Uniform (const char *name, bool b0, bool b1)
| Uniform (const char *name, bool b0, bool b1, bool b2)
| Uniform (const char *name, bool b0, bool b1, bool b2, bool b3)
virtual int | compare (const Uniform &rhs) const
| return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
virtual int | compareData (const Uniform &rhs) const
bool | operator< (const Uniform &rhs) const
bool | operator== (const Uniform &rhs) const
bool | operator!= (const Uniform &rhs) const
void | copyData (const Uniform &rhs)
const ParentList & | getParents () const
| Get the parent list of this Uniform.
ParentList | getParents ()
| Get the a copy of parent list of node.
StateSet * | getParent (unsigned int i)
const StateSet * | getParent (unsigned int i) const
| Get a single const parent of this Uniform.
unsigned int | getNumParents () const
| Get the number of parents of this Uniform.
bool | set (float f)
| value assignment
bool | set (int i)
bool | set (bool b)
bool | set (const osg::Vec2 &v2)
bool | set (const osg::Vec3 &v3)
bool | set (const osg::Vec4 &v4)
bool | set (const osg::Matrix2 &m2)
bool | set (const osg::Matrix3 &m3)
bool | set (const osg::Matrixf &m4)
bool | set (const osg::Matrixd &m4)
bool | set (int i0, int i1)
bool | set (int i0, int i1, int i2)
bool | set (int i0, int i1, int i2, int i3)
bool | set (bool b0, bool b1)
bool | set (bool b0, bool b1, bool b2)
bool | set (bool b0, bool b1, bool b2, bool b3)
bool | get (float &f) const
| value query
bool | get (int &i) const
bool | get (bool &b) const
bool | get (osg::Vec2 &v2) const
bool | get (osg::Vec3 &v3) const
bool | get (osg::Vec4 &v4) const
bool | get (osg::Matrix2 &m2) const
bool | get (osg::Matrix3 &m3) const
bool | get (osg::Matrixf &m4) const
bool | get (osg::Matrixd &m4) const
bool | get (int &i0, int &i1) const
bool | get (int &i0, int &i1, int &i2) const
bool | get (int &i0, int &i1, int &i2, int &i3) const
bool | get (bool &b0, bool &b1) const
bool | get (bool &b0, bool &b1, bool &b2) const
bool | get (bool &b0, bool &b1, bool &b2, bool &b3) const
void | setUpdateCallback (Callback *uc)
| Set the UpdateCallback which allows users to attach customize the updating of an object during the update traversal.
Callback * | getUpdateCallback ()
| Get the non const UpdateCallback.
const Callback * | getUpdateCallback () const
| Get the const UpdateCallback.
void | setEventCallback (Callback *ec)
| Set the EventCallback which allows users to attach customize the updating of an object during the Event traversal.
Callback * | getEventCallback ()
| Get the non const EventCallback.
const Callback * | getEventCallback () const
| Get the const EventCallback.
void | dirty ()
| Increment the modified count on the Uniform so ProgramObjects watching it know it update themselves.
void | setModifiedCount (unsigned int mc)
unsigned int | getModifiedCount () const
void | apply (const GL2Extensions *ext, GLint location) const
## Static Public Member Functions
const char * | getTypename (Type t)
| Return the name of a Type enum as string.
Uniform::Type | getTypeId (const std::string &tname)
| Return the Type enum of a Uniform typename string.
Type | getGlApiType (Type t)
| Return the GL API type corresponding to a GLSL type.
## Protected Member Functions
virtual | ~Uniform ()
Uniform & | operator= (const Uniform &)
bool | isCompatibleType (Type t) const
void | addParent (osg::StateSet *object)
void | removeParent (osg::StateSet *object)
## Protected Attributes
ParentList | _parents
Type | _type
union {
GLfloat f1
GLfloat f2 [2]
GLfloat f3 [3]
GLfloat f4 [4]
GLfloat f9 [9]
GLfloat f16 [16]
GLint i1
GLint i2 [2]
GLint i3 [3]
GLint i4 [4]
} | _data
ref_ptr< Callback > | _updateCallback
ref_ptr< Callback > | _eventCallback
unsigned int | _modifiedCount

## Detailed Description

Uniform encapsulates glUniform values.

## Member Typedef Documentation

typedef std::vector<StateSet*> osg::Uniform::ParentList

| A vector of osg::StateSet pointers which is used to store the parent(s) of this Uniform, the parents could be osg::Node or osg::Drawable.

## Member Enumeration Documentation

enum osg::Uniform::Type

  | Enumeration values:
  FLOAT |
  FLOAT_VEC2 |
  FLOAT_VEC3 |
  FLOAT_VEC4 |
  INT |
  INT_VEC2 |
  INT_VEC3 |
  INT_VEC4 |
  BOOL |
  BOOL_VEC2 |
  BOOL_VEC3 |
  BOOL_VEC4 |
  FLOAT_MAT2 |
  FLOAT_MAT3 |
  FLOAT_MAT4 |
  SAMPLER_1D |
  SAMPLER_2D |
  SAMPLER_3D |
  SAMPLER_CUBE |
  SAMPLER_1D_SHADOW |
  SAMPLER_2D_SHADOW |
  UNDEFINED |

## Constructor & Destructor Documentation

osg::Uniform::Uniform | ( |  | ) |

osg::Uniform::Uniform | ( | Type | type,
|  | const std::string & | name
| ) |

osg::Uniform::Uniform | ( | const Uniform & | rhs,
|  | const CopyOp & | copyop = CopyOp::SHALLOW_COPY
| ) |

| Copy constructor using CopyOp to manage deep vs shallow copy.

osg::Uniform::Uniform | ( | const char * | name,
|  | float | f
| ) | `[explicit]`

| convenient construction w/ assignment

osg::Uniform::Uniform | ( | const char * | name,
|  | int | i
| ) | `[explicit]`

osg::Uniform::Uniform | ( | const char * | name,
|  | bool | b
| ) | `[explicit]`

osg::Uniform::Uniform | ( | const char * | name,
|  | const osg::Vec2 & | v2
| ) |

osg::Uniform::Uniform | ( | const char * | name,
|  | const osg::Vec3 & | v3
| ) |

osg::Uniform::Uniform | ( | const char * | name,
|  | const osg::Vec4 & | v4
| ) |

osg::Uniform::Uniform | ( | const char * | name,
|  | const osg::Matrix2 & | m2
| ) |

osg::Uniform::Uniform | ( | const char * | name,
|  | const osg::Matrix3 & | m3
| ) |

osg::Uniform::Uniform | ( | const char * | name,
|  | const osg::Matrixf & | m4
| ) |

osg::Uniform::Uniform | ( | const char * | name,
|  | const osg::Matrixd & | m4
| ) |

osg::Uniform::Uniform | ( | const char * | name,
|  | int | i0,
|  | int | i1
| ) |

osg::Uniform::Uniform | ( | const char * | name,
|  | int | i0,
|  | int | i1,
|  | int | i2
| ) |

osg::Uniform::Uniform | ( | const char * | name,
|  | int | i0,
|  | int | i1,
|  | int | i2,
|  | int | i3
| ) |

osg::Uniform::Uniform | ( | const char * | name,
|  | bool | b0,
|  | bool | b1
| ) |

osg::Uniform::Uniform | ( | const char * | name,
|  | bool | b0,
|  | bool | b1,
|  | bool | b2
| ) |

osg::Uniform::Uniform | ( | const char * | name,
|  | bool | b0,
|  | bool | b1,
|  | bool | b2,
|  | bool | b3
| ) |

virtual osg::Uniform::~Uniform | ( |  | ) | `[protected, virtual]`

## Member Function Documentation

void osg::Uniform::addParent | ( | osg::StateSet * | object | ) | `[protected]`

void osg::Uniform::apply | ( | const GL2Extensions * | ext,
|  | GLint | location
| ) | const

virtual int osg::Uniform::compare | ( | const Uniform & | rhs | ) | const`[virtual]`

| return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.

virtual int osg::Uniform::compareData | ( | const Uniform & | rhs | ) | const`[virtual]`

void osg::Uniform::copyData | ( | const Uniform & | rhs | ) |

void osg::Uniform::dirty | ( |  | ) | `[inline]`

| Increment the modified count on the Uniform so ProgramObjects watching it know it update themselves. note, autoatmatically call bet Uniform::set(*).

bool osg::Uniform::get | ( | bool & | b0,
|  | bool & | b1,
|  | bool & | b2,
|  | bool & | b3
| ) | const

bool osg::Uniform::get | ( | bool & | b0,
|  | bool & | b1,
|  | bool & | b2
| ) | const

bool osg::Uniform::get | ( | bool & | b0,
|  | bool & | b1
| ) | const

bool osg::Uniform::get | ( | int & | i0,
|  | int & | i1,
|  | int & | i2,
|  | int & | i3
| ) | const

bool osg::Uniform::get | ( | int & | i0,
|  | int & | i1,
|  | int & | i2
| ) | const

bool osg::Uniform::get | ( | int & | i0,
|  | int & | i1
| ) | const

bool osg::Uniform::get | ( | osg::Matrixd & | m4 | ) | const

bool osg::Uniform::get | ( | osg::Matrixf & | m4 | ) | const

bool osg::Uniform::get | ( | osg::Matrix3 & | m3 | ) | const

bool osg::Uniform::get | ( | osg::Matrix2 & | m2 | ) | const

bool osg::Uniform::get | ( | osg::Vec4 & | v4 | ) | const

bool osg::Uniform::get | ( | osg::Vec3 & | v3 | ) | const

bool osg::Uniform::get | ( | osg::Vec2 & | v2 | ) | const

bool osg::Uniform::get | ( | bool & | b | ) | const

bool osg::Uniform::get | ( | int & | i | ) | const

bool osg::Uniform::get | ( | float & | f | ) | const

| value query

const Callback* osg::Uniform::getEventCallback | ( |  | ) | const`[inline]`

| Get the const EventCallback.

Callback* osg::Uniform::getEventCallback | ( |  | ) | `[inline]`

| Get the non const EventCallback.

Type osg::Uniform::getGlApiType | ( | Type | t | ) | `[static]`

| Return the GL API type corresponding to a GLSL type.

unsigned int osg::Uniform::getModifiedCount | ( |  | ) | const`[inline]`

unsigned int osg::Uniform::getNumParents | ( |  | ) | const`[inline]`

| Get the number of parents of this Uniform. Returns: the number of parents of this Uniform.

const StateSet* osg::Uniform::getParent | ( | unsigned int | i | ) | const`[inline]`

  | Get a single const parent of this Uniform. Parameters:
  i | index of the parent to get.
Returns: the parent i.

StateSet* osg::Uniform::getParent | ( | unsigned int | i | ) | `[inline]`

ParentList osg::Uniform::getParents | ( |  | ) | `[inline]`

| Get the a copy of parent list of node. A copy is returned to prevent modification of the parent list.

const ParentList& osg::Uniform::getParents | ( |  | ) | const`[inline]`

| Get the parent list of this Uniform.

const Type osg::Uniform::getType | ( |  | ) | const`[inline]`

| Get the type of glUniform as enum.

Uniform::Type osg::Uniform::getTypeId | ( | const std::string & | tname | ) | `[static]`

| Return the Type enum of a Uniform typename string.

const char* osg::Uniform::getTypename | ( | Type | t | ) | `[static]`

| Return the name of a Type enum as string.

const Callback* osg::Uniform::getUpdateCallback | ( |  | ) | const`[inline]`

| Get the const UpdateCallback.

Callback* osg::Uniform::getUpdateCallback | ( |  | ) | `[inline]`

| Get the non const UpdateCallback.

bool osg::Uniform::isCompatibleType | ( | Type | t | ) | const`[protected]`

osg::Uniform::META_Object | ( | osg | ,
|  | Uniform |
| ) |

bool osg::Uniform::operator!= | ( | const Uniform & | rhs | ) | const`[inline]`

bool osg::Uniform::operator< | ( | const Uniform & | rhs | ) | const`[inline]`

Uniform& osg::Uniform::operator= | ( | const Uniform & |  | ) | `[inline, protected]`

bool osg::Uniform::operator== | ( | const Uniform & | rhs | ) | const`[inline]`

void osg::Uniform::removeParent | ( | osg::StateSet * | object | ) | `[protected]`

bool osg::Uniform::set | ( | bool | b0,
|  | bool | b1,
|  | bool | b2,
|  | bool | b3
| ) |

bool osg::Uniform::set | ( | bool | b0,
|  | bool | b1,
|  | bool | b2
| ) |

bool osg::Uniform::set | ( | bool | b0,
|  | bool | b1
| ) |

bool osg::Uniform::set | ( | int | i0,
|  | int | i1,
|  | int | i2,
|  | int | i3
| ) |

bool osg::Uniform::set | ( | int | i0,
|  | int | i1,
|  | int | i2
| ) |

bool osg::Uniform::set | ( | int | i0,
|  | int | i1
| ) |

bool osg::Uniform::set | ( | const osg::Matrixd & | m4 | ) |

bool osg::Uniform::set | ( | const osg::Matrixf & | m4 | ) |

bool osg::Uniform::set | ( | const osg::Matrix3 & | m3 | ) |

bool osg::Uniform::set | ( | const osg::Matrix2 & | m2 | ) |

bool osg::Uniform::set | ( | const osg::Vec4 & | v4 | ) |

bool osg::Uniform::set | ( | const osg::Vec3 & | v3 | ) |

bool osg::Uniform::set | ( | const osg::Vec2 & | v2 | ) |

bool osg::Uniform::set | ( | bool | b | ) |

bool osg::Uniform::set | ( | int | i | ) |

bool osg::Uniform::set | ( | float | f | ) |

| value assignment

void osg::Uniform::setEventCallback | ( | Callback * | ec | ) |

| Set the EventCallback which allows users to attach customize the updating of an object during the Event traversal.

void osg::Uniform::setModifiedCount | ( | unsigned int | mc | ) | `[inline]`

void osg::Uniform::setName | ( | const std::string & | name | ) |

| Set the name of the glUniform, checking to make sure its only set once. Reimplemented from osg::Object.

bool osg::Uniform::setType | ( | Type | t | ) |

| Set the type of glUniform.

void osg::Uniform::setUpdateCallback | ( | Callback * | uc | ) |

| Set the UpdateCallback which allows users to attach customize the updating of an object during the update traversal.

## Member Data Documentation

union { ... } osg::Uniform::_data`[protected]`

ref_ptr<Callback> osg::Uniform::_eventCallback`[protected]`

unsigned int osg::Uniform::_modifiedCount`[protected]`

ParentList osg::Uniform::_parents`[protected]`

Type osg::Uniform::_type`[protected]`

ref_ptr<Callback> osg::Uniform::_updateCallback`[protected]`

GLfloat osg::Uniform::f1`[protected]`

GLfloat osg::Uniform::f16[16]`[protected]`

GLfloat osg::Uniform::f2[2]`[protected]`

GLfloat osg::Uniform::f3[3]`[protected]`

GLfloat osg::Uniform::f4[4]`[protected]`

GLfloat osg::Uniform::f9[9]`[protected]`

GLint osg::Uniform::i1`[protected]`

GLint osg::Uniform::i2[2]`[protected]`

GLint osg::Uniform::i3[3]`[protected]`

GLint osg::Uniform::i4[4]`[protected]`

The documentation for this class was generated from the following file:

- Uniform