Josh Posted November 21, 2018 Share Posted November 21, 2018 This is using json for modern C++. I don't know how to navigate the json data, but at least I can load it: nlohmann::json j3; int sz = stream->GetSize(); if (sz <= 4) return false; if (stream->ReadString(4) == "glTF") { if (sz <= 20) return false; int version = stream->ReadInt(); int length = stream->ReadInt(); int model_length = stream->ReadInt(); int model_format = stream->ReadInt(); int binstart = 20 + model_length; int binsize = sz - 20 - model_length; if (20 + model_length > sz or model_length < 1 or model_format != 0x4E4F534A) return false; std::vector<uint8_t> data; data.resize(model_length); Assert(data.size() == model_length); stream->Read(&data[0], model_length); j3 = nlohmann::json::parse(data); } else { stream->Seek(0); std::string contents; while (!stream->Ended()) { contents += stream->ReadLine() + "\n"; } j3 = nlohmann::json::parse(contents.c_str()); } //Now interpret json data and build model... if (j3.type() != nlohmann::json::value_t::object) { return false; } //auto obj = j3.value.get_impl_ptr();//???? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted November 21, 2018 Author Share Posted November 21, 2018 The fact that we finally have built-in support for a 3D model format in Windows is what makes this compelling to me. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
gamecreator Posted November 21, 2018 Share Posted November 21, 2018 Does that work in 7? And can you rotate/zoom it in the preview pane? Quote Link to comment Share on other sites More sharing options...
Josh Posted November 22, 2018 Author Share Posted November 22, 2018 You can rotate and zoom, no pan. I think it was added in the Win 10 creator edition or whatever. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted November 22, 2018 Author Share Posted November 22, 2018 It supports FBX as well, but FBX cannot be used for your final game format, and GLTF can. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
catch22 Posted November 23, 2018 Share Posted November 23, 2018 Wonder how long till someone YAMLs or BSONs it for file size? JSON is great, I work with it everyday, but it's it's a little heavy around the waist since it's notation/markup is a bit excessive. Being a Ctype struct expression, it moves between languages very easily as well. Now we should ditch lua and go javascript rite? hue Quote Coding for Christ. Link to comment Share on other sites More sharing options...
Josh Posted November 23, 2018 Author Share Posted November 23, 2018 1 hour ago, catch22 said: Now we should ditch lua and go javascript rite? hue Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
catch22 Posted November 23, 2018 Share Posted November 23, 2018 You've said crazier things?! 1 Quote Coding for Christ. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.