Rajawali / Rajawali

Android OpenGL ES 2.0/3.0 Engine
https://rajawali.github.io/Rajawali/
Other
2.35k stars 700 forks source link

LoaderFBX.java:347 ArrayIndexOutOfBoundsException #2462

Open GGBomb opened 1 year ago

GGBomb commented 1 year ago

Rajawali Version or Branch

open de

Device and Android Version

android 12, by HUAWEI

Summary

LoaderFBX ArrayIndexOutOfBoundsException

Steps to Reproduce

        //for each trig in triangulation
        for (int[] trig: triangulation) {
            for (int v: trig){
                int tidx_old = modelIdx[i+v];//index of current vertex in FBX order
                int nidx_old = i+v;//index of current normal in FBX order
                indices[iNext] = iNext;//the correct modelIdx for this vertex
                vertexes[3*iNext+0] = modelVerts[3*tidx_old+0];//x
                vertexes[3*iNext+1] = modelVerts[3*tidx_old+1];//y
                vertexes[3*iNext+2] = modelVerts[3*tidx_old+2];//z
                normals[3*iNext+0] = modelNorm[3*nidx_old+0];//nx
                normals[3*iNext+1] = modelNorm[3*nidx_old+1];//ny
                normals[3*iNext+2] = modelNorm[3*nidx_old+2];//nz
                if(hasUVs) {
                    int uvidx_old = modelUVIdx[i+v];//index of current normal in FBX order
                    uvs[2*iNext] = modelUv[2*uvidx_old];
                    uvs[2*iNext+1] = 1f - modelUv[2*uvidx_old+1];
                }
                ++iNext;
            }
        }

Trace or Log Output

EGLNativeWindowType 0x76c3618010 disconnect failed java.lang.ArrayIndexOutOfBoundsException: length=2751; index=2751 at org.rajawali3d.loader.fbx.LoaderFBX.buildMesh(LoaderFBX.java:347) at org.rajawali3d.loader.fbx.LoaderFBX.parse(LoaderFBX.java:188) at org.rajawali3d.examples.examples.loaders.FBXFragment$FBXRenderer.initScene(FBXFragment.java:70) at org.rajawali3d.renderer.Renderer.onRenderSurfaceSizeChanged(Renderer.java:352) at org.rajawali3d.view.TextureView$GLThread.guardedRun(TextureView.kt:1215) at org.rajawali3d.view.TextureView$GLThread.run(TextureView.kt:935)