diff --git a/src/Main.elm b/src/Main.elm index 4bc97b9..f214969 100644 --- a/src/Main.elm +++ b/src/Main.elm @@ -1,4 +1,4 @@ -module Main exposing (main) +module Main exposing (Flags, Model, Msg, Object3d, main) import Angle import Array @@ -11,7 +11,7 @@ import Element exposing (..) import Element.Background as Background import Element.Font as Font import Html exposing (Html) -import Http exposing (Error) +import Http import Length import Obj.Decode import Pixels @@ -61,11 +61,6 @@ animatedEl = animatedUi Element.el -animatedCol : Animation -> List (Element.Attribute msg) -> List (Element msg) -> Element msg -animatedCol = - animatedUi Element.column - - main : Program Flags Model Msg main = Browser.document { init = init, update = update, subscriptions = subscribe, view = view } @@ -81,9 +76,11 @@ type alias Flags = init : Flags -> ( Model, Cmd Msg ) init flags = - case flags of - ( width, height ) -> - ( { w = width, h = height, mesh = Nothing, textures = Nothing, angle = 0 }, Cmd.batch [ getMesh, getTexture ] ) + let + ( width, height ) = + flags + in + ( { w = width, h = height, mesh = Nothing, textures = Nothing, angle = 0 }, Cmd.batch [ getMesh, getTexture ] ) @@ -236,23 +233,29 @@ pyramidMesh : Mesh.Uniform coordinates pyramidMesh = let -- Define the vertices of our pyramid + frontLeft : Point3d Length.Meters coordinates frontLeft = Point3d.centimeters 250 500 0 + frontRight : Point3d Length.Meters coordinates frontRight = Point3d.centimeters 400 0 -500 + backLeft : Point3d Length.Meters coordinates backLeft = Point3d.centimeters -250 500 -500 + backRight : Point3d Length.Meters coordinates backRight = Point3d.centimeters -250 0 0 + tip : Point3d Length.Meters coordinates tip = Point3d.centimeters 0 0 500 -- Create a TriangularMesh value from an array of vertices and list -- of index triples defining faces (see https://package.elm-lang.org/packages/ianmackenzie/elm-triangular-mesh/latest/TriangularMesh#indexed) + triangularMesh : TriangularMesh (Point3d Length.Meters coordinates) triangularMesh = TriangularMesh.indexed (Array.fromList @@ -302,6 +305,7 @@ view3D model = { focalPoint = Point3d.origin , eyePoint = let + theta : Angle.Angle theta = Angle.degrees model.angle in