1. Model your objects in N-Geometry.
2. Create materials in the Attributes Editor.
4. Redisplay your 3D object in N·World in real time, using the SGI GL Shade hardware renderer.
1. Open a UNIX shell and type in the following command.
unix%capture &
3. Change the Default In: parameter to Analog Source.
2. In the GeoMenus, (CLICK-L) on New Object>mapper.
3. In the GeoMenus, (CLICK-L) on Shading, then select your object from the menu which appears.
Figure 2.3 Toggling shading for Geometry objects
4. Open the Browser, then (CLICK-L) on the Geo button.
5. In the Browser, (CLICK-R) over your object.
Figure 2.5 The Browser Operations menu for sphere6. (CLICK-L) on Assign Mapper.
7. Open the Attributes Editor.
8. (CLICK-L) on New to create a new material.
Figure 2.8 Creating a new material Figure 2.9 Sega render domain attributes editor menu9. (CLICK-L) on the Sega button.
11. (CLICK-L) on the Texture Map field, and select the following texture map file:
/usr/local/ngc/presets/maps/Green_snake_B.tpx
14. (CLICK-R) on the Mapper field, then (CLICK-L) on the Spherical mapper you created in step 2.
15. In the Attributes Editor, (CLICK-L) on Redisplay.
1. (Click-L) on Export in the GeoMenu.
2. Choose the object you want to export from the object list that appears.
3. Choose Sega SGL from the Choose Export Format pop-up menu.
Figure 2.14 The Choose Export format pop-up menu
5. (Click-L) on Write Object File.
1. Copy the following files into the directory where you want to compile the files:
/usr/local/ngc/plugin/sega/Makefile
/usr/local/ngc/plugin/sega/nichimen.lnk
ln -s /usr/local/bin/sh-hms-ld ld
ln -s /usr/local/bin/sh-hms-ar ar
ln -s /usr/local/bin/sh-hms-as as
SRCS = octahedron-main.c octahedron-polygon.c octahedron-texture.c
set path=($path /usr/local/bin)
make
nichimen.cof
POINT point_cube[] = {
POStoFIXED(-15.0,-15.0,-15.0),
POStoFIXED(-15.0,-15.0, 15.0),
POStoFIXED(-15.0, 15.0,-15.0),
POStoFIXED(-15.0, 15.0, 15.0),
POStoFIXED( 15.0,-15.0,-15.0),
POStoFIXED( 15.0,-15.0, 15.0),
POStoFIXED( 15.0, 15.0,-15.0),
POStoFIXED( 15.0, 15.0, 15.0),
Write face normal in xyz coordinates and face definition list in vertex numbers:};
POLYGON polygon_cube[] = {
NORMAL(-1.0, 0.0, 0.0), VERTICES(0,1,3,2),
NORMAL( 0.0, 0.0, 1.0), VERTICES(1,5,7,3),
NORMAL( 1.0, 0.0, 0.0), VERTICES(5,4,6,7),
NORMAL( 0.0, 0.0,-1.0), VERTICES(4,0,2,6),
NORMAL( 0.0,-1.0, 0.0), VERTICES(4,5,1,0),
NORMAL( 0.0, 1.0, 0.0), VERTICES(2,3,7,6),
Write out face attribute list.};
ATTR attribute_cube[] = {
ATTRIBUTE(Single_Plane,SORT_MIN,No_Texture,C_RGB(31,31,00),
No_Gouraud,MESHoff,sprPolygon,UseLight),
ATTRIBUTE(Single_Plane,SORT_MIN,No_Texture,C_RGB(31,00,00),
No_Gouraud,MESHoff,sprPolygon,UseLight),
ATTRIBUTE(Single_Plane,SORT_MIN,No_Texture,C_RGB(00,31,00),
No_Gouraud,MESHoff,sprPolygon,UseLight),
ATTRIBUTE(Single_Plane,SORT_MIN,No_Texture,C_RGB(00,00,31),
No_Gouraud,MESHoff,sprPolygon,UseLight),
ATTRIBUTE(Single_Plane,SORT_MIN,No_Texture,C_RGB(31,00,31),
No_Gouraud,MESHoff,sprPolygon,UseLight),
ATTRIBUTE(Single_Plane,SORT_MIN,No_Texture,C_RGB(00,31,31),
No_Gouraud,MESHoff,sprPolygon,UseLight),
Write out object structure. Include the point list, face list, and attribute list:};
PDATA PD_cube = {
point_cube,sizeof(point_cube)/sizeof(POINT),
polygon_cube,sizeof(polygon_cube)/sizeof(POLYGON),
attribute_cube
};
#include "sgl.h"
#define PN_SONIC 0
#define PN_AM2 1
POINT point_plane[] = {
POStoFIXED(-40.0 , -40.0 , 0.0) ,
POStoFIXED( 40.0 , -40.0 , 0.0) ,
POStoFIXED( 40.0 , 40.0 , 0.0) ,
POStoFIXED(-40.0 , 40.0 , 0.0)
};
POLYGON polygon_plane[] = {
NORMAL(0.0,0.0,1.0), VERTICES(0 , 1 , 2 , 3)
};
ATTR attribute_plane[] = {
ATTRIBUTE(Single_Plane, SORT_CEN, PN_SONIC, No_Palet, No_Gouraud, CL32KRGB|MESHoff, sprNoflip, No_Option),
};
PDATA PD_PLANE = {
point_plane , sizeof(point_plane)/sizeof(POINT),
polygon_plane, sizeof(polygon_plane)/sizeof(POLYGON),
attribute_plane
};
#include "sgl.h"
TEXDAT sonic_64x64[]={
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffdd, 0xfb7b,
0xe292, 0xcd8c, 0xcd8c, 0xd569, 0xd569, 0xd569, 0xd569, 0xddee,
.
.
.
TEXDAT am2_64x32[]={
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
0xffff, 0xffff, 0xffff, 0xffff, 0x8000, 0x8000, 0x8000, 0x8000,
0x8000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
.
.
.
TEXTURE tex_sample[]={
TEXDEF(64,64,0),
TEXDEF(64,32,64*64*1),
};
PICTURE pic_sample[]={
PICDEF(0,COL_32K,sonic_64x64),
PICDEF(1,COL_32K,am2_64x32),
};
#include "sgl.h"
#define GRaddr 0xe000
static POINT point_cube[] = {
POStoFIXED(-20.0 , -20.0 , 20.0) ,
POStoFIXED( 20.0 , -20.0 , 20.0) ,
POStoFIXED( 20.0 , 20.0 , 20.0) ,
POStoFIXED(-20.0 , 20.0 , 20.0) ,
POStoFIXED(-20.0 , -20.0 , -20.0) ,
POStoFIXED( 20.0 , -20.0 , -20.0) ,
POStoFIXED( 20.0 , 20.0 , -20.0) ,
POStoFIXED(-20.0 , 20.0 , -20.0)
};
static POLYGON polygon_cube[] = {
NORMAL( 0.0 , 0.0 , 1.0), VERTICES(0 , 1 , 2 , 3),
NORMAL(-1.0 , 0.0 , 0.0), VERTICES(4 , 0 , 3 , 7),
NORMAL( 0.0 , 0.0 ,-1.0), VERTICES(5 , 4 , 7 , 6),
NORMAL( 1.0 , 0.0 , 0.0), VERTICES(1 , 5 , 6 , 2),
NORMAL( 0.0 ,-1.0 , 0.0), VERTICES(4 , 5 , 1 , 0),
NORMAL( 0.0 , 1.0 , 0.0), VERTICES(3 , 2 , 6 , 7)
};
static ATTR attribute_cube[] = {
ATTRIBUTE(Single_Plane, SORT_MIN, No_Texture, C_RGB(31,16,31), GRaddr, MESHoff|CL_Gouraud, sprPolygon,No_Option),
ATTRIBUTE(Single_Plane, SORT_MIN, No_Texture, C_RGB(31,16,31), GRaddr+1, MESHoff|CL_Gouraud, sprPolygon,No_Option),
ATTRIBUTE(Single_Plane, SORT_MIN, No_Texture, C_RGB(31,16,31), GRaddr+2, MESHoff|CL_Gouraud, sprPolygon,No_Option),
ATTRIBUTE(Single_Plane, SORT_MIN, No_Texture, C_RGB(31,16,31), GRaddr+3, MESHoff|CL_Gouraud, sprPolygon,No_Option),
ATTRIBUTE(Single_Plane, SORT_MIN, No_Texture, C_RGB(31,16,31), GRaddr+4, MESHoff|CL_Gouraud, sprPolygon,No_Option),
ATTRIBUTE(Single_Plane, SORT_MIN, No_Texture, C_RGB(31,16,31), GRaddr+5, MESHoff|CL_Gouraud, sprPolygon,No_Option),
};
PDATA PD_cube = {
point_cube , sizeof(point_cube)/sizeof(POINT),
polygon_cube , sizeof(polygon_cube)/sizeof(POLYGON) ,
attribute_cube
};
Copyright © 1996, Nichimen Graphics Corporation. All rights reserved.