Originally Posted by
M109uk
Ah sorry, i forgot to post that bit
ops:
type
PVector2f = ^TVector2f;
PVector3f = ^TVector3f;
PVector4f = ^TVector4f;
TVolumetricCloud = Class
//
vBuffer: PVector3f;
tBuffer: PVector2f;
cBuffer: PVector4f;
IcBuffer: PVector4f;
end;
Thanks
Okay, this is the problem and is my fault. What you need is this type for the buffers:
Code:
type
TVector3fArray = array of Vector3f;
PVector3fArray = ^TVector3fArray;
//...
TVolumetricCloud = Class
vBuffer: PVector3fArray;
//...
end;
//..
//OnCreate...
var cur: PVector3f;
counter: Integer;
begin
GetMem(vBuffer, SizeOf(TVector3f) * Length(Puffs));
cur := Pointer(vBuffer^[0]);
counter := Length(Puffs);
while counter > 0 do begin
// Manipulation here...
Inc(Cur);
Dec(Counter);
end;
end;
You should understand how to expand upon this by now, but I'll give you the basics. Sometimes pointers really aren't worth it--especially for arrays. Now, you could do a single/double linked list, but there would be no increase in speed to set the vertex buffer that way (the API's are C and want arrays...).
Bookmarks