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

Function combineUVs

src/IECoreScene/Primitive.cpp:151–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151V2fVectorDataPtr combineUVs( const FloatVectorData *u, const FloatVectorData *v, const IntVectorData *indices )
152{
153 const std::vector<float> &uValues = u->readable();
154 const std::vector<float> &vValues = v->readable();
155 V2fVectorDataPtr uvs = new V2fVectorData();
156 uvs->setInterpretation( GeometricData::UV );
157
158 if( indices )
159 {
160 const std::vector<int> &indexValues = indices->readable();
161 int numUVs = 1 + *max_element( indexValues.begin(), indexValues.end() );
162 std::vector<Imath::V2f> &uvValues = uvs->writable();
163 uvValues.resize( numUVs );
164
165 for( size_t i = 0, e = indexValues.size(); i < e; ++i )
166 {
167 uvValues[indexValues[i]] = Imath::V2f( uValues[i], vValues[i] );
168 }
169 }
170 else
171 {
172 size_t numUVs = uValues.size();
173
174 std::vector<Imath::V2f> &uvValues = uvs->writable();
175 uvValues.reserve( numUVs );
176
177 for( size_t i = 0; i < numUVs; ++i )
178 {
179 uvValues.emplace_back( uValues[i], vValues[i] );
180 }
181 }
182
183 return uvs;
184}
185
186void remapToLegacyVariableNames( const IndexedIO::EntryIDList &requested, const IndexedIO::EntryIDList &existing, IndexedIO::EntryIDList &result )
187{

Callers 1

convertLegacyVariablesFunction · 0.85

Calls 6

readableMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
writableMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected