Jump to content

Recommended Posts

Posted

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();//????

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

The fact that we finally have built-in support for a 3D model format in Windows is what makes this compelling to me.

Image1.thumb.jpg.c53d9742b27bfb8226ed33520ec942f8.jpg

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

You can rotate and zoom, no pan. I think it was added in the Win 10 creator edition or whatever.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

It supports FBX as well, but FBX cannot be used for your final game format, and GLTF can.

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

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? :P hue

Coding for Christ.

Posted
1 hour ago, catch22 said:

Now we should ditch lua and go javascript rite? :P hue

Image result for disapproval

My job is to make tools you love, with the features you want, and performance you can't live without.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...