SGL User's ManualData transfer
Back | ■
Data transfer

4. Data structure


In this chapter, we will explain the model data handled by Sega Saturn, the specifications of material names, and the structure of texture data.

4-1. Model data specifications

The model data here refers to a set of three data: point data of three-dimensional coordinates (x, y, x), polygon data formed by four of them, and attribute data representing the attributes of the polygon. increase.
The general format when the model name is assumed to be "label" is shown below.

Point data


POINT point_label [] = {   
      POStoFIXED (x, y, z),
      POStoFIXED (x, y, z),
      POStoFIXED (x, y, z),
      POStoFIXED (x, y, z),
           .............
      };                
	
POINT: Point data  x, y, z: Float type coordinate values

It is an index of 0, 1, 2, and 3 point data in order from the top.

Polygon data


POLYGON polygon_label [] = {
     NORMAL (x, y, z),      
     VERTICES (0,1,2,3),  
                         
     NORMAL (x, y, z),      
     VERTICES (0,1,2,3),  
          .............  
    };                   
	
NORMAL: normal vector  x, y, z: Float type coordinate values  VERTICES: Point data of 4 points forming a polygon

In the case of a triangular polygon, the last one point is repeated to obtain four points of polygon data.

Example) In the case of a quadrilateral polygon
VERTICES (0,1,2,3)

Example) In the case of a triangular polygon
VERTICES (0,1,2,2)

Attribute data


ATTR attribute_label = [] = {                                           
        ATTRIBUTE (Plane, Sort, Texture, Color, Gouraud, Mode, Dir, Option),
         ....... .... ..... ... ... ..... ... .....          
                                                                    
        };                                                          
	
ATTR: Attribute  Plane: Attribute of whether or not there is backside judgment Sort: Representative point of Z sort  Texture: Texture name (No.)  Color: Color data  Gouraud: Gouraud shading attribute Mode: Drawing mode  Dir: Polygon and texture state Option: Options and other features 

The attribute has the above eight parameters. Here, the symbols that should actually be output for each parameter and their contents are described.

[Plane]
Single_Plane: With backside judgment
Dual_Plane: No backside judgment

[Sort]
SORT_MIN: Recent points
SORT_CEN: Center point
SORT_MAX: Farthest point
SORT_BFR: Displayed in front of the polygon registered immediately before

[Texture]
No_Texture: For polygons
Texture name: For texture (macro showing texture data)

For details, refer to “ Section 4-3 : Texture Data Specifications”.

[Color]
No_Palet: For texture
C_RGB (r, g, b: Color data for polygons
r, g, and b each represent the three primary colors and contain decimal values from 0 to 31.

[Gouraud]
No_Gouraud: No Gouraud
Address: Relative address of Gouraud shading table

[Mode]
group macro Contents
[1] No_Window Unrestricted in Window (default)
Window_In Display inside the Window
Window_Out Display outside the window
[2] MESHoff Normal display (default)
MESHon Display as a mesh
[3] ECdis Disable End Code
ECenb Enable End Code (default)
[4] SPdis Also show transparent pixels (default)
SPenb Do not show transparent pixels
[5] CL16Bnk 16-color color bank mode (default)
CL16Look 16-color look-up table mode
CL64Bnk 64 color color bank mode
CL128Bnk 128 color color bank mode
CL256Bnk 256 color color bank mode
CL32KRGB 32768 color RGB mode
[6] CL_Replace Overwrite (standard) mode (default)
CL_Shadow Shadow mode
CL_Half Semi-brightness mode
CL_Trans Semi-transparent mode
CL_Gouraud Gouraud shading mode

[Dir]
macro Contents
sprNoflip Display textures normally
sprHflip Flip the texture left and right
sprVflip Flip the texture upside down
sprHVflip Flip the texture up / down / left / right
sprPorygon Show polygons
sprPolyLine Show polyline
sprLine Display a straight line using the first two points

[Option]
macro Contents
UseLight Perform light source calculation
UseClip Do not display when the vertices go off the screen
UsePalette Indicates that the polygon color is in palette format

Of the above parameters, Plane , Sort , and Mode can be obtained by specifying the material name in the next section.

PDATA structure


PDATA pdata_label [] = {   
       point_label, n1,  
       polygon_label, n2,
       attribute_label  
      };                
	
pdata_label: Indicates the PDATA type address to be passed to SGL. point_label: Indicates a POINT type address.  nl: Indicates the number of points.  polygon_label: Indicates a POLYGON type address.  n2: Indicates the number of polygons.  attribute_label: Indicates an ATTR type address. 

OBJECT structure


OBJECT object_label [] = {   
       pdata_label,       
       TRANSLATION (x, y, z),
       ROTATION (x, y, z),   
       SCALING (x, y, z),    
       object_child,      
       object_sibling,    

pdata_label: Indicates a PDATA type address.  TRANSLATION: Indicates the amount of movement.  ROTATION: Indicates the amount of rotation.  SCALING: Indicates the amount of enlargement.  object_child: Indicates the OBJECT type address of the child. object_sibling: Indicates the OBJECT type address of siblings.

See the “design 3” sample source for how to use this structure.

4-2. Material name specifications

The material name has a meaning for each character. The contents will be reflected in the attribute data as it is. The specifications are shown below.

Generally, it is as follows.
[Plane] [Sort] [Mesh] ([] contains one character, and the material name is represented by three characters, for example, "SSN".)

The attributes of each character are

[Plane]
S: Single_Plane
D: Dual_Plane

[Sort]
N: SORT_MIN
C: SORT_CEN
F: SORT_MAX
B: SORT_BFR

[Mesh]
O: MESHon
N: MESHoff

Example) If the material name is "SCN", the attribute data will be

ATTRIBUTE (Single_Plane, SORT_CEN, No_Texture, C_RGB (r, g, b), No_Gouraud, MESHoff, sprNoflip, NoOption)

It will be.

4-3. Texture data specifications

This is the data needed only for textures. The texture name in “Texture” of the attribute data is based on this data.

If the DGT file used as the texture is "sample.dgt",


TEXDAT sample [] = {                      
        rgb, rgb, rgb, rgb, rgb, rgb, rgb, rgb
        rgb, rgb, rgb, rgb, rgb, rgb, rgb, rgb
        .............................  
        };                             

TEXTB: Texture table  sample: Indicates a label with texture data (file name as it is) hsize, vsize: The size of the texture (hsize is always a multiple of 8)  bgr: 1 pixel of texture data 

In addition, each of the three primary colors is represented by a value of 0 to 31 in 5 bits.
The data format is as follows.

B G R
1 Four 3 2 1 0 Four 3 2 1 0 Four 3 2 1 0

Example) Suppose that the graphic data file sample.dgt has the texture of 8x2 size white and black checkers as shown in the figure below.

Figure 4-1 Checkered texture

Then the texture data for this texture will be as follows.


TEXDAT sample [] = {                                               
        0xffff, 0x8000, 0xffff, 0x8000, 0xffff, 0x8000, 0xffff, 0x8000,
        0x8000,0xffff, 0x8000,0xffff, 0x8000,0xffff, 0x8000,0xffff 
        };                                                      
	

The attribute data of the polygon with the material name "SCN" to which this texture is pasted is

ATTRIBUTE (Single_Plane, SORT_CEN, SAMPLE, No_Palet, No_Gouraud, MESHoff, SprNoflip, NoOption)

It will be.

caution
For textures, the H size must be a multiple of 8. This is a limitation due to Satan's hardware specifications.


Back | ■
SGL User's ManualData transfer
Copyright SEGA ENTERPRISES, LTD., 1997