Jump to content

How to correct using timing and vec3?


Aily
 Share

Recommended Posts

In all examples all values are multiply by appspeed() function. So what is faster to calculation:

 

this:


repeat

   turnentity cube1,vec3(0,1*appspeed(),0)
   turnentity cube2,vec3(0,2*appspeed(),0)
   turnentity cube3,vec3(0,3*appspeed(),0)

forever

 

or this:


repeat

   spd#=appspeed()

   turnentity cube1,vec3(0,1*spd,0)
   turnentity cube2,vec3(0,2*spd,0)
   turnentity cube3,vec3(0,3*spd,0)

forever

 

?

 

And that's one, what is better (faster) to using vector constructors:

 

this:


repeat

   turnentity cube,vec3(0,1,0)

forever

 

or this:


global turn_vec:tvec3=vec3(0,1,0)

repeat

   turnentity cube,turn_vec

forever

 

?

"Better" is big enemy of "good"

Link to comment
Share on other sites

Well I expect that the AppTime is calculated only once per update and then cached and it should return the same result per frame, so I think it's the same as performance.

 

Also for the second question I say that it's the same as performance since you're not doing any operations on the Vec3 except the initialization with default values.

 

At the end it's just matter of taste, I'd prefer to instantiate a variable in both cases just because if tomorrow I have to change their value it should be done on a single line and not 3+

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

Well I expect that the AppTime is calculated only once per update and then cached and it should return the same result per frame, so I think it's the same as performance.

 

Also for the second question I say that it's the same as performance since you're not doing any operations on the Vec3 except the initialization with default values.

 

At the end it's just matter of taste, I'd prefer to instantiate a variable in both cases just because if tomorrow I have to change their value it should be done on a single line and not 3+

Thanks man ;)

"Better" is big enemy of "good"

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...