16 #ifndef SURGSIM_GRAPHICS_OSGUNIFORM_INL_H
17 #define SURGSIM_GRAPHICS_OSGUNIFORM_INL_H
44 osg::Uniform::Type osgUniformType = getOsgUniformType<T>();
45 SURGSIM_ASSERT(osgUniformType != osg::Uniform::UNDEFINED) <<
"Failed to get OSG uniform type!";
54 " Uniform: " << getName() <<
" value: " << value;
68 osg::Uniform::Type osgUniformType = getOsgUniformType<T>();
69 SURGSIM_ASSERT(osgUniformType != osg::Uniform::UNDEFINED) <<
"Failed to get OSG uniform type!";
78 return m_uniform->getNumElements();
84 SURGSIM_ASSERT(m_uniform->setElement(index,
toOsg(value))) <<
"Failed to set OSG uniform value!" <<
85 " Uniform: " << getName() <<
" index: " << index <<
" value: " << value;
86 m_value[index] = value;
93 "Number of elements (" << value.size() <<
") must match uniform's number of elements (" <<
94 m_uniform->getNumElements() <<
")! Uniform: " << getName();
95 for (
size_t i = 0; i < value.size(); ++i)
97 setElement(i, value[i]);
104 return m_value[index];
117 #endif // SURGSIM_GRAPHICS_OSGUNIFORM_INL_H
Definition: DriveElementFromInputBehavior.cpp:27
Conversions to and from OSG types.
#define SURGSIM_ASSERT(condition)
Assert that condition is true.
Definition: Assert.h:77
const osg::Matrix2 toOsg(const Eigen::Matrix< float, 2, 2, MOpt > &matrix)
Convert a fixed-size 2x2 matrix of floats to OSG.
Definition: OsgMatrixConversions.h:56
The header that provides the assertion API.