Go to the documentation of this file.
16 #ifndef SURGSIM_GRAPHICS_OSGUNIFORM_INL_H
17 #define SURGSIM_GRAPHICS_OSGUNIFORM_INL_H
46 osg::Uniform::Type osgUniformType = getOsgUniformType<T>();
47 SURGSIM_ASSERT(osgUniformType != osg::Uniform::UNDEFINED) <<
"Failed to get OSG uniform type!";
48 SURGSIM_ASSERT(m_uniform->setType(osgUniformType)) <<
"Failed to set OSG uniform type!";
49 m_uniform->setNumElements(1);
56 " Uniform: " << getName() <<
" value: " << value;
76 osg::Uniform::Type osgUniformType = getOsgUniformType<T>();
77 SURGSIM_ASSERT(osgUniformType != osg::Uniform::UNDEFINED) <<
"Failed to get OSG uniform type!";
86 return m_uniform->getNumElements();
92 SURGSIM_ASSERT(m_uniform->setElement(index,
toOsg(value))) <<
"Failed to set OSG uniform value!" <<
93 " Uniform: " << getName() <<
" index: " << index <<
" value: " << value;
94 m_value[index] = value;
101 "Number of elements (" << value.size() <<
") must match uniform's number of elements (" <<
102 m_uniform->getNumElements() <<
")! Uniform: " << getName();
103 for (
size_t i = 0; i < value.size(); ++i)
105 setElement(i, value[i]);
112 SURGSIM_ASSERT(node.IsSequence()) <<
"Yaml setter called on vector uniform with non-sequence yaml node.";
113 set(node.as<std::vector<T>>());
119 return m_value[index];
132 #endif // SURGSIM_GRAPHICS_OSGUNIFORM_INL_H
#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
Definition: CompoundShapeToGraphics.cpp:29
const T & toOsg(const T &value)
Default type conversion to OSG.
Definition: OsgUniform-inl.h:37