A little explanation about space warping in Crystal Space and how
the space warping matrix/vector should be given.


Crystal Space always works with 3x3 matrices and one 3-vector to represent 
transformations. Let's say that the camera is given as Mc and Vc (camera matrix 
and camera vector). 

When going through a warping portal (mirror for example) there is also a 
warping matrix and two vectors: Mw, Vw1 and Vw2.  Vw1 is the vector that is
applied before Mw and Vw2 is applied after Mw.
The warping transformation is a transformation in world space. For example. 
If you have the following sector: 

        A 
    +---------+              z 
    |         |              ^ 
    |         |              | 
  D |    o    | B            o-->x 
    |         | 
    |         | 
    +---------+ 
        C 

With o at (0,0,0) and the B side a mirror. Let's say that B is 2 units 
to the right of o. The warping matrix/vector would then be: 

        /-1 0 0 \          / 2 \           / 2 \
  Mw =  | 0 1 0 |    Vw1 = | 0 |     Vw2 = | 0 |
        \ 0 0 1 /          \ 0 /           \ 0 /

(The mirror swaps x). 

How is this transformation then used? 

To know how this works we should understand that Mc and Vc (the camera 
transformation) is a transformation from world space to camera space. 
Since the warping transformation is in world space we first have to
apply Mw/Vw before Mc/Vc.

So we want to make a new camera transformation matrix/vector that
we are then going to use for the recursive rendering of the sector
behind the mirror. Let's call this Mc' and Vc'.

The camera transformation is used like this in Crystal Space:

	C = Mc * (W - Vc)		(1)

with C the camera space coordinates and W the world space coordinates.

But first we want to transform world space using the warping
transformation:

	W' = Mw * (W - Vw1) + Vw2	(2)

It is important to realize that the Mw/Vwx transformation is used
a little differently here. The Vw1 vector is used to translate to
the warping polygon first and Vw2 is used to go back when the matrix
Mw has done its work. This is just how Crystal Space does it. One could
use other matrices/vectors to express the warping transformations.

Combining equations (1) and (2) (but replacing W by W' in (1))
gives:

	C = Mc * (Mw * (W - Vw1) + Vw2 - Vc)
	C = Mc * Mw * ((W - Vw1) - 1/Mw * (Vc - Vw2))
	C = Mc * Mw * (W - (Vw1 + 1/Mw * (Vc - Vw2)))

And this is the new camera transformation:

	Mc' = Mc * Mw
	Vc' = Vw1 + 1/Mw * (Vc - Vw2)

In summary: the warping transformation works by first transforming
world space to a new warped world space. The new camera transformation
is made by combining the warping transformation with the old camera
transformation.

