more work on voxelize

This commit is contained in:
tth
2022-04-03 06:44:24 +02:00
parent 595c6901c9
commit 913452bc81
8 changed files with 183 additions and 11 deletions

32
Fraktalism/vox2inc.awk Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/awk -f
BEGIN {
maxcount = 0
nbrvox = 0
bx = by = bz = 0.0
print "// generated file, don't touch it bastard !"
print "#declare Voxels = object {"
print "union {"
}
$4 > 120 {
count = $4
value = $5
if (count > maxcount)
{ maxcount = count }
nbrvox++;
bx += $1
by += $2
bz += $3
printf "object { VOXEL scale %f translate <%f, %f, %f> } // %d \n", \
value, $1, $2, $3, count
}
END {
print "} } // done, ", NR, " records read"
print "#declare VoxMaxcount = ", maxcount, ";"
print "#declare NbrVox = ", nbrvox, ";"
print "#declare Bary_X = ", bx/nbrvox, ";"
print "#declare Bary_Y = ", by/nbrvox, ";"
print "#declare Bary_Z = ", bz/nbrvox, ";"
}