Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UVIndex not handled #5

Open
klaszlo8207 opened this issue Jan 27, 2020 · 6 comments
Open

UVIndex not handled #5

klaszlo8207 opened this issue Jan 27, 2020 · 6 comments

Comments

@klaszlo8207
Copy link

You assume that the UvIndices is in order but not, you have to handle that and order manually

in

void _loadUvs(FbxElement e) { //fbx_mesh.dart

add this

//TODO UVIndex
      else if (c.id == 'UVIndex' && p.isNotEmpty) {
        uvs.indexArray = List<int>(p.length);
        for (var i = 0, j = 0, len = p.length; i < len; i++) {
          uvs.indexArray[j++] = toInt(p[i]);
        }
      }

then in generateDisplayMeshes: (to the last line add)

      //TODO disp uvs ordering
      Float32List newUvs = Float32List(disp.uvs.length);

      int j = 0;
      for (int index = 0; index < uvs.indexArray.length; index++) {
        final uvIndex = uvs.indexArray[index];
        final temp = uvs.data[uvIndex];
        newUvs[j++] = temp.x;
        newUvs[j++] = temp.y;
      }
      disp.uvs = newUvs;


@brendan-duncan
Copy link
Owner

Thanks. Do you happen to have a fbx with this data in it so I can make sure it's correct?

@klaszlo8207
Copy link
Author

klaszlo8207 commented Jan 29, 2020

https://github.com/klaszlo8207/Flutter-FBX-3D-Viewer/tree/master/assets

Here it is some fbx files, version 7.4.0 ASCII

Brendan I had to update some BUGS in your code and I had to upload to my package:

https://github.com/klaszlo8207/Flutter-FBX-3D-Viewer/tree/master/lib/fbx_parser

If you FIX those all I can use your library then later

I found 3 BUGS (mentioned here in the issues as well), you can find in my repo with searching for: "//TODO"

or just compare the codes

https://github.com/klaszlo8207/Flutter-FBX-3D-Viewer/search?q=%2F%2FTODO&unscoped_q=%2F%2FTODO

Thanks.

@klaszlo8207
Copy link
Author

More on the BUGS:

https://github.com/klaszlo8207/Flutter-FBX-3D-Viewer/blob/ae68cd2ad367cd7916593d3c25ad68a07fd4477b/lib/fbx_parser/fbx/scene/fbx_mesh.dart

line 175-184

line 390 null check (crash was)

line 414-424

@klaszlo8207
Copy link
Author

and

https://github.com/klaszlo8207/Flutter-FBX-3D-Viewer/blob/ae68cd2ad367cd7916593d3c25ad68a07fd4477b/lib/fbx_parser/fbx/fbx_loader.dart

line 268-290 maybe

@brendan-duncan
Copy link
Owner

That's great, I'll add those fixes and make sure those fbx files work. I did add a couple fixes last night to get an fbx file exported out of blender to load.

You're the first person I know of to have used this library, so much appreciated sharing your fixes. I haven't even used it for anything, I was just curious what was inside fbx files.

@oengmengthong
Copy link

that issues already fixed? or not yet?

@klaszlo8207 I updated some code and already pull request to your repo package.

i hope this package will be work again.

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

No branches or pull requests

3 participants