diff --git a/libs/yocto/yocto_sceneio.cpp b/libs/yocto/yocto_sceneio.cpp index 36013a4c2..411d8b8ec 100644 --- a/libs/yocto/yocto_sceneio.cpp +++ b/libs/yocto/yocto_sceneio.cpp @@ -1951,18 +1951,15 @@ struct json_enum_trait { }; // Load a scene in the builtin JSON format. -static void load_json_scene( - const string& filename, scene_data& scene, bool noparallel) { +static void load_json_scene_version41(const string& filename, json_value& json, + scene_data& scene, bool noparallel) { // ends with auto ends_with = [](const string& str, const string& end) { if (str.size() < end.size()) return false; return str.substr(str.size() - end.size()) == end; }; - // open file - auto json = load_json(filename); - - // check vrsion + // check version if (!json.contains("asset") || !json.at("asset").contains("version")) return load_json_scene_version40(filename, json, scene, noparallel); @@ -2002,43 +1999,9 @@ static void load_json_scene( auto material_map = unordered_map{}; // filenames - auto shape_datafiles = vector{}; - auto texture_datafiles = vector{}; - auto subdiv_datafiles = vector{}; - - // // load json instance - // struct ply_instance { - // vector frames = {}; - // }; - // using ply_instance_handle = int; - // auto ply_instances = vector{}; - // auto ply_instances_names = vector{}; - // auto ply_instance_map = unordered_map{ - // {"", invalidid}}; - // auto instance_ply = unordered_map{}; - // auto get_ist = [&scene, &ply_instances, &ply_instances_names, - // &ply_instance_map, &instance_ply](const json_value& - // json, const string& key, const instance_data& instance) - // { - // auto name = json.value(key, string{}); - // if (name.empty()) return; - // auto instance_id = (int)(&instance - scene.instances.data()); - // auto it = ply_instance_map.find(name); - // if (it != ply_instance_map.end()) { - // instance_ply[instance_id] = it->second; - // } else { - // ply_instances_names.emplace_back(name); - // ply_instances.emplace_back(ply_instance()); - // auto ply_instance_id = (int)ply_instances.size() - 1; - // ply_instance_map[name] = ply_instance_id; - // instance_ply[instance_id] = ply_instance_id; - // } - // }; - // auto get_ply_instance_name = [&ply_instances, &ply_instances_names]( - // const scene_data& scene, - // const ply_instance& instance) -> string { - // return ply_instances_names[&instance - ply_instances.data()]; - // }; + auto shape_filenames = vector{}; + auto texture_filenames = vector{}; + auto subdiv_filenames = vector{}; // prepare data auto dirname = path_dirname(filename); @@ -2080,11 +2043,11 @@ static void load_json_scene( auto& group = json.at("textures"); scene.textures.reserve(group.size()); scene.texture_names.reserve(group.size()); - texture_datafiles.reserve(group.size()); + texture_filenames.reserve(group.size()); for (auto& [key, element] : group.items()) { [[maybe_unused]] auto& texture = scene.textures.emplace_back(); scene.texture_names.push_back(key); - auto& datafile = texture_datafiles.emplace_back(); + auto& datafile = texture_filenames.emplace_back(); texture_map[key] = (int)scene.textures.size() - 1; if (element.is_string()) { auto filename = element.get(); @@ -2132,11 +2095,11 @@ static void load_json_scene( auto& group = json.at("shapes"); scene.shapes.reserve(group.size()); scene.shape_names.reserve(group.size()); - shape_datafiles.reserve(group.size()); + shape_filenames.reserve(group.size()); for (auto& [key, element] : group.items()) { [[maybe_unused]] auto& shape = scene.shapes.emplace_back(); scene.shape_names.push_back(key); - auto& datafile = shape_datafiles.emplace_back(); + auto& datafile = shape_filenames.emplace_back(); shape_map[key] = (int)scene.shapes.size() - 1; if (element.is_string()) { auto filename = element.get(); @@ -2154,11 +2117,11 @@ static void load_json_scene( auto& group = json.at("subdivs"); scene.subdivs.reserve(group.size()); scene.subdiv_names.reserve(group.size()); - subdiv_datafiles.reserve(group.size()); + subdiv_filenames.reserve(group.size()); for (auto& [key, element] : group.items()) { auto& subdiv = scene.subdivs.emplace_back(); scene.subdiv_names.emplace_back(key); - auto& datafile = subdiv_datafiles.emplace_back(); + auto& datafile = subdiv_filenames.emplace_back(); if (element.is_string()) { auto filename = element.get(); element = load_json(path_join(dirname, "subdivs", filename)); @@ -2215,47 +2178,6 @@ static void load_json_scene( } } } - // if (json.contains("object_instances")) { - // for (auto& [key, element] : json.at("object_instances").items()) { - // auto& instance = ply_instances.emplace_back(); - // if (element.is_string()) { - // auto filename = element.get(); - // element = load_json(path_join(dirname, "objects", filename)); - // } - // get_opt(element, "frame", instance.frame); - // get_rrf(element, "shape", instance.shape, shape_map); - // get_rrf(element, "material", instance.material, material_map); - // if (element.contains("lookat")) { - // get_opt(element, "lookat", (mat3f&)instance.frame); - // instance.frame = lookat_frame( - // instance.frame.x, instance.frame.y, instance.frame.z, false); - // } - // if (element.contains("ply_instance")) { - // get_ist(element, "instance", instance); - // } - // } - // } - // if (json.contains("objects")) { - // for (auto& [key, element] : json.at("objects").items()) { - // auto& instance = scene.instances.emplace_back(); - // scene.instance_names.emplace_back(key); - // if (element.is_string()) { - // auto filename = element.get(); - // element = load_json(path_join(dirname, "objects", filename)); - // } - // get_opt(element, "frame", instance.frame); - // get_rrf(element, "shape", instance.shape, shape_map); - // get_rrf(element, "material", instance.material, material_map); - // if (element.contains("lookat")) { - // get_opt(element, "lookat", (mat3f&)instance.frame); - // instance.frame = lookat_frame( - // instance.frame.x, instance.frame.y, instance.frame.z, false); - // } - // if (element.contains("ply_instance")) { - // get_ist(element, "instance", instance); - // } - // } - // } } catch (const json_error& error) { throw io_error::parse_error( filename, json_value::get_path(&json, error.where())); @@ -2266,11 +2188,11 @@ static void load_json_scene( } // fix paths - for (auto& datafile : shape_datafiles) + for (auto& datafile : shape_filenames) datafile = path_join(dirname, "shapes", datafile); - for (auto& datafile : texture_datafiles) + for (auto& datafile : texture_filenames) datafile = path_join(dirname, "textures", datafile); - for (auto& datafile : subdiv_datafiles) + for (auto& datafile : subdiv_filenames) datafile = path_join(dirname, "subdivs", datafile); // load resources @@ -2278,78 +2200,242 @@ static void load_json_scene( if (noparallel) { // load shapes for (auto idx : range(scene.shapes.size())) { - load_shape(shape_datafiles[idx], scene.shapes[idx], true); + load_shape(shape_filenames[idx], scene.shapes[idx], true); } // load subdivs for (auto idx : range(scene.subdivs.size())) { - load_subdiv(subdiv_datafiles[idx], scene.subdivs[idx]); + load_subdiv(subdiv_filenames[idx], scene.subdivs[idx]); } // load textures for (auto idx : range(scene.textures.size())) { - load_texture(texture_datafiles[idx], scene.textures[idx]); + load_texture(texture_filenames[idx], scene.textures[idx]); } - // load instances - // for (auto& ply_instance : ply_instances) { - // auto path = find_path( - // get_ply_instance_name(scene, ply_instance), "instances", - // {".ply"}); - // load_instance(path_join(dirname, path), ply_instance.frames); - // } } else { // load shapes parallel_for(scene.shapes.size(), [&](size_t idx) { - load_shape(shape_datafiles[idx], scene.shapes[idx], true); + load_shape(shape_filenames[idx], scene.shapes[idx], true); }); // load subdivs parallel_for(scene.subdivs.size(), [&](size_t idx) { - load_subdiv(subdiv_datafiles[idx], scene.subdivs[idx]); + load_subdiv(subdiv_filenames[idx], scene.subdivs[idx]); }); // load textures parallel_for(scene.textures.size(), [&](size_t idx) { - load_texture(texture_datafiles[idx], scene.textures[idx]); + load_texture(texture_filenames[idx], scene.textures[idx]); }); - // // load instances - // parallel_foreach(ply_instances, [&](auto& ply_instance) { - // auto path = find_path( - // get_ply_instance_name(scene, ply_instance), "instances", - // {".ply"}); - // load_instance(path_join(dirname, path), ply_instance.frames); - // }); } } catch (const io_error& exception) { throw io_error::dependent_error(filename, exception); } - // apply instances - // if (!ply_instances.empty()) { - // auto instances = scene.instances; - // auto instance_names = scene.instance_names; - // scene.instances.clear(); - // scene.instance_names.clear(); - // for (auto& instance : instances) { - // auto it = instance_ply.find((int)(&instance - instances.data())); - // if (it == instance_ply.end()) { - // auto& ninstance = scene.instances.emplace_back(); - // scene.instance_names.emplace_back( - // instance_names[&instance - instances.data()]); - // ninstance.frame = instance.frame; - // ninstance.shape = instance.shape; - // ninstance.material = instance.material; - // } else { - // auto& ply_instance = ply_instances[it->second]; - // auto instance_id = 0; - // for (auto& frame : ply_instance.frames) { - // auto& ninstance = scene.instances.emplace_back(); - // scene.instance_names.emplace_back( - // instance_names[&instance - instances.data()] + "_" + - // std::to_string(instance_id++)); - // ninstance.frame = frame * instance.frame; - // ninstance.shape = instance.shape; - // ninstance.material = instance.material; - // } - // } - // } - // } + // fix scene + add_missing_camera(scene); + add_missing_radius(scene); + trim_memory(scene); +} + +// Load a scene in the builtin JSON format. +static void load_json_scene( + const string& filename, scene_data& scene, bool noparallel) { + // open file + auto json = load_json(filename); + + // check version + if (!json.contains("asset") || !json.at("asset").contains("version")) + return load_json_scene_version40(filename, json, scene, noparallel); + if (json.contains("asset") && json.at("asset").contains("version") && + json.at("asset").at("version") == "4.1") + return load_json_scene_version41(filename, json, scene, noparallel); + + // parse json value + auto get_opt = [](const json_value& json, const string& key, auto& value) { + value = json.value(key, value); + }; + auto get_req = [](const json_value& json, const string& key, auto& value) { + try { + json.at(key).get(value); + } catch (const std::out_of_range&) { + throw json_error{"missing reference", &json}; + } + }; + + // filenames + auto shape_filenames = vector{}; + auto texture_filenames = vector{}; + auto subdiv_filenames = vector{}; + + // prepare data + auto dirname = path_dirname(filename); + + // parsing values + try { + if (json.contains("asset")) { + auto& element = json.at("asset"); + get_opt(element, "copyright", scene.copyright); + auto version = string{}; + get_req(element, "version", version); + if (version != "4.2" && version != "5.0") + throw json_error("bad version", &element); + } + if (json.contains("cameras")) { + auto& group = json.at("cameras"); + scene.cameras.reserve(group.size()); + scene.camera_names.reserve(group.size()); + for (auto& element : group) { + auto& camera = scene.cameras.emplace_back(); + auto& name = scene.camera_names.emplace_back(); + get_opt(element, "name", name); + get_opt(element, "frame", camera.frame); + get_opt(element, "orthographic", camera.orthographic); + get_opt(element, "ortho", camera.orthographic); + get_opt(element, "lens", camera.lens); + get_opt(element, "aspect", camera.aspect); + get_opt(element, "film", camera.film); + get_opt(element, "focus", camera.focus); + get_opt(element, "aperture", camera.aperture); + } + } + if (json.contains("textures")) { + auto& group = json.at("textures"); + scene.textures.reserve(group.size()); + scene.texture_names.reserve(group.size()); + texture_filenames.reserve(group.size()); + for (auto& element : group) { + [[maybe_unused]] auto& texture = scene.textures.emplace_back(); + auto& name = scene.texture_names.emplace_back(); + auto& uri = texture_filenames.emplace_back(); + get_opt(element, "name", name); + get_req(element, "uri", uri); + } + } + if (json.contains("materials")) { + auto& group = json.at("materials"); + scene.materials.reserve(group.size()); + scene.material_names.reserve(group.size()); + for (auto& element : json.at("materials")) { + auto& material = scene.materials.emplace_back(); + auto& name = scene.material_names.emplace_back(); + get_opt(element, "name", name); + get_opt(element, "type", material.type); + get_opt(element, "emission", material.emission); + get_opt(element, "color", material.color); + get_opt(element, "metallic", material.metallic); + get_opt(element, "roughness", material.roughness); + get_opt(element, "ior", material.ior); + get_opt(element, "trdepth", material.trdepth); + get_opt(element, "scattering", material.scattering); + get_opt(element, "scanisotropy", material.scanisotropy); + get_opt(element, "opacity", material.opacity); + get_opt(element, "emission_tex", material.emission_tex); + get_opt(element, "color_tex", material.color_tex); + get_opt(element, "roughness_tex", material.roughness_tex); + get_opt(element, "scattering_tex", material.scattering_tex); + get_opt(element, "normal_tex", material.normal_tex); + } + } + if (json.contains("shapes")) { + auto& group = json.at("shapes"); + scene.shapes.reserve(group.size()); + scene.shape_names.reserve(group.size()); + shape_filenames.reserve(group.size()); + for (auto& element : group) { + [[maybe_unused]] auto& shape = scene.shapes.emplace_back(); + auto& name = scene.shape_names.emplace_back(); + auto& uri = shape_filenames.emplace_back(); + get_opt(element, "name", name); + get_req(element, "uri", uri); + } + } + if (json.contains("subdivs")) { + auto& group = json.at("subdivs"); + scene.subdivs.reserve(group.size()); + scene.subdiv_names.reserve(group.size()); + subdiv_filenames.reserve(group.size()); + for (auto& element : group) { + auto& subdiv = scene.subdivs.emplace_back(); + auto& name = scene.subdiv_names.emplace_back(); + auto& uri = subdiv_filenames.emplace_back(); + get_opt(element, "name", name); + get_req(element, "uri", uri); + get_req(element, "shape", subdiv.shape); + get_opt(element, "subdivisions", subdiv.subdivisions); + get_opt(element, "catmullclark", subdiv.catmullclark); + get_opt(element, "smooth", subdiv.smooth); + get_opt(element, "displacement", subdiv.displacement); + get_opt(element, "displacement_tex", subdiv.displacement_tex); + } + } + if (json.contains("instances")) { + auto& group = json.at("instances"); + scene.instances.reserve(group.size()); + scene.instance_names.reserve(group.size()); + for (auto element : group) { + auto& instance = scene.instances.emplace_back(); + auto& name = scene.instance_names.emplace_back(); + get_opt(element, "name", name); + get_opt(element, "frame", instance.frame); + get_req(element, "shape", instance.shape); + get_req(element, "material", instance.material); + } + } + if (json.contains("environments")) { + auto& group = json.at("environments"); + scene.instances.reserve(group.size()); + scene.instance_names.reserve(group.size()); + for (auto& element : group) { + auto& environment = scene.environments.emplace_back(); + auto& name = scene.environment_names.emplace_back(); + get_opt(element, "name", name); + get_opt(element, "frame", environment.frame); + get_opt(element, "emission", environment.emission); + get_opt(element, "emission_tex", environment.emission_tex); + } + } + } catch (const json_error& error) { + throw io_error::parse_error( + filename, json_value::get_path(&json, error.where())); + } catch (...) { + throw io_error::parse_error(filename); + } + + // load resources + try { + if (noparallel) { + // load shapes + for (auto idx : range(scene.shapes.size())) { + load_shape( + path_join(dirname, shape_filenames[idx]), scene.shapes[idx], true); + } + // load subdivs + for (auto idx : range(scene.subdivs.size())) { + load_subdiv( + path_join(dirname, subdiv_filenames[idx]), scene.subdivs[idx]); + } + // load textures + for (auto idx : range(scene.textures.size())) { + load_texture( + path_join(dirname, texture_filenames[idx]), scene.textures[idx]); + } + } else { + // load shapes + parallel_for(scene.shapes.size(), [&](size_t idx) { + load_shape( + path_join(dirname, shape_filenames[idx]), scene.shapes[idx], true); + }); + // load subdivs + parallel_for(scene.subdivs.size(), [&](size_t idx) { + load_subdiv( + path_join(dirname, subdiv_filenames[idx]), scene.subdivs[idx]); + }); + // load textures + parallel_for(scene.textures.size(), [&](size_t idx) { + load_texture( + path_join(dirname, texture_filenames[idx]), scene.textures[idx]); + }); + } + } catch (const io_error& exception) { + throw io_error::dependent_error(filename, exception); + } // fix scene add_missing_camera(scene); @@ -2366,10 +2452,14 @@ static void save_json_scene( item = json_object{}; return item; }; - auto add_value = [](json_value& json, const string& name, - const auto& value) -> json_value& { + auto add_array = [](json_value& json, const string& name) -> json_value& { auto& item = json.insert_back(name); - item = value; + item = json_array{}; + return item; + }; + auto append_object = [](json_value& json) -> json_value& { + auto& item = json.emplace_back(); + item = json_object{}; return item; }; auto set_opt = [](json_value& json, const string& name, const auto& value, @@ -2383,43 +2473,54 @@ static void save_json_scene( auto set_orf = [](json_value& json, const string& name, int value, const vector& names) { if (value < 0) return; - json.insert_back(name) = names.at(value); + if (names.size() > value && names[value] != "") { + json.insert_back(name) = names.at(value); + } else { + json.insert_back(name) = value; + } }; auto set_rrf = [](json_value& json, const string& name, int value, const vector& names) { - json.insert_back(name) = names.at(value); + if (names.size() > value && names[value] != "") { + json.insert_back(name) = names.at(value); + } else { + json.insert_back(name) = value; + } }; // dirname auto dirname = path_dirname(filename); // names - auto camera_names = make_names(scene.cameras, scene.camera_names, "camera"); - auto texture_names = make_names( - scene.textures, scene.texture_names, "texture"); - auto material_names = make_names( - scene.materials, scene.material_names, "material"); - auto shape_names = make_names(scene.shapes, scene.shape_names, "shape"); - auto subdiv_names = make_names(scene.subdivs, scene.subdiv_names, "subdiv"); - auto instance_names = make_names( - scene.instances, scene.instance_names, "instance"); + auto get_name = [](const vector& names, size_t idx) -> string { + if (names.size() <= idx) return ""; + return names[idx]; + }; + auto get_filename = [](const vector& names, size_t idx, + const string& basename, + const string& extension) -> string { + if (names.size() <= idx) { + return basename + "s/" + names[idx] + extension; + } else { + return basename + "s/" + basename + extension; + } + }; // filenames - auto shape_datafiles = vector(shape_names.size()); - auto texture_datafiles = vector(texture_names.size()); - auto subdiv_datafiles = vector(subdiv_names.size()); - for (auto idx : range(shape_datafiles.size())) { - shape_datafiles[idx] = path_join( - dirname, "shapes", shape_names[idx] + ".ply"); + auto shape_filenames = vector(scene.shapes.size()); + auto texture_filenames = vector(scene.textures.size()); + auto subdiv_filenames = vector(scene.subdivs.size()); + for (auto idx : range(shape_filenames.size())) { + shape_filenames[idx] = get_filename( + scene.shape_names, idx, "shape", ".ply"); } - for (auto idx : range(texture_datafiles.size())) { - texture_datafiles[idx] = path_join(dirname, "textures", - texture_names[idx] + - (scene.textures[idx].pixelsf.empty() ? ".png" : ".hdr")); + for (auto idx : range(texture_filenames.size())) { + texture_filenames[idx] = get_filename(scene.texture_names, idx, "texture", + (scene.textures[idx].pixelsf.empty() ? ".png" : ".hdr")); } - for (auto idx : range(subdiv_datafiles.size())) { - subdiv_datafiles[idx] = path_join( - dirname, "subdivs", subdiv_names[idx] + ".obj"); + for (auto idx : range(subdiv_filenames.size())) { + subdiv_filenames[idx] = get_filename( + scene.subdiv_names, idx, "subdiv", ".obj"); } // save json file @@ -2432,15 +2533,16 @@ static void save_json_scene( set_opt(element, "copyright", scene.copyright, ""); set_req(element, "generator", "Yocto/GL - https://github.com/xelatihy/yocto-gl"); - set_req(element, "version", "4.1"); + set_req(element, "version", "4.2"); } if (!scene.cameras.empty()) { auto default_ = camera_data{}; - auto& group = add_object(json, "cameras"); + auto& group = add_array(json, "cameras"); group.reserve(scene.cameras.size()); for (auto&& [idx, camera] : enumerate(scene.cameras)) { - auto& element = add_object(group, camera_names[idx]); + auto& element = append_object(group); + set_opt(element, "name", get_name(scene.camera_names, idx), ""); set_opt(element, "frame", camera.frame, default_.frame); set_opt( element, "orthographic", camera.orthographic, default_.orthographic); @@ -2453,20 +2555,22 @@ static void save_json_scene( } if (!scene.textures.empty()) { - auto& group = add_object(json, "textures"); + auto& group = add_array(json, "textures"); group.reserve(scene.textures.size()); for (auto&& [idx, texture] : enumerate(scene.textures)) { - add_value(group, texture_names[idx], - texture_names[idx] + (texture.pixelsf.empty() ? ".png" : ".hdr")); + auto& element = append_object(group); + set_opt(element, "name", get_name(scene.texture_names, idx), ""); + set_req(element, "uri", texture_filenames[idx]); } } if (!scene.materials.empty()) { auto default_ = material_data{}; - auto& group = add_object(json, "materials"); + auto& group = add_array(json, "materials"); group.reserve(scene.materials.size()); for (auto&& [idx, material] : enumerate(scene.materials)) { - auto& element = add_object(group, material_names[idx]); + auto& element = append_object(group); + set_opt(element, "name", get_name(scene.material_names, idx), ""); set_opt(element, "type", material.type, default_.type); set_opt(element, "emission", material.emission, default_.emission); set_opt(element, "color", material.color, default_.color); @@ -2478,12 +2582,14 @@ static void save_json_scene( set_opt(element, "scanisotropy", material.scanisotropy, default_.scanisotropy); set_opt(element, "opacity", material.opacity, default_.opacity); - set_orf(element, "emission_tex", material.emission_tex, texture_names); - set_orf(element, "color_tex", material.color_tex, texture_names); - set_orf(element, "roughness_tex", material.roughness_tex, texture_names); set_orf( - element, "scattering_tex", material.scattering_tex, texture_names); - set_orf(element, "normal_tex", material.normal_tex, texture_names); + element, "emission_tex", material.emission_tex, scene.texture_names); + set_orf(element, "color_tex", material.color_tex, scene.texture_names); + set_orf(element, "roughness_tex", material.roughness_tex, + scene.texture_names); + set_orf(element, "scattering_tex", material.scattering_tex, + scene.texture_names); + set_orf(element, "normal_tex", material.normal_tex, scene.texture_names); } } @@ -2491,18 +2597,21 @@ static void save_json_scene( auto& group = add_object(json, "shapes"); group.reserve(scene.shapes.size()); for (auto&& [idx, shape] : enumerate(scene.shapes)) { - add_value(group, shape_names[idx], shape_names[idx] + ".ply"); + auto& element = append_object(group); + set_opt(element, "name", get_name(scene.shape_names, idx), ""); + set_req(element, "uri", shape_filenames[idx]); } } if (!scene.subdivs.empty()) { auto default_ = subdiv_data{}; - auto& group = add_object(json, "subdivs"); + auto& group = add_array(json, "subdivs"); group.reserve(scene.subdivs.size()); for (auto&& [idx, subdiv] : enumerate(scene.subdivs)) { - auto& element = add_object(group, subdiv_names[idx]); - set_rrf(element, "shape", subdiv.shape, shape_names); - set_req(element, "datafile", subdiv_names[idx] + ".obj"); + auto& element = append_object(group); + set_opt(element, "name", get_name(scene.subdiv_names, idx), ""); + set_rrf(element, "shape", subdiv.shape, scene.shape_names); + set_req(element, "uri", subdiv_filenames[idx]); set_opt( element, "subdivisions", subdiv.subdivisions, default_.subdivisions); set_opt( @@ -2517,26 +2626,28 @@ static void save_json_scene( if (!scene.instances.empty()) { auto default_ = instance_data{}; - auto& group = add_object(json, "instances"); + auto& group = add_array(json, "instances"); group.reserve(scene.instances.size()); - for (auto& instance : scene.instances) { - auto& element = add_object(group, get_instance_name(scene, instance)); + for (auto&& [idx, instance] : enumerate(scene.instances)) { + auto& element = append_object(group); + set_opt(element, "name", get_name(scene.instance_names, idx), ""); set_opt(element, "frame", instance.frame, default_.frame); - set_rrf(element, "shape", instance.shape, shape_names); - set_rrf(element, "material", instance.material, material_names); + set_rrf(element, "shape", instance.shape, scene.shape_names); + set_rrf(element, "material", instance.material, scene.material_names); } } if (!scene.environments.empty()) { auto default_ = environment_data{}; - auto& group = add_object(json, "environments"); + auto& group = add_array(json, "environments"); group.reserve(scene.environments.size()); - for (auto& environment : scene.environments) { - auto& element = add_object( - group, get_environment_name(scene, environment)); + for (auto&& [idx, environment] : enumerate(scene.environments)) { + auto& element = append_object(group); + set_opt(element, "name", get_name(scene.environment_names, idx), ""); set_opt(element, "frame", environment.frame, default_.frame); set_opt(element, "emission", environment.emission, default_.emission); - set_orf(element, "emission_tex", environment.emission_tex, texture_names); + set_orf(element, "emission_tex", environment.emission_tex, + scene.texture_names); } } @@ -2548,28 +2659,34 @@ static void save_json_scene( if (noparallel) { // save shapes for (auto idx : range(scene.shapes.size())) { - save_shape(shape_datafiles[idx], scene.shapes[idx], true); + save_shape( + path_join(dirname, shape_filenames[idx]), scene.shapes[idx], true); } // save subdiv for (auto idx : range(scene.subdivs.size())) { - save_subdiv(subdiv_datafiles[idx], scene.subdivs[idx]); + save_subdiv( + path_join(dirname, subdiv_filenames[idx]), scene.subdivs[idx]); } // save textures for (auto idx : range(scene.textures.size())) { - save_texture(texture_datafiles[idx], scene.textures[idx]); + save_texture( + path_join(dirname, texture_filenames[idx]), scene.textures[idx]); } } else { // save shapes parallel_for(scene.shapes.size(), [&](auto idx) { - save_shape(shape_datafiles[idx], scene.shapes[idx], true); + save_shape( + path_join(dirname, shape_filenames[idx]), scene.shapes[idx], true); }); // save subdivs parallel_for(scene.subdivs.size(), [&](auto idx) { - save_subdiv(subdiv_datafiles[idx], scene.subdivs[idx]); + save_subdiv( + path_join(dirname, subdiv_filenames[idx]), scene.subdivs[idx]); }); // save textures parallel_for(scene.textures.size(), [&](auto idx) { - save_texture(texture_datafiles[idx], scene.textures[idx]); + save_texture( + path_join(dirname, texture_filenames[idx]), scene.textures[idx]); }); } } catch (const io_error& exception) { diff --git a/scripts/scene.schema.json b/scripts/scene.schema.json index f176642de..f8a652462 100644 --- a/scripts/scene.schema.json +++ b/scripts/scene.schema.json @@ -22,18 +22,19 @@ "cameras": { "description": "Scene cameras", "type": "object", - "additionalProperties": { + "items": { "description": "Camera", "type": "object", "properties": { + "name": { + "description": "Name", + "type": "string" + }, "frame": { "description": "Frame", "type": "array", "items": { - "type": "array", - "items": { - "type": "number" - } + "type": "number" } }, "lens": { @@ -61,11 +62,15 @@ }, "environments": { "description": "Scene environments", - "type": "object", - "additionalProperties": { + "type": "array", + "items": { "description": "Environment", "type": "object", "properties": { + "name": { + "description": "Name", + "type": "string" + }, "frame": { "description": "Frame", "type": "array", @@ -89,11 +94,15 @@ }, "materials": { "description": "Scene materials", - "type": "object", - "additionalProperties": { + "type": "array", + "items": { "description": "Object", "type": "object", "properties": { + "name": { + "description": "Name", + "type": "string" + }, "emission": { "description": "Emission", "type": "array", diff --git a/scripts/upgrade-scenes.py b/scripts/upgrade-scenes-41.py similarity index 100% rename from scripts/upgrade-scenes.py rename to scripts/upgrade-scenes-41.py diff --git a/scripts/upgrade-scenes-42.py b/scripts/upgrade-scenes-42.py new file mode 100755 index 000000000..4786c11bc --- /dev/null +++ b/scripts/upgrade-scenes-42.py @@ -0,0 +1,47 @@ +#! /usr/bin/env python3 -B + +import json, argparse +from typing import OrderedDict + +def upgrade(filename, remove_names): + with open(filename) as f: + scene = json.load(f, object_pairs_hook=OrderedDict) + if scene['asset']['version'] == "4.2": return + if scene['asset']['version'] != "4.1": return + shape_map = { name: id for id, name in enumerate(scene['shapes'].keys()) } if 'shapes' in scene else {} + texture_map = { name: id for id, name in enumerate(scene['textures'].keys()) } if 'textures' in scene else {} + material_map = { name: id for id, name in enumerate(scene['materials'].keys()) } if 'materials' in scene else {} + nscene = OrderedDict() + nscene['asset'] = scene['asset'] + nscene['asset']['version'] = "4.2" + for groupname in ['cameras', 'environments', 'textures', 'materials', 'shapes', 'subdivs', 'instances']: + if groupname not in scene: continue + nscene[groupname] = [] + for name, item in scene[groupname].items(): + nitem = OrderedDict() + nscene[groupname].append(nitem) + if not remove_names: nitem['name'] = name + if groupname in ['textures', 'shapes']: + nitem['uri'] = groupname + "/" + item + else: + nitem.update(item) + for key, value in nitem.items(): + if key.endswith('_tex'): nitem[key] = texture_map[value] + if key == 'shape': nitem[key] = shape_map[value] + if key == 'material': nitem[key] = material_map[value] + if key == 'frame' and isinstance(value[0], list): + nitem[key] = value[0] + value[1] + value[2] + value[3] + if 'datafile' in nitem: + nitem['uri'] = item['datafile'] + del item['datafile'] + with open(filename, 'w') as f: + json.dump(nscene, f, indent=2) + +parser = argparse.ArgumentParser(description='Upgrades scene.') +parser.add_argument('scenes', type=str, nargs='+') +parser.add_argument('--remove-names', action='store_true', default=False) +args = parser.parse_args() + +for filename in args.scenes: + print(filename) + upgrade(filename, args.remove_names) diff --git a/tests/arealights1/arealights1.json b/tests/arealights1/arealights1.json index 6afe68a5c..fb7a4a1e2 100644 --- a/tests/arealights1/arealights1.json +++ b/tests/arealights1/arealights1.json @@ -2,200 +2,234 @@ "asset": { "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "default": { + "cameras": [ + { + "name": "default", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "front": { + { + "name": "front", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 0.936329185962677, -0.3511234223842621], - [0.0, 0.3511234223842621, 0.936329185962677], - [0.0, 0.574999988079071, 1.399999976158142] + 1.0, 0.0, 0.0, 0.0, 0.936329185962677, -0.3511234223842621, 0.0, + 0.3511234223842621, 0.936329185962677, 0.0, 0.574999988079071, + 1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "back": { + { + "name": "back", "frame": [ - [-1.0, 0.0, 0.0], - [0.0, 0.936329185962677, 0.3511234223842621], - [0.0, 0.3511234223842621, -0.936329185962677], - [0.0, 0.574999988079071, -1.399999976158142] + -1.0, 0.0, 0.0, 0.0, 0.936329185962677, 0.3511234223842621, 0.0, + 0.3511234223842621, -0.936329185962677, 0.0, 0.574999988079071, + -1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "perspective-sharp": { + { + "name": "perspective-sharp", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "perspective-dof": { + { + "name": "perspective-dof", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.02500000037252903 }, - "orthographic-sharp": { + { + "name": "orthographic-sharp", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "orthographic-dof": { + { + "name": "orthographic-dof", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.019999999552965164 } - }, - "textures": { - "floor": "floor.png", - "uvgrid": "uvgrid.png" - }, - "materials": { - "floor": { + ], + "textures": [ + { + "name": "floor", + "uri": "textures/floor.png" + }, + { + "name": "uvgrid", + "uri": "textures/uvgrid.png" + } + ], + "materials": [ + { + "name": "floor", "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], - "color_tex": "floor" + "color_tex": 0 }, - "arealight1": { + { + "name": "arealight1", "emission": [20.0, 20.0, 20.0] }, - "arealight2": { + { + "name": "arealight2", "emission": [20.0, 20.0, 20.0] }, - "bunny-uvgrid": { + { + "name": "bunny-uvgrid", "type": "glossy", "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 1 }, - "sphere-plastic-sharp": { + { + "name": "sphere-plastic-sharp", "type": "glossy", "color": [0.5, 0.5, 0.699999988079071], "roughness": 0.009999999776482582 }, - "bunny-metal-rough": { + { + "name": "bunny-metal-rough", "type": "reflective", "color": [0.6600000262260437, 0.44999998807907104, 0.3400000035762787], "roughness": 0.20000000298023224 }, - "sphere-plastic-rough": { + { + "name": "sphere-plastic-rough", "type": "glossy", "color": [0.5, 0.699999988079071, 0.5], "roughness": 0.20000000298023224 }, - "bunny-metal-sharp": { + { + "name": "bunny-metal-sharp", "type": "reflective", "color": [0.699999988079071, 0.699999988079071, 0.699999988079071] } - }, - "shapes": { - "floor": "floor.ply", - "arealight1": "arealight1.ply", - "arealight2": "arealight2.ply", - "bunny": "bunny.ply", - "sphere": "sphere.ply" - }, - "instances": { - "floor": { - "shape": "floor", - "material": "floor" - }, - "arealight1": { + ], + "shapes": [ + { + "name": "floor", + "uri": "shapes/floor.ply" + }, + { + "name": "arealight1", + "uri": "shapes/arealight1.ply" + }, + { + "name": "arealight2", + "uri": "shapes/arealight2.ply" + }, + { + "name": "bunny", + "uri": "shapes/bunny.ply" + }, + { + "name": "sphere", + "uri": "shapes/sphere.ply" + } + ], + "instances": [ + { + "name": "floor", + "shape": 0, + "material": 0 + }, + { + "name": "arealight1", "frame": [ - [0.8944271802902222, -0.0, 0.4472135901451111], - [0.27562475204467773, 0.7874992489814758, -0.5512495040893555], - [-0.3521803617477417, 0.6163156628608704, 0.7043607234954834], - [-0.4000000059604645, 0.800000011920929, 0.800000011920929] + 0.8944271802902222, -0.0, 0.4472135901451111, 0.27562475204467773, + 0.7874992489814758, -0.5512495040893555, -0.3521803617477417, + 0.6163156628608704, 0.7043607234954834, -0.4000000059604645, + 0.800000011920929, 0.800000011920929 ], - "shape": "arealight1", - "material": "arealight1" + "shape": 1, + "material": 1 }, - "arealight2": { + { + "name": "arealight2", "frame": [ - [0.8944271802902222, 0.0, -0.4472135901451111], - [-0.27562475204467773, 0.7874992489814758, -0.5512495040893555], - [0.3521803617477417, 0.6163156628608704, 0.7043607234954834], - [0.4000000059604645, 0.800000011920929, 0.800000011920929] + 0.8944271802902222, 0.0, -0.4472135901451111, -0.27562475204467773, + 0.7874992489814758, -0.5512495040893555, 0.3521803617477417, + 0.6163156628608704, 0.7043607234954834, 0.4000000059604645, + 0.800000011920929, 0.800000011920929 ], - "shape": "arealight2", - "material": "arealight2" + "shape": 2, + "material": 2 }, - "bunny-uvgrid": { + { + "name": "bunny-uvgrid", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.4000000059604645, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + 0.0 ], - "shape": "bunny", - "material": "bunny-uvgrid" + "shape": 3, + "material": 3 }, - "sphere-plastic-sharp": { + { + "name": "sphere-plastic-sharp", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.20000000298023224, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-plastic-sharp" + "shape": 4, + "material": 4 }, - "bunny-metal-rough": { - "shape": "bunny", - "material": "bunny-metal-rough" + { + "name": "bunny-metal-rough", + "shape": 3, + "material": 5 }, - "sphere-plastic-rough": { + { + "name": "sphere-plastic-rough", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.20000000298023224, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-plastic-rough" + "shape": 4, + "material": 6 }, - "bunny-metal-sharp": { + { + "name": "bunny-metal-sharp", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.4000000059604645, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + 0.0 ], - "shape": "bunny", - "material": "bunny-metal-sharp" + "shape": 3, + "material": 7 } - } + ] } diff --git a/tests/cornellbox/cornellbox.json b/tests/cornellbox/cornellbox.json index 460be3b1e..e8e97ffd3 100644 --- a/tests/cornellbox/cornellbox.json +++ b/tests/cornellbox/cornellbox.json @@ -1,90 +1,129 @@ { "asset": { "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "camera1": { + "cameras": [ + { + "name": "camera1", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.0, 1.0, 3.9000000953674316 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, + 3.9000000953674316 ], "lens": 0.03500000014901161, "aspect": 1.0, "film": 0.024000000208616257, "focus": 3.9000000953674316 } - }, - "materials": { - "backwall": { - "color": [ 0.7250000238418579, 0.7099999785423279, 0.6800000071525574 ] + ], + "materials": [ + { + "name": "backwall", + "color": [0.7250000238418579, 0.7099999785423279, 0.6800000071525574] }, - "ceiling": { - "color": [ 0.7250000238418579, 0.7099999785423279, 0.6800000071525574 ] + { + "name": "ceiling", + "color": [0.7250000238418579, 0.7099999785423279, 0.6800000071525574] }, - "floor": { - "color": [ 0.7250000238418579, 0.7099999785423279, 0.6800000071525574 ] + { + "name": "floor", + "color": [0.7250000238418579, 0.7099999785423279, 0.6800000071525574] }, - "leftwall": { - "color": [ 0.6299999952316284, 0.06499999761581421, 0.05000000074505806 ] + { + "name": "leftwall", + "color": [0.6299999952316284, 0.06499999761581421, 0.05000000074505806] }, - "light": { - "emission": [ 17.0, 12.0, 4.0 ] + { + "name": "light", + "emission": [17.0, 12.0, 4.0] }, - "rightwall": { - "color": [ 0.14000000059604645, 0.44999998807907104, 0.09000000357627869 ] + { + "name": "rightwall", + "color": [0.14000000059604645, 0.44999998807907104, 0.09000000357627869] }, - "shortbox": { - "color": [ 0.7250000238418579, 0.7099999785423279, 0.6800000071525574 ] + { + "name": "shortbox", + "color": [0.7250000238418579, 0.7099999785423279, 0.6800000071525574] }, - "tallbox": { - "color": [ 0.7250000238418579, 0.7099999785423279, 0.6800000071525574 ] + { + "name": "tallbox", + "color": [0.7250000238418579, 0.7099999785423279, 0.6800000071525574] } - }, - "shapes": { - "backwall": "backwall.ply", - "ceiling": "ceiling.ply", - "floor": "floor.ply", - "leftwall": "leftwall.ply", - "light": "light.ply", - "rightwall": "rightwall.ply", - "shortbox": "shortbox.ply", - "tallbox": "tallbox.ply" - }, - "instances": { - "backwall": { - "shape": "backwall", - "material": "backwall" - }, - "ceiling": { - "shape": "ceiling", - "material": "ceiling" - }, - "floor": { - "shape": "floor", - "material": "floor" - }, - "leftwall": { - "shape": "leftwall", - "material": "leftwall" - }, - "light": { - "shape": "light", - "material": "light" - }, - "rightwall": { - "shape": "rightwall", - "material": "rightwall" - }, - "shortbox": { - "shape": "shortbox", - "material": "shortbox" - }, - "tallbox": { - "shape": "tallbox", - "material": "tallbox" + ], + "shapes": [ + { + "name": "backwall", + "uri": "shapes/backwall.ply" + }, + { + "name": "ceiling", + "uri": "shapes/ceiling.ply" + }, + { + "name": "floor", + "uri": "shapes/floor.ply" + }, + { + "name": "leftwall", + "uri": "shapes/leftwall.ply" + }, + { + "name": "light", + "uri": "shapes/light.ply" + }, + { + "name": "rightwall", + "uri": "shapes/rightwall.ply" + }, + { + "name": "shortbox", + "uri": "shapes/shortbox.ply" + }, + { + "name": "tallbox", + "uri": "shapes/tallbox.ply" + } + ], + "instances": [ + { + "name": "backwall", + "shape": 0, + "material": 0 + }, + { + "name": "ceiling", + "shape": 1, + "material": 1 + }, + { + "name": "floor", + "shape": 2, + "material": 2 + }, + { + "name": "leftwall", + "shape": 3, + "material": 3 + }, + { + "name": "light", + "shape": 4, + "material": 4 + }, + { + "name": "rightwall", + "shape": 5, + "material": 5 + }, + { + "name": "shortbox", + "shape": 6, + "material": 6 + }, + { + "name": "tallbox", + "shape": 7, + "material": 7 } - } -} \ No newline at end of file + ] +} diff --git a/tests/environments1/environments1.json b/tests/environments1/environments1.json index cfc000105..c65582eef 100644 --- a/tests/environments1/environments1.json +++ b/tests/environments1/environments1.json @@ -2,179 +2,207 @@ "asset": { "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "default": { + "cameras": [ + { + "name": "default", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "front": { + { + "name": "front", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 0.936329185962677, -0.3511234223842621], - [0.0, 0.3511234223842621, 0.936329185962677], - [0.0, 0.574999988079071, 1.399999976158142] + 1.0, 0.0, 0.0, 0.0, 0.936329185962677, -0.3511234223842621, 0.0, + 0.3511234223842621, 0.936329185962677, 0.0, 0.574999988079071, + 1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "back": { + { + "name": "back", "frame": [ - [-1.0, 0.0, 0.0], - [0.0, 0.936329185962677, 0.3511234223842621], - [0.0, 0.3511234223842621, -0.936329185962677], - [0.0, 0.574999988079071, -1.399999976158142] + -1.0, 0.0, 0.0, 0.0, 0.936329185962677, 0.3511234223842621, 0.0, + 0.3511234223842621, -0.936329185962677, 0.0, 0.574999988079071, + -1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "perspective-sharp": { + { + "name": "perspective-sharp", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "perspective-dof": { + { + "name": "perspective-dof", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.02500000037252903 }, - "orthographic-sharp": { + { + "name": "orthographic-sharp", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "orthographic-dof": { + { + "name": "orthographic-dof", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.019999999552965164 } - }, - "textures": { - "sunsky": "sunsky.hdr", - "floor": "floor.png", - "uvgrid": "uvgrid.png" - }, - "materials": { - "floor": { + ], + "environments": [ + { + "name": "sunsky", + "emission": [1.0, 1.0, 1.0], + "emission_tex": 0 + } + ], + "textures": [ + { + "name": "sunsky", + "uri": "textures/sunsky.hdr" + }, + { + "name": "floor", + "uri": "textures/floor.png" + }, + { + "name": "uvgrid", + "uri": "textures/uvgrid.png" + } + ], + "materials": [ + { + "name": "floor", "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], - "color_tex": "floor" + "color_tex": 1 }, - "bunny-uvgrid": { + { + "name": "bunny-uvgrid", "type": "glossy", "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 }, - "sphere-plastic-sharp": { + { + "name": "sphere-plastic-sharp", "type": "glossy", "color": [0.5, 0.5, 0.699999988079071], "roughness": 0.009999999776482582 }, - "bunny-metal-rough": { + { + "name": "bunny-metal-rough", "type": "reflective", "color": [0.6600000262260437, 0.44999998807907104, 0.3400000035762787], "roughness": 0.20000000298023224 }, - "sphere-plastic-rough": { + { + "name": "sphere-plastic-rough", "type": "glossy", "color": [0.5, 0.699999988079071, 0.5], "roughness": 0.20000000298023224 }, - "bunny-metal-sharp": { + { + "name": "bunny-metal-sharp", "type": "reflective", "color": [0.699999988079071, 0.699999988079071, 0.699999988079071] } - }, - "shapes": { - "floor": "floor.ply", - "bunny": "bunny.ply", - "sphere": "sphere.ply" - }, - "instances": { - "floor": { - "shape": "floor", - "material": "floor" - }, - "bunny-uvgrid": { + ], + "shapes": [ + { + "name": "floor", + "uri": "shapes/floor.ply" + }, + { + "name": "bunny", + "uri": "shapes/bunny.ply" + }, + { + "name": "sphere", + "uri": "shapes/sphere.ply" + } + ], + "instances": [ + { + "name": "floor", + "shape": 0, + "material": 0 + }, + { + "name": "bunny-uvgrid", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.4000000059604645, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + 0.0 ], - "shape": "bunny", - "material": "bunny-uvgrid" + "shape": 1, + "material": 1 }, - "sphere-plastic-sharp": { + { + "name": "sphere-plastic-sharp", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.20000000298023224, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-plastic-sharp" + "shape": 2, + "material": 2 }, - "bunny-metal-rough": { - "shape": "bunny", - "material": "bunny-metal-rough" + { + "name": "bunny-metal-rough", + "shape": 1, + "material": 3 }, - "sphere-plastic-rough": { + { + "name": "sphere-plastic-rough", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.20000000298023224, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-plastic-rough" + "shape": 2, + "material": 4 }, - "bunny-metal-sharp": { + { + "name": "bunny-metal-sharp", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.4000000059604645, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + 0.0 ], - "shape": "bunny", - "material": "bunny-metal-sharp" - } - }, - "environments": { - "sunsky": { - "emission": [1.0, 1.0, 1.0], - "emission_tex": "sunsky" + "shape": 1, + "material": 5 } - } + ] } diff --git a/tests/environments2/environments2.json b/tests/environments2/environments2.json index ebb669b60..05332c567 100644 --- a/tests/environments2/environments2.json +++ b/tests/environments2/environments2.json @@ -2,179 +2,207 @@ "asset": { "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "default": { + "cameras": [ + { + "name": "default", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "front": { + { + "name": "front", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 0.936329185962677, -0.3511234223842621], - [0.0, 0.3511234223842621, 0.936329185962677], - [0.0, 0.574999988079071, 1.399999976158142] + 1.0, 0.0, 0.0, 0.0, 0.936329185962677, -0.3511234223842621, 0.0, + 0.3511234223842621, 0.936329185962677, 0.0, 0.574999988079071, + 1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "back": { + { + "name": "back", "frame": [ - [-1.0, 0.0, 0.0], - [0.0, 0.936329185962677, 0.3511234223842621], - [0.0, 0.3511234223842621, -0.936329185962677], - [0.0, 0.574999988079071, -1.399999976158142] + -1.0, 0.0, 0.0, 0.0, 0.936329185962677, 0.3511234223842621, 0.0, + 0.3511234223842621, -0.936329185962677, 0.0, 0.574999988079071, + -1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "perspective-sharp": { + { + "name": "perspective-sharp", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "perspective-dof": { + { + "name": "perspective-dof", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.02500000037252903 }, - "orthographic-sharp": { + { + "name": "orthographic-sharp", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "orthographic-dof": { + { + "name": "orthographic-dof", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.019999999552965164 } - }, - "textures": { - "sky": "sky.hdr", - "floor": "floor.png", - "uvgrid": "uvgrid.png" - }, - "materials": { - "floor": { + ], + "environments": [ + { + "name": "sky", + "emission": [1.0, 1.0, 1.0], + "emission_tex": 0 + } + ], + "textures": [ + { + "name": "sky", + "uri": "textures/sky.hdr" + }, + { + "name": "floor", + "uri": "textures/floor.png" + }, + { + "name": "uvgrid", + "uri": "textures/uvgrid.png" + } + ], + "materials": [ + { + "name": "floor", "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], - "color_tex": "floor" + "color_tex": 1 }, - "bunny-uvgrid": { + { + "name": "bunny-uvgrid", "type": "glossy", "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 }, - "sphere-plastic-sharp": { + { + "name": "sphere-plastic-sharp", "type": "glossy", "color": [0.5, 0.5, 0.699999988079071], "roughness": 0.009999999776482582 }, - "bunny-metal-rough": { + { + "name": "bunny-metal-rough", "type": "reflective", "color": [0.6600000262260437, 0.44999998807907104, 0.3400000035762787], "roughness": 0.20000000298023224 }, - "sphere-plastic-rough": { + { + "name": "sphere-plastic-rough", "type": "glossy", "color": [0.5, 0.699999988079071, 0.5], "roughness": 0.20000000298023224 }, - "bunny-metal-sharp": { + { + "name": "bunny-metal-sharp", "type": "reflective", "color": [0.699999988079071, 0.699999988079071, 0.699999988079071] } - }, - "shapes": { - "floor": "floor.ply", - "bunny": "bunny.ply", - "sphere": "sphere.ply" - }, - "instances": { - "floor": { - "shape": "floor", - "material": "floor" - }, - "bunny-uvgrid": { + ], + "shapes": [ + { + "name": "floor", + "uri": "shapes/floor.ply" + }, + { + "name": "bunny", + "uri": "shapes/bunny.ply" + }, + { + "name": "sphere", + "uri": "shapes/sphere.ply" + } + ], + "instances": [ + { + "name": "floor", + "shape": 0, + "material": 0 + }, + { + "name": "bunny-uvgrid", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.4000000059604645, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + 0.0 ], - "shape": "bunny", - "material": "bunny-uvgrid" + "shape": 1, + "material": 1 }, - "sphere-plastic-sharp": { + { + "name": "sphere-plastic-sharp", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.20000000298023224, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-plastic-sharp" + "shape": 2, + "material": 2 }, - "bunny-metal-rough": { - "shape": "bunny", - "material": "bunny-metal-rough" + { + "name": "bunny-metal-rough", + "shape": 1, + "material": 3 }, - "sphere-plastic-rough": { + { + "name": "sphere-plastic-rough", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.20000000298023224, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-plastic-rough" + "shape": 2, + "material": 4 }, - "bunny-metal-sharp": { + { + "name": "bunny-metal-sharp", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.4000000059604645, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + 0.0 ], - "shape": "bunny", - "material": "bunny-metal-sharp" - } - }, - "environments": { - "sky": { - "emission": [1.0, 1.0, 1.0], - "emission_tex": "sky" + "shape": 1, + "material": 5 } - } + ] } diff --git a/tests/features1/features1.json b/tests/features1/features1.json index d995b01c3..498b1062a 100644 --- a/tests/features1/features1.json +++ b/tests/features1/features1.json @@ -2,211 +2,252 @@ "asset": { "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "default": { + "cameras": [ + { + "name": "default", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "front": { + { + "name": "front", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 0.936329185962677, -0.3511234223842621], - [0.0, 0.3511234223842621, 0.936329185962677], - [0.0, 0.574999988079071, 1.399999976158142] + 1.0, 0.0, 0.0, 0.0, 0.936329185962677, -0.3511234223842621, 0.0, + 0.3511234223842621, 0.936329185962677, 0.0, 0.574999988079071, + 1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "back": { + { + "name": "back", "frame": [ - [-1.0, 0.0, 0.0], - [0.0, 0.936329185962677, 0.3511234223842621], - [0.0, 0.3511234223842621, -0.936329185962677], - [0.0, 0.574999988079071, -1.399999976158142] + -1.0, 0.0, 0.0, 0.0, 0.936329185962677, 0.3511234223842621, 0.0, + 0.3511234223842621, -0.936329185962677, 0.0, 0.574999988079071, + -1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "perspective-sharp": { + { + "name": "perspective-sharp", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "perspective-dof": { + { + "name": "perspective-dof", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.02500000037252903 }, - "orthographic-sharp": { + { + "name": "orthographic-sharp", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "orthographic-dof": { + { + "name": "orthographic-dof", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.019999999552965164 } - }, - "textures": { - "sky": "sky.hdr", - "floor": "floor.png", - "uvgrid": "uvgrid.png", - "bumps-normal": "bumps-normal.png" - }, - "materials": { - "floor": { + ], + "environments": [ + { + "name": "sky", + "emission": [0.5, 0.5, 0.5], + "emission_tex": 0 + } + ], + "textures": [ + { + "name": "sky", + "uri": "textures/sky.hdr" + }, + { + "name": "floor", + "uri": "textures/floor.png" + }, + { + "name": "uvgrid", + "uri": "textures/uvgrid.png" + }, + { + "name": "bumps-normal", + "uri": "textures/bumps-normal.png" + } + ], + "materials": [ + { + "name": "floor", "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], - "color_tex": "floor" + "color_tex": 1 }, - "bunny-uvgrid-coated": { + { + "name": "bunny-uvgrid-coated", "type": "glossy", "color": [1.0, 1.0, 1.0], "roughness": 0.20000000298023224, - "color_tex": "uvgrid" + "color_tex": 2 }, - "bunny-volume-jade": { + { + "name": "bunny-volume-jade", "type": "refractive", "color": [0.5, 0.5, 0.5], "scattering": [ 0.30000001192092896, 0.6000000238418579, 0.30000001192092896 ] }, - "bunny-metal-rough": { + { + "name": "bunny-metal-rough", "type": "reflective", "color": [0.6600000262260437, 0.44999998807907104, 0.3400000035762787], "roughness": 0.20000000298023224 }, - "sphere-volume-glass": { + { + "name": "sphere-volume-glass", "type": "refractive", "color": [1.0, 0.5, 0.5] }, - "sphere-plastic-rough-bumped": { + { + "name": "sphere-plastic-rough-bumped", "type": "glossy", "color": [0.5, 0.699999988079071, 0.5], "roughness": 0.20000000298023224, - "normal_tex": "bumps-normal" + "normal_tex": 3 }, - "arealight1": { + { + "name": "arealight1", "emission": [20.0, 20.0, 20.0] }, - "arealight2": { + { + "name": "arealight2", "emission": [20.0, 20.0, 20.0] } - }, - "shapes": { - "floor": "floor.ply", - "bunny": "bunny.ply", - "sphere": "sphere.ply", - "arealight1": "arealight1.ply", - "arealight2": "arealight2.ply" - }, - "instances": { - "floor": { - "shape": "floor", - "material": "floor" - }, - "bunny-uvgrid-coated": { + ], + "shapes": [ + { + "name": "floor", + "uri": "shapes/floor.ply" + }, + { + "name": "bunny", + "uri": "shapes/bunny.ply" + }, + { + "name": "sphere", + "uri": "shapes/sphere.ply" + }, + { + "name": "arealight1", + "uri": "shapes/arealight1.ply" + }, + { + "name": "arealight2", + "uri": "shapes/arealight2.ply" + } + ], + "instances": [ + { + "name": "floor", + "shape": 0, + "material": 0 + }, + { + "name": "bunny-uvgrid-coated", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.4000000059604645, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + 0.0 ], - "shape": "bunny", - "material": "bunny-uvgrid-coated" + "shape": 1, + "material": 1 }, - "bunny-volume-jade": { - "shape": "bunny", - "material": "bunny-volume-jade" + { + "name": "bunny-volume-jade", + "shape": 1, + "material": 2 }, - "bunny-metal-rough": { + { + "name": "bunny-metal-rough", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.4000000059604645, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + 0.0 ], - "shape": "bunny", - "material": "bunny-metal-rough" + "shape": 1, + "material": 3 }, - "sphere-volume-glass": { + { + "name": "sphere-volume-glass", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.20000000298023224, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-volume-glass" + "shape": 2, + "material": 4 }, - "sphere-plastic-rough-bumped": { + { + "name": "sphere-plastic-rough-bumped", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.20000000298023224, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-plastic-rough-bumped" + "shape": 2, + "material": 5 }, - "arealight1": { + { + "name": "arealight1", "frame": [ - [0.8944271802902222, -0.0, 0.4472135901451111], - [0.27562475204467773, 0.7874992489814758, -0.5512495040893555], - [-0.3521803617477417, 0.6163156628608704, 0.7043607234954834], - [-0.4000000059604645, 0.800000011920929, 0.800000011920929] + 0.8944271802902222, -0.0, 0.4472135901451111, 0.27562475204467773, + 0.7874992489814758, -0.5512495040893555, -0.3521803617477417, + 0.6163156628608704, 0.7043607234954834, -0.4000000059604645, + 0.800000011920929, 0.800000011920929 ], - "shape": "arealight1", - "material": "arealight1" + "shape": 3, + "material": 6 }, - "arealight2": { + { + "name": "arealight2", "frame": [ - [0.8944271802902222, 0.0, -0.4472135901451111], - [-0.27562475204467773, 0.7874992489814758, -0.5512495040893555], - [0.3521803617477417, 0.6163156628608704, 0.7043607234954834], - [0.4000000059604645, 0.800000011920929, 0.800000011920929] + 0.8944271802902222, 0.0, -0.4472135901451111, -0.27562475204467773, + 0.7874992489814758, -0.5512495040893555, 0.3521803617477417, + 0.6163156628608704, 0.7043607234954834, 0.4000000059604645, + 0.800000011920929, 0.800000011920929 ], - "shape": "arealight2", - "material": "arealight2" - } - }, - "environments": { - "sky": { - "emission": [0.5, 0.5, 0.5], - "emission_tex": "sky" + "shape": 4, + "material": 7 } - } + ] } diff --git a/tests/features2/features2.json b/tests/features2/features2.json index f3719bc32..2f2f78300 100644 --- a/tests/features2/features2.json +++ b/tests/features2/features2.json @@ -2,238 +2,297 @@ "asset": { "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "default": { + "cameras": [ + { + "name": "default", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "front": { + { + "name": "front", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 0.936329185962677, -0.3511234223842621 ], - [ 0.0, 0.3511234223842621, 0.936329185962677 ], - [ 0.0, 0.574999988079071, 1.399999976158142 ] + 1.0, 0.0, 0.0, 0.0, 0.936329185962677, -0.3511234223842621, 0.0, + 0.3511234223842621, 0.936329185962677, 0.0, 0.574999988079071, + 1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "back": { + { + "name": "back", "frame": [ - [ -1.0, 0.0, 0.0 ], - [ 0.0, 0.936329185962677, 0.3511234223842621 ], - [ 0.0, 0.3511234223842621, -0.936329185962677 ], - [ 0.0, 0.574999988079071, -1.399999976158142 ] + -1.0, 0.0, 0.0, 0.0, 0.936329185962677, 0.3511234223842621, 0.0, + 0.3511234223842621, -0.936329185962677, 0.0, 0.574999988079071, + -1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "perspective-sharp": { + { + "name": "perspective-sharp", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "perspective-dof": { + { + "name": "perspective-dof", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.02500000037252903 }, - "orthographic-sharp": { + { + "name": "orthographic-sharp", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "orthographic-dof": { + { + "name": "orthographic-dof", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.019999999552965164 } - }, - "textures": { - "sky": "sky.hdr", - "floor": "floor.png", - "uvgrid": "uvgrid.png", - "bumps-displacement": "bumps-displacement.png" - }, - "materials": { - "floor": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], - "color_tex": "floor" + ], + "environments": [ + { + "name": "sky", + "emission": [0.5, 0.5, 0.5], + "emission_tex": 0 + } + ], + "textures": [ + { + "name": "sky", + "uri": "textures/sky.hdr" }, - "arealight1": { - "emission": [ 20.0, 20.0, 20.0 ] + { + "name": "floor", + "uri": "textures/floor.png" + }, + { + "name": "uvgrid", + "uri": "textures/uvgrid.png" + }, + { + "name": "bumps-displacement", + "uri": "textures/bumps-displacement.png" + } + ], + "materials": [ + { + "name": "floor", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], + "color_tex": 1 }, - "arealight2": { - "emission": [ 20.0, 20.0, 20.0 ] + { + "name": "arealight1", + "emission": [20.0, 20.0, 20.0] }, - "sphere-uvgrid": { + { + "name": "arealight2", + "emission": [20.0, 20.0, 20.0] + }, + { + "name": "sphere-uvgrid", "type": "glossy", - "color": [ 1.0, 1.0, 1.0 ], + "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 }, - "suzanne-subdiv-plastic-rough": { + { + "name": "suzanne-subdiv-plastic-rough", "type": "glossy", - "color": [ 0.5, 0.699999988079071, 0.5 ], + "color": [0.5, 0.699999988079071, 0.5], "roughness": 0.20000000298023224 }, - "hairball1-hair": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], + { + "name": "hairball1-hair", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], "roughness": 1.0 }, - "sphere-displaced-plastic-rough": { + { + "name": "sphere-displaced-plastic-rough", "type": "glossy", - "color": [ 0.5, 0.699999988079071, 0.5 ], + "color": [0.5, 0.699999988079071, 0.5], "roughness": 0.20000000298023224 }, - "cube-uvgrid": { + { + "name": "cube-uvgrid", "type": "glossy", - "color": [ 1.0, 1.0, 1.0 ], + "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 }, - "hairballi-hair": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], + { + "name": "hairballi-hair", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], "roughness": 1.0 } - }, - "shapes": { - "floor": "floor.ply", - "arealight1": "arealight1.ply", - "arealight2": "arealight2.ply", - "sphere": "sphere.ply", - "suzanne-subdiv": "suzanne-subdiv.ply", - "hairball1": "hairball1.ply", - "sphere-displaced": "sphere-displaced.ply", - "cube": "cube.ply", - "hairballi": "hairballi.ply" - }, - "subdivs": { - "suzanne-subdiv": { - "shape": "suzanne-subdiv", + ], + "shapes": [ + { + "name": "floor", + "uri": "shapes/floor.ply" + }, + { + "name": "arealight1", + "uri": "shapes/arealight1.ply" + }, + { + "name": "arealight2", + "uri": "shapes/arealight2.ply" + }, + { + "name": "sphere", + "uri": "shapes/sphere.ply" + }, + { + "name": "suzanne-subdiv", + "uri": "shapes/suzanne-subdiv.ply" + }, + { + "name": "hairball1", + "uri": "shapes/hairball1.ply" + }, + { + "name": "sphere-displaced", + "uri": "shapes/sphere-displaced.ply" + }, + { + "name": "cube", + "uri": "shapes/cube.ply" + }, + { + "name": "hairballi", + "uri": "shapes/hairballi.ply" + } + ], + "subdivs": [ + { + "name": "suzanne-subdiv", + "shape": 4, "datafile": "suzanne-subdiv.obj", "subdivisions": 2, "catmullclark": true, - "smooth": true + "smooth": true, + "uri": "suzanne-subdiv.obj" }, - "sphere-displaced": { - "shape": "sphere-displaced", + { + "name": "sphere-displaced", + "shape": 6, "datafile": "sphere-displaced.obj", "catmullclark": true, "smooth": true, "displacement": 0.02500000037252903, - "displacement_tex": "bumps-displacement" + "displacement_tex": 3, + "uri": "sphere-displaced.obj" } - }, - "instances": { - "floor": { - "shape": "floor", - "material": "floor" + ], + "instances": [ + { + "name": "floor", + "shape": 0, + "material": 0 }, - "arealight1": { + { + "name": "arealight1", "frame": [ - [ 0.8944271802902222, -0.0, 0.4472135901451111 ], - [ 0.27562475204467773, 0.7874992489814758, -0.5512495040893555 ], - [ -0.3521803617477417, 0.6163156628608704, 0.7043607234954834 ], - [ -0.4000000059604645, 0.800000011920929, 0.800000011920929 ] + 0.8944271802902222, -0.0, 0.4472135901451111, 0.27562475204467773, + 0.7874992489814758, -0.5512495040893555, -0.3521803617477417, + 0.6163156628608704, 0.7043607234954834, -0.4000000059604645, + 0.800000011920929, 0.800000011920929 ], - "shape": "arealight1", - "material": "arealight1" + "shape": 1, + "material": 1 }, - "arealight2": { + { + "name": "arealight2", "frame": [ - [ 0.8944271802902222, 0.0, -0.4472135901451111 ], - [ -0.27562475204467773, 0.7874992489814758, -0.5512495040893555 ], - [ 0.3521803617477417, 0.6163156628608704, 0.7043607234954834 ], - [ 0.4000000059604645, 0.800000011920929, 0.800000011920929 ] + 0.8944271802902222, 0.0, -0.4472135901451111, -0.27562475204467773, + 0.7874992489814758, -0.5512495040893555, 0.3521803617477417, + 0.6163156628608704, 0.7043607234954834, 0.4000000059604645, + 0.800000011920929, 0.800000011920929 ], - "shape": "arealight2", - "material": "arealight2" + "shape": 2, + "material": 2 }, - "sphere-uvgrid": { + { + "name": "sphere-uvgrid", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.4000000059604645, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-uvgrid" + "shape": 3, + "material": 3 }, - "suzanne-subdiv-plastic-rough": { + { + "name": "suzanne-subdiv-plastic-rough", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.20000000298023224, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + 0.0 ], - "shape": "suzanne-subdiv", - "material": "suzanne-subdiv-plastic-rough" + "shape": 4, + "material": 4 }, - "hairball1-hair": { - "shape": "hairball1", - "material": "hairball1-hair" + { + "name": "hairball1-hair", + "shape": 5, + "material": 5 }, - "sphere-displaced-plastic-rough": { + { + "name": "sphere-displaced-plastic-rough", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.20000000298023224, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere-displaced", - "material": "sphere-displaced-plastic-rough" + "shape": 6, + "material": 6 }, - "cube-uvgrid": { + { + "name": "cube-uvgrid", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.4000000059604645, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + 0.0 ], - "shape": "cube", - "material": "cube-uvgrid" + "shape": 7, + "material": 7 }, - "hairballi-hair": { - "shape": "hairballi", - "material": "hairballi-hair" - } - }, - "environments": { - "sky": { - "emission": [ 0.5, 0.5, 0.5 ], - "emission_tex": "sky" + { + "name": "hairballi-hair", + "shape": 8, + "material": 8 } - } -} \ No newline at end of file + ] +} diff --git a/tests/furnace1/furnace1.json b/tests/furnace1/furnace1.json index 698403a12..e05209ad7 100644 --- a/tests/furnace1/furnace1.json +++ b/tests/furnace1/furnace1.json @@ -2,45 +2,45 @@ "asset": { "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "default": { - "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.0, 0.0, 1.0] - ], + "cameras": [ + { + "name": "default", + "frame": [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0], "aspect": 2.4000000953674316, "focus": 1.0 } - }, - "materials": { - "sphere": { + ], + "environments": [ + { + "name": "env", + "emission": [0.5, 0.5, 0.5] + } + ], + "materials": [ + { + "name": "sphere", "type": "reflective", "color": [1.0, 1.0, 1.0], "roughness": 0.5 } - }, - "shapes": { - "sphere": "sphere.ply" - }, - "instances": { - "sphere": { + ], + "shapes": [ + { + "name": "sphere", + "uri": "shapes/sphere.ply" + } + ], + "instances": [ + { + "name": "sphere", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.0, -0.07500000298023224, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, -0.07500000298023224, + 0.0 ], - "shape": "sphere", - "material": "sphere" - } - }, - "environments": { - "env": { - "emission": [0.5, 0.5, 0.5] + "shape": 0, + "material": 0 } - } + ] } diff --git a/tests/furnace2/furnace2.json b/tests/furnace2/furnace2.json index 859a55022..c18632da1 100644 --- a/tests/furnace2/furnace2.json +++ b/tests/furnace2/furnace2.json @@ -1,272 +1,331 @@ { "asset": { - "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl" + "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", + "version": "4.2" }, - "cameras": { - "default": { + "cameras": [ + { + "name": "default", "lens": 0.1, "aperture": 0.0, "aspect": 1, "lookat": [0, 0.075, 3, 0, 0.075, 0, 0, 1, 0] } - }, - "environments": { - "furnace": { + ], + "environments": [ + { + "name": "furnace", "emission": [0.5, 0.5, 0.5] } - }, - "instances": { - "metallic-0": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.4, 0.4, 0], - "material": "metallic-0" - }, - "metallic-0.25": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.2, 0.4, 0], - "material": "metallic-0.25" - }, - "metallic-0.5": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0], - "material": "metallic-0.5" - }, - "metallic-0.75": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 0.4, 0], - "material": "metallic-0.75" - }, - "metallic-1": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.4, 0.4, 0], - "material": "metallic-1" - }, - "transparent-0": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.4, 0.2, 0], - "material": "transparent-0" - }, - "transparent-0.25": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.2, 0.2, 0], - "material": "transparent-0.25" - }, - "transparent-0.5": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.2, 0], - "material": "transparent-0.5" - }, - "transparent-0.75": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 0.2, 0], - "material": "transparent-0.75" - }, - "transparent-1": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.4, 0.2, 0], - "material": "transparent-1" - }, - "refractive-0": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.4, 0, 0], - "material": "refractive-0" - }, - "refractive-0.25": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.2, 0, 0], - "material": "refractive-0.25" - }, - "refractive-0.5": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], - "material": "refractive-0.5" - }, - "refractive-0.75": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 0, 0], - "material": "refractive-0.75" - }, - "refractive-1": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.4, 0, 0], - "material": "refractive-1" - }, - "matte-0": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.4, -0.2, 0], - "material": "matte-0" - }, - "matte-0.25": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.2, -0.2, 0], - "material": "matte-0.25" - }, - "matte-0.5": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.2, 0], - "material": "matte-0.5" - }, - "matte-0.75": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, -0.2, 0], - "material": "matte-0.75" - }, - "matte-1": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.4, -0.2, 0], - "material": "matte-1" - }, - "glossy-0": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.4, -0.4, 0], - "material": "glossy-0" - }, - "glossy-0.25": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.2, -0.4, 0], - "material": "glossy-0.25" - }, - "glossy-0.5": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.4, 0], - "material": "glossy-0.5" - }, - "glossy-0.75": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, -0.4, 0], - "material": "glossy-0.75" - }, - "glossy-1": { - "shape": "sphere", - "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.4, -0.4, 0], - "material": "glossy-1" - } - }, - "materials": { - "metallic-0": { + ], + "materials": [ + { + "name": "metallic-0", "type": "reflective", "color": [1, 1, 1], "roughness": 0 }, - "metallic-0.25": { + { + "name": "metallic-0.25", "type": "reflective", "color": [1, 1, 1], "roughness": 0.25 }, - "metallic-0.5": { + { + "name": "metallic-0.5", "type": "reflective", "color": [1, 1, 1], "roughness": 0.5 }, - "metallic-0.75": { + { + "name": "metallic-0.75", "type": "reflective", "color": [1, 1, 1], "roughness": 0.75 }, - "metallic-1": { + { + "name": "metallic-1", "type": "reflective", "color": [1, 1, 1], "roughness": 1 }, - "transparent-0": { + { + "name": "transparent-0", "type": "transparent", "color": [1, 1, 1], "roughness": 0 }, - "transparent-0.25": { + { + "name": "transparent-0.25", "type": "transparent", "color": [1, 1, 1], "roughness": 0.25 }, - "transparent-0.5": { + { + "name": "transparent-0.5", "type": "transparent", "color": [1, 1, 1], "roughness": 0.5 }, - "transparent-0.75": { + { + "name": "transparent-0.75", "type": "transparent", "color": [1, 1, 1], "roughness": 0.75 }, - "transparent-1": { + { + "name": "transparent-1", "type": "transparent", "color": [1, 1, 1], "roughness": 1 }, - "refractive-0": { + { + "name": "refractive-0", "type": "refractive", "color": [1, 1, 1], "roughness": 0 }, - "refractive-0.25": { + { + "name": "refractive-0.25", "type": "refractive", "color": [1, 1, 1], "roughness": 0.25 }, - "refractive-0.5": { + { + "name": "refractive-0.5", "type": "refractive", "color": [1, 1, 1], "roughness": 0.5 }, - "refractive-0.75": { + { + "name": "refractive-0.75", "type": "refractive", "color": [1, 1, 1], "roughness": 0.75 }, - "refractive-1": { + { + "name": "refractive-1", "type": "refractive", "color": [1, 1, 1], "roughness": 1 }, - "matte-0": { + { + "name": "matte-0", "type": "matte", "color": [1, 1, 1], "roughness": 0 }, - "matte-0.25": { + { + "name": "matte-0.25", "type": "matte", "color": [1, 1, 1], "roughness": 0.25 }, - "matte-0.5": { + { + "name": "matte-0.5", "type": "matte", "color": [1, 1, 1], "roughness": 0.5 }, - "matte-0.75": { + { + "name": "matte-0.75", "type": "matte", "color": [1, 1, 1], "roughness": 0.75 }, - "matte-1": { + { + "name": "matte-1", "type": "matte", "color": [1, 1, 1], "roughness": 1 }, - "glossy-0": { + { + "name": "glossy-0", "type": "glossy", "color": [1, 1, 1], "roughness": 0 }, - "glossy-0.25": { + { + "name": "glossy-0.25", "type": "glossy", "color": [1, 1, 1], "roughness": 0.25 }, - "glossy-0.5": { + { + "name": "glossy-0.5", "type": "glossy", "color": [1, 1, 1], "roughness": 0.5 }, - "glossy-0.75": { + { + "name": "glossy-0.75", "type": "glossy", "color": [1, 1, 1], "roughness": 0.75 }, - "glossy-1": { + { + "name": "glossy-1", "type": "glossy", "color": [1, 1, 1], "roughness": 1 } - } + ], + "shapes": [ + { + "name": "sphere", + "uri": "shapes/sphere.ply" + } + ], + "instances": [ + { + "name": "metallic-0", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.4, 0.4, 0], + "material": 0 + }, + { + "name": "metallic-0.25", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.2, 0.4, 0], + "material": 1 + }, + { + "name": "metallic-0.5", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0], + "material": 2 + }, + { + "name": "metallic-0.75", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 0.4, 0], + "material": 3 + }, + { + "name": "metallic-1", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.4, 0.4, 0], + "material": 4 + }, + { + "name": "transparent-0", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.4, 0.2, 0], + "material": 5 + }, + { + "name": "transparent-0.25", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.2, 0.2, 0], + "material": 6 + }, + { + "name": "transparent-0.5", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.2, 0], + "material": 7 + }, + { + "name": "transparent-0.75", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 0.2, 0], + "material": 8 + }, + { + "name": "transparent-1", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.4, 0.2, 0], + "material": 9 + }, + { + "name": "refractive-0", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.4, 0, 0], + "material": 10 + }, + { + "name": "refractive-0.25", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.2, 0, 0], + "material": 11 + }, + { + "name": "refractive-0.5", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], + "material": 12 + }, + { + "name": "refractive-0.75", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 0, 0], + "material": 13 + }, + { + "name": "refractive-1", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.4, 0, 0], + "material": 14 + }, + { + "name": "matte-0", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.4, -0.2, 0], + "material": 15 + }, + { + "name": "matte-0.25", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.2, -0.2, 0], + "material": 16 + }, + { + "name": "matte-0.5", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.2, 0], + "material": 17 + }, + { + "name": "matte-0.75", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, -0.2, 0], + "material": 18 + }, + { + "name": "matte-1", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.4, -0.2, 0], + "material": 19 + }, + { + "name": "glossy-0", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.4, -0.4, 0], + "material": 20 + }, + { + "name": "glossy-0.25", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, -0.2, -0.4, 0], + "material": 21 + }, + { + "name": "glossy-0.5", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.4, 0], + "material": 22 + }, + { + "name": "glossy-0.75", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, -0.4, 0], + "material": 23 + }, + { + "name": "glossy-1", + "shape": 0, + "frame": [1, 0, 0, 0, 1, 0, 0, 0, 1, 0.4, -0.4, 0], + "material": 24 + } + ] } diff --git a/tests/instances1/instances1.json b/tests/instances1/instances1.json index cc6ab0fcc..80749238b 100644 --- a/tests/instances1/instances1.json +++ b/tests/instances1/instances1.json @@ -2,147 +2,182 @@ "asset": { "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "default": { + "cameras": [ + { + "name": "default", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "front": { + { + "name": "front", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 0.936329185962677, -0.3511234223842621 ], - [ 0.0, 0.3511234223842621, 0.936329185962677 ], - [ 0.0, 0.574999988079071, 1.399999976158142 ] + 1.0, 0.0, 0.0, 0.0, 0.936329185962677, -0.3511234223842621, 0.0, + 0.3511234223842621, 0.936329185962677, 0.0, 0.574999988079071, + 1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "back": { + { + "name": "back", "frame": [ - [ -1.0, 0.0, 0.0 ], - [ 0.0, 0.936329185962677, 0.3511234223842621 ], - [ 0.0, 0.3511234223842621, -0.936329185962677 ], - [ 0.0, 0.574999988079071, -1.399999976158142 ] + -1.0, 0.0, 0.0, 0.0, 0.936329185962677, 0.3511234223842621, 0.0, + 0.3511234223842621, -0.936329185962677, 0.0, 0.574999988079071, + -1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "perspective-sharp": { + { + "name": "perspective-sharp", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "perspective-dof": { + { + "name": "perspective-dof", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.02500000037252903 }, - "orthographic-sharp": { + { + "name": "orthographic-sharp", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "orthographic-dof": { + { + "name": "orthographic-dof", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.019999999552965164 } - }, - "textures": { - "sky": "sky.hdr", - "floor": "floor.png", - "uvgrid": "uvgrid.png" - }, - "materials": { - "floor": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], - "color_tex": "floor" + ], + "environments": [ + { + "name": "sky", + "emission": [0.5, 0.5, 0.5], + "emission_tex": 0 + } + ], + "textures": [ + { + "name": "sky", + "uri": "textures/sky.hdr" + }, + { + "name": "floor", + "uri": "textures/floor.png" }, - "sphere-uvgrid": { + { + "name": "uvgrid", + "uri": "textures/uvgrid.png" + } + ], + "materials": [ + { + "name": "floor", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], + "color_tex": 1 + }, + { + "name": "sphere-uvgrid", "type": "glossy", - "color": [ 1.0, 1.0, 1.0 ], + "color": [1.0, 1.0, 1.0], "roughness": 0.20000000298023224, - "color_tex": "uvgrid" + "color_tex": 2 }, - "arealight1": { - "emission": [ 20.0, 20.0, 20.0 ] + { + "name": "arealight1", + "emission": [20.0, 20.0, 20.0] }, - "arealight2": { - "emission": [ 20.0, 20.0, 20.0 ] + { + "name": "arealight2", + "emission": [20.0, 20.0, 20.0] } - }, - "shapes": { - "floor": "floor.ply", - "sphere": "sphere.ply", - "arealight1": "arealight1.ply", - "arealight2": "arealight2.ply" - }, - "instances": { - "floor": { - "shape": "floor", - "material": "floor" + ], + "shapes": [ + { + "name": "floor", + "uri": "shapes/floor.ply" + }, + { + "name": "sphere", + "uri": "shapes/sphere.ply" }, - "sphere": { - "shape": "sphere", - "material": "sphere-uvgrid" + { + "name": "arealight1", + "uri": "shapes/arealight1.ply" + }, + { + "name": "arealight2", + "uri": "shapes/arealight2.ply" + } + ], + "instances": [ + { + "name": "floor", + "shape": 0, + "material": 0 }, - "arealight1": { + { + "name": "sphere", + "shape": 1, + "material": 1 + }, + { + "name": "arealight1", "frame": [ - [ 0.8944271802902222, -0.0, 0.4472135901451111 ], - [ 0.27562475204467773, 0.7874992489814758, -0.5512495040893555 ], - [ -0.3521803617477417, 0.6163156628608704, 0.7043607234954834 ], - [ -0.4000000059604645, 0.800000011920929, 0.800000011920929 ] + 0.8944271802902222, -0.0, 0.4472135901451111, 0.27562475204467773, + 0.7874992489814758, -0.5512495040893555, -0.3521803617477417, + 0.6163156628608704, 0.7043607234954834, -0.4000000059604645, + 0.800000011920929, 0.800000011920929 ], - "shape": "arealight1", - "material": "arealight1" + "shape": 2, + "material": 2 }, - "arealight2": { + { + "name": "arealight2", "frame": [ - [ 0.8944271802902222, 0.0, -0.4472135901451111 ], - [ -0.27562475204467773, 0.7874992489814758, -0.5512495040893555 ], - [ 0.3521803617477417, 0.6163156628608704, 0.7043607234954834 ], - [ 0.4000000059604645, 0.800000011920929, 0.800000011920929 ] + 0.8944271802902222, 0.0, -0.4472135901451111, -0.27562475204467773, + 0.7874992489814758, -0.5512495040893555, 0.3521803617477417, + 0.6163156628608704, 0.7043607234954834, 0.4000000059604645, + 0.800000011920929, 0.800000011920929 ], - "shape": "arealight2", - "material": "arealight2" - } - }, - "environments": { - "sky": { - "emission": [ 0.5, 0.5, 0.5 ], - "emission_tex": "sky" + "shape": 3, + "material": 3 } - } -} \ No newline at end of file + ] +} diff --git a/tests/materials1/materials1.json b/tests/materials1/materials1.json index 57ab4874c..7249babbd 100644 --- a/tests/materials1/materials1.json +++ b/tests/materials1/materials1.json @@ -2,83 +2,81 @@ "asset": { "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "default": { + "cameras": [ + { + "name": "default", "frame": [ - [0.9805806875228882, -0.0, 0.1961161345243454], - [0.08506310731172562, 0.9010388255119324, -0.4253155291080475], - [-0.17670825123786926, 0.43373844027519226, 0.8835412859916687], - [-0.6000000238418579, 1.5, 2.75] + 0.9805806875228882, -0.0, 0.1961161345243454, 0.08506310731172562, + 0.9010388255119324, -0.4253155291080475, -0.17670825123786926, + 0.43373844027519226, 0.8835412859916687, -0.6000000238418579, 1.5, 2.75 ], "lens": 0.10000000149011612, "aspect": 2.4000000953674316, "focus": 3.1124749183654785 }, - "front": { + { + "name": "front", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 0.8853979110717773, -0.46483391523361206], - [0.0, 0.46483391523361206, 0.8853979110717773], - [0.0, 1.75, 3.0] + 1.0, 0.0, 0.0, 0.0, 0.8853979110717773, -0.46483391523361206, 0.0, + 0.46483391523361206, 0.8853979110717773, 0.0, 1.75, 3.0 ], "lens": 0.10000000149011612, "aspect": 3.0, "focus": 3.3883070945739746 }, - "back": { + { + "name": "back", "frame": [ - [-1.0, 0.0, 0.0], - [0.0, 0.9026037454605103, 0.4304725229740143], - [0.0, 0.4304724931716919, -0.9026036858558655], - [0.0, 1.5, -3.25] + -1.0, 0.0, 0.0, 0.0, 0.9026037454605103, 0.4304725229740143, 0.0, + 0.4304724931716919, -0.9026036858558655, 0.0, 1.5, -3.25 ], "lens": 0.10000000149011612, "aspect": 3.0, "focus": 3.600694417953491 }, - "perspective-sharp": { + { + "name": "perspective-sharp", "frame": [ - [0.9805806875228882, -0.0, 0.1961161345243454], - [0.08506310731172562, 0.9010388255119324, -0.4253155291080475], - [-0.17670825123786926, 0.43373844027519226, 0.8835412859916687], - [-0.6000000238418579, 1.5, 2.75] + 0.9805806875228882, -0.0, 0.1961161345243454, 0.08506310731172562, + 0.9010388255119324, -0.4253155291080475, -0.17670825123786926, + 0.43373844027519226, 0.8835412859916687, -0.6000000238418579, 1.5, 2.75 ], "lens": 0.10000000149011612, "aspect": 2.4000000953674316, "focus": 3.1124749183654785 }, - "perspective-dof": { + { + "name": "perspective-dof", "frame": [ - [0.9805806875228882, -0.0, 0.1961161345243454], - [0.08506310731172562, 0.9010388255119324, -0.4253155291080475], - [-0.17670825123786926, 0.43373844027519226, 0.8835412859916687], - [-0.6000000238418579, 1.5, 2.75] + 0.9805806875228882, -0.0, 0.1961161345243454, 0.08506310731172562, + 0.9010388255119324, -0.4253155291080475, -0.17670825123786926, + 0.43373844027519226, 0.8835412859916687, -0.6000000238418579, 1.5, 2.75 ], "lens": 0.10000000149011612, "aspect": 2.4000000953674316, "focus": 3.1124749183654785, "aperture": 0.05000000074505806 }, - "orthographic-sharp": { + { + "name": "orthographic-sharp", "frame": [ - [0.9756097197532654, -0.0, 0.2195121943950653], - [0.08407647162675858, 0.9237421154975891, -0.3736732006072998], - [-0.20277264714241028, 0.3830150067806244, 0.9012117385864258], - [-0.5, 1.0, 2.0] + 0.9756097197532654, -0.0, 0.2195121943950653, 0.08407647162675858, + 0.9237421154975891, -0.3736732006072998, -0.20277264714241028, + 0.3830150067806244, 0.9012117385864258, -0.5, 1.0, 2.0 ], "orthographic": true, "lens": 0.029999999329447746, "aspect": 2.4000000953674316, "focus": 2.2192342281341553 }, - "orthographic-dof": { + { + "name": "orthographic-dof", "frame": [ - [0.9756097197532654, -0.0, 0.2195121943950653], - [0.08407647162675858, 0.9237421154975891, -0.3736732006072998], - [-0.20277264714241028, 0.3830150067806244, 0.9012117385864258], - [-0.5, 1.0, 2.0] + 0.9756097197532654, -0.0, 0.2195121943950653, 0.08407647162675858, + 0.9237421154975891, -0.3736732006072998, -0.20277264714241028, + 0.3830150067806244, 0.9012117385864258, -0.5, 1.0, 2.0 ], "orthographic": true, "lens": 0.029999999329447746, @@ -86,200 +84,230 @@ "focus": 2.2192342281341553, "aperture": 0.019999999552965164 } - }, - "textures": { - "sky": "sky.hdr", - "floor": "floor.png" - }, - "materials": { - "floor": { + ], + "environments": [ + { + "name": "sky", + "emission": [0.5, 0.5, 0.5], + "emission_tex": 0 + } + ], + "textures": [ + { + "name": "sky", + "uri": "textures/sky.hdr" + }, + { + "name": "floor", + "uri": "textures/floor.png" + } + ], + "materials": [ + { + "name": "floor", "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], - "color_tex": "floor" + "color_tex": 1 }, - "largearealight1": { + { + "name": "largearealight1", "emission": [10.0, 10.0, 10.0] }, - "largearealight2": { + { + "name": "largearealight2", "emission": [10.0, 10.0, 10.0] }, - "sphere-plastic-sharp": { + { + "name": "sphere-plastic-sharp", "type": "glossy", "color": [0.5, 0.5, 0.699999988079071], "roughness": 0.009999999776482582 }, - "sphere-plastic-rough": { + { + "name": "sphere-plastic-rough", "type": "glossy", "color": [0.5, 0.699999988079071, 0.5], "roughness": 0.20000000298023224 }, - "sphere-matte": { + { + "name": "sphere-matte", "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], "roughness": 1.0 }, - "sphere-metal-sharp": { + { + "name": "sphere-metal-sharp", "type": "reflective", "color": [0.699999988079071, 0.699999988079071, 0.699999988079071] }, - "sphere-metal-rough": { + { + "name": "sphere-metal-rough", "type": "reflective", "color": [0.6600000262260437, 0.44999998807907104, 0.3400000035762787], "roughness": 0.20000000298023224 }, - "bunny-plastic-sharp": { + { + "name": "bunny-plastic-sharp", "type": "glossy", "color": [0.5, 0.5, 0.699999988079071], "roughness": 0.009999999776482582 }, - "bunny-plastic-rough": { + { + "name": "bunny-plastic-rough", "type": "glossy", "color": [0.5, 0.699999988079071, 0.5], "roughness": 0.20000000298023224 }, - "bunny-matte": { + { + "name": "bunny-matte", "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], "roughness": 1.0 }, - "bunny-metal-sharp": { + { + "name": "bunny-metal-sharp", "type": "reflective", "color": [0.699999988079071, 0.699999988079071, 0.699999988079071] }, - "bunny-metal-rough": { + { + "name": "bunny-metal-rough", "type": "reflective", "color": [0.6600000262260437, 0.44999998807907104, 0.3400000035762787], "roughness": 0.20000000298023224 } - }, - "shapes": { - "floor": "floor.ply", - "largearealight1": "largearealight1.ply", - "largearealight2": "largearealight2.ply", - "sphere": "sphere.ply", - "bunny": "bunny.ply" - }, - "instances": { - "floor": { - "shape": "floor", - "material": "floor" + ], + "shapes": [ + { + "name": "floor", + "uri": "shapes/floor.ply" }, - "largearealight1": { + { + "name": "largearealight1", + "uri": "shapes/largearealight1.ply" + }, + { + "name": "largearealight2", + "uri": "shapes/largearealight2.ply" + }, + { + "name": "sphere", + "uri": "shapes/sphere.ply" + }, + { + "name": "bunny", + "uri": "shapes/bunny.ply" + } + ], + "instances": [ + { + "name": "floor", + "shape": 0, + "material": 0 + }, + { + "name": "largearealight1", "frame": [ - [0.8944271802902222, -0.0, 0.4472135901451111], - [0.2873478829860687, 0.766261100769043, -0.5746957659721375], - [-0.3426823318004608, 0.6425293684005737, 0.6853646636009216], - [-0.800000011920929, 1.600000023841858, 1.600000023841858] + 0.8944271802902222, -0.0, 0.4472135901451111, 0.2873478829860687, + 0.766261100769043, -0.5746957659721375, -0.3426823318004608, + 0.6425293684005737, 0.6853646636009216, -0.800000011920929, + 1.600000023841858, 1.600000023841858 ], - "shape": "largearealight1", - "material": "largearealight1" + "shape": 1, + "material": 1 }, - "largearealight2": { + { + "name": "largearealight2", "frame": [ - [0.8944271802902222, 0.0, -0.4472135901451111], - [-0.2873478829860687, 0.766261100769043, -0.5746957659721375], - [0.3426823318004608, 0.6425293684005737, 0.6853646636009216], - [0.800000011920929, 1.600000023841858, 1.600000023841858] + 0.8944271802902222, 0.0, -0.4472135901451111, -0.2873478829860687, + 0.766261100769043, -0.5746957659721375, 0.3426823318004608, + 0.6425293684005737, 0.6853646636009216, 0.800000011920929, + 1.600000023841858, 1.600000023841858 ], - "shape": "largearealight2", - "material": "largearealight2" + "shape": 2, + "material": 2 }, - "sphere-plastic-sharp": { + { + "name": "sphere-plastic-sharp", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.4000000059604645, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-plastic-sharp" + "shape": 3, + "material": 3 }, - "sphere-plastic-rough": { + { + "name": "sphere-plastic-rough", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.20000000298023224, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-plastic-rough" + "shape": 3, + "material": 4 }, - "sphere-matte": { - "shape": "sphere", - "material": "sphere-matte" + { + "name": "sphere-matte", + "shape": 3, + "material": 5 }, - "sphere-metal-sharp": { + { + "name": "sphere-metal-sharp", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.20000000298023224, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-metal-sharp" + "shape": 3, + "material": 6 }, - "sphere-metal-rough": { + { + "name": "sphere-metal-rough", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.4000000059604645, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-metal-rough" + "shape": 3, + "material": 7 }, - "bunny-plastic-sharp": { + { + "name": "bunny-plastic-sharp", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.4000000059604645, 0.0, -0.4000000059604645] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-plastic-sharp" + "shape": 4, + "material": 8 }, - "bunny-plastic-rough": { + { + "name": "bunny-plastic-rough", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.20000000298023224, 0.0, -0.4000000059604645] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-plastic-rough" + "shape": 4, + "material": 9 }, - "bunny-matte": { + { + "name": "bunny-matte", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.0, 0.0, -0.4000000059604645] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-matte" + "shape": 4, + "material": 10 }, - "bunny-metal-sharp": { + { + "name": "bunny-metal-sharp", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.20000000298023224, 0.0, -0.4000000059604645] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-metal-sharp" + "shape": 4, + "material": 11 }, - "bunny-metal-rough": { + { + "name": "bunny-metal-rough", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.4000000059604645, 0.0, -0.4000000059604645] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-metal-rough" - } - }, - "environments": { - "sky": { - "emission": [0.5, 0.5, 0.5], - "emission_tex": "sky" + "shape": 4, + "material": 12 } - } + ] } diff --git a/tests/materials2/materials2.json b/tests/materials2/materials2.json index 07130c29d..d850ab301 100644 --- a/tests/materials2/materials2.json +++ b/tests/materials2/materials2.json @@ -2,83 +2,81 @@ "asset": { "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "default": { + "cameras": [ + { + "name": "default", "frame": [ - [ 0.9805806875228882, -0.0, 0.1961161345243454 ], - [ 0.08506310731172562, 0.9010388255119324, -0.4253155291080475 ], - [ -0.17670825123786926, 0.43373844027519226, 0.8835412859916687 ], - [ -0.6000000238418579, 1.5, 2.75 ] + 0.9805806875228882, -0.0, 0.1961161345243454, 0.08506310731172562, + 0.9010388255119324, -0.4253155291080475, -0.17670825123786926, + 0.43373844027519226, 0.8835412859916687, -0.6000000238418579, 1.5, 2.75 ], "lens": 0.10000000149011612, "aspect": 2.4000000953674316, "focus": 3.1124749183654785 }, - "front": { + { + "name": "front", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 0.8853979110717773, -0.46483391523361206 ], - [ 0.0, 0.46483391523361206, 0.8853979110717773 ], - [ 0.0, 1.75, 3.0 ] + 1.0, 0.0, 0.0, 0.0, 0.8853979110717773, -0.46483391523361206, 0.0, + 0.46483391523361206, 0.8853979110717773, 0.0, 1.75, 3.0 ], "lens": 0.10000000149011612, "aspect": 3.0, "focus": 3.3883070945739746 }, - "back": { + { + "name": "back", "frame": [ - [ -1.0, 0.0, 0.0 ], - [ 0.0, 0.9026037454605103, 0.4304725229740143 ], - [ 0.0, 0.4304724931716919, -0.9026036858558655 ], - [ 0.0, 1.5, -3.25 ] + -1.0, 0.0, 0.0, 0.0, 0.9026037454605103, 0.4304725229740143, 0.0, + 0.4304724931716919, -0.9026036858558655, 0.0, 1.5, -3.25 ], "lens": 0.10000000149011612, "aspect": 3.0, "focus": 3.600694417953491 }, - "perspective-sharp": { + { + "name": "perspective-sharp", "frame": [ - [ 0.9805806875228882, -0.0, 0.1961161345243454 ], - [ 0.08506310731172562, 0.9010388255119324, -0.4253155291080475 ], - [ -0.17670825123786926, 0.43373844027519226, 0.8835412859916687 ], - [ -0.6000000238418579, 1.5, 2.75 ] + 0.9805806875228882, -0.0, 0.1961161345243454, 0.08506310731172562, + 0.9010388255119324, -0.4253155291080475, -0.17670825123786926, + 0.43373844027519226, 0.8835412859916687, -0.6000000238418579, 1.5, 2.75 ], "lens": 0.10000000149011612, "aspect": 2.4000000953674316, "focus": 3.1124749183654785 }, - "perspective-dof": { + { + "name": "perspective-dof", "frame": [ - [ 0.9805806875228882, -0.0, 0.1961161345243454 ], - [ 0.08506310731172562, 0.9010388255119324, -0.4253155291080475 ], - [ -0.17670825123786926, 0.43373844027519226, 0.8835412859916687 ], - [ -0.6000000238418579, 1.5, 2.75 ] + 0.9805806875228882, -0.0, 0.1961161345243454, 0.08506310731172562, + 0.9010388255119324, -0.4253155291080475, -0.17670825123786926, + 0.43373844027519226, 0.8835412859916687, -0.6000000238418579, 1.5, 2.75 ], "lens": 0.10000000149011612, "aspect": 2.4000000953674316, "focus": 3.1124749183654785, "aperture": 0.05000000074505806 }, - "orthographic-sharp": { + { + "name": "orthographic-sharp", "frame": [ - [ 0.9756097197532654, -0.0, 0.2195121943950653 ], - [ 0.08407647162675858, 0.9237421154975891, -0.3736732006072998 ], - [ -0.20277264714241028, 0.3830150067806244, 0.9012117385864258 ], - [ -0.5, 1.0, 2.0 ] + 0.9756097197532654, -0.0, 0.2195121943950653, 0.08407647162675858, + 0.9237421154975891, -0.3736732006072998, -0.20277264714241028, + 0.3830150067806244, 0.9012117385864258, -0.5, 1.0, 2.0 ], "orthographic": true, "lens": 0.029999999329447746, "aspect": 2.4000000953674316, "focus": 2.2192342281341553 }, - "orthographic-dof": { + { + "name": "orthographic-dof", "frame": [ - [ 0.9756097197532654, -0.0, 0.2195121943950653 ], - [ 0.08407647162675858, 0.9237421154975891, -0.3736732006072998 ], - [ -0.20277264714241028, 0.3830150067806244, 0.9012117385864258 ], - [ -0.5, 1.0, 2.0 ] + 0.9756097197532654, -0.0, 0.2195121943950653, 0.08407647162675858, + 0.9237421154975891, -0.3736732006072998, -0.20277264714241028, + 0.3830150067806244, 0.9012117385864258, -0.5, 1.0, 2.0 ], "orthographic": true, "lens": 0.029999999329447746, @@ -86,200 +84,230 @@ "focus": 2.2192342281341553, "aperture": 0.019999999552965164 } - }, - "textures": { - "sky": "sky.hdr", - "floor": "floor.png" - }, - "materials": { - "floor": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], - "color_tex": "floor" + ], + "environments": [ + { + "name": "sky", + "emission": [0.5, 0.5, 0.5], + "emission_tex": 0 + } + ], + "textures": [ + { + "name": "sky", + "uri": "textures/sky.hdr" }, - "largearealight1": { - "emission": [ 10.0, 10.0, 10.0 ] + { + "name": "floor", + "uri": "textures/floor.png" + } + ], + "materials": [ + { + "name": "floor", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], + "color_tex": 1 }, - "largearealight2": { - "emission": [ 10.0, 10.0, 10.0 ] + { + "name": "largearealight1", + "emission": [10.0, 10.0, 10.0] }, - "sphere-glass-sharp": { + { + "name": "largearealight2", + "emission": [10.0, 10.0, 10.0] + }, + { + "name": "sphere-glass-sharp", "type": "refractive", - "color": [ 1.0, 1.0, 1.0 ] + "color": [1.0, 1.0, 1.0] }, - "sphere-glass-rough": { + { + "name": "sphere-glass-rough", "type": "refractive", - "color": [ 1.0, 0.699999988079071, 0.699999988079071 ], + "color": [1.0, 0.699999988079071, 0.699999988079071], "roughness": 0.10000000149011612 }, - "sphere-transparent": { - "color": [ 0.699999988079071, 0.5, 0.5 ], + { + "name": "sphere-transparent", + "color": [0.699999988079071, 0.5, 0.5], "roughness": 1.0, "opacity": 0.20000000298023224 }, - "sphere-thinglass-sharp": { + { + "name": "sphere-thinglass-sharp", "type": "transparent", - "color": [ 1.0, 1.0, 1.0 ] + "color": [1.0, 1.0, 1.0] }, - "sphere-thinglass-rough": { + { + "name": "sphere-thinglass-rough", "type": "transparent", - "color": [ 1.0, 0.699999988079071, 0.699999988079071 ], + "color": [1.0, 0.699999988079071, 0.699999988079071], "roughness": 0.05000000074505806 }, - "bunny-glass-sharp": { + { + "name": "bunny-glass-sharp", "type": "refractive", - "color": [ 1.0, 1.0, 1.0 ] + "color": [1.0, 1.0, 1.0] }, - "bunny-glass-rough": { + { + "name": "bunny-glass-rough", "type": "refractive", - "color": [ 1.0, 0.699999988079071, 0.699999988079071 ], + "color": [1.0, 0.699999988079071, 0.699999988079071], "roughness": 0.10000000149011612 }, - "bunny-transparent": { - "color": [ 0.699999988079071, 0.5, 0.5 ], + { + "name": "bunny-transparent", + "color": [0.699999988079071, 0.5, 0.5], "roughness": 1.0, "opacity": 0.20000000298023224 }, - "bunny-thinglass-sharp": { + { + "name": "bunny-thinglass-sharp", "type": "transparent", - "color": [ 1.0, 1.0, 1.0 ] + "color": [1.0, 1.0, 1.0] }, - "bunny-thinglass-rough": { + { + "name": "bunny-thinglass-rough", "type": "transparent", - "color": [ 1.0, 0.699999988079071, 0.699999988079071 ], + "color": [1.0, 0.699999988079071, 0.699999988079071], "roughness": 0.05000000074505806 } - }, - "shapes": { - "floor": "floor.ply", - "largearealight1": "largearealight1.ply", - "largearealight2": "largearealight2.ply", - "sphere": "sphere.ply", - "bunny": "bunny.ply" - }, - "instances": { - "floor": { - "shape": "floor", - "material": "floor" + ], + "shapes": [ + { + "name": "floor", + "uri": "shapes/floor.ply" }, - "largearealight1": { + { + "name": "largearealight1", + "uri": "shapes/largearealight1.ply" + }, + { + "name": "largearealight2", + "uri": "shapes/largearealight2.ply" + }, + { + "name": "sphere", + "uri": "shapes/sphere.ply" + }, + { + "name": "bunny", + "uri": "shapes/bunny.ply" + } + ], + "instances": [ + { + "name": "floor", + "shape": 0, + "material": 0 + }, + { + "name": "largearealight1", "frame": [ - [ 0.8944271802902222, -0.0, 0.4472135901451111 ], - [ 0.2873478829860687, 0.766261100769043, -0.5746957659721375 ], - [ -0.3426823318004608, 0.6425293684005737, 0.6853646636009216 ], - [ -0.800000011920929, 1.600000023841858, 1.600000023841858 ] + 0.8944271802902222, -0.0, 0.4472135901451111, 0.2873478829860687, + 0.766261100769043, -0.5746957659721375, -0.3426823318004608, + 0.6425293684005737, 0.6853646636009216, -0.800000011920929, + 1.600000023841858, 1.600000023841858 ], - "shape": "largearealight1", - "material": "largearealight1" + "shape": 1, + "material": 1 }, - "largearealight2": { + { + "name": "largearealight2", "frame": [ - [ 0.8944271802902222, 0.0, -0.4472135901451111 ], - [ -0.2873478829860687, 0.766261100769043, -0.5746957659721375 ], - [ 0.3426823318004608, 0.6425293684005737, 0.6853646636009216 ], - [ 0.800000011920929, 1.600000023841858, 1.600000023841858 ] + 0.8944271802902222, 0.0, -0.4472135901451111, -0.2873478829860687, + 0.766261100769043, -0.5746957659721375, 0.3426823318004608, + 0.6425293684005737, 0.6853646636009216, 0.800000011920929, + 1.600000023841858, 1.600000023841858 ], - "shape": "largearealight2", - "material": "largearealight2" + "shape": 2, + "material": 2 }, - "sphere-glass-sharp": { + { + "name": "sphere-glass-sharp", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.4000000059604645, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-glass-sharp" + "shape": 3, + "material": 3 }, - "sphere-glass-rough": { + { + "name": "sphere-glass-rough", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.20000000298023224, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-glass-rough" + "shape": 3, + "material": 4 }, - "sphere-transparent": { - "shape": "sphere", - "material": "sphere-transparent" + { + "name": "sphere-transparent", + "shape": 3, + "material": 5 }, - "sphere-thinglass-sharp": { + { + "name": "sphere-thinglass-sharp", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.20000000298023224, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-thinglass-sharp" + "shape": 3, + "material": 6 }, - "sphere-thinglass-rough": { + { + "name": "sphere-thinglass-rough", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.4000000059604645, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-thinglass-rough" + "shape": 3, + "material": 7 }, - "bunny-glass-sharp": { + { + "name": "bunny-glass-sharp", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.4000000059604645, 0.0, -0.4000000059604645 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-glass-sharp" + "shape": 4, + "material": 8 }, - "bunny-glass-rough": { + { + "name": "bunny-glass-rough", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.20000000298023224, 0.0, -0.4000000059604645 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-glass-rough" + "shape": 4, + "material": 9 }, - "bunny-transparent": { + { + "name": "bunny-transparent", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.0, 0.0, -0.4000000059604645 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-transparent" + "shape": 4, + "material": 10 }, - "bunny-thinglass-sharp": { + { + "name": "bunny-thinglass-sharp", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.20000000298023224, 0.0, -0.4000000059604645 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-thinglass-sharp" + "shape": 4, + "material": 11 }, - "bunny-thinglass-rough": { + { + "name": "bunny-thinglass-rough", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.4000000059604645, 0.0, -0.4000000059604645 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-thinglass-rough" - } - }, - "environments": { - "sky": { - "emission": [ 0.5, 0.5, 0.5 ], - "emission_tex": "sky" + "shape": 4, + "material": 12 } - } -} \ No newline at end of file + ] +} diff --git a/tests/materials3/materials3.json b/tests/materials3/materials3.json index cd9516685..9ceb12cfc 100644 --- a/tests/materials3/materials3.json +++ b/tests/materials3/materials3.json @@ -2,83 +2,81 @@ "asset": { "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "default": { + "cameras": [ + { + "name": "default", "frame": [ - [0.9805806875228882, -0.0, 0.1961161345243454], - [0.08506310731172562, 0.9010388255119324, -0.4253155291080475], - [-0.17670825123786926, 0.43373844027519226, 0.8835412859916687], - [-0.6000000238418579, 1.5, 2.75] + 0.9805806875228882, -0.0, 0.1961161345243454, 0.08506310731172562, + 0.9010388255119324, -0.4253155291080475, -0.17670825123786926, + 0.43373844027519226, 0.8835412859916687, -0.6000000238418579, 1.5, 2.75 ], "lens": 0.10000000149011612, "aspect": 2.4000000953674316, "focus": 3.1124749183654785 }, - "front": { + { + "name": "front", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 0.8853979110717773, -0.46483391523361206], - [0.0, 0.46483391523361206, 0.8853979110717773], - [0.0, 1.75, 3.0] + 1.0, 0.0, 0.0, 0.0, 0.8853979110717773, -0.46483391523361206, 0.0, + 0.46483391523361206, 0.8853979110717773, 0.0, 1.75, 3.0 ], "lens": 0.10000000149011612, "aspect": 3.0, "focus": 3.3883070945739746 }, - "back": { + { + "name": "back", "frame": [ - [-1.0, 0.0, 0.0], - [0.0, 0.9026037454605103, 0.4304725229740143], - [0.0, 0.4304724931716919, -0.9026036858558655], - [0.0, 1.5, -3.25] + -1.0, 0.0, 0.0, 0.0, 0.9026037454605103, 0.4304725229740143, 0.0, + 0.4304724931716919, -0.9026036858558655, 0.0, 1.5, -3.25 ], "lens": 0.10000000149011612, "aspect": 3.0, "focus": 3.600694417953491 }, - "perspective-sharp": { + { + "name": "perspective-sharp", "frame": [ - [0.9805806875228882, -0.0, 0.1961161345243454], - [0.08506310731172562, 0.9010388255119324, -0.4253155291080475], - [-0.17670825123786926, 0.43373844027519226, 0.8835412859916687], - [-0.6000000238418579, 1.5, 2.75] + 0.9805806875228882, -0.0, 0.1961161345243454, 0.08506310731172562, + 0.9010388255119324, -0.4253155291080475, -0.17670825123786926, + 0.43373844027519226, 0.8835412859916687, -0.6000000238418579, 1.5, 2.75 ], "lens": 0.10000000149011612, "aspect": 2.4000000953674316, "focus": 3.1124749183654785 }, - "perspective-dof": { + { + "name": "perspective-dof", "frame": [ - [0.9805806875228882, -0.0, 0.1961161345243454], - [0.08506310731172562, 0.9010388255119324, -0.4253155291080475], - [-0.17670825123786926, 0.43373844027519226, 0.8835412859916687], - [-0.6000000238418579, 1.5, 2.75] + 0.9805806875228882, -0.0, 0.1961161345243454, 0.08506310731172562, + 0.9010388255119324, -0.4253155291080475, -0.17670825123786926, + 0.43373844027519226, 0.8835412859916687, -0.6000000238418579, 1.5, 2.75 ], "lens": 0.10000000149011612, "aspect": 2.4000000953674316, "focus": 3.1124749183654785, "aperture": 0.05000000074505806 }, - "orthographic-sharp": { + { + "name": "orthographic-sharp", "frame": [ - [0.9756097197532654, -0.0, 0.2195121943950653], - [0.08407647162675858, 0.9237421154975891, -0.3736732006072998], - [-0.20277264714241028, 0.3830150067806244, 0.9012117385864258], - [-0.5, 1.0, 2.0] + 0.9756097197532654, -0.0, 0.2195121943950653, 0.08407647162675858, + 0.9237421154975891, -0.3736732006072998, -0.20277264714241028, + 0.3830150067806244, 0.9012117385864258, -0.5, 1.0, 2.0 ], "orthographic": true, "lens": 0.029999999329447746, "aspect": 2.4000000953674316, "focus": 2.2192342281341553 }, - "orthographic-dof": { + { + "name": "orthographic-dof", "frame": [ - [0.9756097197532654, -0.0, 0.2195121943950653], - [0.08407647162675858, 0.9237421154975891, -0.3736732006072998], - [-0.20277264714241028, 0.3830150067806244, 0.9012117385864258], - [-0.5, 1.0, 2.0] + 0.9756097197532654, -0.0, 0.2195121943950653, 0.08407647162675858, + 0.9237421154975891, -0.3736732006072998, -0.20277264714241028, + 0.3830150067806244, 0.9012117385864258, -0.5, 1.0, 2.0 ], "orthographic": true, "lens": 0.029999999329447746, @@ -86,207 +84,240 @@ "focus": 2.2192342281341553, "aperture": 0.019999999552965164 } - }, - "textures": { - "sky": "sky.hdr", - "floor": "floor.png", - "bumps-normal": "bumps-normal.png" - }, - "materials": { - "floor": { + ], + "environments": [ + { + "name": "sky", + "emission": [0.5, 0.5, 0.5], + "emission_tex": 0 + } + ], + "textures": [ + { + "name": "sky", + "uri": "textures/sky.hdr" + }, + { + "name": "floor", + "uri": "textures/floor.png" + }, + { + "name": "bumps-normal", + "uri": "textures/bumps-normal.png" + } + ], + "materials": [ + { + "name": "floor", "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], - "color_tex": "floor" + "color_tex": 1 }, - "largearealight1": { + { + "name": "largearealight1", "emission": [10.0, 10.0, 10.0] }, - "largearealight2": { + { + "name": "largearealight2", "emission": [10.0, 10.0, 10.0] }, - "sphere-plastic-sharp-bumped": { + { + "name": "sphere-plastic-sharp-bumped", "type": "glossy", "color": [0.5, 0.5, 0.699999988079071], "roughness": 0.009999999776482582, - "normal_tex": "bumps-normal" + "normal_tex": 2 }, - "sphere-plastic-rough-coated": { + { + "name": "sphere-plastic-rough-coated", "type": "glossy", "color": [0.5, 0.699999988079071, 0.5], "roughness": 0.20000000298023224 }, - "sphere-metal-sharp-bumped": { + { + "name": "sphere-metal-sharp-bumped", "type": "reflective", "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], - "normal_tex": "bumps-normal" + "normal_tex": 2 }, - "sphere-metal-rough-coated": { + { + "name": "sphere-metal-rough-coated", "type": "reflective", "color": [0.6600000262260437, 0.44999998807907104, 0.3400000035762787], "roughness": 0.20000000298023224 }, - "sphere-metal-rough": { + { + "name": "sphere-metal-rough", "type": "reflective", "color": [0.6600000262260437, 0.44999998807907104, 0.3400000035762787], "roughness": 0.20000000298023224 }, - "bunny-plastic-sharp-bumped": { + { + "name": "bunny-plastic-sharp-bumped", "type": "glossy", "color": [0.5, 0.5, 0.699999988079071], "roughness": 0.009999999776482582, - "normal_tex": "bumps-normal" + "normal_tex": 2 }, - "bunny-plastic-rough-coated": { + { + "name": "bunny-plastic-rough-coated", "type": "glossy", "color": [0.5, 0.699999988079071, 0.5], "roughness": 0.20000000298023224 }, - "bunny-metal-sharp-bumped": { + { + "name": "bunny-metal-sharp-bumped", "type": "reflective", "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], - "normal_tex": "bumps-normal" + "normal_tex": 2 }, - "bunny-metal-rough-coated": { + { + "name": "bunny-metal-rough-coated", "type": "reflective", "color": [0.6600000262260437, 0.44999998807907104, 0.3400000035762787], "roughness": 0.20000000298023224 }, - "bunny-metal-rough": { + { + "name": "bunny-metal-rough", "type": "reflective", "color": [0.6600000262260437, 0.44999998807907104, 0.3400000035762787], "roughness": 0.20000000298023224 } - }, - "shapes": { - "floor": "floor.ply", - "largearealight1": "largearealight1.ply", - "largearealight2": "largearealight2.ply", - "sphere": "sphere.ply", - "bunny": "bunny.ply" - }, - "instances": { - "floor": { - "shape": "floor", - "material": "floor" + ], + "shapes": [ + { + "name": "floor", + "uri": "shapes/floor.ply" }, - "largearealight1": { + { + "name": "largearealight1", + "uri": "shapes/largearealight1.ply" + }, + { + "name": "largearealight2", + "uri": "shapes/largearealight2.ply" + }, + { + "name": "sphere", + "uri": "shapes/sphere.ply" + }, + { + "name": "bunny", + "uri": "shapes/bunny.ply" + } + ], + "instances": [ + { + "name": "floor", + "shape": 0, + "material": 0 + }, + { + "name": "largearealight1", "frame": [ - [0.8944271802902222, -0.0, 0.4472135901451111], - [0.2873478829860687, 0.766261100769043, -0.5746957659721375], - [-0.3426823318004608, 0.6425293684005737, 0.6853646636009216], - [-0.800000011920929, 1.600000023841858, 1.600000023841858] + 0.8944271802902222, -0.0, 0.4472135901451111, 0.2873478829860687, + 0.766261100769043, -0.5746957659721375, -0.3426823318004608, + 0.6425293684005737, 0.6853646636009216, -0.800000011920929, + 1.600000023841858, 1.600000023841858 ], - "shape": "largearealight1", - "material": "largearealight1" + "shape": 1, + "material": 1 }, - "largearealight2": { + { + "name": "largearealight2", "frame": [ - [0.8944271802902222, 0.0, -0.4472135901451111], - [-0.2873478829860687, 0.766261100769043, -0.5746957659721375], - [0.3426823318004608, 0.6425293684005737, 0.6853646636009216], - [0.800000011920929, 1.600000023841858, 1.600000023841858] + 0.8944271802902222, 0.0, -0.4472135901451111, -0.2873478829860687, + 0.766261100769043, -0.5746957659721375, 0.3426823318004608, + 0.6425293684005737, 0.6853646636009216, 0.800000011920929, + 1.600000023841858, 1.600000023841858 ], - "shape": "largearealight2", - "material": "largearealight2" + "shape": 2, + "material": 2 }, - "sphere-plastic-sharp-bumped": { + { + "name": "sphere-plastic-sharp-bumped", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.4000000059604645, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-plastic-sharp-bumped" + "shape": 3, + "material": 3 }, - "sphere-plastic-rough-coated": { + { + "name": "sphere-plastic-rough-coated", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.20000000298023224, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-plastic-rough-coated" + "shape": 3, + "material": 4 }, - "sphere-metal-sharp-bumped": { - "shape": "sphere", - "material": "sphere-metal-sharp-bumped" + { + "name": "sphere-metal-sharp-bumped", + "shape": 3, + "material": 5 }, - "sphere-metal-rough-coated": { + { + "name": "sphere-metal-rough-coated", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.20000000298023224, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-metal-rough-coated" + "shape": 3, + "material": 6 }, - "sphere-metal-rough": { + { + "name": "sphere-metal-rough", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.4000000059604645, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-metal-rough" + "shape": 3, + "material": 7 }, - "bunny-plastic-sharp-bumped": { + { + "name": "bunny-plastic-sharp-bumped", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.4000000059604645, 0.0, -0.4000000059604645] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-plastic-sharp-bumped" + "shape": 4, + "material": 8 }, - "bunny-plastic-rough-coated": { + { + "name": "bunny-plastic-rough-coated", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.20000000298023224, 0.0, -0.4000000059604645] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-plastic-rough-coated" + "shape": 4, + "material": 9 }, - "bunny-metal-sharp-bumped": { + { + "name": "bunny-metal-sharp-bumped", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.0, 0.0, -0.4000000059604645] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-metal-sharp-bumped" + "shape": 4, + "material": 10 }, - "bunny-metal-rough-coated": { + { + "name": "bunny-metal-rough-coated", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.20000000298023224, 0.0, -0.4000000059604645] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-metal-rough-coated" + "shape": 4, + "material": 11 }, - "bunny-metal-rough": { + { + "name": "bunny-metal-rough", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.4000000059604645, 0.0, -0.4000000059604645] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-metal-rough" - } - }, - "environments": { - "sky": { - "emission": [0.5, 0.5, 0.5], - "emission_tex": "sky" + "shape": 4, + "material": 12 } - } + ] } diff --git a/tests/materials4/materials4.json b/tests/materials4/materials4.json index 12d6b51a9..a54c52f6f 100644 --- a/tests/materials4/materials4.json +++ b/tests/materials4/materials4.json @@ -2,83 +2,81 @@ "asset": { "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "default": { + "cameras": [ + { + "name": "default", "frame": [ - [ 0.9805806875228882, -0.0, 0.1961161345243454 ], - [ 0.08506310731172562, 0.9010388255119324, -0.4253155291080475 ], - [ -0.17670825123786926, 0.43373844027519226, 0.8835412859916687 ], - [ -0.6000000238418579, 1.5, 2.75 ] + 0.9805806875228882, -0.0, 0.1961161345243454, 0.08506310731172562, + 0.9010388255119324, -0.4253155291080475, -0.17670825123786926, + 0.43373844027519226, 0.8835412859916687, -0.6000000238418579, 1.5, 2.75 ], "lens": 0.10000000149011612, "aspect": 2.4000000953674316, "focus": 3.1124749183654785 }, - "front": { + { + "name": "front", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 0.8853979110717773, -0.46483391523361206 ], - [ 0.0, 0.46483391523361206, 0.8853979110717773 ], - [ 0.0, 1.75, 3.0 ] + 1.0, 0.0, 0.0, 0.0, 0.8853979110717773, -0.46483391523361206, 0.0, + 0.46483391523361206, 0.8853979110717773, 0.0, 1.75, 3.0 ], "lens": 0.10000000149011612, "aspect": 3.0, "focus": 3.3883070945739746 }, - "back": { + { + "name": "back", "frame": [ - [ -1.0, 0.0, 0.0 ], - [ 0.0, 0.9026037454605103, 0.4304725229740143 ], - [ 0.0, 0.4304724931716919, -0.9026036858558655 ], - [ 0.0, 1.5, -3.25 ] + -1.0, 0.0, 0.0, 0.0, 0.9026037454605103, 0.4304725229740143, 0.0, + 0.4304724931716919, -0.9026036858558655, 0.0, 1.5, -3.25 ], "lens": 0.10000000149011612, "aspect": 3.0, "focus": 3.600694417953491 }, - "perspective-sharp": { + { + "name": "perspective-sharp", "frame": [ - [ 0.9805806875228882, -0.0, 0.1961161345243454 ], - [ 0.08506310731172562, 0.9010388255119324, -0.4253155291080475 ], - [ -0.17670825123786926, 0.43373844027519226, 0.8835412859916687 ], - [ -0.6000000238418579, 1.5, 2.75 ] + 0.9805806875228882, -0.0, 0.1961161345243454, 0.08506310731172562, + 0.9010388255119324, -0.4253155291080475, -0.17670825123786926, + 0.43373844027519226, 0.8835412859916687, -0.6000000238418579, 1.5, 2.75 ], "lens": 0.10000000149011612, "aspect": 2.4000000953674316, "focus": 3.1124749183654785 }, - "perspective-dof": { + { + "name": "perspective-dof", "frame": [ - [ 0.9805806875228882, -0.0, 0.1961161345243454 ], - [ 0.08506310731172562, 0.9010388255119324, -0.4253155291080475 ], - [ -0.17670825123786926, 0.43373844027519226, 0.8835412859916687 ], - [ -0.6000000238418579, 1.5, 2.75 ] + 0.9805806875228882, -0.0, 0.1961161345243454, 0.08506310731172562, + 0.9010388255119324, -0.4253155291080475, -0.17670825123786926, + 0.43373844027519226, 0.8835412859916687, -0.6000000238418579, 1.5, 2.75 ], "lens": 0.10000000149011612, "aspect": 2.4000000953674316, "focus": 3.1124749183654785, "aperture": 0.05000000074505806 }, - "orthographic-sharp": { + { + "name": "orthographic-sharp", "frame": [ - [ 0.9756097197532654, -0.0, 0.2195121943950653 ], - [ 0.08407647162675858, 0.9237421154975891, -0.3736732006072998 ], - [ -0.20277264714241028, 0.3830150067806244, 0.9012117385864258 ], - [ -0.5, 1.0, 2.0 ] + 0.9756097197532654, -0.0, 0.2195121943950653, 0.08407647162675858, + 0.9237421154975891, -0.3736732006072998, -0.20277264714241028, + 0.3830150067806244, 0.9012117385864258, -0.5, 1.0, 2.0 ], "orthographic": true, "lens": 0.029999999329447746, "aspect": 2.4000000953674316, "focus": 2.2192342281341553 }, - "orthographic-dof": { + { + "name": "orthographic-dof", "frame": [ - [ 0.9756097197532654, -0.0, 0.2195121943950653 ], - [ 0.08407647162675858, 0.9237421154975891, -0.3736732006072998 ], - [ -0.20277264714241028, 0.3830150067806244, 0.9012117385864258 ], - [ -0.5, 1.0, 2.0 ] + 0.9756097197532654, -0.0, 0.2195121943950653, 0.08407647162675858, + 0.9237421154975891, -0.3736732006072998, -0.20277264714241028, + 0.3830150067806244, 0.9012117385864258, -0.5, 1.0, 2.0 ], "orthographic": true, "lens": 0.029999999329447746, @@ -86,205 +84,247 @@ "focus": 2.2192342281341553, "aperture": 0.019999999552965164 } - }, - "textures": { - "sky": "sky.hdr", - "floor": "floor.png" - }, - "materials": { - "floor": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], - "color_tex": "floor" + ], + "environments": [ + { + "name": "sky", + "emission": [0.5, 0.5, 0.5], + "emission_tex": 0 + } + ], + "textures": [ + { + "name": "sky", + "uri": "textures/sky.hdr" }, - "largearealight1": { - "emission": [ 10.0, 10.0, 10.0 ] + { + "name": "floor", + "uri": "textures/floor.png" + } + ], + "materials": [ + { + "name": "floor", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], + "color_tex": 1 }, - "largearealight2": { - "emission": [ 10.0, 10.0, 10.0 ] + { + "name": "largearealight1", + "emission": [10.0, 10.0, 10.0] }, - "sphere-volume-cloud": { + { + "name": "largearealight2", + "emission": [10.0, 10.0, 10.0] + }, + { + "name": "sphere-volume-cloud", "type": "volume", - "color": [ 0.6499999761581421, 0.6499999761581421, 0.6499999761581421 ], - "scattering": [ 0.8999999761581421, 0.8999999761581421, 0.8999999761581421 ] + "color": [0.6499999761581421, 0.6499999761581421, 0.6499999761581421], + "scattering": [0.8999999761581421, 0.8999999761581421, 0.8999999761581421] }, - "sphere-volume-glass": { + { + "name": "sphere-volume-glass", "type": "refractive", - "color": [ 1.0, 0.5, 0.5 ], + "color": [1.0, 0.5, 0.5], "trdepth": 0.019999999552965164 }, - "sphere-volume-jade": { + { + "name": "sphere-volume-jade", "type": "refractive", - "color": [ 0.5, 0.5, 0.5 ], - "scattering": [ 0.30000001192092896, 0.6000000238418579, 0.30000001192092896 ] + "color": [0.5, 0.5, 0.5], + "scattering": [ + 0.30000001192092896, 0.6000000238418579, 0.30000001192092896 + ] }, - "sphere-volume-jade2": { + { + "name": "sphere-volume-jade2", "type": "refractive", - "color": [ 0.5, 0.5, 0.5 ], - "scattering": [ 0.30000001192092896, 0.6000000238418579, 0.30000001192092896 ] + "color": [0.5, 0.5, 0.5], + "scattering": [ + 0.30000001192092896, 0.6000000238418579, 0.30000001192092896 + ] }, - "sphere-volume-smoke": { + { + "name": "sphere-volume-smoke", "type": "volume", - "color": [ 0.5, 0.5, 0.5 ], - "scattering": [ 0.20000000298023224, 0.20000000298023224, 0.20000000298023224 ] + "color": [0.5, 0.5, 0.5], + "scattering": [ + 0.20000000298023224, 0.20000000298023224, 0.20000000298023224 + ] }, - "bunny-volume-cloud": { + { + "name": "bunny-volume-cloud", "type": "volume", - "color": [ 0.6499999761581421, 0.6499999761581421, 0.6499999761581421 ], - "scattering": [ 0.8999999761581421, 0.8999999761581421, 0.8999999761581421 ] + "color": [0.6499999761581421, 0.6499999761581421, 0.6499999761581421], + "scattering": [0.8999999761581421, 0.8999999761581421, 0.8999999761581421] }, - "bunny-volume-glass": { + { + "name": "bunny-volume-glass", "type": "refractive", - "color": [ 1.0, 0.5, 0.5 ], + "color": [1.0, 0.5, 0.5], "trdepth": 0.019999999552965164 }, - "bunny-volume-jade": { + { + "name": "bunny-volume-jade", "type": "refractive", - "color": [ 0.5, 0.5, 0.5 ], - "scattering": [ 0.30000001192092896, 0.6000000238418579, 0.30000001192092896 ] + "color": [0.5, 0.5, 0.5], + "scattering": [ + 0.30000001192092896, 0.6000000238418579, 0.30000001192092896 + ] }, - "bunny-volume-jade2": { + { + "name": "bunny-volume-jade2", "type": "refractive", - "color": [ 0.5, 0.5, 0.5 ], + "color": [0.5, 0.5, 0.5], "roughness": 0.10000000149011612, - "scattering": [ 0.30000001192092896, 0.6000000238418579, 0.30000001192092896 ] + "scattering": [ + 0.30000001192092896, 0.6000000238418579, 0.30000001192092896 + ] }, - "bunny-volume-smoke": { + { + "name": "bunny-volume-smoke", "type": "volume", - "color": [ 0.5, 0.5, 0.5 ], - "scattering": [ 0.20000000298023224, 0.20000000298023224, 0.20000000298023224 ] + "color": [0.5, 0.5, 0.5], + "scattering": [ + 0.20000000298023224, 0.20000000298023224, 0.20000000298023224 + ] } - }, - "shapes": { - "floor": "floor.ply", - "largearealight1": "largearealight1.ply", - "largearealight2": "largearealight2.ply", - "sphere": "sphere.ply", - "bunny": "bunny.ply" - }, - "instances": { - "floor": { - "shape": "floor", - "material": "floor" + ], + "shapes": [ + { + "name": "floor", + "uri": "shapes/floor.ply" }, - "largearealight1": { + { + "name": "largearealight1", + "uri": "shapes/largearealight1.ply" + }, + { + "name": "largearealight2", + "uri": "shapes/largearealight2.ply" + }, + { + "name": "sphere", + "uri": "shapes/sphere.ply" + }, + { + "name": "bunny", + "uri": "shapes/bunny.ply" + } + ], + "instances": [ + { + "name": "floor", + "shape": 0, + "material": 0 + }, + { + "name": "largearealight1", "frame": [ - [ 0.8944271802902222, -0.0, 0.4472135901451111 ], - [ 0.2873478829860687, 0.766261100769043, -0.5746957659721375 ], - [ -0.3426823318004608, 0.6425293684005737, 0.6853646636009216 ], - [ -0.800000011920929, 1.600000023841858, 1.600000023841858 ] + 0.8944271802902222, -0.0, 0.4472135901451111, 0.2873478829860687, + 0.766261100769043, -0.5746957659721375, -0.3426823318004608, + 0.6425293684005737, 0.6853646636009216, -0.800000011920929, + 1.600000023841858, 1.600000023841858 ], - "shape": "largearealight1", - "material": "largearealight1" + "shape": 1, + "material": 1 }, - "largearealight2": { + { + "name": "largearealight2", "frame": [ - [ 0.8944271802902222, 0.0, -0.4472135901451111 ], - [ -0.2873478829860687, 0.766261100769043, -0.5746957659721375 ], - [ 0.3426823318004608, 0.6425293684005737, 0.6853646636009216 ], - [ 0.800000011920929, 1.600000023841858, 1.600000023841858 ] + 0.8944271802902222, 0.0, -0.4472135901451111, -0.2873478829860687, + 0.766261100769043, -0.5746957659721375, 0.3426823318004608, + 0.6425293684005737, 0.6853646636009216, 0.800000011920929, + 1.600000023841858, 1.600000023841858 ], - "shape": "largearealight2", - "material": "largearealight2" + "shape": 2, + "material": 2 }, - "sphere-volume-cloud": { + { + "name": "sphere-volume-cloud", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.4000000059604645, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-volume-cloud" + "shape": 3, + "material": 3 }, - "sphere-volume-glass": { + { + "name": "sphere-volume-glass", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.20000000298023224, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-volume-glass" + "shape": 3, + "material": 4 }, - "sphere-volume-jade": { - "shape": "sphere", - "material": "sphere-volume-jade" + { + "name": "sphere-volume-jade", + "shape": 3, + "material": 5 }, - "sphere-volume-jade2": { + { + "name": "sphere-volume-jade2", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.20000000298023224, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-volume-jade2" + "shape": 3, + "material": 6 }, - "sphere-volume-smoke": { + { + "name": "sphere-volume-smoke", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.4000000059604645, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-volume-smoke" + "shape": 3, + "material": 7 }, - "bunny-volume-cloud": { + { + "name": "bunny-volume-cloud", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.4000000059604645, 0.0, -0.4000000059604645 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-volume-cloud" + "shape": 4, + "material": 8 }, - "bunny-volume-glass": { + { + "name": "bunny-volume-glass", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.20000000298023224, 0.0, -0.4000000059604645 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-volume-glass" + "shape": 4, + "material": 9 }, - "bunny-volume-jade": { + { + "name": "bunny-volume-jade", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.0, 0.0, -0.4000000059604645 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-volume-jade" + "shape": 4, + "material": 10 }, - "bunny-volume-jade2": { + { + "name": "bunny-volume-jade2", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.20000000298023224, 0.0, -0.4000000059604645 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-volume-jade2" + "shape": 4, + "material": 11 }, - "bunny-volume-smoke": { + { + "name": "bunny-volume-smoke", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.4000000059604645, 0.0, -0.4000000059604645 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "bunny-volume-smoke" - } - }, - "environments": { - "sky": { - "emission": [ 0.5, 0.5, 0.5 ], - "emission_tex": "sky" + "shape": 4, + "material": 12 } - } -} \ No newline at end of file + ] +} diff --git a/tests/materials5/materials5.json b/tests/materials5/materials5.json index aaad4c236..55b70ac78 100644 --- a/tests/materials5/materials5.json +++ b/tests/materials5/materials5.json @@ -2,83 +2,81 @@ "asset": { "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "default": { + "cameras": [ + { + "name": "default", "frame": [ - [ 0.9805806875228882, -0.0, 0.1961161345243454 ], - [ 0.08506310731172562, 0.9010388255119324, -0.4253155291080475 ], - [ -0.17670825123786926, 0.43373844027519226, 0.8835412859916687 ], - [ -0.6000000238418579, 1.5, 2.75 ] + 0.9805806875228882, -0.0, 0.1961161345243454, 0.08506310731172562, + 0.9010388255119324, -0.4253155291080475, -0.17670825123786926, + 0.43373844027519226, 0.8835412859916687, -0.6000000238418579, 1.5, 2.75 ], "lens": 0.10000000149011612, "aspect": 2.4000000953674316, "focus": 3.1124749183654785 }, - "front": { + { + "name": "front", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 0.8853979110717773, -0.46483391523361206 ], - [ 0.0, 0.46483391523361206, 0.8853979110717773 ], - [ 0.0, 1.75, 3.0 ] + 1.0, 0.0, 0.0, 0.0, 0.8853979110717773, -0.46483391523361206, 0.0, + 0.46483391523361206, 0.8853979110717773, 0.0, 1.75, 3.0 ], "lens": 0.10000000149011612, "aspect": 3.0, "focus": 3.3883070945739746 }, - "back": { + { + "name": "back", "frame": [ - [ -1.0, 0.0, 0.0 ], - [ 0.0, 0.9026037454605103, 0.4304725229740143 ], - [ 0.0, 0.4304724931716919, -0.9026036858558655 ], - [ 0.0, 1.5, -3.25 ] + -1.0, 0.0, 0.0, 0.0, 0.9026037454605103, 0.4304725229740143, 0.0, + 0.4304724931716919, -0.9026036858558655, 0.0, 1.5, -3.25 ], "lens": 0.10000000149011612, "aspect": 3.0, "focus": 3.600694417953491 }, - "perspective-sharp": { + { + "name": "perspective-sharp", "frame": [ - [ 0.9805806875228882, -0.0, 0.1961161345243454 ], - [ 0.08506310731172562, 0.9010388255119324, -0.4253155291080475 ], - [ -0.17670825123786926, 0.43373844027519226, 0.8835412859916687 ], - [ -0.6000000238418579, 1.5, 2.75 ] + 0.9805806875228882, -0.0, 0.1961161345243454, 0.08506310731172562, + 0.9010388255119324, -0.4253155291080475, -0.17670825123786926, + 0.43373844027519226, 0.8835412859916687, -0.6000000238418579, 1.5, 2.75 ], "lens": 0.10000000149011612, "aspect": 2.4000000953674316, "focus": 3.1124749183654785 }, - "perspective-dof": { + { + "name": "perspective-dof", "frame": [ - [ 0.9805806875228882, -0.0, 0.1961161345243454 ], - [ 0.08506310731172562, 0.9010388255119324, -0.4253155291080475 ], - [ -0.17670825123786926, 0.43373844027519226, 0.8835412859916687 ], - [ -0.6000000238418579, 1.5, 2.75 ] + 0.9805806875228882, -0.0, 0.1961161345243454, 0.08506310731172562, + 0.9010388255119324, -0.4253155291080475, -0.17670825123786926, + 0.43373844027519226, 0.8835412859916687, -0.6000000238418579, 1.5, 2.75 ], "lens": 0.10000000149011612, "aspect": 2.4000000953674316, "focus": 3.1124749183654785, "aperture": 0.05000000074505806 }, - "orthographic-sharp": { + { + "name": "orthographic-sharp", "frame": [ - [ 0.9756097197532654, -0.0, 0.2195121943950653 ], - [ 0.08407647162675858, 0.9237421154975891, -0.3736732006072998 ], - [ -0.20277264714241028, 0.3830150067806244, 0.9012117385864258 ], - [ -0.5, 1.0, 2.0 ] + 0.9756097197532654, -0.0, 0.2195121943950653, 0.08407647162675858, + 0.9237421154975891, -0.3736732006072998, -0.20277264714241028, + 0.3830150067806244, 0.9012117385864258, -0.5, 1.0, 2.0 ], "orthographic": true, "lens": 0.029999999329447746, "aspect": 2.4000000953674316, "focus": 2.2192342281341553 }, - "orthographic-dof": { + { + "name": "orthographic-dof", "frame": [ - [ 0.9756097197532654, -0.0, 0.2195121943950653 ], - [ 0.08407647162675858, 0.9237421154975891, -0.3736732006072998 ], - [ -0.20277264714241028, 0.3830150067806244, 0.9012117385864258 ], - [ -0.5, 1.0, 2.0 ] + 0.9756097197532654, -0.0, 0.2195121943950653, 0.08407647162675858, + 0.9237421154975891, -0.3736732006072998, -0.20277264714241028, + 0.3830150067806244, 0.9012117385864258, -0.5, 1.0, 2.0 ], "orthographic": true, "lens": 0.029999999329447746, @@ -86,193 +84,228 @@ "focus": 2.2192342281341553, "aperture": 0.019999999552965164 } - }, - "textures": { - "sky": "sky.hdr", - "floor": "floor.png" - }, - "materials": { - "floor": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], - "color_tex": "floor" + ], + "environments": [ + { + "name": "sky", + "emission": [0.5, 0.5, 0.5], + "emission_tex": 0 + } + ], + "textures": [ + { + "name": "sky", + "uri": "textures/sky.hdr" + }, + { + "name": "floor", + "uri": "textures/floor.png" + } + ], + "materials": [ + { + "name": "floor", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], + "color_tex": 1 }, - "largearealight1": { - "emission": [ 10.0, 10.0, 10.0 ] + { + "name": "largearealight1", + "emission": [10.0, 10.0, 10.0] }, - "largearealight2": { - "emission": [ 10.0, 10.0, 10.0 ] + { + "name": "largearealight2", + "emission": [10.0, 10.0, 10.0] }, - "skin1a": { + { + "name": "skin1a", "type": "refractive", - "color": [ 0.7599999904632568, 0.47999998927116394, 0.23000000417232513 ], + "color": [0.7599999904632568, 0.47999998927116394, 0.23000000417232513], "roughness": 0.25, "trdepth": 0.0010000000474974513, - "scattering": [ 0.4359999895095825, 0.22699999809265137, 0.13099999725818634 ], + "scattering": [ + 0.4359999895095825, 0.22699999809265137, 0.13099999725818634 + ], "scanisotropy": -0.800000011920929 }, - "skin2a": { + { + "name": "skin2a", "type": "refractive", - "color": [ 0.8199999928474426, 0.550000011920929, 0.4000000059604645 ], + "color": [0.8199999928474426, 0.550000011920929, 0.4000000059604645], "roughness": 0.25, "trdepth": 0.0010000000474974513, - "scattering": [ 0.6230000257492065, 0.43299999833106995, 0.34299999475479126 ], + "scattering": [ + 0.6230000257492065, 0.43299999833106995, 0.34299999475479126 + ], "scanisotropy": -0.800000011920929 }, - "skins": { + { + "name": "skins", "type": "refractive", - "color": [ 0.7599999904632568, 0.47999998927116394, 0.23000000417232513 ], + "color": [0.7599999904632568, 0.47999998927116394, 0.23000000417232513], "trdepth": 0.0010000000474974513, - "scattering": [ 0.4359999895095825, 0.22699999809265137, 0.13099999725818634 ], + "scattering": [ + 0.4359999895095825, 0.22699999809265137, 0.13099999725818634 + ], "scanisotropy": -0.800000011920929 }, - "skin1b": { + { + "name": "skin1b", "type": "refractive", - "color": [ 0.7599999904632568, 0.47999998927116394, 0.23000000417232513 ], + "color": [0.7599999904632568, 0.47999998927116394, 0.23000000417232513], "roughness": 0.25, "trdepth": 0.0010000000474974513, - "scattering": [ 0.4359999895095825, 0.22699999809265137, 0.13099999725818634 ], + "scattering": [ + 0.4359999895095825, 0.22699999809265137, 0.13099999725818634 + ], "scanisotropy": -0.800000011920929 }, - "skin2b": { + { + "name": "skin2b", "type": "refractive", - "color": [ 0.8199999928474426, 0.550000011920929, 0.4000000059604645 ], + "color": [0.8199999928474426, 0.550000011920929, 0.4000000059604645], "roughness": 0.25, "trdepth": 0.0010000000474974513, - "scattering": [ 0.6230000257492065, 0.43299999833106995, 0.34299999475479126 ], + "scattering": [ + 0.6230000257492065, 0.43299999833106995, 0.34299999475479126 + ], "scanisotropy": -0.800000011920929 } - }, - "shapes": { - "floor": "floor.ply", - "largearealight1": "largearealight1.ply", - "largearealight2": "largearealight2.ply", - "sphere": "sphere.ply", - "bunny": "bunny.ply" - }, - "instances": { - "floor": { - "shape": "floor", - "material": "floor" + ], + "shapes": [ + { + "name": "floor", + "uri": "shapes/floor.ply" + }, + { + "name": "largearealight1", + "uri": "shapes/largearealight1.ply" + }, + { + "name": "largearealight2", + "uri": "shapes/largearealight2.ply" + }, + { + "name": "sphere", + "uri": "shapes/sphere.ply" }, - "largearealight1": { + { + "name": "bunny", + "uri": "shapes/bunny.ply" + } + ], + "instances": [ + { + "name": "floor", + "shape": 0, + "material": 0 + }, + { + "name": "largearealight1", "frame": [ - [ 0.8944271802902222, -0.0, 0.4472135901451111 ], - [ 0.2873478829860687, 0.766261100769043, -0.5746957659721375 ], - [ -0.3426823318004608, 0.6425293684005737, 0.6853646636009216 ], - [ -0.800000011920929, 1.600000023841858, 1.600000023841858 ] + 0.8944271802902222, -0.0, 0.4472135901451111, 0.2873478829860687, + 0.766261100769043, -0.5746957659721375, -0.3426823318004608, + 0.6425293684005737, 0.6853646636009216, -0.800000011920929, + 1.600000023841858, 1.600000023841858 ], - "shape": "largearealight1", - "material": "largearealight1" + "shape": 1, + "material": 1 }, - "largearealight2": { + { + "name": "largearealight2", "frame": [ - [ 0.8944271802902222, 0.0, -0.4472135901451111 ], - [ -0.2873478829860687, 0.766261100769043, -0.5746957659721375 ], - [ 0.3426823318004608, 0.6425293684005737, 0.6853646636009216 ], - [ 0.800000011920929, 1.600000023841858, 1.600000023841858 ] + 0.8944271802902222, 0.0, -0.4472135901451111, -0.2873478829860687, + 0.766261100769043, -0.5746957659721375, 0.3426823318004608, + 0.6425293684005737, 0.6853646636009216, 0.800000011920929, + 1.600000023841858, 1.600000023841858 ], - "shape": "largearealight2", - "material": "largearealight2" + "shape": 2, + "material": 2 }, - "sphere-skin1a": { + { + "name": "sphere-skin1a", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.4000000059604645, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + 0.0 ], - "shape": "sphere", - "material": "skin1a" + "shape": 3, + "material": 3 }, - "sphere-skin2a": { + { + "name": "sphere-skin2a", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.20000000298023224, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "skin2a" + "shape": 3, + "material": 4 }, - "sphere-skins": { - "shape": "sphere", - "material": "skins" + { + "name": "sphere-skins", + "shape": 3, + "material": 5 }, - "sphere-skin1b": { + { + "name": "sphere-skin1b", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.20000000298023224, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + 0.0 ], - "shape": "sphere", - "material": "skin1b" + "shape": 3, + "material": 6 }, - "sphere-skin2b": { + { + "name": "sphere-skin2b", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.4000000059604645, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + 0.0 ], - "shape": "sphere", - "material": "skin2b" + "shape": 3, + "material": 7 }, - "bunny-skin1a": { + { + "name": "bunny-skin1a", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.4000000059604645, 0.0, -0.4000000059604645 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "skin1a" + "shape": 4, + "material": 3 }, - "bunny-skin2a": { + { + "name": "bunny-skin2a", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.20000000298023224, 0.0, -0.4000000059604645 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "skin2a" + "shape": 4, + "material": 4 }, - "bunny-skins": { + { + "name": "bunny-skins", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.0, 0.0, -0.4000000059604645 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "skins" + "shape": 4, + "material": 5 }, - "bunny-skin1b": { + { + "name": "bunny-skin1b", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.20000000298023224, 0.0, -0.4000000059604645 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "skin1b" + "shape": 4, + "material": 6 }, - "bunny-skin2b": { + { + "name": "bunny-skin2b", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.4000000059604645, 0.0, -0.4000000059604645 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + -0.4000000059604645 ], - "shape": "bunny", - "material": "skin2b" - } - }, - "environments": { - "sky": { - "emission": [ 0.5, 0.5, 0.5 ], - "emission_tex": "sky" + "shape": 4, + "material": 7 } - } -} \ No newline at end of file + ] +} diff --git a/tests/shapes1/shapes1.json b/tests/shapes1/shapes1.json index 2db08fc55..da482929a 100644 --- a/tests/shapes1/shapes1.json +++ b/tests/shapes1/shapes1.json @@ -2,215 +2,262 @@ "asset": { "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "default": { + "cameras": [ + { + "name": "default", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "front": { + { + "name": "front", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 0.936329185962677, -0.3511234223842621 ], - [ 0.0, 0.3511234223842621, 0.936329185962677 ], - [ 0.0, 0.574999988079071, 1.399999976158142 ] + 1.0, 0.0, 0.0, 0.0, 0.936329185962677, -0.3511234223842621, 0.0, + 0.3511234223842621, 0.936329185962677, 0.0, 0.574999988079071, + 1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "back": { + { + "name": "back", "frame": [ - [ -1.0, 0.0, 0.0 ], - [ 0.0, 0.936329185962677, 0.3511234223842621 ], - [ 0.0, 0.3511234223842621, -0.936329185962677 ], - [ 0.0, 0.574999988079071, -1.399999976158142 ] + -1.0, 0.0, 0.0, 0.0, 0.936329185962677, 0.3511234223842621, 0.0, + 0.3511234223842621, -0.936329185962677, 0.0, 0.574999988079071, + -1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "perspective-sharp": { + { + "name": "perspective-sharp", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "perspective-dof": { + { + "name": "perspective-dof", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.02500000037252903 }, - "orthographic-sharp": { + { + "name": "orthographic-sharp", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "orthographic-dof": { + { + "name": "orthographic-dof", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.019999999552965164 } - }, - "textures": { - "sky": "sky.hdr", - "floor": "floor.png", - "uvgrid": "uvgrid.png" - }, - "materials": { - "floor": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], - "color_tex": "floor" + ], + "environments": [ + { + "name": "sky", + "emission": [0.5, 0.5, 0.5], + "emission_tex": 0 + } + ], + "textures": [ + { + "name": "sky", + "uri": "textures/sky.hdr" }, - "arealight1": { - "emission": [ 20.0, 20.0, 20.0 ] + { + "name": "floor", + "uri": "textures/floor.png" + }, + { + "name": "uvgrid", + "uri": "textures/uvgrid.png" + } + ], + "materials": [ + { + "name": "floor", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], + "color_tex": 1 }, - "arealight2": { - "emission": [ 20.0, 20.0, 20.0 ] + { + "name": "arealight1", + "emission": [20.0, 20.0, 20.0] }, - "sphere-uvgrid": { + { + "name": "arealight2", + "emission": [20.0, 20.0, 20.0] + }, + { + "name": "sphere-uvgrid", "type": "glossy", - "color": [ 1.0, 1.0, 1.0 ], + "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 }, - "uvsphere-flipcap-uvgrid": { + { + "name": "uvsphere-flipcap-uvgrid", "type": "glossy", - "color": [ 1.0, 1.0, 1.0 ], + "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 }, - "disk-uvgrid": { + { + "name": "disk-uvgrid", "type": "glossy", - "color": [ 1.0, 1.0, 1.0 ], + "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 }, - "uvcylinder-uvgrid": { + { + "name": "uvcylinder-uvgrid", "type": "glossy", - "color": [ 1.0, 1.0, 1.0 ], + "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 }, - "cube-uvgrid": { + { + "name": "cube-uvgrid", "type": "glossy", - "color": [ 1.0, 1.0, 1.0 ], + "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 } - }, - "shapes": { - "floor": "floor.ply", - "arealight1": "arealight1.ply", - "arealight2": "arealight2.ply", - "sphere": "sphere.ply", - "uvsphere-flipcap": "uvsphere-flipcap.ply", - "disk": "disk.ply", - "uvcylinder": "uvcylinder.ply", - "cube": "cube.ply" - }, - "instances": { - "floor": { - "shape": "floor", - "material": "floor" + ], + "shapes": [ + { + "name": "floor", + "uri": "shapes/floor.ply" + }, + { + "name": "arealight1", + "uri": "shapes/arealight1.ply" }, - "arealight1": { + { + "name": "arealight2", + "uri": "shapes/arealight2.ply" + }, + { + "name": "sphere", + "uri": "shapes/sphere.ply" + }, + { + "name": "uvsphere-flipcap", + "uri": "shapes/uvsphere-flipcap.ply" + }, + { + "name": "disk", + "uri": "shapes/disk.ply" + }, + { + "name": "uvcylinder", + "uri": "shapes/uvcylinder.ply" + }, + { + "name": "cube", + "uri": "shapes/cube.ply" + } + ], + "instances": [ + { + "name": "floor", + "shape": 0, + "material": 0 + }, + { + "name": "arealight1", "frame": [ - [ 0.8944271802902222, -0.0, 0.4472135901451111 ], - [ 0.27562475204467773, 0.7874992489814758, -0.5512495040893555 ], - [ -0.3521803617477417, 0.6163156628608704, 0.7043607234954834 ], - [ -0.4000000059604645, 0.800000011920929, 0.800000011920929 ] + 0.8944271802902222, -0.0, 0.4472135901451111, 0.27562475204467773, + 0.7874992489814758, -0.5512495040893555, -0.3521803617477417, + 0.6163156628608704, 0.7043607234954834, -0.4000000059604645, + 0.800000011920929, 0.800000011920929 ], - "shape": "arealight1", - "material": "arealight1" + "shape": 1, + "material": 1 }, - "arealight2": { + { + "name": "arealight2", "frame": [ - [ 0.8944271802902222, 0.0, -0.4472135901451111 ], - [ -0.27562475204467773, 0.7874992489814758, -0.5512495040893555 ], - [ 0.3521803617477417, 0.6163156628608704, 0.7043607234954834 ], - [ 0.4000000059604645, 0.800000011920929, 0.800000011920929 ] + 0.8944271802902222, 0.0, -0.4472135901451111, -0.27562475204467773, + 0.7874992489814758, -0.5512495040893555, 0.3521803617477417, + 0.6163156628608704, 0.7043607234954834, 0.4000000059604645, + 0.800000011920929, 0.800000011920929 ], - "shape": "arealight2", - "material": "arealight2" + "shape": 2, + "material": 2 }, - "sphere-uvgrid": { + { + "name": "sphere-uvgrid", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.4000000059604645, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-uvgrid" + "shape": 3, + "material": 3 }, - "uvsphere-flipcap-uvgrid": { + { + "name": "uvsphere-flipcap-uvgrid", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.20000000298023224, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + 0.0 ], - "shape": "uvsphere-flipcap", - "material": "uvsphere-flipcap-uvgrid" + "shape": 4, + "material": 4 }, - "disk-uvgrid": { - "shape": "disk", - "material": "disk-uvgrid" + { + "name": "disk-uvgrid", + "shape": 5, + "material": 5 }, - "uvcylinder-uvgrid": { + { + "name": "uvcylinder-uvgrid", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.20000000298023224, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + 0.0 ], - "shape": "uvcylinder", - "material": "uvcylinder-uvgrid" + "shape": 6, + "material": 6 }, - "cube-uvgrid": { + { + "name": "cube-uvgrid", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.4000000059604645, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + 0.0 ], - "shape": "cube", - "material": "cube-uvgrid" - } - }, - "environments": { - "sky": { - "emission": [ 0.5, 0.5, 0.5 ], - "emission_tex": "sky" + "shape": 7, + "material": 7 } - } -} \ No newline at end of file + ] +} diff --git a/tests/shapes2/shapes2.json b/tests/shapes2/shapes2.json index 32fd8d385..f7c486167 100644 --- a/tests/shapes2/shapes2.json +++ b/tests/shapes2/shapes2.json @@ -2,236 +2,292 @@ "asset": { "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "default": { + "cameras": [ + { + "name": "default", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "front": { + { + "name": "front", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 0.936329185962677, -0.3511234223842621 ], - [ 0.0, 0.3511234223842621, 0.936329185962677 ], - [ 0.0, 0.574999988079071, 1.399999976158142 ] + 1.0, 0.0, 0.0, 0.0, 0.936329185962677, -0.3511234223842621, 0.0, + 0.3511234223842621, 0.936329185962677, 0.0, 0.574999988079071, + 1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "back": { + { + "name": "back", "frame": [ - [ -1.0, 0.0, 0.0 ], - [ 0.0, 0.936329185962677, 0.3511234223842621 ], - [ 0.0, 0.3511234223842621, -0.936329185962677 ], - [ 0.0, 0.574999988079071, -1.399999976158142 ] + -1.0, 0.0, 0.0, 0.0, 0.936329185962677, 0.3511234223842621, 0.0, + 0.3511234223842621, -0.936329185962677, 0.0, 0.574999988079071, + -1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "perspective-sharp": { + { + "name": "perspective-sharp", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "perspective-dof": { + { + "name": "perspective-dof", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.02500000037252903 }, - "orthographic-sharp": { + { + "name": "orthographic-sharp", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "orthographic-dof": { + { + "name": "orthographic-dof", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.019999999552965164 } - }, - "textures": { - "sky": "sky.hdr", - "floor": "floor.png", - "uvgrid": "uvgrid.png", - "bumps-displacement": "bumps-displacement.png" - }, - "materials": { - "floor": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], - "color_tex": "floor" + ], + "environments": [ + { + "name": "sky", + "emission": [0.5, 0.5, 0.5], + "emission_tex": 0 + } + ], + "textures": [ + { + "name": "sky", + "uri": "textures/sky.hdr" }, - "arealight1": { - "emission": [ 20.0, 20.0, 20.0 ] + { + "name": "floor", + "uri": "textures/floor.png" + }, + { + "name": "uvgrid", + "uri": "textures/uvgrid.png" + }, + { + "name": "bumps-displacement", + "uri": "textures/bumps-displacement.png" + } + ], + "materials": [ + { + "name": "floor", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], + "color_tex": 1 }, - "arealight2": { - "emission": [ 20.0, 20.0, 20.0 ] + { + "name": "arealight1", + "emission": [20.0, 20.0, 20.0] }, - "cube-subdiv-uvgrid": { + { + "name": "arealight2", + "emission": [20.0, 20.0, 20.0] + }, + { + "name": "cube-subdiv-uvgrid", "type": "glossy", - "color": [ 1.0, 1.0, 1.0 ], + "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 }, - "suzanne-subdiv-plastic-sharp": { + { + "name": "suzanne-subdiv-plastic-sharp", "type": "glossy", - "color": [ 0.5, 0.5, 0.699999988079071 ], + "color": [0.5, 0.5, 0.699999988079071], "roughness": 0.009999999776482582 }, - "sphere-displaced-matte": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], + { + "name": "sphere-displaced-matte", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], "roughness": 1.0 }, - "bunny-uvgrid": { + { + "name": "bunny-uvgrid", "type": "glossy", - "color": [ 1.0, 1.0, 1.0 ], + "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 }, - "teapot-uvgrid": { + { + "name": "teapot-uvgrid", "type": "glossy", - "color": [ 1.0, 1.0, 1.0 ], + "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 } - }, - "shapes": { - "floor": "floor.ply", - "arealight1": "arealight1.ply", - "arealight2": "arealight2.ply", - "cube-subdiv": "cube-subdiv.ply", - "suzanne-subdiv": "suzanne-subdiv.ply", - "sphere-displaced": "sphere-displaced.ply", - "bunny": "bunny.ply", - "teapot": "teapot.ply" - }, - "subdivs": { - "sphere-displaced": { - "shape": "sphere-displaced", + ], + "shapes": [ + { + "name": "floor", + "uri": "shapes/floor.ply" + }, + { + "name": "arealight1", + "uri": "shapes/arealight1.ply" + }, + { + "name": "arealight2", + "uri": "shapes/arealight2.ply" + }, + { + "name": "cube-subdiv", + "uri": "shapes/cube-subdiv.ply" + }, + { + "name": "suzanne-subdiv", + "uri": "shapes/suzanne-subdiv.ply" + }, + { + "name": "sphere-displaced", + "uri": "shapes/sphere-displaced.ply" + }, + { + "name": "bunny", + "uri": "shapes/bunny.ply" + }, + { + "name": "teapot", + "uri": "shapes/teapot.ply" + } + ], + "subdivs": [ + { + "name": "sphere-displaced", + "shape": 5, "datafile": "sphere-displaced.obj", "catmullclark": true, "smooth": true, "displacement": 0.02500000037252903, - "displacement_tex": "bumps-displacement" + "displacement_tex": 3, + "uri": "sphere-displaced.obj" }, - "suzanne-subdiv": { - "shape": "suzanne-subdiv", + { + "name": "suzanne-subdiv", + "shape": 4, "datafile": "suzanne-subdiv.obj", "subdivisions": 2, "catmullclark": true, - "smooth": true + "smooth": true, + "uri": "suzanne-subdiv.obj" }, - "cube-subdiv": { - "shape": "cube-subdiv", + { + "name": "cube-subdiv", + "shape": 3, "datafile": "cube-subdiv.obj", "subdivisions": 4, - "catmullclark": true + "catmullclark": true, + "uri": "cube-subdiv.obj" } - }, - "instances": { - "floor": { - "shape": "floor", - "material": "floor" + ], + "instances": [ + { + "name": "floor", + "shape": 0, + "material": 0 }, - "arealight1": { + { + "name": "arealight1", "frame": [ - [ 0.8944271802902222, -0.0, 0.4472135901451111 ], - [ 0.27562475204467773, 0.7874992489814758, -0.5512495040893555 ], - [ -0.3521803617477417, 0.6163156628608704, 0.7043607234954834 ], - [ -0.4000000059604645, 0.800000011920929, 0.800000011920929 ] + 0.8944271802902222, -0.0, 0.4472135901451111, 0.27562475204467773, + 0.7874992489814758, -0.5512495040893555, -0.3521803617477417, + 0.6163156628608704, 0.7043607234954834, -0.4000000059604645, + 0.800000011920929, 0.800000011920929 ], - "shape": "arealight1", - "material": "arealight1" + "shape": 1, + "material": 1 }, - "arealight2": { + { + "name": "arealight2", "frame": [ - [ 0.8944271802902222, 0.0, -0.4472135901451111 ], - [ -0.27562475204467773, 0.7874992489814758, -0.5512495040893555 ], - [ 0.3521803617477417, 0.6163156628608704, 0.7043607234954834 ], - [ 0.4000000059604645, 0.800000011920929, 0.800000011920929 ] + 0.8944271802902222, 0.0, -0.4472135901451111, -0.27562475204467773, + 0.7874992489814758, -0.5512495040893555, 0.3521803617477417, + 0.6163156628608704, 0.7043607234954834, 0.4000000059604645, + 0.800000011920929, 0.800000011920929 ], - "shape": "arealight2", - "material": "arealight2" + "shape": 2, + "material": 2 }, - "cube-subdiv-uvgrid": { + { + "name": "cube-subdiv-uvgrid", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.4000000059604645, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + 0.0 ], - "shape": "cube-subdiv", - "material": "cube-subdiv-uvgrid" + "shape": 3, + "material": 3 }, - "suzanne-subdiv-plastic-sharp": { + { + "name": "suzanne-subdiv-plastic-sharp", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.20000000298023224, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + 0.0 ], - "shape": "suzanne-subdiv", - "material": "suzanne-subdiv-plastic-sharp" + "shape": 4, + "material": 4 }, - "sphere-displaced-matte": { - "shape": "sphere-displaced", - "material": "sphere-displaced-matte" + { + "name": "sphere-displaced-matte", + "shape": 5, + "material": 5 }, - "bunny-uvgrid": { + { + "name": "bunny-uvgrid", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.20000000298023224, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + 0.0 ], - "shape": "bunny", - "material": "bunny-uvgrid" + "shape": 6, + "material": 6 }, - "teapot-uvgrid": { + { + "name": "teapot-uvgrid", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.4000000059604645, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + 0.0 ], - "shape": "teapot", - "material": "teapot-uvgrid" - } - }, - "environments": { - "sky": { - "emission": [ 0.5, 0.5, 0.5 ], - "emission_tex": "sky" + "shape": 7, + "material": 7 } - } -} \ No newline at end of file + ] +} diff --git a/tests/shapes3/shapes3.json b/tests/shapes3/shapes3.json index bdbc1c257..1958d4223 100644 --- a/tests/shapes3/shapes3.json +++ b/tests/shapes3/shapes3.json @@ -2,226 +2,272 @@ "asset": { "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "default": { + "cameras": [ + { + "name": "default", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "front": { + { + "name": "front", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 0.936329185962677, -0.3511234223842621 ], - [ 0.0, 0.3511234223842621, 0.936329185962677 ], - [ 0.0, 0.574999988079071, 1.399999976158142 ] + 1.0, 0.0, 0.0, 0.0, 0.936329185962677, -0.3511234223842621, 0.0, + 0.3511234223842621, 0.936329185962677, 0.0, 0.574999988079071, + 1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "back": { + { + "name": "back", "frame": [ - [ -1.0, 0.0, 0.0 ], - [ 0.0, 0.936329185962677, 0.3511234223842621 ], - [ 0.0, 0.3511234223842621, -0.936329185962677 ], - [ 0.0, 0.574999988079071, -1.399999976158142 ] + -1.0, 0.0, 0.0, 0.0, 0.936329185962677, 0.3511234223842621, 0.0, + 0.3511234223842621, -0.936329185962677, 0.0, 0.574999988079071, + -1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "perspective-sharp": { + { + "name": "perspective-sharp", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "perspective-dof": { + { + "name": "perspective-dof", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.02500000037252903 }, - "orthographic-sharp": { + { + "name": "orthographic-sharp", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "orthographic-dof": { + { + "name": "orthographic-dof", "frame": [ - [ 0.8151804208755493, -0.0, 0.579207181930542 ], - [ 0.16660168766975403, 0.9577393531799316, -0.23447643220424652 ], - [ -0.5547295212745667, 0.28763750195503235, 0.7807304263114929 ], - [ -0.75, 0.4000000059604645, 0.8999999761581421 ] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.019999999552965164 } - }, - "textures": { - "sky": "sky.hdr", - "floor": "floor.png" - }, - "materials": { - "floor": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], - "color_tex": "floor" + ], + "environments": [ + { + "name": "sky", + "emission": [0.5, 0.5, 0.5], + "emission_tex": 0 + } + ], + "textures": [ + { + "name": "sky", + "uri": "textures/sky.hdr" + }, + { + "name": "floor", + "uri": "textures/floor.png" + } + ], + "materials": [ + { + "name": "floor", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], + "color_tex": 1 }, - "arealight1": { - "emission": [ 20.0, 20.0, 20.0 ] + { + "name": "arealight1", + "emission": [20.0, 20.0, 20.0] }, - "arealight2": { - "emission": [ 20.0, 20.0, 20.0 ] + { + "name": "arealight2", + "emission": [20.0, 20.0, 20.0] }, - "sphere-matte": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], + { + "name": "sphere-matte", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], "roughness": 1.0 }, - "hairball1-hair": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], + { + "name": "hairball1-hair", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], "roughness": 1.0 }, - "hairball2-hair": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], + { + "name": "hairball2-hair", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], "roughness": 1.0 }, - "hairball3-hair": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], + { + "name": "hairball3-hair", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], "roughness": 1.0 }, - "hairballi1-hair": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], + { + "name": "hairballi1-hair", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], "roughness": 1.0 }, - "hairballi2-hair": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], + { + "name": "hairballi2-hair", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], "roughness": 1.0 }, - "hairballi3-hair": { - "color": [ 0.699999988079071, 0.699999988079071, 0.699999988079071 ], + { + "name": "hairballi3-hair", + "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], "roughness": 1.0 } - }, - "shapes": { - "floor": "floor.ply", - "arealight1": "arealight1.ply", - "arealight2": "arealight2.ply", - "sphere": "sphere.ply", - "hairball1": "hairball1.ply", - "hairball2": "hairball2.ply", - "hairball3": "hairball3.ply", - "hairballi": "hairballi.ply" - }, - "instances": { - "floor": { - "shape": "floor", - "material": "floor" + ], + "shapes": [ + { + "name": "floor", + "uri": "shapes/floor.ply" + }, + { + "name": "arealight1", + "uri": "shapes/arealight1.ply" + }, + { + "name": "arealight2", + "uri": "shapes/arealight2.ply" }, - "arealight1": { + { + "name": "sphere", + "uri": "shapes/sphere.ply" + }, + { + "name": "hairball1", + "uri": "shapes/hairball1.ply" + }, + { + "name": "hairball2", + "uri": "shapes/hairball2.ply" + }, + { + "name": "hairball3", + "uri": "shapes/hairball3.ply" + }, + { + "name": "hairballi", + "uri": "shapes/hairballi.ply" + } + ], + "instances": [ + { + "name": "floor", + "shape": 0, + "material": 0 + }, + { + "name": "arealight1", "frame": [ - [ 0.8944271802902222, -0.0, 0.4472135901451111 ], - [ 0.27562475204467773, 0.7874992489814758, -0.5512495040893555 ], - [ -0.3521803617477417, 0.6163156628608704, 0.7043607234954834 ], - [ -0.4000000059604645, 0.800000011920929, 0.800000011920929 ] + 0.8944271802902222, -0.0, 0.4472135901451111, 0.27562475204467773, + 0.7874992489814758, -0.5512495040893555, -0.3521803617477417, + 0.6163156628608704, 0.7043607234954834, -0.4000000059604645, + 0.800000011920929, 0.800000011920929 ], - "shape": "arealight1", - "material": "arealight1" + "shape": 1, + "material": 1 }, - "arealight2": { + { + "name": "arealight2", "frame": [ - [ 0.8944271802902222, 0.0, -0.4472135901451111 ], - [ -0.27562475204467773, 0.7874992489814758, -0.5512495040893555 ], - [ 0.3521803617477417, 0.6163156628608704, 0.7043607234954834 ], - [ 0.4000000059604645, 0.800000011920929, 0.800000011920929 ] + 0.8944271802902222, 0.0, -0.4472135901451111, -0.27562475204467773, + 0.7874992489814758, -0.5512495040893555, 0.3521803617477417, + 0.6163156628608704, 0.7043607234954834, 0.4000000059604645, + 0.800000011920929, 0.800000011920929 ], - "shape": "arealight2", - "material": "arealight2" + "shape": 2, + "material": 2 }, - "sphere-matte": { + { + "name": "sphere-matte", "frame": [ - [ 0.5, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.4000000059604645, 0.0, 0.0 ] + 0.5, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-matte" + "shape": 3, + "material": 3 }, - "hairball1-hair": { + { + "name": "hairball1-hair", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.20000000298023224, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + 0.0 ], - "shape": "hairball1", - "material": "hairball1-hair" + "shape": 4, + "material": 4 }, - "hairball2-hair": { - "shape": "hairball2", - "material": "hairball2-hair" + { + "name": "hairball2-hair", + "shape": 5, + "material": 5 }, - "hairball3-hair": { + { + "name": "hairball3-hair", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.20000000298023224, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + 0.0 ], - "shape": "hairball3", - "material": "hairball3-hair" + "shape": 6, + "material": 6 }, - "hairballi1-hair": { + { + "name": "hairballi1-hair", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ -0.20000000298023224, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + 0.0 ], - "shape": "hairballi", - "material": "hairballi1-hair" + "shape": 7, + "material": 7 }, - "hairballi2-hair": { - "shape": "hairballi", - "material": "hairballi2-hair" + { + "name": "hairballi2-hair", + "shape": 7, + "material": 8 }, - "hairballi3-hair": { + { + "name": "hairballi3-hair", "frame": [ - [ 1.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 1.0 ], - [ 0.20000000298023224, 0.0, 0.0 ] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + 0.0 ], - "shape": "hairballi", - "material": "hairballi3-hair" - } - }, - "environments": { - "sky": { - "emission": [ 0.5, 0.5, 0.5 ], - "emission_tex": "sky" + "shape": 7, + "material": 9 } - } -} \ No newline at end of file + ] +} diff --git a/tests/shapes4/shapes4.json b/tests/shapes4/shapes4.json index 9e0551739..0c22041e7 100644 --- a/tests/shapes4/shapes4.json +++ b/tests/shapes4/shapes4.json @@ -2,215 +2,262 @@ "asset": { "copyright": "Model by Fabio Pellacini from github.com/~xelatihy/yocto-gl", "generator": "Yocto/GL - https://github.com/xelatihy/yocto-gl", - "version": "4.1" + "version": "4.2" }, - "cameras": { - "default": { + "cameras": [ + { + "name": "default", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "front": { + { + "name": "front", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 0.936329185962677, -0.3511234223842621], - [0.0, 0.3511234223842621, 0.936329185962677], - [0.0, 0.574999988079071, 1.399999976158142] + 1.0, 0.0, 0.0, 0.0, 0.936329185962677, -0.3511234223842621, 0.0, + 0.3511234223842621, 0.936329185962677, 0.0, 0.574999988079071, + 1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "back": { + { + "name": "back", "frame": [ - [-1.0, 0.0, 0.0], - [0.0, 0.936329185962677, 0.3511234223842621], - [0.0, 0.3511234223842621, -0.936329185962677], - [0.0, 0.574999988079071, -1.399999976158142] + -1.0, 0.0, 0.0, 0.0, 0.936329185962677, 0.3511234223842621, 0.0, + 0.3511234223842621, -0.936329185962677, 0.0, 0.574999988079071, + -1.399999976158142 ], "aspect": 3.0, "focus": 1.4952006340026855 }, - "perspective-sharp": { + { + "name": "perspective-sharp", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "perspective-dof": { + { + "name": "perspective-dof", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.02500000037252903 }, - "orthographic-sharp": { + { + "name": "orthographic-sharp", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133 }, - "orthographic-dof": { + { + "name": "orthographic-dof", "frame": [ - [0.8151804208755493, -0.0, 0.579207181930542], - [0.16660168766975403, 0.9577393531799316, -0.23447643220424652], - [-0.5547295212745667, 0.28763750195503235, 0.7807304263114929], - [-0.75, 0.4000000059604645, 0.8999999761581421] + 0.8151804208755493, -0.0, 0.579207181930542, 0.16660168766975403, + 0.9577393531799316, -0.23447643220424652, -0.5547295212745667, + 0.28763750195503235, 0.7807304263114929, -0.75, 0.4000000059604645, + 0.8999999761581421 ], "orthographic": true, "aspect": 2.4000000953674316, "focus": 1.2168092727661133, "aperture": 0.019999999552965164 } - }, - "textures": { - "sky": "sky.hdr", - "floor": "floor.png", - "uvgrid": "uvgrid.png" - }, - "materials": { - "floor": { + ], + "environments": [ + { + "name": "sky", + "emission": [0.5, 0.5, 0.5], + "emission_tex": 0 + } + ], + "textures": [ + { + "name": "sky", + "uri": "textures/sky.hdr" + }, + { + "name": "floor", + "uri": "textures/floor.png" + }, + { + "name": "uvgrid", + "uri": "textures/uvgrid.png" + } + ], + "materials": [ + { + "name": "floor", "color": [0.699999988079071, 0.699999988079071, 0.699999988079071], - "color_tex": "floor" + "color_tex": 1 }, - "arealight1": { + { + "name": "arealight1", "emission": [20.0, 20.0, 20.0] }, - "arealight2": { + { + "name": "arealight2", "emission": [20.0, 20.0, 20.0] }, - "sphere-uvgrid": { + { + "name": "sphere-uvgrid", "type": "glossy", "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 }, - "points-uvgrid": { + { + "name": "points-uvgrid", "type": "glossy", "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 }, - "thickpoints-uvgrid": { + { + "name": "thickpoints-uvgrid", "type": "glossy", "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 }, - "lines-uvgrid": { + { + "name": "lines-uvgrid", "type": "glossy", "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 }, - "thicklines-uvgrid": { + { + "name": "thicklines-uvgrid", "type": "glossy", "color": [1.0, 1.0, 1.0], "roughness": 0.10000000149011612, - "color_tex": "uvgrid" + "color_tex": 2 } - }, - "shapes": { - "floor": "floor.ply", - "arealight1": "arealight1.ply", - "arealight2": "arealight2.ply", - "sphere": "sphere.ply", - "points-grid": "points-grid.ply", - "thickpoints-grid": "thickpoints-grid.ply", - "lines-grid": "lines-grid.ply", - "thicklines-grid": "thicklines-grid.ply" - }, - "instances": { - "floor": { - "shape": "floor", - "material": "floor" + ], + "shapes": [ + { + "name": "floor", + "uri": "shapes/floor.ply" + }, + { + "name": "arealight1", + "uri": "shapes/arealight1.ply" }, - "arealight1": { + { + "name": "arealight2", + "uri": "shapes/arealight2.ply" + }, + { + "name": "sphere", + "uri": "shapes/sphere.ply" + }, + { + "name": "points-grid", + "uri": "shapes/points-grid.ply" + }, + { + "name": "thickpoints-grid", + "uri": "shapes/thickpoints-grid.ply" + }, + { + "name": "lines-grid", + "uri": "shapes/lines-grid.ply" + }, + { + "name": "thicklines-grid", + "uri": "shapes/thicklines-grid.ply" + } + ], + "instances": [ + { + "name": "floor", + "shape": 0, + "material": 0 + }, + { + "name": "arealight1", "frame": [ - [0.8944271802902222, -0.0, 0.4472135901451111], - [0.27562475204467773, 0.7874992489814758, -0.5512495040893555], - [-0.3521803617477417, 0.6163156628608704, 0.7043607234954834], - [-0.4000000059604645, 0.800000011920929, 0.800000011920929] + 0.8944271802902222, -0.0, 0.4472135901451111, 0.27562475204467773, + 0.7874992489814758, -0.5512495040893555, -0.3521803617477417, + 0.6163156628608704, 0.7043607234954834, -0.4000000059604645, + 0.800000011920929, 0.800000011920929 ], - "shape": "arealight1", - "material": "arealight1" + "shape": 1, + "material": 1 }, - "arealight2": { + { + "name": "arealight2", "frame": [ - [0.8944271802902222, 0.0, -0.4472135901451111], - [-0.27562475204467773, 0.7874992489814758, -0.5512495040893555], - [0.3521803617477417, 0.6163156628608704, 0.7043607234954834], - [0.4000000059604645, 0.800000011920929, 0.800000011920929] + 0.8944271802902222, 0.0, -0.4472135901451111, -0.27562475204467773, + 0.7874992489814758, -0.5512495040893555, 0.3521803617477417, + 0.6163156628608704, 0.7043607234954834, 0.4000000059604645, + 0.800000011920929, 0.800000011920929 ], - "shape": "arealight2", - "material": "arealight2" + "shape": 2, + "material": 2 }, - "sphere-uvgrid": { + { + "name": "sphere-uvgrid", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.4000000059604645, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.4000000059604645, 0.0, + 0.0 ], - "shape": "sphere", - "material": "sphere-uvgrid" + "shape": 3, + "material": 3 }, - "points-uvgrid": { + { + "name": "points-uvgrid", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [-0.20000000298023224, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, -0.20000000298023224, 0.0, + 0.0 ], - "shape": "points-grid", - "material": "points-uvgrid" + "shape": 4, + "material": 4 }, - "thickpoints-uvgrid": { - "shape": "thickpoints-grid", - "material": "thickpoints-uvgrid" + { + "name": "thickpoints-uvgrid", + "shape": 5, + "material": 5 }, - "lines-uvgrid": { + { + "name": "lines-uvgrid", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.20000000298023224, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.20000000298023224, 0.0, + 0.0 ], - "shape": "lines-grid", - "material": "lines-uvgrid" + "shape": 6, + "material": 6 }, - "thicklines-uvgrid": { + { + "name": "thicklines-uvgrid", "frame": [ - [1.0, 0.0, 0.0], - [0.0, 1.0, 0.0], - [0.0, 0.0, 1.0], - [0.4000000059604645, 0.0, 0.0] + 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.4000000059604645, 0.0, + 0.0 ], - "shape": "thicklines-grid", - "material": "thicklines-uvgrid" - } - }, - "environments": { - "sky": { - "emission": [0.5, 0.5, 0.5], - "emission_tex": "sky" + "shape": 7, + "material": 7 } - } + ] }