Heightmap to brick converter?


RE: Heightmap to brick converter?
#7
(2018-06-18, 20:14)Jaco van der Molen Wrote: No idea so far how to do that.
Any thoughts. Undecided Huh

If you can somehow generate a lua variable definition with excel.

Then you can do the actual generating of the model in LDCad using a macro. All you would need is the x/z values in an array.

For an 3x3 grid you would need something like this:

Code:
local depthMap={ {0, 1, 2}, {4, 5, 6}, {7, 8, 9} }

You use that in a macro run event like so:

Code:
function renDepthGen()

 local sf=ldc.subfile()
 if not sf:isLinked() then
   ldc.dialog.runMessage('No active session')
   return
 end
 
 local sel=ldc.selection()
 sel:remove()

 local depthMap={
   {0, 1, 2},
   {4, 5, 6},
   {7, 8, 9}
 }
 
 local h=genTools.tableArrayCount(depthMap)
 local w=genTools.tableArrayCount(depthMap[1])
 
 for x=1,w do
   for z=1,h do
     local v=depthMap[z][x]
     
     local v1=v // 3
     local v2=v % 3
   
     local xx=(x-1)*20
     local zz=(z-1)*20
     local yy=0
     
     for b=1,v1  do
       yy=yy-24
       sel:add(sf:addNewRef('3005.dat', 4, ldc.matrix(xx, yy, zz)))      
     end
     
     for p=1,v2 do
       yy=yy-8
       sel:add(sf:addNewRef('3024.dat', 4, ldc.matrix(xx, yy, zz)))
     end
     
   end
 end
end

Which would give you:
   
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: Heightmap to brick converter? - by Roland Melkert - 2018-06-18, 20:56

Forum Jump:


Users browsing this thread: 2 Guest(s)