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

Method copyAttrib

src/cinder/ObjLoader.cpp:689–723  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

687}
688
689void ObjWriteTarget::copyAttrib( geom::Attrib attr, uint8_t dims, size_t strideBytes, const float *srcData, size_t count )
690{
691 switch( attr ) {
692 case geom::Attrib::POSITION: {
693 if( dims == 2 ) { // we need to convert to 3d
694 if( strideBytes == 0 )
695 strideBytes = sizeof(float) * 2;
696 unique_ptr<float[]> tempData( new float[count * 3] );
697 for( size_t i = 0; i < count; ++i ) {
698 tempData.get()[i*3+0] = ((const float*)(((const uint8_t*)srcData) + i*strideBytes))[0];
699 tempData.get()[i*3+1] = ((const float*)(((const uint8_t*)srcData) + i*strideBytes))[1];
700 tempData.get()[i*3+2] = 0;
701 }
702 writeData( "v", 3, 0, tempData.get(), count );
703 }
704 else
705 writeData( "v", dims, strideBytes, srcData, count );
706 }
707 break;
708 case geom::Attrib::TEX_COORD_0:
709 if( mIncludeTexCoords ) {
710 writeData( "vt", dims, strideBytes, srcData, count );
711 mHasTexCoords = true;
712 }
713 break;
714 case geom::Attrib::NORMAL:
715 if( mIncludeNormals ) {
716 writeData( "vn", dims, strideBytes, srcData, count );
717 mHasNormals = true;
718 }
719 break;
720 default:
721 break;
722 }
723}
724
725void ObjWriteTarget::copyIndices( geom::Primitive /*primitive*/, const uint32_t *source, size_t numIndices, uint8_t /*requiredBytesPerIndex*/ )
726{

Callers 1

loadIntoMethod · 0.45

Calls 1

getMethod · 0.45

Tested by

no test coverage detected