FAQSGL programming related
Back | ■
FAQ / SGL programming related

others



What is the specific usage of slColorCalc?

Q)
Please tell me how to use the slColorCalc function.
And what are the default values if you don't call this function?

A)
This function simply sets the data area to be set in the color operation control register.

VDP2 Manual 12.1 Color calculation The data corresponding to the color calculation control register is set.
If this function is not called, the color calculation is not performed. This is the same as the initial state of hardware.


Does the slLookAt function affect all matrices?

Q)
How burdensome is the internal processing of the slLookAt function?

A)
As the processing time, the current matrix (at the time slLookAt is called. If nothing is done, the environment matrix (the matrix on which the calculation is based) is multiplied by the value of the slLookAt function). Is for one position conversion and one rotation conversion.

As an image, the slLookAt function should be thought of as performing operations such as slTranslate and slRot * once in the current matrix for the camera coordinates.


I want to get a 2D coordinate system with SGL.

Q)
It is stated on page 4-3 of the SGL tutorial that it also holds a 2D coordinate system in addition to the virtual 3D space coordinates. How can I refer to the data in the 2D coordinate system?

A)
Think of the 2D coordinate system as the coordinates (2D) sent to the VDP1 command table.
To see this coordinate data from the user side, use the slConvert3Dto2D function.

If you give the local coordinate data for the current matrix as an argument, the value converted to the 2D coordinate system will be returned.


I want to play CDROM-XA with SGL.

Q)
I want to play a CD-XA file with SGL, but I can't find any material about XA anywhere. How do I actually create a CDROM-XA?

A)
SGL does not have a library to play CDROM-XA, it will use the GNU C version of SBL's PCM / ADPCM playback library. We are checking this library on SGL.


I want to use DGT2 (PP).

Q)
How do I display a 2D sprite using the DGT2 (PP) format file format?

A)
When converting DGT2 data to data for SGL, use DG2TXR.EXE in the SGL package.

This converter supports all modes of DGT2, so the PP format can also be converted.

This tool is located in SATURN \ SGL \ TOOL.


I want to program the model data for each stage to be read each time.

Q)
In a game that uses polygons, I want to read different model data for each stage into a specific address and refer to it. How should I describe it?

A)
It is possible to prepare a file for each model data used in each stage and load it from the CD according to each stage using the overlay technique.

Another method is to prepare only the data part that is different for each stage in a separate section.


I want to cast a shadow.

Q)
I don't know a good way to display the shadow of a player in sports games. Please let me know if there is any good way.

A)
If the player is a 3D polygon, make one model dedicated to shadows. This model does not have to be exactly the same as the original model, it can have as few polygons as possible.
Then display the original model programmatically.
The same current matrix is used to display the shadow model, but the size of the current matrix in the y direction is set to 0. The quickest way to set the size in the y direction to 0 is before displaying the model.

slScale (toFIXED (1.0), toFIXED (0.0), toFIXED (1.0))

Is to do.

The shadow model then becomes a shadow parallel to the y-axis plane. If the ground is not parallel to the y-axis, changing the component given to slScale (specifically, it is related to the normal vector) will give a shadow like that.

You can also play with the matrix directly.
In this case, you can expect the effect of tilting the sun and extending the shadow.

[Shadow calculation method]

1 0 0
slMulFX (slSin (ang), long) 0 slMulFX (slCos (ang), long)
0 0 1

Shadow orientation by changing ang
You can adjust the length of the shadow by changing the long.


I'm not sure how to use slConvert3Dto2D.

Q)
In slConvert3Dto2D, if the X and Y values are too large or the Z value is too small and the display does not fit in the 2D plane, how should the judgment be made?
Also, what does it mean to return a Z value as a function value?

A)
slConvert3Dto2D is a function that uses the current matrix to know where the user-specified 3D coordinates are on the 2D plane, but if the specified 3D coordinates extend beyond the drawing area, the user can make a judgment according to the resolution to be used. Determine on the side.
However, as with all SGLs, the origin is in the center of the screen, so you need to be careful when making a decision. Also note that the 3D coordinate values given are relative coordinates from the coordinate space indicated by the current matrix.
Also, the Zpos that we have as the return value of this function is usually for knowing if we are stuck in Z sort.

In SGL, the screen position is managed by the system variables MsScreenDist and SlScreenDist. Therefore, by using the position where near clipping is applied in combination with the system variable "MsZdpsfcnt", you can find out which coordinates are the boundary values.


Back | ■
FAQSGL programming related
Copyright SEGA ENTERPRISES, LTD ,. 1997