vpenades / SharpGLTF

glTF reader and writer for .NET Standard
MIT License
484 stars 77 forks source link

Path issue #112

Closed octopoulos closed 3 years ago

octopoulos commented 3 years ago

The Example1 doesn't work:

            model.SaveAsWavefront("mesh.obj");
            model.SaveGLB("mesh.glb");
            model.SaveGLTF("mesh.gltf");

The SaveAsWavefront method doesn't check for folder names the same way as SaveGLB and SaveGLTF, and actually it saves the obj file just fine, but the glb and gltf are not saved because the folder names becomes "" which triggers an exception with an invalid path.

So, what works here is to use "./mesh.glb" and "./mesh.gltf":

            model.SaveAsWavefront("mesh.obj");
            model.SaveGLB("./mesh.glb");
            model.SaveGLTF("./mesh.gltf");

I just thought I should let you know that there is an inconsistency here between obj and glb/gltf.

Also, for Example1, I couldn't use the default .NET Core 2.2 because it's not longer available for download, so you might want to change that default value too.

vpenades commented 3 years ago

Hmm... which version of the library are you using? NetCore2.2 was removed from the sources a while ago.

Regarding the paths.... I guess you're refering to the Example1 project? I've just run it as is and it worked just fine, so I would need more information: again, which version of the library are you using, which exception throws, at which line.

octopoulos commented 3 years ago

Strange. I just downloaded the master source code as a zip file, shall I do it differently?

Here, I'm using the glb without the ./ and it triggers this exception: image

vpenades commented 3 years ago

It should not be different downloading as a zip or cloning.

It's failing in the Guard.DirectoryPathMustExist(...) which is weird. Could you log the system.Environment.CurrentDirectory ?

octopoulos commented 3 years ago

Okay I found the issue. You can close this issue.

I did a git clone and it worked fine, and then I downloaded the zip again and it worked fine. And then I checked my downloaded files and I guess I downloaded the wrong version the first time, it's because I found about this project through a forum post, and that post linked to a specific version, which is probably quite old (2020-04-14).

Sorry for this.

vpenades commented 3 years ago

Good to know

Out of curiosity, could you point me to that forum link?

octopoulos commented 3 years ago

Sorry, I can't find the forum link anymore, but it linked to this issue: https://github.com/vpenades/SharpGLTF/issues/43, which links to the version from 2020-04-14, and from there, I clicked on "Code" and then download zip, but if I try now, it points to "master" so I'm not sure what I did!

My goal was to find a 3d format that allows to have a binary file with interleaved vertex attributes, because I work with such objects and sometimes I'd like to export them for debugging purposes, so I was looking at GLTF for that, and it seems like this format can handle it.

vpenades commented 3 years ago

Yeah, although it seems lately most people preffers non interleaved vertex formats, glTF does support it and so does SharpGLTF.