model formats (mca..x3d): comments are specs only
This commit is contained in:
1 parent
0bd7b87d2b
commit
b952c10222
49 files changed
+310
-936
No files matched your search
@@ -1,14 +1,10 @@
|
||||
--!strict
|
||||
--!native
|
||||
-- model/vox/Grid: the voxel loops of the VOX format: XYZI records into a dense grid, and a dense grid back into XYZI
|
||||
-- records. Callers check every range first; nothing here throws.
|
||||
-- model/vox/Grid: XYZI records to and from a dense grid (cell x + sx * (y + sy * z); index 0 = empty). Never throws.
|
||||
local Grid = {}
|
||||
|
||||
local readu8, writeu8 = buffer.readu8, buffer.writeu8
|
||||
|
||||
-- fill(dst, sx, sy, sz, src, off, n) -> skipped: writes n XYZI records (x, y, z, index bytes at src[off ..]) into the
|
||||
-- dense grid dst (cell x + sx * (y + sy * z)); records outside the grid or with index 0 are skipped and counted.
|
||||
-- The caller guarantees off + 4 * n <= buffer.len(src) and buffer.len(dst) >= sx * sy * sz.
|
||||
function Grid.fill(dst: buffer, sx: number, sy: number, sz: number, src: buffer, off: number, n: number): number
|
||||
local skipped = 0
|
||||
local sxy = sx * sy
|
||||
@@ -24,7 +20,6 @@ function Grid.fill(dst: buffer, sx: number, sy: number, sz: number, src: buffer,
|
||||
return skipped
|
||||
end
|
||||
|
||||
-- count(data, cells) -> the number of non-empty cells in data[0, cells)
|
||||
function Grid.count(data: buffer, cells: number): number
|
||||
local n = 0
|
||||
for k = 0, cells - 1 do
|
||||
@@ -35,8 +30,7 @@ function Grid.count(data: buffer, cells: number): number
|
||||
return n
|
||||
end
|
||||
|
||||
-- write(dst, at, data, sx, sy, sz) -> the offset after the last record: one XYZI record per non-empty cell (x fastest).
|
||||
-- The caller sizes dst with count() (sx, sy, sz <= 256).
|
||||
-- one XYZI record per non-empty cell (x fastest; sx, sy, sz <= 256)
|
||||
function Grid.write(dst: buffer, at: number, data: buffer, sx: number, sy: number, sz: number): number
|
||||
local p = at
|
||||
local k = 0
|
||||
|
||||
Reference in new issue
Block a user