Hi,

Im still trying to find out why my version is a lot slower than the C++ version, although i have a few ideas of my own to speed it up. but for now i wish to confirm that my C++ conversion is urm correct.. the main parts i am unsure about are the following:

from:
Code:
inline float __fastcall carmack_func(float x)
{
	int carmack;
	float isx, halfx;	//Inverse Squareroot of x

	halfx = 0.5f*x;
	carmack = *(int*)&x; 
	carmack = 0x5f3759df - (carmack>>1); 
	isx = *(float*)&carmack; 

	isx = isx*(1.5f-halfx*isx*isx);  //Newton-Rhapson step, add more for accuracy

	return isx;
}
to:
[pascal]
function carmack_func(x: Single): Single;
var
carmack: Integer;
isx,halfx: Single;
begin
halfx := 0.5*x;
carmack := Round(x);
If carmack > 1 Then
carmack := $5f3759df-(carmack) Else
carmack := $5f3759df-(1);
isx := carmack;
isx := isx*(1.5-halfx*isx*isx);
Result := isx;
end;
[/pascal]

the above im sure is wrong, because i really did'nt have a clue about parts of the code and could'nt find any resources.

from:
Code:
		*(vp++) = Puff->Position + Corner1 * Puff->Size;
		*(tp++) = v1;
		*(cp++) = ParticleColor;
to:
[pascal]
Cloud.vBuffer[j] := Vector3fMake(Cloud.Puffs[i].Position[0]+Corner1[0]*Cloud.Puffs[i].Size,
Cloud.Puffs[i].Position[1]+Corner1[1]*Cloud.Puffs[i].Size,
Cloud.Puffs[i].Position[2]+Corner1[2]*Cloud.Puffs[i].Size);
Cloud.tBuffer[j] := v1;
Cloud.cBuffer[j] := ParticleColor;
Inc(j);
[/pascal]

now im fairly confident in assuming this is going through the array's setting the values?!

and another question, is having the records/classes as a pointer quicker?

e.g.

vBuffer: Array Of TVector3f;
..
for j := 0 to 2500 do vBuffer[i] := Vector3fMake(0,0,0);

Many thanks
Nic