Originally Posted By: NeutronBlue
I'm hoping when the engine "sees" an object of scale=1, it bypasses the scaling math - of course it may not work that way and perform the calc anyway.


The check would be already slower than just scale anyway. Here is how the code needed to look like:
Code:
if(fabsf(scale - 1.0f) <= someSmallDelta)
{
   someVarToBeScaled *= scale;
}



It needs a function call in the worst case (although I'm sure that an inlined version of fabsf() is used), it needs a roundtrip to the FPU (to calculate scale - 1.0f) hence the precision problem of floating points one can't just compare both values without false/positives and then you need a conditional jump. And this always, no matter if the scale is 1 or not. Not to mention that fabsf() also needs to check the value (and here comes the second conditional jump) and then do a bit operation on it to negate the value if needed.
Just calculating this always only takes a roundtrip to the ALU which can process a multiplication by 1 extremely fast.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com