mirror of
https://github.com/moparisthebest/rswiki-book
synced 2024-11-25 02:22:18 -05:00
Update MediaWiki page 'OB3'
This commit is contained in:
parent
d7170d0e2a
commit
df6677d9ae
@ -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 face_count;
|
||||
public int face_v_count[];
|
||||
public int faces[][];
|
||||
public int face_v[][];
|
||||
public int face_back[];
|
||||
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++) {
|
||||
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++) {
|
||||
if (vert_count < 256) {
|
||||
faces[f][fv] = get_u_byte(data[offset++]);
|
||||
face_v[f][fv] = get_u_byte(data[offset++]);
|
||||
} else {
|
||||
faces[f][fv] = get_u_short(data, offset);
|
||||
face_v[f][fv] = get_u_short(data, offset);
|
||||
offset += 2;
|
||||
}
|
||||
}
|
||||
@ -108,4 +108,13 @@ This page refers to .ob3, a custom format for 3D models created by Jagex. It is
|
||||
== '''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.
|
||||
|
||||
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>
|
Loading…
Reference in New Issue
Block a user