Skip to content

Instantly share code, notes, and snippets.

@ToJans
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ToJans/c593a984375b265774f8 to your computer and use it in GitHub Desktop.
Save ToJans/c593a984375b265774f8 to your computer and use it in GitHub Desktop.
let getSupportingWalls veranda =
let boundingBox = {size=Vector3D.zero;center = {x=0M;y=0M;z= -veranda.buildingBlocks.wall.size.depth/2M}}
let walls = veranda.walls
let bricks = veranda.buildingBlocks.wall
let context = Builder.zero
let backWallBlock = bricks.with_a_width_and_height_of walls.middle walls.height
let backWall = context.add a backWallBlock anchoring its Center on the Center boundingBox
if walls.left > 0M then
let leftBlock = bricks.with_a_height_and_depth_of walls.height (walls.left+backWall.boundingBox.size.depth)
context.add a leftBlock anchoring its TopRightBack on the TopLeftBack backWall.boundingBox |> ignore
if walls.right > 0M then
let rightBlock = bricks.with_a_height_and_depth_of walls.height (walls.right+backWall.boundingBox.size.depth)
context.add a rightBlock anchoring its TopLeftBack on the TopRightBack backWall.boundingBox |> ignore
Builder.materialize context
let supportingWallModel left middle right height =
let walls = {middle = middle;right = right;left = left;height = height} * (S appscale)
getSupportingWalls { Veranda.unit with walls = walls }
let supportingwall vec material =
let geometry = CubeGeometry(vec,material)
let mesh = Object3D.mesh geometry
{mesh with castShadow = true; receiveShadow = true}
let oldsupportingWallModel left middle right height =
let wallThickness = 3000M
let lmm,mmm,rmm,hmm = left * appscale,middle* appscale,right* appscale ,height * appscale
let m1 = Vector3D.fromDecimal wallThickness hmm lmm
let m2 = Vector3D.fromDecimal mmm hmm wallThickness
let m3 = Vector3D.fromDecimal wallThickness hmm rmm
let xoffset = (m2.x+wallThickness)/2M
let yoffset = hmm/2M
let zoffsetleft = m1.z/2M
let zoffsetright = m3.z/2M
let negHalfWallThickness = -(wallThickness/2M)
let wl = {supportingwall m1 Brick with position = Vector3D.fromDecimal (-xoffset) yoffset zoffsetleft }
let wm = {supportingwall m2 Brick with position = Vector3D.fromDecimal 0M yoffset negHalfWallThickness }
let wr = {supportingwall m3 Brick with position = Vector3D.fromDecimal xoffset yoffset zoffsetright }
let meshes = [wl;wm;wr] |> List.zip [left;middle;right] |> List.filter (fun(s,_) -> s>0M) |> List.map(fun (_,m) -> m)
//let ground = getGround <| Vector3D.fromDecimal 100000M 0M 100000M
//([ground] @ meshes |> Object3D.objects) - (DY eyeHeight)
(Object3D.objects meshes) - (eyeHeight + Veranda.unit.buildingBlocks.outsideFloor.size.height |> DY)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment