PROGRAMMER'S GUIDEVDP1 library
Back | ■
VDP1 library

6.3 Function specifications


 List
 Title

Function specifications

 Function

VDP1 3D work area definition macro

 Function Name

SPR_3DefineWork

 No

1

Form
[# define SPR_3USE_DOUBLE_BUF]
[# define SPR_3NEED_WORLD_VERT]
#include "sega_spr.h"
SPR_3DefineWork (WORK3D, OBJ_SURF_MAX, OBJ_VERT_MAX)
input
 WORK3D
 : Work area name
 OBJ_SURF_MAX
 : Maximum number of objects
 OBJ_VERT_MAX
 : Maximum number of vertices of object
function
Define the work area used for VDP1 3D display in the data area in the AP.
# define SPR_3USE_DOUBLE_BUF can be omitted, and if specified, processing such as coordinate conversion by DSP and SH processing will be parallelized using two object vertex coordinates and surface brightness tables to increase execution speed.
# define SPR_3NEED_WORLD_VERT is optional, and if specified, the vertex coordinate table in the world coordinate system will be notified when the coordinate conversion result is notified.
# define SPR_3USE_DOUBLE_BUF and # define PR_3NEED_WORD_VERTH must be defined before #define "sega_spr.h" is defined.

 List
 Title

Function specifications

 Function

Initialization of VDP1 3D display

 Function Name

SPR_3Initial

 No

2

Form
void SPR_3Initial (Spr3WorkArea * workArea)
input
workArea: Work area definition table
output
none
Function value
none
function
Initializes the VDP1 3D display.
  • The viewpoint is the origin of the world coordinate system, the viewpoint angle is (0,0,0) (positive direction of Z), and the rotation operation is set in the order of X → Y → Z.
  • The light source angle is (0,0,0) (positive direction of Z).
  • The clipping level is 2, and the maximum / minimum display range of the Z coordinate of the viewpoint coordinate system is from -0.005 to the minimum negative value.

 List
 Title

Function specifications

 Function

Set of clipping modes

 Function Name

SPR_3SetClipLevel

 No

3

Form
void SPR_3SetClipLevel (Uint16 clipLevel, Fixed32 clipZmin, Fixed32 clipZmax)
input
clipLevel: Clipping level number
number meaning
0 No clipping.
1 In the Z range of the viewpoint coordinate system, the Z value of the representative point of the clip polygon outside the specified Z value range is not drawn.
2 or more Clip in a field-of-view pyramid with the entire framebuffer as the screen.
Polygons outside the field of view pyramid are not drawn even at one point.
clipZmin: viewpoint coordinate system Z coordinate clip minimum value
clipZmax: Viewpoint coordinate system Z coordinate clip maximum value
output
none
Function value
none
function
Sets the clipping level of the polygon. The upper level includes the functions of the lower level. For level 1, clipping is done in the viewpoint coordinate system with the maximum Z coordinate value of the polygon, but the range must be set with clipZmin and clipZmax before executing SPR3_DrawModel ().

 List
 Title

Function specifications

 Function

Set of pixel counts

 Function Name

SPR_3SetPixelCount

 No

Four

Form
void SPR_3SetPixelCount (Uint16 pixelCountX, Uint16 pixelCountY)
input
 pixelCountX
 : Number of pixels per unit of Clean X
 pixelCountY
 : Number of pixels per unit of screen Y
output
none
Function value
none
function
Sets the number of screen pixels for each 1.0 of XY during fluoroscopic conversion to the screen. At the time of initial setting, each is set to 256.

 List
 Title

Function specifications

 Function

Light source set

 Function Name

SPR_3SetLight

 No

Five

Form
void SPR_3SetLight (Uint16 moveKind, MthXyz * lightAngle)
input
 moveKind
 : Type of movement amount
 b0
 : 0 = Relative movement
 1 = Absolute move
 b1
 : 0 = Rotational movement is angle
 1 = Rotational movement is a unit vector
 lightAngle
 : When the rotational movement amount of the parallel light source is an angle, the specified range of the movement amount is as follows.
 If a vector is specified, it will be converted to an angle.
 FIXED (-180.0) ≤ Rotational movement amount ≤ FIXED (180.0)
 The rotation operation is performed in the order of X → Y → Z.
output
none
Function value
none
function
Set the light source angle.


 List
 Title

Function specifications

 Function

Set of viewpoints

 Function Name

SPR_3SetView

 No

6

Form
voidSPR_3SetView (Uint16 moveKind, MthXyz * viewPoint, MthXyz * viewAngle, Uint16 angleSeq, MthXyz * viewCoordPoint)
input
 moveKind
 : Type of movement amount
 b0
 : 0 = Relative movement
 1 = Absolute move
 b1
 : 0 = Rotational movement is angle
 1 = Rotational movement is a vector
 viewPoin
 : Viewpoint position or translation amount.
 If the rotation position of the viewpoint in the world coordinate system is 0, it will be ignored.
 viewAngle
 : When the rotation movement amount of the viewpoint is an angle, the specified range of the movement amount is as follows.
 If a vector is specified, it will be converted to an angle.
 FIXED (-180.0) ≤ Rotational movement amount ≤ FIXED (180.0)
 If it is 0, it will be ignored.
 angleSeq
 : Viewpoint rotation operation
 viewCoordPoint
 : Viewpoint position or translation amount in the viewpoint coordinate system.
 If it is 0, it will be ignored. The initial value is (0,0,0).
output
none
Function value
none
function
Moves the viewpoint position within the world coordinate system and rotates around that position.
If viewCoordPoint is specified, the viewpoint position is moved from the origin to the specified position in the viewpoint coordinate system.

angleSeq = ROT_SEQ_ZYX: Rotate the viewpoint 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"


 List
 Title

Function specifications

 Function

Cluster movement

 Function Name

SPR_3MoveCluster

 No

7

Form
void SPR_3MoveCluster (SprCluster * cluster, Uint16 moveKind, MthXyz * angle, MthXyz * point)
input
 cluster
 : Pointer of cluster table to move
 moveKind
 : Type of movement amount
 b0
 : 0 = Relative movement
 1 = Absolute move
 b1
 : 0 = Rotational movement is angle
 1 = Rotational movement is a unit vector
 angle
 : When the rotational movement amount is an angle, the specified range of the movement amount is as follows.
 If a vector is specified, it will be converted to an angle.
 FIXED (-180.0) ≤ Rotational movement amount ≤ FIXED (180.0)
 point
 : Translation amount
output
none
Function value
none
function
Move the cluster in the order of rotation and translation.
If angle and point are 0 respectively, the values are ignored.

 List
 Title

Function specifications

 Function

Model registration

 Function Name

SPR_3DrawModel

 No

8

Form
void SPR_3DrawModel (SprCluster * rootCluster)
input
rootCluster: Pointer to the root cluster table of the model to display
output
none
Function value
none
function
Register the model.

 List
 Title

Function specifications

 Function

Model drawing

 Function Name

SPR_3Flush

 No

9

Form
void SPR_3Flush (void)
input
none
output
none
Function value
none
function
Draw the model.
SPR_3 Completes Z sorting in the viewpoint coordinate system of the polygon group registered by DrawMode ().

 List
 Title

Function specifications

 Function

Set of textures

 Function Name

SPR_3SetTexture

 No

Ten

Form
void SPR_3SetTexture (SprTexture * texture)
input
texture: Texture table pointer
output
none
Function value
none
function
Set the texture.

 List
 Title

Function specifications

 Function

Release texture area

 Function Name

SPR_3ClrTexture

 No

11

Form
void SPR_3ClrTexture (SprTexture * texture)
input
texture: Texture table pointer
output
none
Function value
none
function
Free the texture area.

 List
 Title

Function specifications

 Function

Function call to all clusters

 Function Name

SPR_3CallAllCluster

 No

12

Form
void SPR_3CallAllCluste (SprCluster * cluster, void (* userFunc) (SprCluster *))
input
 cluster
 : Root cluster table pointer
 userFunc
 : User function
output
none
Function value
none
function
Call the specified function with the class table as a parameter for each cluster connected to the root cluster.

 List
 Title

Function specifications

 Function

Change texture color data

 Function Name

SPR_3ChangeTexColor

 No

13

Form
voidSPR_3ChangeTexColor (Uint16 charNo, Uint16 color, SprLookupTbl * lookupTbl)
input
 charNo
 : Character number
 color
 : Color data lookup table number or color bank code
 lookupTbl
 : Look-up table pointer
output
none
Function value
none
function
Changes the color data and color lookup table of the registered texture specified by the character number. If lookupTbl is 0, only the color is changed and the color lookup table is not registered.

 List
 Title

Function specifications

 Function

Set the minimum and maximum values of the Z sort range

 Function Name

SPR_3SetZSortMinMax

 No

14

Form
voidSPR_3SetZSortMinMaxl (Uint16 zSortMode, Fixed32 zSortMin, Fixed32 zSortMax)
input
 zSortMode
 : Z sort Z coordinate value adoption mode
 ZSORT_FLOAT_MODE = Floating mode
 ZSORT_FIXED_MODE = Fixed mode
 zSortMin
 : Viewpoint coordinate system Z sort Z coordinate minimum value
 zSortMax
 : Viewpoint coordinate system Z sort Z coordinate maximum value
output
none
Function value
none
function
zSortMin and zSortMax are parameters that specify the range of Z that divides the drawing order into blocks, and are set before executing the SPR3_DrawModel () routine.
The initial values are zSortMin and zSortMax, which are specified when the floating mode is specified as the Z coordinate value adoption mode, and the Z coordinate maximum and minimum values of the viewpoint coordinate system at the time of the previous drawing are adopted for the subsequent Z range.
In fixed mode, the specified zSortMin and zSortMax are adopted as fixed values.
At the time of initial setting of the SPR_3Initial () routine, -10.0 is set as zSortMin and 0.0 is set as zSortMax, and the Z coordinate value adoption mode is floating mode.
In the viewpoint coordinate system, the viewpoint position coordinates are 0.0 and point in the minus direction of Z.
The blocks used in Z sort use the drawing priority blocks of VDP1 extension processing, so if you want to perform Z sorting finely, you need to take a large number of drawing priority blocks in the 2D work area definition.
Also, if you want to do Z sort, you must set drawPrtyFlag = SPR_2DRAW_PRTY_ON in the SPR_2OpenCommand () routine.


 List
 Title

Function specifications

 Function

Acquisition of current 3D environment data

 Function Name

SPR_3GetStatus

 No

15

Form
void SPR_3GetStatus (Spr3dStatus * spr3dStatus)
input
none
output
spr3dStatus: Pointer for 3D environment data table
Function value
none
function
Acquires the current 3D environment data.


 List
 Title

Function specifications

 Function

Object surface normal vector calculation

 Function Name

SPR_3SetSurfNormVect

 No

16

Form
void SPR_3SetSurfNormVect (SprObject3D * obj)
input
none
output
obj: 3D object
Function value
none
function
Calculates the normal vector from the face vertex table of the specified 3D object and sets it in the face normal vector table. The normal vector is perpendicular to the face vertex order clockwise.
You need to set the surfNormK parameter for the 3D object.


 List
 Title

Function specifications

 Function

VDP1 fast drawing parameter set

 Function Name

SPR_3SetDrawSpeed

 No

17

Form
voidSPR_3SetDrawSpeed (Sint32 hssFlag, Sint32 eosFlag, Sint32 pclpFlag)
input
 hssFlag
 : High speed shrink flag (specify the drawing mode of texture polygon)
 0 = Precision priority drawing (default)
 1 = Speed priority drawing
 eosFlag
 : Sampling coordinates of the original texture when speed priority drawing is specified
 0 = Sampling even coordinates (default)
 1 = Sampling odd coordinates
 pclpFlag
 : Pre-clipping enable / disable flag
 0 = Enabled (default)
 1 = invalid
output
none
Function value
none
function
Set the high-speed drawing mode to be embedded in the drawing mode of the VDP1 sprite command. Please refer to the VDP1 hardware manual for high-speed shrink and pre-clipping.


Back | ■
PROGRAMMER'S GUIDEVDP1 library
Copyright SEGA ENTERPRISES, LTD., 1997