agelosfloros / saitoobjloader

Automatically exported from code.google.com/p/saitoobjloader
0 stars 0 forks source link

Parsing fails if faces have only two (v and vt) indices #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
see attached file...

the solution is inside the Face-Object:

the following methods need to be corrected:

    public int[] getNormalIndices()
    public int[] getTextureIndices()

into this (suggestion)

    public int[] getNormalIndices() {
        int[] v = new int[getNormalIndexCount()];

        for (int i = 0; i < v.length; i++)
            v[i] = getNormalIndex(i);

        return v;
    }

    public int[] getTextureIndices() {

        int[] v = new int[getTextureIndexCount()];

        for (int i = 0; i < v.length; i++)
            v[i] = getTextureIndex(i);

        return v;
    }

plus the following methods need to be added:

    public int getTextureIndexCount() {
        return uvIndices.size();
    }

    public int getNormalIndexCount() {
        return normalIndices.size();
    }

cheers

martin

Original issue reported on code.google.com by maybi...@gmail.com on 7 Feb 2010 at 10:20

Attachments:

GoogleCodeExporter commented 8 years ago
This could be the slowest fix in history. My apologies, it's been a hectic 
year. Hope it didn't hold you back to much. 

MattD

Original comment by mattdit...@gmail.com on 1 Aug 2010 at 12:40