16 #ifndef SURGSIM_GRAPHICS_OSGTEXTUREUNIFORM_INL_H 17 #define SURGSIM_GRAPHICS_OSGTEXTUREUNIFORM_INL_H 41 osg::Uniform::Type osgUniformType = getOsgUniformType<std::shared_ptr<T>>();
42 SURGSIM_ASSERT(osgUniformType != osg::Uniform::UNDEFINED) <<
"Failed to get OSG uniform type!";
68 const osg::StateSet::TextureAttributeList& textures = stateSet->getTextureAttributeList();
88 stateSet->setTextureAttributeAndModes(
m_unit,
m_texture->getOsgTexture(),
89 osg::StateAttribute::ON);
108 SURGSIM_ASSERT(
m_unit == -1) <<
"Can't set minimumTextureUnit after the unit has been assigned.";
121 #endif // SURGSIM_GRAPHICS_OSGTEXTUREUNIFORM_INL_H Definition: DriveElementFromInputBehavior.cpp:27
osg::ref_ptr< osg::StateSet > m_stateset
Definition: OsgTextureUniform.h:64
#define SURGSIM_ASSERT(condition)
Assert that condition is true.
Definition: Assert.h:77
virtual void set(const std::shared_ptr< T > &value)
Sets the value of the uniform.
Definition: OsgTextureUniform-inl.h:48
string(TOUPPER ${DEVICE}DEVICE_UPPER_CASE) option(BUILD_DEVICE_ $
Definition: CMakeLists.txt:35
std::shared_ptr< T > m_texture
Texture.
Definition: OsgTextureUniform.h:62
virtual void removeFromStateSet(osg::StateSet *stateSet)
Removes this uniform from the OSG state set.
Definition: OsgTextureUniform-inl.h:97
OsgTextureUniform(const std::string &name)
Constructor.
Definition: OsgTextureUniform-inl.h:35
void setMinimumTextureUnit(size_t unit)
This is the texture unit from where the search for a free texture unit will start.
Definition: OsgTextureUniform-inl.h:106
The header that provides the assertion API.
virtual const std::shared_ptr< T > & get() const
Returns the value of the uniform.
Definition: OsgTextureUniform-inl.h:58
OSG implementation of graphics uniform with a texture value.
Definition: OsgTextureUniform.h:30
virtual void addToStateSet(osg::StateSet *stateSet)
Adds this uniform to the OSG state set.
Definition: OsgTextureUniform-inl.h:64
ptrdiff_t m_unit
Texture unit.
Definition: OsgTextureUniform.h:67
#define SURGSIM_ADD_RW_PROPERTY(class, type, property, getter, setter)
A macro to register getter and setter for a property that is readable and writeable, order of getter and setter agrees with 'RW'.
Definition: Accessible.h:199
size_t m_minimumTextureUnit
The smallest unit to be used.
Definition: OsgTextureUniform.h:70
size_t getMinimumTextureUnit() const
Definition: OsgTextureUniform-inl.h:113