SegaXtreme

Today I started making an export script for my favorite free 3D modeling tool blender. It's a python plugin which currently doesn't use any external python modules.

The output looks quite good:

Code:
/* Generated with:

 * SegaSaturn.py - python script for blender to export to SGL format.

 * by The Rockin'-B, [url]http://www.rockin-b.de[/url]

 */

// Exporting 3 objects

// Exporting object...name: Cube, type: Mesh

// Number of vertices: 8

POINT	point_Cube[] = {

	POStoFIXED(1.0, 0.999999940395, -1.0),

	POStoFIXED(1.0, -1.0, -1.0),

	POStoFIXED(-1.00000011921, -0.999999821186, -1.0),

	POStoFIXED(-0.999999642372, 1.00000035763, -1.0),

	POStoFIXED(1.00000047684, 0.999999463558, 1.0),

	POStoFIXED(0.999999344349, -1.00000059605, 1.0),

	POStoFIXED(-1.00000035763, -0.999999642372, 1.0),

	POStoFIXED(-0.999999940395, 1.0, 1.0),

};

// Number of faces: 6

POLYGON	polygon_Cube[] = {

	NORMAL(0.0, 0.0, -1.0), VERTICES( 0, 1, 2, 3)

	NORMAL(0.0, 0.0, 1.0), VERTICES( 4, 7, 6, 5)

	NORMAL(1.0, -2.83122062683e-07, 4.470341608e-08), VERTICES( 0, 4, 5, 1)

	NORMAL(-2.83122062683e-07, -1.0, -1.04308199411e-07), VERTICES( 1, 5, 6, 2)

	NORMAL(-1.0, 2.23517446329e-07, -1.34110436534e-07), VERTICES( 2, 6, 7, 3)

	NORMAL(2.38418579102e-07, 1.0, 2.08616256714e-07), VERTICES( 4, 0, 3, 7)

};

// Number of faces: 6

ATTRIBUTE	attribute_Cube[] = {

	ATTRIBUTE(Single_Plane, SORT_CEN, No_Texture, C_RGB(0, 0, 0), No_Gouraud, CL32KRGB, sprPolygon, No_Option),

	ATTRIBUTE(Single_Plane, SORT_CEN, No_Texture, C_RGB(0, 0, 0), No_Gouraud, CL32KRGB, sprPolygon, No_Option),

	ATTRIBUTE(Single_Plane, SORT_CEN, No_Texture, C_RGB(0, 0, 0), No_Gouraud, CL32KRGB, sprPolygon, No_Option),

	ATTRIBUTE(Single_Plane, SORT_CEN, No_Texture, C_RGB(0, 0, 0), No_Gouraud, CL32KRGB, sprPolygon, No_Option),

	ATTRIBUTE(Single_Plane, SORT_CEN, No_Texture, C_RGB(0, 0, 0), No_Gouraud, CL32KRGB, sprPolygon, No_Option),

	ATTRIBUTE(Single_Plane, SORT_CEN, No_Texture, C_RGB(0, 0, 0), No_Gouraud, CL32KRGB, sprPolygon, No_Option),

};

// Number of vertices: 8

VECTOR	normal_Cube[] = {

	POStoFIXED(0.0, 0.0, 0.0), // ERROR: in writeNMesh_vntbl

	POStoFIXED(0.0, 0.0, 0.0), // ERROR: in writeNMesh_vntbl

	POStoFIXED(0.0, 0.0, 0.0), // ERROR: in writeNMesh_vntbl

	POStoFIXED(0.0, 0.0, 0.0), // ERROR: in writeNMesh_vntbl

	POStoFIXED(0.0, 0.0, 0.0), // ERROR: in writeNMesh_vntbl

	POStoFIXED(0.0, 0.0, 0.0), // ERROR: in writeNMesh_vntbl

	POStoFIXED(0.0, 0.0, 0.0), // ERROR: in writeNMesh_vntbl

	POStoFIXED(0.0, 0.0, 0.0), // ERROR: in writeNMesh_vntbl

};

XPDATA	xpdata_Cube = {

	point_Cube, sizeof(point_Cube)/sizeof(POINT),

	polygon_Cube, sizeof(polygon_Cube)/sizeof(POLYGON),

	attribute_Cube,

	normal_Cube,

};

OBJECT	object_Cube = {

	(PDATA *)xpdata_Cube,

	TRANSLATION(0.285713672638, -0.190474033356, 0.0),

	ROTATION(0.0, 0.0, 0.0),

	SCALING(1.0, 1.0, 1.0),

	NULL,

	NULL,

};

The challenge is to map the Saturn specific display attributes in a smart way. Some attributes are not completely supported yet. So it's still WIP and just for your information.

To those who may ask "Why this?":

It's meant to be a 2nd way besides using 3DEditor.

You can't change geometry in 3DEditor, only material properties. Applying geometry changes must thus be done in a sepertate 3D modeling tool. Then all work done with 3DEditor before is lost.

My texture coordinate mapping stuff could be formed to a commandline tool to even have a 2nd way for the texture mapping precomputation of 3DEditor's tool "Texture List".
Back
Top