Exemplo n.º 1
0
void FileManager::saveCustomMap(QString localPath) {

    QFile file(localPath);
    if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
        return;
    flux = new QTextStream(&file);
    flux->setCodec("UTF-8");

    *flux << window->getWidth() << " " << window->getHeight() << endl;

    /* Vertices du terrain */
    saveVertices();

    /* Normales du terrain */
    saveNormales();

    /* Saison courante de la fenetre */
    *flux << window->getSeason() << endl;

    /* Arbres */
    saveTrees();

}
Exemplo n.º 2
0
bool SpriteMeshLoader::saveSpriteMesh( string filename, SkeletalDrawing* myDrawing){

    //generate arrays from location

	MeshData* myMesh=renderer->vboList[myDrawing->vboMeshID];

	vertexCount=myMesh->vData.size();

	vertices=new Vector4f[vertexCount];

	//TODO: change to 8 bit unsigned Integer!
	colors=new Vector4f[vertexCount];
	secondaryColors=new Vector3f[vertexCount];
	normals=new Vector3f[vertexCount];

	texCoords=new Vector3f[vertexCount];

	//TODO: change to 8 bit unsigned Integer!
	boneReference=new Vector4f[vertexCount];

	vertexWeights=new Vector4f[vertexCount];


    for (int i=0;i<(int)vertexCount;i++){
		vertices[i]=myMesh->vData[i].location;
        normals[i]=myMesh->vData[i].normal;

        texCoords[i]=Vector3f(myMesh->vData[i].texCoord);
        colors[i]=myMesh->vData[i].color;
        secondaryColors[i]=myMesh->vData[i].secondaryColor;

        vertexWeights[i]=myMesh->vData[i].vertexWeights;
        boneReference[i]=myMesh->vData[i].boneReferences;
    }

    //setup XML
    TiXmlDocument doc;
    TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "", "" );
    doc.LinkEndChild( decl );
    TiXmlElement * root = new TiXmlElement( "MSBPointSpriteMesh" );
    doc.LinkEndChild( root );

    saveVertices(root);
	delete(vertices);

    saveNormals(root);
	delete(normals);

    saveTexCoords(root);
	delete(texCoords);

    saveColors(root);
	delete(colors);

    saveSecondaryColors(root);
	delete(secondaryColors);

    saveBoneReferences(root);
	delete(boneReference);

    saveVertexWeights(root);
	delete(vertexWeights);

    saveBones(root, myDrawing);

    ///Bones


    doc.SaveFile( filename );
    doc.Clear();


	//createVBOs(myDrawing->vboMeshID);
	loadSpriteMesh(filename, myDrawing->vboMeshID);
    return true;
}