setPosition/setScale/setRotation

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

Thanks guys! :)

@keless: I overloaded an actual engine function and disassambled a real situation. Because otherwise you could get totally different result because the compiler might optimize away and falsify many things.

The function I implemented looks like this (ISceneNode.h):

Code: Select all

virtual void setPosition(f32 x, f32 y, f32 z)
{
	RelativeTranslation.set(x, y, z);
}
This sets the values directly to the target vector without the need of turning it into one before.
It is like it is. And because it is like it is, things are like they are.
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Hm, really interesting. So I was wrong. :)
And it is slower. A little bit. But I don't think that this function is a bottleneck, it would not make any difference changing this. I think if you change all setPosition()-calls in the engine to this, it would not make the engine run faster. So I think the speed argument still doesn't count. :)
Bot_Builder
Posts: 23
Joined: Thu Apr 14, 2005 6:59 pm
Location: Bushland

Post by Bot_Builder »

The speed is just a bonus to the ease added. If you are already using vectors, great it'll be even faster. If you are creating numbers, great you don't have to punch out the vector initializer, and its faster.
ImageXP SP2, AMD Athlon 64 3500+, 1GB HyperX RAM, Radeon X700 Pro (PCI-e), 120GB SATA drive :)
Post Reply