Update MediaWiki page 'OB3'

This commit is contained in:
S 2012-12-05 11:52:15 +00:00 committed by moparisthebest
parent d7170d0e2a
commit df6677d9ae

View File

@ -13,7 +13,7 @@ This page refers to .ob3, a custom format for 3D models created by Jagex. It is
public int vert_z[]; public int vert_z[];
public int face_count; public int face_count;
public int face_v_count[]; public int face_v_count[];
public int faces[][]; public int face_v[][];
public int face_back[]; public int face_back[];
public int face_front[]; public int face_front[];
@ -74,12 +74,12 @@ This page refers to .ob3, a custom format for 3D models created by Jagex. It is
} }
for (int f = 0; f < face_count; f++) { for (int f = 0; f < face_count; f++) {
faces[f] = new int[face_v_count[f]]; face_v[f] = new int[face_v_count[f]];
for (int fv = 0; fv < face_v_count[f]; fv++) { for (int fv = 0; fv < face_v_count[f]; fv++) {
if (vert_count < 256) { if (vert_count < 256) {
faces[f][fv] = get_u_byte(data[offset++]); face_v[f][fv] = get_u_byte(data[offset++]);
} else { } else {
faces[f][fv] = get_u_short(data, offset); face_v[f][fv] = get_u_short(data, offset);
offset += 2; offset += 2;
} }
} }
@ -108,4 +108,13 @@ This page refers to .ob3, a custom format for 3D models created by Jagex. It is
== '''Faces''' == == '''Faces''' ==
A '''negative''' face_back or face_front value indicates a '''solid colour''', whereas a '''positive''' value indicates a '''texture'''. The texture is defined by its offset in the client's texture array. A '''negative''' face_back or face_front value indicates a '''solid colour''', whereas a '''positive''' value indicates a '''texture'''. The texture is defined by its offset in the client's texture array.
When converting to/from [http://en.wikipedia.org/wiki/Wavefront_.obj_file Wavefront OBJ] format, remember that the OB3 face values are one less than the OBJ face values. When converting to/from [http://en.wikipedia.org/wiki/Wavefront_.obj_file Wavefront OBJ] format, remember that the OB3 face values are one less than the OBJ face values.
<pre>public static int decode_colour(int i) {
i = -(i + 1);
int r = i >> 10 & 0x1f;
int g = i >> 5 & 0x1f;
int b = i & 0x1f;
return (r << 19) + (g << 11) + (b << 3);
}
</pre>