toJson method
Implementation
Map<String, dynamic> toJson(meta) {
bool isRootObject = (meta == null || meta is String);
if (!isRootObject && meta.textures[uuid] != null) {
return meta.textures[uuid];
}
Map<String, dynamic> output = {
"metadata": {
"version": 4.5,
"type": 'Texture',
"generator": 'Texture.toJson'
},
"uuid": uuid,
"name": name,
"image": source.toJson(meta)['uuid'],
"mapping": mapping,
"repeat": [repeat.x, repeat.y],
"offset": [offset.x, offset.y],
"center": [center.x, center.y],
"rotation": rotation,
"wrap": [wrapS, wrapT],
"format": format,
"type": type,
"encoding": encoding,
"minFilter": minFilter,
"magFilter": magFilter,
"anisotropy": anisotropy,
"flipY": flipY,
"premultiplyAlpha": premultiplyAlpha,
"unpackAlignment": unpackAlignment
};
if (userData.isNotEmpty) output["userData"] = userData;
if (!isRootObject) {
meta.textures[uuid] = output;
}
return output;
}