how does clamp work?

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
Paradan
Posts: 16
Joined: Wed May 18, 2011 5:45 pm

how does clamp work?

Post by Paradan »

do you put it in before you assign a value or after?
User avatar
Kjell
Posts: 1924
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Paradan,

It doesn't matter all that much .. but using the function directly when assigning a value is a fraction faster.

Code: Select all

// Indirect
T = App.Time;
T = clamp(T,0,1);

// Direct
T = clamp(App.Time,0,1);
Personally I usually go with what benefits the readability / easy-of-use of my code when the performance difference is marginal.

K
Post Reply