Ejemplo n.º 1
0
void MeshPart::serialize(json::BaseJSONWriter &writer) const {
	writer.obj(3);
	writer << "id" = id;
	writer << "type" = getPrimitiveTypeString(primitiveType);
	writer.val("indices").is().data(indices, 12);
	writer << json::end;
}
Ejemplo n.º 2
0
	void G3djWriter::writeMeshParts(Mesh* mesh){
		int partNumber = 0;

		for (std::vector<MeshPart*>::iterator i = mesh->parts.begin(); i != mesh->parts.end(); ++i, ++partNumber)
		{
			MeshPart *meshPart = (*i);

			if(partNumber > 0)
				writer->nextValue(true);

			writer->openObject();
			writer->writeStringPair("id", meshPart->getId().c_str());
			writer->nextValue(true);

			writer->writeStringPair("type", getPrimitiveTypeString(meshPart->_primitiveType));
			writer->nextValue(true);

			writer->openArray("indices");
			for(int i=0; i<meshPart->getIndicesCount(); i++){
				if(i>0)
					writer->nextValue(false);
				writer->writeInteger(meshPart->getIndex(i));				
			}
			writer->closeArray();
			writer->closeObject();
		}
	}