GsDOBJ2

Object structure definition used by the GsCOORDINATE2 3D object handler

struct GsDOBJ2 {
        u_long attribute;
        GsCOORDINATE2 *coord2;
        u_long *tmd;
        u_long id;
};

Members

attribute Object attribute (32-bits)
coord2 Pointer to a local coordinate system
tmd Pointer to model data
id System reserved

Explanation

GsDOBJ2 structures can be used to manipulate 3D models.
Each object in a 3D model has an associated GsDOBJ2 structure.
The GsDOBJ2 structure can be linked to TMD file model data using GsLinkObject4() and can be registered in the ordering table using GsSortObject4().
The coord2 parameter is a pointer to a GsCOORDINATE2 structure defining the object's coordinate system. The location, inclination, and size of the object are defined in a matrix in this structure.
tmd contains the starting address of TMD model data stored in memory and is calculated and set using GsLinkObject4().
attribute is 32 bits and is used to store various display attributes as shown below (all other bits not defined below are reserved by the system):

a) Bit 3: Light source calculation mode
This bit controls whether light source calculation will be performed using FOG.
        0: Normal mode without FOG. This is the fastest mode requiring the least amount of calculation time.
        1: FOG mode. FOG attributes are set in the GsFOGPARAM structure and updated using the GsSetFogParam() function.

b) Bit 5: Light source calculation mode control bit
This bit controls whether light source calculation mode is determined by bit 3 of the attribute field or by the lighting mode set by GsSetLightMode().
        0: Lighting mode is set by GsSetLightMode(). Bit 3 of the attribute field is ignored.
        1: Lighting mode is set according to bit 3 of the attribute field.

c) Bit 6: Light source calculation ON/OFF switch
This bit is used to switch light source calculation on and off.
When light source calculation is turned off, a texture-mapped polygon is displayed in the original texture colour. An unmapped polygon is displayed in the model data colour.

d) Bit 30: Semi-transparency ON/OFF
This bit is used to switch semi-transparency on and off.
This bit must be used with the uppermost bit (STP bit) of the texture colour field to enable semi-transparency. (The texture colour field is the texture pattern when direct mode is set and the CLUT colour field when indexed mode is set). The semi-transparency and non-transparency of each pixel may also be controlled using the STP bit.

e) Bit 31: Display ON/OFF This bit is used to switch the display on and off.

f) Bits 9-11: Automatic partitioning (polygon subdivision)
        0: No automatic partitioning
        1: 2x2 partitioning
        2: 4x4 partitioning
        3: 8x8 partitioning
        4: 16x16 partitioning
        5: 32x32 partitioning

These bits specify the number of subdivisions for the automatic partitioning function. Automatic partitioning, or polygon subdivision, causes all the polygons contained within an object to subdivide. It is used for reducing texture distortion and preventing fragmentation of adjacent polygons. Note that division should be kept to a minimum in order to prevent the number of polygons from increasing exponentially.