MCPcopy Create free account
hub / github.com/ImageEngine/cortex / addPrimitiveVariable

Method addPrimitiveVariable

src/IECoreGL/MeshPrimitive.cpp:84–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84void MeshPrimitive::addPrimitiveVariable( const std::string &name, const IECoreScene::PrimitiveVariable &primVar )
85{
86 if( name == "P" )
87 {
88 // update the bounding box.
89 m_memberData->bound.makeEmpty();
90 IECore::ConstV3fVectorDataPtr points = IECore::runTimeCast< IECore::V3fVectorData >( primVar.data );
91 if( points )
92 {
93 const std::vector<Imath::V3f> &p = points->readable();
94 for( unsigned int i=0; i<p.size(); i++ )
95 {
96 m_memberData->bound.extendBy( p[i] );
97 }
98 }
99 }
100
101 if ( primVar.interpolation==IECoreScene::PrimitiveVariable::FaceVarying )
102 {
103 addVertexAttribute( name, primVar.expandedData() );
104 }
105 else if ( primVar.interpolation==IECoreScene::PrimitiveVariable::Constant )
106 {
107 addUniformAttribute( name, primVar.expandedData() );
108 }
109 else if ( primVar.interpolation==IECoreScene::PrimitiveVariable::Vertex || primVar.interpolation==IECoreScene::PrimitiveVariable::Varying )
110 {
111 throw( "IECoreGL::MeshPrimitive : Invalid interpolation for \"" + name + "\". Must be FaceVarying or Constant." );
112 }
113}
114
115void MeshPrimitive::renderInstances( size_t numInstances ) const
116{

Callers

nothing calls this directly

Calls 4

makeEmptyMethod · 0.80
readableMethod · 0.80
expandedDataMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected