SQ4 file format specification as used for 64k intros made with the SquoQuo intro engine
(c)2k2 by Hopper/SquoQuo
Version: 03/01/06

This file format is used to store 3d scenes. The objects are primitives with modifiers
and animations. This format is a replacement of the SQ3 format of the normal demo engine
especially developed for the intro engine. The corresponding SQ4 exporter plugin for
3DSMax4 is able to export to this format.



//// File format description \\\\
=================================

Each word/short int value is 16bit LSB first

bytes	description
===================
1	number of object blocks (each block contains objects of the same type)
n*x	<blocks>

for each <block>:
=================
WORD	number of objects in block
1	type of object (0=mesh 1=light 2=viewer)
	Each object type may appear just once, i.e. it's not allowed to have 2 blocks each for viewers
n*x	<objects>

for each <object>:
==================
1	subtype of object
	mesh: 	0=dummy (e.g. for grouping) 1=box 2=cylinder 3=cone 4=sphere
	light:	0=point 1=target spot
	viewer:	must be 0
x	name of object (null-terminated string) (if 0 ID/parentID are taken as name (%.4X%.4x))
x	name of texture (if mesh!) (null-terminated string)
WORD	ID
WORD	parentID (0xffff if no parent)
x	object-specific values
	box:		xSize ySize zSize (each short int) tiles (byte)
	cylinder:	radius height (each short int) radiusTiles heightTiles (each byte)
	cone:		radius height (each short int) radiusTiles heightTiles (each byte)
	sphere:		radius (short int) tiles (for radius and height) (byte)
1	number of modifiers
n*x	<modifiers>
1	number of animation types
n*x	<animation types>

for each <modifier>:
====================
1	type of modifier
	0=twist 1=bend 2=skew 3=taper
x	modifier-specific values
	twist:	<Vector> axis <short int> angle
	bend:	<Vector> axis <Vector> direction <short int> angle
	skew:	<Vector> axis <short int> angle
	taper:	<Vector> phase <Vector> period <short int> depth

for each <animation type>:
==========================
1	type of key
	0=translation 1=rotation 2=scale 3=target translation 4=transformation matrix
for transformation:
	row0 row1 rpow2 (each Vector)
else:
WORD	animation keys
n*x	<animation keys>


for each <animation key>:
=========================
WORD	key frame
x	type-specific values
	translation:	<Vector> offset
	rotation:	<Vector> axis <short int> angle
	scale:		<Vector> scale
	target transl.:	<Vector> offset
	
for each <vector>:
==================
SINT	x value
SINT	y value
SINT	z value