Skip to content

Instantly share code, notes, and snippets.

@ToJans
Last active August 29, 2015 13:57
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/9642833 to your computer and use it in GitHub Desktop.
Save ToJans/9642833 to your computer and use it in GitHub Desktop.
Try describing this in C#
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
@thinkbeforecoding
Copy link

maybe you can use a record for Mesh instead of a discriminated union ?

@ToJans
Copy link
Author

ToJans commented Mar 19, 2014

I'll take a look at records; thanks for the tip!

@ToJans
Copy link
Author

ToJans commented Mar 19, 2014

adjusted!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment