SGO

Also Known As: Showcase, Silicon Graphics Object


Type 3D vector
Colors Unlimited
Compression None
Maximum Image Size Unlimited
Multiple Images Per File No
Numerical Format Big-endian
Originator Silicon Graphics
Platform UNIX
Supporting Applications SGI Showcase
See Also SGI Inventor

Usage
Used primarily with Silicon Graphics Showcase.

Comments
A useful format to examine if you are interested in interchange strategies.

Vendor specifications are available for this format.


SGO (Silicon Graphics Object) is a binary format used to store 3D image-rendering information. SGO was originally created for internal use at Silicon Graphics, but is now associated with the Silicon Graphics Showcase application. SGO is used primarily as a way to import 3D models into Showcase, although the SGI Inventor format is generally preferred over SGO as an interchange medium. (See the SGI Inventor article for information about this format.)

Contents:
File Organization
File Details
For Further Information

File Organization

The SGO file format does not have an actual header as most image file formats do. The first two bytes of every SGO file is a magic number value of 5424h. This value identifies the file as being an SGO data file.

Following the magic number is a series of data objects. Each object begins with a data token value indicating the type of data the object stores. Valid data token values are:

01h Quadrilateral List
02h Triangle List
03h Triangle Mesh
04h End Of Data

An SGO data file may contain any number of these objects in any order, except that there is only one End Of Data object per file, and it must appear as the last object stored in the data file. An End Of Data object contains only a token value and no data.

File Details

The SGO Quadrilateral List and SGO Triangle List data objects have the same structure, shown below:

typedef struct _QuadTriListObjects
{
  LONG ObjectToken;          /* Object token identifier */
  LONG DataSize;             /* Size of the data in this object in WORDs */
  struct _Vertex             /* Object vertex structure(s) */
  {
    FLOAT XNormalVector;     /* X axis of the normal vector at the vertex */
    FLOAT YNormalVector;     /* Y axis of the normal vector at the vertex */
    FLOAT ZNormalVector;     /* Z axis of the normal vector at the vertex */
    FLOAT RedVertexComponent;   /* Red color component at the vertex */
    FLOAT GreenVertexComponent; /* Green color component at the vertex */
    FLOAT BlueVertexComponent;  /* Blue color component at the vertex */
    FLOAT XVertex;           /* X axis of the vertex */
    FLOAT YVertex;           /* Y axis of the vertex */
    FLOAT ZVertex;           /* Z axis of the vertex */
  } Vertices[DataSize / 9];
} SGOQUADLIST, SGOTRIANGLIST;

ObjectToken is the object token identification value. This value is 01h for Quadrilateral List objects and 02h for Triangle List objects.

DataSize is the size in WORDs of the data contained within this object. The size of the ObjectToken and DataSize fields are not included in this value.

Each vertex in the object is encoded as an array of one or more 18-byte structures. Each vertex structure contains nine fields of data defining a vertex in the object. The fields in each structure are defined as follows:

XNormalVector, YNormalVector, and ZNormalVector contain the position of the normal vector at this vertex.

RedVertexComponent, GreenVertexComponent, and BlueVertexComponent hold the RGB values for the color of this vertex.

XVertex, YVertex, and ZVertex contain the position of the vertex itself.

The structure of the SGO Triangle Mesh data object is similar to the List objects, but adds a few more fields of information:

typedef struct _TriMeshObject
{
  LONG ObjectToken;          /* Object token identifier */
  LONG DataSize;             /* Size of the data in this object in WORDs */
  LONG VertexSize;           /* Size of the vertex data in WORDs */
  struct _Vertex             /* Object vertex structure(s) */
  {
    FLOAT XNormalVector;     /* X axis of the normal vector at the vertex */
    FLOAT YNormalVector;     /* Y axis of the normal vector at the vertex */
    FLOAT ZNormalVector;     /* Z axis of the normal vector at the vertex */
    FLOAT RedVertexComponent;   /* Red color component at the vertex */
    FLOAT GreenVertexComponent; /* Green color component at the vertex */
    FLOAT BlueVertexComponent;  /* Blue color component at the vertex */
    FLOAT XVertex;           /* X axis of the vertex */
    FLOAT YVertex;           /* Y axis of the vertex */
    FLOAT ZVertex;           /* Z axis of the vertex */
    } Vertices[DataSize / 9];
  struct _MeshControl        /* Mesh Control structure(s) */
  {
    LONG MeshControlId;      /* Mesh Control identifier */
    LONG NumOfIndices;      /* Number of indices stored in the control */
    LONG Indices[NumOfIndices]; /* Index values */
  } Vertices[];
} SGOTRIANGMESH;

ObjectToken is the object token identification value. This value is 03h for Triangle Mesh objects.

DataSize is the size in bytes of the data contained within this object. The size of the ObjectToken and DataSize fields are not included in this value.

VertexSize is the number of WORDs required to store the vertex data in the object.

Each vertex in the object is encoded as an array of one or more 18-byte structures. Each vertex structure contains nine fields of data defining a vertex in the object. The fields in each vertex structure are defined as follows:

XNormalVector, YNormalVector, and ZNormalVector contain the position of the normal vector at this vertex.

RedVertexComponent, GreenVertexComponent, and BlueVertexComponent hold the RGB values for the color of this vertex.

XVertex, YVertex, and ZVertex contain the position of the vertex itself.

Following the vertices array is an array of mesh control structures. These structures hold data that specifies how the vertex data is to be linked together. The fields in each mesh control structure are defined as follows:

MeshControlId is the identifier for the type of mesh control. The valid values for this field are:

01h Begin Triangle Mesh
02h Swap Triangle Mesh
03h End Begin Triangle Mesh
04h End Triangle Mesh

NumOfIndices indicates how many indices are stored in this mesh control. Indices is an array of the index values for this mesh control.

For Further Information

For further information about the SGO file format, see the specification included on the CD-ROM. In addition, see the references in the SGI Inventor article and the following article, available from SGI:

Silicon Graphics, IRIS Showcase User's Guide, Appendix C, "Graphics Library Programming Guide."

Contact:

Silicon Graphics Inc.
Attn: Visual Magic Marketing
2011 North Shoreline Blvd.
Mountain View, CA 94039-7311
Voice: 800-800-4SGI
FTP: ftp://sgi.com/
WWW: http://www.sgi.com/



Copyright © 1996, 1994 O'Reilly & Associates, Inc. All Rights Reserved.