TIE Format Document
--------------------


TIE Instances
----------------

The instances are arranged into a BVH like with tfrag.
The visibility bit strings work exactly the same way too.

The "origin" matrix stores 16-bits per entry.
The final row is set with (x << 16) >> 10 and vitof0
The other rows are set with (x << 16) >> 16 and vitof12
row0's w is set to 0 manually.


There are 64 winds. The wind index of an instance is (wind-index + wind-time) & 0b111111. The wind time is stored in *wind-work*.
This indexes into the wind-vectors in the proxy-prototype-array-tie of the drawable-tree-instance-tie.
(and also the wind-vectors of *wind-work*, but this isn't known yet)


The flags mean:
0b01 : Do not generate instance DMA, in all conditions. Likely rare because it's checked pretty late.
0b10 : Use the GENERIC renderer.

DMA in work:
 work.upload-color-0.addr = output_ptr
 work.generic-color-0.addr = output_ptr


calculation of clipped w:
  multiply bsphere by camera matrix
  add hvdf_offset.w to w
  clamp to within (hmge-d.x hmdge-d.y)

calculation of total camera matrix:
vf10+ is origin, vf20+ is the SHRUB MATRIX!!!

vmulax.xyzw acc, vf20, vf10
vmadday.xyzw acc, vf21, vf10
vmaddz.xyzw vf10, vf22, vf10
vmulax.xyzw acc, vf20, vf11
vmadday.xyzw acc, vf21, vf11
vmaddz.xyzw vf11, vf22, vf11
vmulax.xyzw acc, vf20, vf12
vmadday.xyzw acc, vf21, vf12
vmaddz.xyzw vf12, vf22, vf12
vmulax.xyzw acc, vf20, vf13
vmadday.xyzw acc, vf21, vf13
vmaddaz.xyzw acc, vf22, vf13
vmaddw.xyzw vf13, vf23, vf0 

Out data (6 qw = 96 bytes):
 0-64 : matrix.
 64 : morph constants
 80 : [flags & 2, clipping/dists, 0, clipped_w]

Next are 3x "color" tags.
The final one will link to the "next" instance in the proto bucket
For the final instance in the bucket, it will be a ret.

96: color0

