Actually I meen "scale", "translate" it's different tool and is work well with just applying inverse matrix as you said to direction in wich I calculate in global space. It working because for translation I need only one axis (or direction in which I need move vertices) so I don't have some "non-uniformity".
Things bellow I tested without dividing scaling on gobal and model as been on this firt reddit post
, so model transform looks like
m4x4 ModelTrans = Model->ScaleMat * Model->Axis;
Also applying scaling to face that scale only on basis vector (1, 0, 0) (0, 1, 0) (0, 0, 1) also work well (example
). Here I already need apply scale matrix but in this case I just need move global basis to model space and I don't need to know current state of model scale because it already in "model space" for this case.
(I use row-mojor matrix so it's from left to right)
m4x4 InvRot = Transpose(Model->Axis);
m4x4 Scale = ScaleMat(ScaleV);
ResultScale = Model->Axis * Scale * InvRot;
ScaleV is just represent magnitude of scaling for some axis, for example scale by X axis wiil look like (1.1f, 1.0f, 1.0f) for example.
But when I need perform scale in arbitrary direction (as I said in post doing this on face of model just for example) I need perform full inverse transform so that after applying Model->ScaleMat vertices will be place in expeted position. In solution that you suggest it should looks like this?(maybe I wrong)
In this case vertices completely "go crazy"
m4x4 ScaleAxis = ScaleMat(ScaleV) * ToM4x4(Tool->Axis);
ResultScale = ScaleAxis * InvRot * InvScale;
Result that looks more like closely for what I need but is also produces incorrect result (example
m4x4 ScaleAxis = ToM4x4(Tool->Axis) * InvRot;
m4x4 InvScaleAxis = Transpose(ScaleAxis);
m4x4 Scale = ScaleAxis * ScaleMat(ScaleV) * InvScaleAxis;
ResultScale = ResultScale * InvScale;
If not looking that scale happen in not adequate speed, rotation happaning from my understanding because after apply InvScale
transform, vectors in scale matrix not anymore orhogonal as I demonstrate on screen shot on reddit post.
Sorry for long replying I have a little time in the evening for test and to think carefully about this