*sigh* I wasn't really thinking clearly when i wrote that :lol: procedure AddToMem says something about what you want to do in it... Original procedure propably did something only C can do, now in pascal you likely need a new approach completely. So.. i think plan is to add 1 vertex to array and same time make preparations so next call will also add 1 after it. Need to make sure the array is resized and update some Count variable, then assign parameter info to vBuffer[Count-1] that is last index.Originally Posted by User137
And about sorting, this is 1 efficient structure:
[pascal]for i:=0 to Count-2 do
for j:=i+1 to Count-1 do
// Compare here and swap if needed
// Notice how it ignores all useless calls, like this way would make final compare to item itself, not to mention amount of extra calls it there wasn't i+1
for i:=0 to Count-1 do
for j:=i+1 to Count-1 do[/pascal]
But still there exist faster ways, i'm not very much familiarized with them and they are propably made for certain kinds of arrays.
Edit: Ok i take my words back a bit, it is all propably possible in pascal too, but this line
Inc(Cloud.vBuffer);
was actually made to increase the pointer (the place that array starts, note you would need to revert it backwards too if want to use it), and likely not by 1, but 12 that is sizeof(TVector3f). Maybe something like (i'm not sure):
pointer(Cloud.vBuffer):=pointer(integer(Cloud.vBuf fer)+12);
Bookmarks