Skip to content

SURFACE

Jocelyn Beedie edited this page Nov 28, 2020 · 7 revisions

SURFACE

This page is under development

Format

struct SurfaceObject {
    float unknown[4];
    float transform[16]; // 4x4 matrix
    char junk[16];
    uint16_t unknown2;
    uint16_t unknown3;
    uint32_t num_vertices;
    Vector3 vertices[num_vertices];
    uint32_t num_unk0;
    char unk0[24][num_unk0]; // 32 bytes on PS2
    uint32_t num_unk1;
    char unk1[24][num_unk1]; // 32 bytes on PS2
    uint32_t num_surfaces;
    Surface surfaces[num_unk2]; // 140 bytes each
    uint32_t num_curves;
    Curve curves[num_curves]; // 8 bytes each
    uint32_t num_normals;
    Vector3 normals[num_normals]; // 12 bytes each
    uint32_t num_unk5;
    char unk5[104][num_unk5]; // 112 bytes on PS2, contains a 4x4 matrix
    uint32_t num_unk6;
    uint16_t unk6[num_unk6]; // Index into either surfaces or unk5
    uint32_t num_unk7;
    char unk7[24][num_unk7]; // 32 bytes on PS2
    uint8_t weird;
    uint32_t num_unk8;
    char unk8[???][num_unk8]; // still figuring this one out
    uint32_t num_unk9;
    uint32_t unk9[num_unk9];
};

Surface structure

This represents a surface

struct Surface {
    Vector2 texcoords[8]; // texture coordinates
    float unknown2[12]; // More unknown floats; these are constrained to [0.0, 1.0]
    uint16_t normal_indices[4];
    uint16_t curve_indices[4];
    uint32_t curve_order; // Curve order
    char unknown3[32];
    uint32_t index_n6; // Index into unk6
    int32_t materialanim_id; // ID of a MATERIALANIM
};

Curve structure

This is a degree 3 Bézier curve.

struct Curve {
    uint16_t p1;
    uint16_t p2;
    uint16_t p1_t;
    uint16_t p2_t;
};
Clone this wiki locally