le-michael / ElmJrMetalEdition

2 stars 0 forks source link

3d example for interpreter #100

Closed WyattWismer closed 3 years ago

WyattWismer commented 3 years ago

This changes introduces a simple system for loading elm files. That means I can load each one of the library files directly instead of throwing everything into one massive elm test case file.

Note @Necried I had to make some changes (mostly commenting things out) to get things to parse. Let me know if anything is weird.

With this change we can interpret the snowman example which we want for the Tuesday meeting. It becomes this thing:

(SceneWithTime (ArcballCamera 5 (0, -1, 0) Nothing Nothing) [(DirectionalLight (RGB 0.6 0.6 0.6) (1, 2, 2) (RGB 0.1 0.1 0.1)), (AmbientLight (RGB 1 1 1) 0.5)] (\time -> [(ApTransform (Scale (0.5, 0.5, 0.5)) (ApTransform (Translate (0, 2.25, 0)) (Inked (Just (RGBA 1 1 1 1)) Sphere))), (ApTransform (Scale (0.75, 0.75, 0.75)) (ApTransform (Translate (0, 1.25, 0)) (Inked (Just (RGBA 1 1 1 1)) Sphere))), (Inked (Just (RGBA 1 1 1 1)) Sphere), (ApTransform (Translate (-0.3, 2.25, 0.45)) (ApTransform (Scale (0.075, 0.075, 0.075)) (Inked (Just (RGBA 0 0 0 1)) Sphere))), (ApTransform (Translate (0.3, 2.25, 0.45)) (ApTransform (Scale (0.075, 0.075, 0.075)) (Inked (Just (RGBA 0 0 0 1)) Sphere))), (ApTransform (Translate (0, 2.15, 0.5)) (ApTransform (Scale (0.1, 0.1, 0.1)) (ApTransform (Rotate3D (90, 0, 0)) (Inked (Just (RGBA 0.20392157 0.68235296 0.39607844 1)) Capsule)))), (ApTransform (Translate (0, 2.7, 0)) (ApTransform (Scale (0.35, 0.02, 0.35)) (Inked (Just (RGBA 0.1 0.1 0.1 1)) Cylinder))), (ApTransform (Translate (0, 2.9, 0)) (ApTransform (Scale (0.25, 0.02, 0.25)) (Inked (Just (RGBA 0.1 0.1 0.1 1)) Cylinder))), (ApTransform (Rotate3D (0, 0, (30+(15*(Sin (time*8)))))) (ApTransform (Translate (-0.55, 1.65, 0)) (ApTransform (Scale (0.05, 0.8, 0.05)) (Inked (Just (RGBA 0.5882353 0.27450982 0 1)) Cylinder)))), (ApTransform (Rotate3D (0, 0, 35)) (ApTransform (Translate (-0.67, 1.3, 0)) (ApTransform (Scale (0.05, 0.8, 0.05)) (Inked (Just (RGBA 0.5882353 0.27450982 0 1)) Cylinder))))]))

This is pretty gigantic so @Khan-Saad don't hesitate to comment out parts of the example when you are first getting things working. In particular you might want to comment out the shape which moves depending on the sin of time since that's a bit tricky to work with compared to everything else.

Note: The snowman test is testThreeDee in EIEvaluatorTests.swift