(Sorry, answered same time.)
Well, the compiler will add the same mess and maybe more internally (N-dimensional dynamic array is actually array of arrays, each prime index having different allocation) You would just be in control over it. But sure it may need a little "thinking with indexes" sometimes.
Also it's possible to simplify the indexing with inline functions:
Code:
function TChunk.GetIndex(const x, y, z: integer): integer; inline;
begin
result:=x + (z + y * ChunkDepth) * ChunkWidth; // Hope it went right ...
end;
pBlok:=@pChunk^.blocks[GetIndex(x, y, z)];
Inlining places the code directly to where it's used, so there shouldn't be any parameter "overhead" or what it's called.
Bookmarks