Last active
August 29, 2015 13:57
-
-
Save ToJans/9642833 to your computer and use it in GitHub Desktop.
Try describing this in C#
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 LightIntensity = float | |
type Material = Ground | Floor | ShinyStuff | Wall | |
type Geometry = CubeGeometry of Size | |
type Color = Color of float * float * float | |
type Mesh = { | |
geometry : Geometry; | |
material : Material; | |
position : Position; | |
rotation : Rotation; | |
castsShadows: bool; | |
receivesShadow: bool | |
} | |
type Object3D = | |
| Object3D of Mesh list | |
| Mesh | |
type Light = | |
| AmbientLight of Color | |
| DirectionalLight of Color * LightIntensity * Direction | |
type Camera = Camera of Position * Direction | |
type SceneObject = | |
| Light | |
| Object3D | |
| Camera | |
type Scene = Scene of SceneObject list |
I'll take a look at records; thanks for the tip!
adjusted!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
maybe you can use a record for Mesh instead of a discriminated union ?