Update MediaWiki page 'OB3'

This commit is contained in:
Protocol 2012-11-25 18:36:07 +00:00 committed by moparisthebest
parent a247b0b1a3
commit be85fc3431

View File

@ -4,33 +4,85 @@ Work in progress.
This page refers to .ob3, a custom format for 3D models created by Jagex. It is used by the RuneScape Classic engine. This page refers to .ob3, a custom format for 3D models created by Jagex. It is used by the RuneScape Classic engine.
[Unsigned Short] vertex_count <pre>
[Unsigned Short] face_count import util.Data;
for (int i = 0; i < vertex_count; i++) public class Ob3Model {
[Signed Short] vert_x public int faceCount;
for (int i = 0; i < vertex_count; i++) public int vertexCount;
[Signed Short] vert_z
for (int i = 0; i < vertex_count; i++) public int faceVertexCount[];
[Signed Short] vert_y public int faceBack[];
public int faceFront[];
for (int i = 0; i < face_count; i++) public int verticesX[];
[Unsigned Byte] face_vert_count public int verticesZ[];
for (int i = 0; i < face_count; i++) public int verticesY[];
[Signed Short] face_back
for (int i = 0; i < face_count; i++) private static final int trigger = 0xbc614e;
[Signed Short] face_front
for (int i = 0; i < face_count; i++) public Ob3Model(byte data[], int position) {
[Unsigned Byte] Boolean. Gourad shading? int vertexCount = Data.readInt16(data, position);
position += 2;
for (int i = 0; i < face_count; i++) { int faceCount = Data.readInt16(data, position);
for (int j = 0; j < face_vert_count[i]; j++) { position += 2;
if (vertex_count < 256)
[Unsigned Byte] Unknown verticesX = new int[vertexCount];
else verticesY = new int[vertexCount];
[Unsigned Short] Unknown verticesZ = new int[vertexCount];
}
} faceBack = new int[faceCount];
faceFront = new int[faceCount];
faceVertexCount = new int[faceCount];
for (int i = 0; i < vertexCount; i++) {
verticesX[i] = Data.readSignedInt16(data, position);
position += 2;
}
for (int i = 0; i < vertexCount; i++) {
verticesZ[i] = Data.readSignedInt16(data, position);
position += 2;
}
for (int i = 0; i < vertexCount; i++) {
verticesY[i] = Data.readSignedInt16(data, position);
position += 2;
}
for (int i = 0; i < faceCount; i++)
faceVertexCount[i] = data[position++] & 0xff;
for (int i = 0; i < faceCount; i++) {
faceBack[i] = Data.readSignedInt16(data, position);
position += 2;
if (faceBack[i] == 32767)
faceBack[i] = trigger;
}
for (int i = 0; i < faceCount; i++) {
faceFront[i] = Data.readSignedInt16(data, position);
position += 2;
if (faceFront[i] == 32767)
faceFront[i] = trigger;
}
position += faceCount - 1;
for (int i = 0; i < faceCount; i++) {
for (int j = 0; j < faceVertexCount[i]; j++) {
if (vertexCount < 256) {
position++;
} else {
Data.readInt16(data, position);
position += 2;
}
}
}
this.vertexCount = vertexCount;
this.faceCount = faceCount;
}
}</pre>
== '''Face sides''' == == '''Face sides''' ==