Of course if you scale up by 2, then your camera movement will also scaled

with 2.

So somehow you must push the model matrix before the scale of the object

on

the stack and pop it back again for the camera translation.

Or am I missing something here?

Now I am very curious.

This is the idea. One thinks of rotation as happening 'naturally' about a

certain point of an object. For example, one thinks of rotating a square

about its center point. Lets call this the rotation point of an object, and

measure it as relative to the upper left hand corner of the smallest

rectangel that can contain it (i.e., relative to what the .NET Framework

thinks is its Left and Top points), and call this [rotate_dx, rotate_dy].

Similarly, if one is scaling in an x of y direction separately, one thinks

of this as happening when the object is in a certain 'rotational

orientation'. For example, we think of a square 'naturally' as its sides

being parallel to the x-axis and y-axis.

Thus, the first thing to do is to decide what the natural orientation for an

object is, and build it this way as your model. Then pick a rotation point

for it.

Ok, here we go. Say the object is to be placed at location (x,y) with

rotation r and scale_x and scale_y. First perform a translation of the

object so its rotation point is at (0,0). That is, move the world (-x,-y)

and then (-rotate_dx, -rotate_dy). We'll call this translate transform T =

(-x-rotate_x, -y-rotate_dy).

Now, as far as other transforms are concerned, the object is located at the

world origin. Now we must scale before we rotate, since we can scale

independently on both x and y directions, and our model is the correct

orientation. So we now apply scaling.

We can now apply rotate since scaling does not move the rotation point

(thats why we put it at world (0,0) since multiplying by anything still

results in (0,0)).

We can now move the object back to its original position, so we applt the

INVERSE of what we defined before as T. Thus, we translate by ( x+rotate_x,

y+rotate_y ). Note that since this is done after the scaling the camera

position is NOT scaled along with the object!!! Finally, we can apply any

additional translation in order to move the object from last position.

Thus the full transform function is as follows:

transform = T(-x-rotate_dx,-y-rotate_dy) S(scale_x,scale_y) R(r)

T(x+rotate_dx, y+rotate_dy) T(dx, Tdy)

applied from left to right, with:

T = translate

R = rotate

S = scale

And there you have it! The trick is moving it to the wrod origin before

scaling and rotating to ease the computations, and to scale before rotating

since scaling can be performed on two axes.

Is that what you were asking? : )

[==P==]