| 93 | } |
| 94 | |
| 95 | void ObjLoader::loadInto( geom::Target *target, const geom::AttribSet & /*requestedAttribs*/ ) const |
| 96 | { |
| 97 | load(); |
| 98 | |
| 99 | // copy attributes |
| 100 | if( getAttribDims( geom::Attrib::POSITION ) ) |
| 101 | target->copyAttrib( geom::Attrib::POSITION, getAttribDims( geom::Attrib::POSITION ), 0, (const float*)mOutputVertices.data(), getNumVertices() ); |
| 102 | if( getAttribDims( geom::Attrib::NORMAL ) ) |
| 103 | target->copyAttrib( geom::Attrib::NORMAL, getAttribDims( geom::Attrib::NORMAL ), 0, (const float*)mOutputNormals.data(), std::min( mOutputNormals.size(), mOutputVertices.size() ) ); |
| 104 | if( getAttribDims( geom::Attrib::TEX_COORD_0 ) ) |
| 105 | target->copyAttrib( geom::Attrib::TEX_COORD_0, getAttribDims( geom::Attrib::TEX_COORD_0 ), 0, (const float*)mOutputTexCoords.data(), std::min( mOutputTexCoords.size(), mOutputVertices.size() ) ); |
| 106 | if( getAttribDims( geom::Attrib::COLOR ) ) |
| 107 | target->copyAttrib( geom::Attrib::COLOR, getAttribDims( geom::Attrib::COLOR ), 0, (const float*)mOutputColors.data(), std::min( mOutputColors.size(), mOutputVertices.size() ) ); |
| 108 | |
| 109 | // copy indices |
| 110 | if( getNumIndices() ) |
| 111 | target->copyIndices( geom::Primitive::TRIANGLES, mOutputIndices.data(), getNumIndices(), 4 /* bytes per index */ ); |
| 112 | } |
| 113 | |
| 114 | uint8_t ObjLoader::getAttribDims( geom::Attrib attr ) const |
| 115 | { |
no test coverage detected