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

Function deletePoints

src/IECoreScene/PointsAlgo.cpp:111–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109
110template<typename T>
111PointsPrimitivePtr deletePoints( const PointsPrimitive *pointsPrimitive, IECoreScene::PrimitiveVariable::IndexedView<T>& deleteFlagView, bool invert, const Canceller *canceller )
112{
113 PointsPrimitivePtr outPointsPrimitive = new PointsPrimitive( 0 );
114
115 IECoreScene::PrimitiveVariableAlgos::DeleteFlaggedUniformFunctor<T> vertexFunctor( deleteFlagView, invert );
116
117 for( PrimitiveVariableMap::const_iterator it = pointsPrimitive->variables.begin(), e = pointsPrimitive->variables.end(); it != e; ++it )
118 {
119 Canceller::check( canceller );
120 switch( it->second.interpolation )
121 {
122 case PrimitiveVariable::Vertex:
123 case PrimitiveVariable::Varying:
124 case PrimitiveVariable::FaceVarying:
125 {
126 if( !pointsPrimitive->isPrimitiveVariableValid( it->second ) )
127 {
128 throw InvalidArgumentException(
129 boost::str ( boost::format( "PointsAlgo::deletePoints cannot process invalid primitive variable \"%s\"" ) % it->first ) );
130 }
131 const IECore::Data *inputData = it->second.data.get();
132 vertexFunctor.setIndices( it->second.indices.get() );
133 IECoreScene::PrimitiveVariableAlgos::IndexedData indexedData = dispatch( inputData, vertexFunctor );
134 outPointsPrimitive->variables[it->first] = PrimitiveVariable( it->second.interpolation, indexedData.data, indexedData.indices );
135 break;
136 }
137 case PrimitiveVariable::Uniform:
138 case PrimitiveVariable::Constant:
139 case PrimitiveVariable::Invalid:
140 {
141 outPointsPrimitive->variables[it->first] = it->second;
142 break;
143 }
144 }
145 }
146
147 V3fVectorDataPtr positionData = outPointsPrimitive->variableData<V3fVectorData>( "P" );
148 if( positionData )
149 {
150 outPointsPrimitive->setNumPoints( positionData->readable().size() );
151 }
152
153 return outPointsPrimitive;
154}
155
156struct CollectDataFn
157{

Callers 1

deletePointsWrapperFunction · 0.85

Calls 11

InvalidArgumentExceptionFunction · 0.85
PrimitiveVariableFunction · 0.85
setIndicesMethod · 0.80
setNumPointsMethod · 0.80
readableMethod · 0.80
strFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected