From what I saw in Blocks generate faces
Code: [Select]
Code:
void findTexturePage(byte data[], int offset, int faceIndexOffset, int textureIndexOffset)
is only called once
and all the if checks in
findTexturePage are checked at once, meaning if one succeds the others won't get added so it is technically only one texture page in Face class active as texturepages always returns 1 in size to me.
Also due to
Code: [Select]
Code:
public String getPage() { return (String)texturepages.get(texturepages.size() - 1); }
it still just sends the last created one, which means all other data stored in faces are of no use. or is this just for debugging code and that code will be changed?
at write out I just did in C++ that all the Texture indices that are equal got written out together once per block, this reduced the total size of the file from 80MB to 38.6MB which is quite some savings, it did however add a bit of processing time.
also a change I'd like to suggest is moving findTextureIndices to Block.
considering TextureCoords is only x and y , this way you can get away with Dbl x and Dbl y on textures. although it would write out 3xtextures per fetch, it is however alot easier for writing a code sort for texture coordinates. eg
in Texture
Code: [Select]
Code:
public class Texture{ public Texture(int id,double X,double Y) { this.id = id; this.X=X; this.Y=Y; } public int getId() { return id; } public double getX() { return X; } public double getY() { return Y; } public int getPage() { return ((Integer)texturepages.get(texturepages.size() - 1)).intValue(); } public void print() { System.out.print(texturepages); } public static final int COORDINATE_BYTES = 1; public static final int p = 0; private final int id; private double X; private double Y; private final ArrayList texturepages = new ArrayList();}
in Block
Code: [Select]
Code:
public void findTextureIndices(byte data[], int offset) { textures.add(new Texture(textures.size(),(data[offset + 6] & 0xff) + 0.5D) / 256D,(data[offset + 7] & 0xff) + 0.5D) / 256D) textures.add(new Texture(textures.size(),(data[offset + 8] & 0xff) + 0.5D) / 256D,(data[offset + 9] & 0xff) + 0.5D) / 256D) textures.add(new Texture(textures.size(),(data[offset + 10] & 0xff) + 0.5D) / 256D,(data[offset + 11] & 0xff) + 0.5D) / 256D) } public void generateTextures(byte data[], int faceIndexOffset, int textureIndexOffset) { for(int texture = 0; texture < faceCount; texture++) findTextureIndices(data, offset + texture * 16)) }
by the way if you are wondering how I got your code changes is because I was too lazy to ask for source and decompiled your code, sorry about that.
also, don't know where I read it, but someone somewhere said there was a limitation to how many faces or vertices can be on each terrain chunk, which I can't really see, a pure water tile uses 512 faces, 400 vertices, but the chunk with balamb town for example uses 790 vertices and 1156 faces, which suggests to me that it should be possible to put more detail onto the FF8 world.