Skip to content

Bschnurr/fix glb empty#4

Merged
agrittmsft merged 8 commits into
masterfrom
bschnurr/fix_glb_empty
Aug 30, 2018
Merged

Bschnurr/fix glb empty#4
agrittmsft merged 8 commits into
masterfrom
bschnurr/fix_glb_empty

Conversation

@bschnurr
Copy link
Copy Markdown
Member

Adding support to write out empty glb files. "stream" was going into a failed state with m_stream was empty.


namespace Microsoft
{
namespace glTF
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix whitespace

{
auto streamWriter = std::make_shared<const StreamReaderWriter>();
GLBResourceWriter writer(streamWriter);
std::string uri = "glb";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the filename, it should be more like "foo.glb"

std::string uri = "glb";
writer.Flush("", uri);

std::vector<char> output(100);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for writing another external file such as a png, why are you doing this here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just needed a way to access the output stream in the cache. Now i'm using the streamWriter directly

{
GLTFSDK_TEST_CLASS(GLBResourceWriterTests)
{
GLTFSDK_TEST_METHOD(GLBResourceWriterTests, WriteBufferView_Empty)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test needs to read the output and confirm that it's a valid GLB by parsing it again.

std::string uri = "glb";
std::string uri = "foo.glb";

writer.Flush("", uri);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need to serialize an actual valid glTF/glB file and then read it in to confirm everything works.

auto stream = streamWriter->GetInputStream(uri);

// Deserialize Stream -> Document
GLBResourceReader resourceReader(std::make_shared<const StreamReaderWriter>(), stream);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You already have "streamWriter"

@bschnurr
Copy link
Copy Markdown
Member Author

internal build 11543727 passed

@agrittmsft agrittmsft merged commit afb4c7a into master Aug 30, 2018
@agrittmsft agrittmsft deleted the bschnurr/fix_glb_empty branch March 7, 2019 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants