MCPcopy Create free account
hub / github.com/cinder/Cinder / copyIndices

Method copyIndices

src/cinder/ObjLoader.cpp:725–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

723}
724
725void ObjWriteTarget::copyIndices( geom::Primitive /*primitive*/, const uint32_t *source, size_t numIndices, uint8_t /*requiredBytesPerIndex*/ )
726{
727 for( size_t i = 0; i < numIndices; i += 3 ) {
728 ostringstream os;
729 os << "f ";
730 if( mHasNormals && mHasTexCoords ) {
731 os << source[i+0]+1 << "/" << source[i+0]+1 << "/" << source[i+0]+1 << " ";
732 os << source[i+1]+1 << "/" << source[i+1]+1 << "/" << source[i+1]+1 << " ";
733 os << source[i+2]+1 << "/" << source[i+2]+1 << "/" << source[i+2]+1 << " ";
734 }
735 else if( mHasNormals ) {
736 os << source[i+0]+1 << "//" << source[i+0]+1 << " ";
737 os << source[i+1]+1 << "//" << source[i+1]+1 << " ";
738 os << source[i+2]+1 << "//" << source[i+2]+1 << " ";
739 }
740 else if( mHasTexCoords ) {
741 os << source[i+0]+1 << "/" << source[i+0]+1 << " ";
742 os << source[i+1]+1 << "/" << source[i+1]+1 << " ";
743 os << source[i+2]+1 << "/" << source[i+2]+1 << " ";
744 }
745 else { // just verts
746 os << source[i+0]+1 << " ";
747 os << source[i+1]+1 << " ";
748 os << source[i+2]+1 << " ";
749 }
750 os << std::endl;
751 mStream->writeData( os.str().c_str(), os.str().length() );
752 }
753}
754} // anonymous namespace
755
756void writeObj( const DataTargetRef &dataTarget, const geom::Source &source, bool includeNormals, bool includeTexCoords )

Callers 1

loadIntoMethod · 0.45

Calls 4

writeDataMethod · 0.45
c_strMethod · 0.45
strMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected