★ PROGRAMMER'S GUIDE ★ VDP1 libraryTitle | Data | Data Name | No |
typedef struct SprCluster {
Uint16 no; / * cluster number * /
Uint16 angleSeq; / * Rotation order * /
MthXyz angle; / * Rotation in the coordinate system of the parent cluster * /
MthXyz point; / * Coordinates of origin in parent cluster coordinate system * /
SprObject3D * object / * 3D object * /
SprCluster * next; / * Next cluster * /
SprCluster * child; / * Child cluster * /
SprInbetInf * inbetInf; / * Connection polygon information between objects * /
void (* transStart) (SprCluster *);
/ * User callback routine before starting coordinate conversion * /
void (transEnd) (SprCluster *, SprObject3D *, MthMatrix *, MthXyz *);
/ * User callback routine after coordinate conversion * /
void * context; / * User context area * /
} SprCluster;no is for the user callback routine to identify the cluster table and is optional.
angleSeq = ROT_SEQ_ZYX: Rotate the object in the order of Z → Y → X = ROT_SEQ_ZXY: ”Z → X → Y”
= ROT_SEQ_YZX: ”Y → Z → X”
= ROT_SEQ_YXZ: ”Y → X → Z”
= ROT_SEQ_XYZ: ”X → Y → Z”
= ROT_SEQ_XZY: ”X → Z → Y”If the 3D object, next cluster, and child cluster are not connected, set object, next, and child to 0, respectively.Set inbetInf to 0 if there is no inter-object connection polygon information.
transStart specifies a user callback routine that will be called before the start of coordinate transformation for this cluster. In the routine, move the cluster, change the object data, and so on. Set to 0 if there is no callback routine.
[Calling sequence of transStart routine] void transStart (SprCluster * cluster);
cluster: Local cluster table
transEnd specifies the user's callback routine to be called after the coordinate transformation of this cluster is complete. This callback routine is connected to a cluster in 3D Called for each object. Set to 0 if there is no callback routine.[Calling sequence of transStart routine] void transEnd (SprCluster * cluster, SprObject3D * object,
MthMatrix * worldMatrix, MthXyz * worldVertPoint);
cluster: Local cluster table object: 3D object table worldMatrix: Conversion matrix to world coordinate system (3 rows and 4 columns) worldVertPoint: Vertex coordinate value table in the world coordinate system (returned when #define SPR_3NEED_WORLD_VERT is defined in the 3D sprite work area definition macro)context specifies the context area used by the user callback routine for each cluster. If not, set it to 0.
Title | Data | Data Name | No |
typedef struct SprObject3D {
Uint16 no; / * object number * /
Uint16 dispFlag / * Display flag * /
Uint16 vertCount; / * Number of vertices * /
Uint16 surfaceCount; / * Number of faces * /
MthXyz * vertPoint; / * Vertex coordinate table * /
MthXyz * vertNormal; / * Vertex normal vector table * /
SprSurface * surface; / * Surface definition table * /
MthXyz * surfaceNormal; / * Surface normal vector table * /
MthXyz * surfaceVert; / * Surface representative point coordinate table * /
Uint16 ** shdIdxTbl; / * Shading index table * /
Fixed32 surfNormK; / * Calculation correction value of surface normal vector * /
SprObject3D * next; / * Next 3D object * /
} SprObject3D; no is for the user callback routine to identify the object table and can be set arbitrarily.
dispFlag b15, b14 = 00: Polygon display = 10: Polyline displayb12 = 1: Double-sided polygon
b9, b8 = 00: No shading 01: Flat shading 10: Gouraud shading
b4 = 1: Object-to-object connection polygon object
vertNormal: Set when performing Gouraud shading.
surface: Pointer of the table that defines the vertices that make up the face and color information for each face surfaceNormal: Pointer of the table that defines the normal for each face surfaceVert: Representative point of the face that is referred to when calculating the brightness of the face (Center point) Set the pointer of the coordinate table. If set to 0, the first vertex of the face definition will be used as the representative point.
shdIdxTbl: Sets the index table of the shading table when performing flat shading with the shading table. When Gouraud shading is specified,
When this parameter is specified, shdIdxTbl [0] becomes the Gouraud shading gray code table. When this parameter is specified when flat shading and the drawing mode of the surface definition is texture specified, shdIdxTbl [0] is set as the gray code table of flat shading.
surfNormK: Specify when calculating the surface normal vector for this object with the SPR_3SetNormVect () routine, or when this object is an inter-object connection polygon object. For details, see sur in the MTH_ComputeNormVect () routine of the math library.
See fNormK parameter.
Connect between objects Specify a negative value for polygon objects.The shading table is specified in the following format with 32 gradations of RGB code.
Uint16 shadingTbl [32]; 0 ← Dark → 31
When the double-sided polygon specification is set to 1, single-sided polygon data is displayed on both sides.
Title | Data | Data Name | No |
typedef struct SprSurface {
Uint16 vertNo [4]; / * Vertex numbers that make up the face * /
Uint16 drawMode; / * Draw mode * /
Uint16 color; / * Color data * /
} SprSurface;drawMode b15, b14 = 00: color is the color code 01: color is the texture character number 10: color is the shading table index number 11: color is the original RGB code for automatic shadingb13, b12 = 00: The minimum value of the 4 vertices after coordinate conversion is set as the target point for Z sorting. 01: The maximum value of the 4 vertices after coordinate conversion is the target point for Z sorting. 10: The center value of the four vertices after coordinate conversion is set as the target point for Z sorting.
b11-b0: Same as the sprite's drawing mode word. If you specify a texture in drawMode, the color bits are as follows: For color b15 and b14, specify the texture inversion mode. b15, b14 = 00: No inversion = 01: Left / right inversion = 10: Up / down inversion = 11: Up / down / left / right inversion
b13-b0: Character number of the luxture
Title | Data | Data Name | No |
typedef struct SprInbetInf {
Sint32 vertCount; / * Number of extracted vertices * /
SprObject3D * fromObj; / * Connected vertex data retrieval object * /
Uint16 * fromVertNo; / * Extracted vertex number array * /
SprObject3D * toObj; / * Connected vertex data setting object * /
Uint16 * toVertNo; / * Set vertex number array * /
SprInbetInf * next; / * Connection polygon information between next objects * /
} SprTexture;
Set next to 0 if there is no next inter-object connection polygon information.
Title | Data | Data Name | No |
typedef struct SprTexture {
Uint16 charNo; / * Character number * /
Uint16 colorMode; / * Color mode * /
Uint16 color; / * Color data * /
Uint16 width; / * Character width * /
Uint16 height; / * Character height * /
Uint8 * charData; / * Pointer for character data * /
SprLookupTbl * lookupTbl; / * Lookup table pointer * /
} SprTexture;
SprTexture texture [n]; The charNo of the last entry should be 0xffff (stopper).
colorMode: b5 --b3 is the same as the sprite drawing mode word.
color: Color data Look-up table number when color mode = 1 Color bank code when color mode = 0, 2, 3, 4 Ignore when color mode = 5
Title | Data | Data Name | No |
typedef struct Spr3dStatus {
MthXyz lightAngle; / * Light source angle * /
MthXyz viewCoordPoint; / * Viewpoint position in viewpoint coordinate system * /
MthXyz viewPoint; / * Viewpoint coordinates * /
MthXyz viewAngle; / * Viewpoint angle * /
Sint32 viewAngleSeq; / * Viewpoint angle rotation operation * /
Sint32 zSortMode; / * Z sort Z coordinate value adoption mode * /
Fixed32 zSortZMin; / * Z sort current viewpoint coordinate system Z minimum value * /
Fixed32 zSortZMax; / * Z sort Current viewpoint coordinate system Z maximum value * /
Fixed32 clipZMin; / * Viewpoint coordinate system clip Z minimum value * /
Fixed32 clipZMax; / * Viewpoint coordinate system clip Z maximum value * /
Sint32 clipLevel; / * Clipping level * /
MthXy unitPixel; / * Number of screen pixels for x, y1.0 * /
} Spr3dStatus;
★ PROGRAMMER'S GUIDE ★ VDP1 library