Code: Select all
virtual void setPosition(irr::f32 x, irr::f32 y, irr::f32 z)
{
RelativeTranslation.X = x;
RelativeTranslation.Y = y;
RelativeTranslation.Z = z;
}
Code: Select all
virtual void setPosition(irr::f32 x, irr::f32 y, irr::f32 z)
{
RelativeTranslation.X = x;
RelativeTranslation.Y = y;
RelativeTranslation.Z = z;
}
Could you please supply a patch file including all changes? It's much easier for others to integrate these changes and test them intensively using a patch.roninmagus wrote:I have, it's more of a suggestion to Niko, maybe for the official release.
Assessing the possible savings in code it's probably like nothing as most objects will be created on the fly. I found this solution useful if there are different default values for the different methods. You could provide them easier in the separated version. But it will mostly come down to zeros so maybe it's just to add default values with the vector3d constructor.niko wrote:Hm, I don't like this. If I start with things like that, the next thing will be that lots of people will want to have overloaded other interfaces which take vectors as parameters with similar ones taking 3 floats. That would be really a mess.
Hm, I don't quite understand what you mean, sorry.hybrid wrote:Is it correct that if the parameters are applied inside the method as a vector they are send as vector, and otherwise as 3 numbers?
If you are referring to my question: I meant something different. So also @niko:buhatkj wrote:the compiler decides based on the parameters which version of the method to use, the one that takes a vector, or the one that takes 3 floats.
I don't think so. Many vector3d are passed by reference thus only one pointer is stored on the stack. But you also have some additional runtime penalty due to the construction and destruction of the objects.keless wrote: the ONLY difference between blah( float x, float y, float z) and blah( vector x) is the syntax you use to get thru it. since a vector is comprised of 3 floats internally the assembly code is still the same.
I read from Niko's first posting that there are sometimes vectors used and sometimes three floats - and I was thinking about the reason which to take at what time. But maybe I got it wrong and Irrlicht always uses the vector?!if you happen to be storing your own positions in separate floats it might be easier you if the syntax were broken up into floats and the conversion was done on the other side, but I know I sure dont and internally in the engine Niko doesnt either. asking niko to break up his clean interface so you dont have to type an extra irr::core::vector3df() (especially when you can simply typedef it to something smaller as pointed out above) is not a good idea.
Code: Select all
mov edx,dword ptr [esi]
lea eax,[esp+40h]
push eax
mov ecx,esi
mov dword ptr [esp+44h],3F8CCCCDh
mov dword ptr [esp+48h],3F99999Ah
mov dword ptr [esp+4Ch],3FA66666h
call dword ptr [edx+6Ch]
Code: Select all
mov eax,dword ptr [esi]
push 3FA66666h
push 3F99999Ah
push 3F8CCCCDh
mov ecx,esi
call dword ptr [eax+68h]