Prechádzať zdrojové kódy

Merge pull request #1916 from LoicFr/master

Add vertex color support to glTF2 export
Kim Kulling 7 rokov pred
rodič
commit
90b4b6a18d
1 zmenil súbory, kde vykonal 8 pridanie a 0 odobranie
  1. 8 0
      code/glTF2Exporter.cpp

+ 8 - 0
code/glTF2Exporter.cpp

@@ -732,6 +732,14 @@ void glTF2Exporter::ExportMeshes()
 			}
 			}
 		}
 		}
 
 
+		/*************** Vertex colors ****************/
+		for (unsigned int indexColorChannel = 0; indexColorChannel < aim->GetNumColorChannels(); ++indexColorChannel)
+		{
+			Ref<Accessor> c = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mColors[indexColorChannel], AttribType::VEC4, AttribType::VEC4, ComponentType_FLOAT, false);
+			if (c)
+				p.attributes.color.push_back(c);
+		}
+		
 		/*************** Vertices indices ****************/
 		/*************** Vertices indices ****************/
 		if (aim->mNumFaces > 0) {
 		if (aim->mNumFaces > 0) {
 			std::vector<IndicesType> indices;
 			std::vector<IndicesType> indices;