Exemple #1
0
 shared_ptr <MeshAttributeVector> GLTFMesh::meshAttributes() {
     shared_ptr <MeshAttributeVector> meshAttributes(new MeshAttributeVector());
     vector <GLTF::Semantic> allSemantics = this->allSemantics();
     std::map<string, unsigned int> semanticAndSetToIndex;
     
     for (unsigned int i = 0 ; i < allSemantics.size() ; i++) {
         GLTF::Semantic semantic = allSemantics[i];
         size_t attributesCount = this->getMeshAttributesCountForSemantic(semantic);
         for (size_t j = 0 ; j < attributesCount ; j++) {
             shared_ptr <GLTF::GLTFAccessor> selectedMeshAttribute = this->getMeshAttribute(semantic, j);
             unsigned int indexSet = j;
             std::string semanticIndexSetKey = keyWithSemanticAndSet(semantic, indexSet);
             unsigned int size = (unsigned int)meshAttributes->size();
             semanticAndSetToIndex[semanticIndexSetKey] = size;
             
             meshAttributes->push_back(selectedMeshAttribute);
         }
     }
     return meshAttributes;
 }
Exemple #2
0
 shared_ptr <MeshAttributeVector> GLTFMesh::meshAttributes() {
     shared_ptr <MeshAttributeVector> meshAttributes(new MeshAttributeVector());
     vector <GLTF::Semantic> allSemantics = this->allSemantics();
     std::map<string, unsigned int> semanticAndSetToIndex;
     
     for (unsigned int i = 0 ; i < allSemantics.size() ; i++) {
         IndexSetToMeshAttributeHashmap& indexSetToMeshAttribute = this->getMeshAttributesForSemantic(allSemantics[i]);
         IndexSetToMeshAttributeHashmap::const_iterator meshAttributeIterator;
         for (meshAttributeIterator = indexSetToMeshAttribute.begin() ; meshAttributeIterator != indexSetToMeshAttribute.end() ; meshAttributeIterator++) {
             //(*it).first;             // the key value (of type Key)
             //(*it).second;            // the mapped value (of type T)
             shared_ptr <GLTF::GLTFMeshAttribute> selectedMeshAttribute = (*meshAttributeIterator).second;
             unsigned int indexSet = (*meshAttributeIterator).first;
             GLTF::Semantic semantic = allSemantics[i];
             std::string semanticIndexSetKey = keyWithSemanticAndSet(semantic, indexSet);
             unsigned int size = (unsigned int)meshAttributes->size();
             semanticAndSetToIndex[semanticIndexSetKey] = size;
             
             meshAttributes->push_back(selectedMeshAttribute);
         }
     }
     return meshAttributes;
 }