/*

{
    "topFace" : "~/burp/faceZ/.png",
    "bottomFace" : "~/burp/faceZ-/.png",
    "leftFace" : "~/burp/faceY/.png",
    "rightFace" : "~/burp/faceY-/.png",
    "frontFace" : "~/burp/faceX/.png",
    "backFace" : "~/burp/faceX-/.png",
    "frameStart" : 1,
    "frameStop" : 499,
    "outputWidth" : 4094,
    "antialiasing" : 1,
    "aaPattern" : "grid",
    "frames": [
          {"cubemap": 1, "fov": 180, "pitch" : 0, "yaw" : 0, "roll" : 0, "zoom" : 0},
          {"cubemap": 1, "fov": 180, "pitch" : 1, "yaw" : 2, "roll" : 3, "zoom" : 4},
          {"cubemap": 1, "fov": 180, "pitch" : 2, "yaw" : 3, "roll" : 4, "zoom" : 1},
          {"cubemap": 1, "fov": 180, "pitch" : 3, "yaw" : 4, "roll" : 1, "zoom" : 2},
          {"cubemap": 1, "fov": 180, "pitch" : 4, "yaw" : 1, "roll" : 2, "zoom" : 3}
        ]
}

  */
void JSonIO::saveJSon(QString filePath){
    QFile jsonFile(filePath);
    if (!jsonFile.open(QIODevice::WriteOnly | QIODevice::Text)){
        parserState = 1;
        return;
    }

    QVariantMap root;
    root.insert("outputFile", getOutputFile());
    root.insert("topFace", getTopFace());
    root.insert("bottomFace", getBottomFace());
    root.insert("leftFace", getLeftFace());
    root.insert("rightFace", getRightFace());
    root.insert("frontFace", getFrontFace());
    root.insert("backFace", getBackFace());
    root.insert("frameStart", getFrameStart());
    root.insert("frameStop", getFrameStop());
    root.insert("outputWidth", getOutputWidth());
    root.insert("antialiasing", getAntialiasing());
    root.insert("aaPattern", getAaPattern());
    root.insert("frames", frames);

    QJson::Serializer serializer;
    QByteArray json = serializer.serialize(root);
    QTextStream out(&jsonFile);
    out.setCodec("UTF-8");
    out << json;
    jsonFile.close();
    qDebug() << "Saved to " << filePath;
}
Example #2
0
float PET::getFrameMid( int fr ) {
  return getFrameStart( fr ) + getFrameDurat( fr ) / 2.0;
}