Japanese
PROGRAMMER'S GUIDEVDP1 library
Back | ■
VDP1 library

6.3 Function specifications


 one
View
table
 Title

function specification

 Function

VDP1 3D work area definition macro

 Function name

SPR_3DefineWork

 No

1

Format
[#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 within the AP.
#define SPR_3USE_DOUBLE_BUF is optional, and if specified, it will use two object vertex coordinates and surface brightness tables to parallelize processing such as coordinate conversion by DSP and SH processing, increasing 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 notifying coordinate transformation results.
#define SPR_3USE_DOUBLE_BUF and #definePR_3NEED_WORD_VERTH must be defined before #define "sega_spr.h" is defined.

 one
View
table
 Title

function specification

 Function

VDP1 3D display initialization

 Function name

SPR_3Initial

 No

2

Format
void SPR_3Initial(Spr3WorkArea *workArea)
input
workArea: Work area definition table
output
none
function value
none
function
Initialize 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 Z direction).
  • 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 negative minimum value.

 one
View
table
 Title

function specification

 Function

Set of clipping modes

 Function name

SPR_3SetClipLevel

 No

3

Format
void SPR_3SetClipLevel(Uint16 clipLevel, Fixed32 clipZmin,Fixed32 clipZmax)
input
clipLevel: Clipping level number
number meaning
0 No clipping.
1 If the Z value of the representative point of the clip polygon falls outside the specified Z value range in the Z range of the viewpoint coordinate system, it will not be drawn.
2 or more Clipping is performed using a viewing pyramid that uses the entire frame buffer as a screen.
Polygons with even one point outside the viewing pyramid will not be drawn.
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 polygon clipping level. The upper level contains the functionality of the lower level. For level 1, clipping is performed within the viewpoint coordinate system at the maximum Z coordinate value of the polygon, but the range must be set with clipZmin and clipZmax before executing SPR3_DrawModel().

 one
View
table
 Title

function specification

 Function

Set of unit pixels

 Function name

SPR_3SetPixelCount

 No

4

Format
void SPR_3SetPixelCount(Uint16 pixelCountX, Uint16 pixelCountY)
input
 pixelCountX
 : Clean X unit pixel number
 pixelCountY
 :Unit pixel number of screen Y
output
none
function value
none
function
Set the number of screen pixels for each 1.0 in XY when converting perspective to the screen. Each is set to 256 by default.

 one
View
table
 Title

function specification

 Function

set of light sources

 Function name

SPR_3SetLight

 No

5

Format
void SPR_3SetLight(Uint16 moveKind, MthXyz *lightAngle)
input
 moveKind
 :Type of movement amount
 b0
 :0 = relative movement
 1 = absolute movement
 b1
 :0 = rotational movement is angle
 1 = rotational displacement is a unit vector
 lightAngle
 : If the amount of rotational movement of the parallel light source is an angle, the specified range of the amount of movement is as follows.
 If specified as a vector, it will be converted to an angle.
 FIXED(-180.0) ≦ Rotational movement amount ≦ FIXED(180.0)
 Rotation operations are performed in the order of X→Y→Z.
output
none
function value
none
function
Set the light source angle.


 one
View
table
 Title

function specification

 Function

set of perspectives

 Function name

SPR_3SetView

 No

6

Format
voidSPR_3SetView(Uint16 moveKind, MthXyz *viewPoint,MthXyz *viewAngle, Uint16 angleSeq, MthXyz *viewCoordPoint)
input
 moveKind
 :Type of movement amount
 b0
 :0 = relative movement
 1 = absolute movement
 b1
 :0 = rotational movement is angle
 1 = rotational displacement is a vector
 viewPoint
 : Position or translation amount of viewpoint.
 If the rotational position of the viewpoint in the world coordinate system is 0, it will be ignored.
 viewAngle
 : If the amount of rotational movement of the viewpoint is an angle, the specified range of the amount of movement is as shown in the following formula.
 If specified as a vector, it will be converted to an angle.
 FIXED(-180.0) ≦ Rotational movement amount ≦ FIXED(180.0)
 If 0, it will be ignored.
 angleSeq
 : Viewpoint rotation operation
 viewCoordPoint
 : Viewpoint position or translation amount within the viewpoint coordinate system.
 If 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 will be moved from the origin to the specified position within 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”


 one
View
table
 Title

function specification

 Function

Moving a cluster

 Function name

SPR_3MoveCluster

 No

7

Format
void SPR_3MoveCluster(SprCluster *cluster, Uint16 moveKind,MthXyz *angle, MthXyz *point)
input
 cluster
 : pointer to the cluster table to be moved
 moveKind
 :Type of movement amount
 b0
 :0 = relative movement
 1 = absolute movement
 b1
 :0 = rotational movement is angle
 1 = rotational displacement is a unit vector
 angle
 : If the amount of rotational movement is an angle, the specified range of the amount of movement is as shown in the following formula.
 If specified as a vector, it will be converted to an angle.
 FIXED(-180.0) ≦ Rotational movement amount ≦ FIXED(180.0)
 point
 : Parallel movement amount
output
none
function value
none
function
Move the cluster in the order of rotation and translation.
If angle and point are each 0, their values are ignored.

 one
View
table
 Title

function specification

 Function

Registering the model

 Function name

SPR_3DrawModel

 No

8

Format
void SPR_3DrawModel(SprCluster *rootCluster)
input
rootCluster: Pointer to the root cluster table of the model to be displayed
output
none
function value
none
function
Register the model.

 one
View
table
 Title

function specification

 Function

drawing the model

 Function name

SPR_3Flush

 No

9

Format
void SPR_3Flush(void)
input
none
output
none
function value
none
function
Draw the model.
Completes Z sorting in the viewpoint coordinate system of polygons registered by SPR_3DrawMode().

 one
View
table
 Title

function specification

 Function

set of textures

 Function name

SPR_3SetTexture

 No

10

Format
void SPR_3SetTexture(SprTexture *texture)
input
texture: pointer to texture table
output
none
function value
none
function
Set texture.

 one
View
table
 Title

function specification

 Function

Freeing the texture area

 Function name

SPR_3ClrTexture

 No

11

Format
void SPR_3ClrTexture(SprTexture *texture)
input
texture: pointer to texture table
output
none
function value
none
function
Free up the texture area.

 one
View
table
 Title

function specification

 Function

for all clusters
function call

 Function name

SPR_3CallAllCluster

 No

12

Format
void SPR_3CallAllCluste(SprCluster *cluster, void (*userFunc)(SprCluster*))
input
 cluster
 : Pointer to root cluster table
 userFunc
 :User function
output
none
function value
none
function
Call the specified function for each cluster connected to the root cluster, using the class table as a parameter.

 one
View
table
 Title

function specification

 Function

Changing texture color data

 Function name

SPR_3ChangeTexColor

 No

13

Format
voidSPR_3ChangeTexColor(Uint16 charNo, Uint16 color,SprLookupTbl *lookupTbl)
input
 charNo
 :Character number
 color
 :Color data lookup table number or color bank code
 lookupTbl
 : Lookup 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 will be changed and the color lookup table will not be registered.

 one
View
table
 Title

function specification

 Function

Set the minimum and maximum values of the Z sort range

 Function name

SPR_3SetZSortMinMax

 No

14

Format
voidSPR_3SetZSortMinMaxl(Uint16 zSortMode,Fixed32 zSortMin,Fixed32 zSortMax)
input
 zSortMode
 :Z sort Z coordinate value adoption mode
 ZSORT_FLOAT_MODE=Float 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 Z range for dividing the drawing order into blocks, and are set before executing the SPR3_DrawModel() routine.
If floating mode is specified as the Z coordinate value adoption mode, the specified zSortMin and zSortMax will be used as initial values, and the Z coordinate maximum and minimum values of the viewpoint coordinate system from the previous drawing will be used for the subsequent Z range.
In fixed mode, the specified zSortMin and zSortMax are taken as fixed values.
During the initial settings of the SPR_3Initial() routine, zSortMin is set to -10.0, zSortMax is set to 0.0, and the Z coordinate value adoption mode is floating mode.
In the viewpoint coordinate system, the viewpoint position coordinate is 0.0, pointing in the negative Z direction.
The blocks used for Z sorting use the drawing priority blocks of VDP1 extended processing, so if you want to perform detailed Z sorting, you need to increase the number of drawing priority blocks in the 2D work area definition.
Also, if you want to perform Z sorting, you must set drawPrtyFlag=SPR_2DRAW_PRTY_ON in the SPR_2OpenCommand() routine.


 one
View
table
 Title

function specification

 Function

Acquisition of current 3D environment data

 Function name

SPR_3GetStatus

 No

15

Format
void SPR_3GetStatus(Spr3dStatus *spr3dStatus)
input
none
output
spr3dStatus: Pointer to 3D environment data table
function value
none
function
Get the current 3D environment data.


 one
View
table
 Title

function specification

 Function

Object surface normal vector calculation

 Function name

SPR_3SetSurfNormVect

 No

16

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


 one
View
table
 Title

function specification

 Function

VDP1 high-speed drawing parameter set

 Function name

SPR_3SetDrawSpeed

 No

17

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


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