mirror of
https://github.com/moparisthebest/rswiki-book
synced 2024-11-28 20:02:19 -05:00
Update MediaWiki page 'OB3'
This commit is contained in:
parent
7be6c32c64
commit
5fd9283b96
@ -4,82 +4,31 @@ 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.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
import util.Data;
|
[Unsigned Short] vertex_count
|
||||||
|
[Unsigned Short] face_count
|
||||||
|
|
||||||
public class Ob3Model {
|
for (int i = 0; i < vertex_count; i++)
|
||||||
public int faceCount;
|
[Signed Short] vert_x
|
||||||
public int vertexCount;
|
for (int i = 0; i < vertex_count; i++)
|
||||||
|
[Signed Short] vert_z
|
||||||
|
for (int i = 0; i < vertex_count; i++)
|
||||||
|
[Signed Short] vert_y
|
||||||
|
|
||||||
public int faceVertexCount[];
|
for (int i = 0; i < face_count; i++)
|
||||||
public int faceBack[];
|
[Unsigned Byte] face_vert_count
|
||||||
public int faceFront[];
|
for (int i = 0; i < face_count; i++)
|
||||||
public int verticesX[];
|
[Signed Short] face_back
|
||||||
public int verticesZ[];
|
for (int i = 0; i < face_count; i++)
|
||||||
public int verticesY[];
|
[Signed Short] face_front
|
||||||
|
for (int i = 0; i < face_count; i++)
|
||||||
|
[Unsigned Byte] Boolean. Gourad shading?
|
||||||
|
|
||||||
private static final int trigger = 0xbc614e;
|
for (int i = 0; i < face_count; i++) {
|
||||||
|
for (int j = 0; j < face_vert_count[i]; j++) {
|
||||||
public Ob3Model(byte data[], int position) {
|
if (vertex_count < 256)
|
||||||
int vertexCount = Data.readInt16(data, position);
|
[Unsigned Byte] Unknown
|
||||||
position += 2;
|
else
|
||||||
int faceCount = Data.readInt16(data, position);
|
[Unsigned Short] Unknown
|
||||||
position += 2;
|
|
||||||
|
|
||||||
verticesX = new int[vertexCount];
|
|
||||||
verticesY = new int[vertexCount];
|
|
||||||
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>
|
}</pre>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user