Last active
August 29, 2015 13:57
-
-
Save ToJans/9645088 to your computer and use it in GitHub Desktop.
Odd error: pilar is a Mesh, and I want to change some fields, so I use the with-syntax. On the last line I get this error:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Error 1 This expression was expected to have type | |
unit | |
but here has type | |
Mesh C:\dev\.Net\arealities\Arealities.Models\Veranda.fs 17 11 Arealities.Models |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Arealities.Models.Veranda | |
let windowWall(width:decimal, height:decimal, maxWidth: decimal , beamThickness:decimal) = | |
let pilar = { geometry = CubeGeometry(Size(beamThickness,height, beamThickness)); | |
position = Position(0M,0M,0M); | |
rotation = Rotation(0M,0M,0M); | |
material = ShinyStuff; | |
castsShadows = true; | |
receivesShadow = false; | |
} | |
let panelCount = (width - beamThickness)/maxWidth |> System.Math.Ceiling |> int | |
let spaceBetweenBeams = (width-beamThickness) / decimal(panelCount) - beamThickness | |
let halfWidth = width/2M | |
let halfHeight = height/2M | |
[1..panelCount] |> List.iter(fun i -> | |
let x = decimal(i-1)*(spaceBetweenBeams+beamThickness)-halfWidth; | |
{ pilar with position = Position(x, halfHeight, 0) }) | |
let veranda(Size(x,y,z)) = | |
let beamSize = 1 | |
let panelDepth = 0.5 | |
let maxPanelWidth = 12 | |
windowWall(1M,1M,1M,1M) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Arealities.Models | |
type Size = Size of decimal * decimal * decimal | |
type Position = Position of decimal * decimal * decimal | |
type Rotation = Rotation of decimal * decimal * decimal | |
type Direction = Direction of decimal * decimal * decimal | |
type Intensity = float | |
type Color = Color of Intensity * Intensity * Intensity | |
type Material = Ground | Floor | ShinyStuff | Wall | |
type Geometry = CubeGeometry of Size | |
type Mesh = { | |
geometry : Geometry; | |
material : Material; | |
position : Position; | |
rotation : Rotation; | |
castsShadows: bool; | |
receivesShadow: bool | |
} | |
type Object3D = Object3D of Mesh list * Position * Rotation | |
type Light = | |
| AmbientLight of Color | |
| DirectionalLight of Color * Intensity * Direction | |
type Camera = Camera of Position * Direction | |
type SceneObject = | |
| Light | |
| Object3D | |
| Camera | |
type Scene = Scene of SceneObject list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
doh;
map
, notiter