mirror of
https://github.com/moparisthebest/rswiki-book
synced 2024-11-25 10:32:17 -05:00
Update MediaWiki page 'OB3'
This commit is contained in:
parent
a247b0b1a3
commit
be85fc3431
@ -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++)
|
|
||||||
[Signed Short] vert_y
|
|
||||||
|
|
||||||
for (int i = 0; i < face_count; i++)
|
public int faceVertexCount[];
|
||||||
[Unsigned Byte] face_vert_count
|
public int faceBack[];
|
||||||
for (int i = 0; i < face_count; i++)
|
public int faceFront[];
|
||||||
[Signed Short] face_back
|
public int verticesX[];
|
||||||
for (int i = 0; i < face_count; i++)
|
public int verticesZ[];
|
||||||
[Signed Short] face_front
|
public int verticesY[];
|
||||||
for (int i = 0; i < face_count; i++)
|
|
||||||
[Unsigned Byte] Boolean. Gourad shading?
|
|
||||||
|
|
||||||
for (int i = 0; i < face_count; i++) {
|
private static final int trigger = 0xbc614e;
|
||||||
for (int j = 0; j < face_vert_count[i]; j++) {
|
|
||||||
if (vertex_count < 256)
|
public Ob3Model(byte data[], int position) {
|
||||||
[Unsigned Byte] Unknown
|
int vertexCount = Data.readInt16(data, position);
|
||||||
else
|
position += 2;
|
||||||
[Unsigned Short] Unknown
|
int faceCount = Data.readInt16(data, position);
|
||||||
|
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>
|
||||||
|
|
||||||
== '''Face sides''' ==
|
== '''Face sides''' ==
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user