+ m_parameters = parsedJson[QLatin1String("parameters")].toMap();
+ QVariantMap attachedShaders =
+ parsedJson[QLatin1String("shaders")].toMap();
+ QVariantMap::const_iterator itr;
+
+
+ for (itr = attachedShaders.constBegin(); itr != attachedShaders.constEnd();
+ ++itr) {
+ QString type = itr.key();
+ QString source = itr.value().toString();
+ m_shaderSources[type] = source;
+ }
+
+ m_uniforms = parsedJson[QLatin1String("uniforms")].toMap();
+
+ QVariantMap textures =
+ parsedJson[QLatin1String("textures")].toMap();
+ for (itr = textures.constBegin(); itr != textures.constEnd(); ++itr) {
+ QVariantMap image = itr.value().toMap();
+ QSize size(image[QLatin1String("__width__")].toInt(),
+ image[QLatin1String("__height__")].toInt());
+ QString cls = image[QLatin1String("__class__")].toString();
+ QString type = image[QLatin1String("__type__")].toString();
+ bool normalized =
+ image[QLatin1String("__normalized__")].toBool();
+ int numChannels =
+ image[QLatin1String("__channels__")].toInt();
+ int depth =
+ image[QLatin1String("__depth__")].toInt();
+ QString formatName =
+ image[QLatin1String("__format__")].toString();
+
+ Q_ASSERT(type == QLatin1String("uint8"));
+ Q_ASSERT(normalized == true);
+ Q_UNUSED(normalized);
+
+ QByteArray dataArray =
+ image[QLatin1String("__data__")].toByteArray();
+
+ ApiTexture tex;
+ tex.setSize(size);
+ tex.setDepth(depth);
+ tex.setFormatName(formatName);
+ tex.setNumChannels(numChannels);
+ tex.setLabel(itr.key());
+ tex.contentsFromBase64(dataArray);
+
+ m_textures.append(tex);
+ }
+
+ QVariantMap fbos =
+ parsedJson[QLatin1String("framebuffer")].toMap();
+ for (itr = fbos.constBegin(); itr != fbos.constEnd(); ++itr) {
+ QVariantMap buffer = itr.value().toMap();
+ QSize size(buffer[QLatin1String("__width__")].toInt(),
+ buffer[QLatin1String("__height__")].toInt());
+ QString cls = buffer[QLatin1String("__class__")].toString();
+ QString type = buffer[QLatin1String("__type__")].toString();
+ bool normalized = buffer[QLatin1String("__normalized__")].toBool();
+ int numChannels = buffer[QLatin1String("__channels__")].toInt();
+ int depth = buffer[QLatin1String("__depth__")].toInt();
+ QString formatName = buffer[QLatin1String("__format__")].toString();
+
+ Q_ASSERT(type == QLatin1String("uint8"));
+ Q_ASSERT(normalized == true);
+ Q_UNUSED(normalized);
+
+ QByteArray dataArray =
+ buffer[QLatin1String("__data__")].toByteArray();
+
+ ApiFramebuffer fbo;
+ fbo.setSize(size);
+ fbo.setDepth(depth);
+ fbo.setFormatName(formatName);
+ fbo.setNumChannels(numChannels);
+ fbo.setType(itr.key());
+ fbo.contentsFromBase64(dataArray);
+ m_framebuffers.append(fbo);
+ }