Skip to content

Commit

Permalink
add mouse sensitivity
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperVi committed Aug 28, 2019
1 parent faca4a0 commit 8ff6369
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,23 @@ uniforms model =



--vec3 (0.5 * cos (degrees x)) (0.5 * sin (degrees x)) 1
--calc circle


manipulatePerspective : Float -> Float -> Model -> Mat4
manipulatePerspective width height model =
let
sensitivity =
0.32

eye =
vec3 (0.2 * cos (degrees model.mousePosition.x)) -(0.5 - model.mousePosition.y / height) (0.2 * sin (degrees model.mousePosition.x))
vec3 (0.2 * cos (degrees (model.mousePosition.x * sensitivity))) -(0.5 - model.mousePosition.y / height) (0.2 * sin (degrees (model.mousePosition.x * sensitivity)))
|> Vec3.normalize
|> Vec3.scale 25
|> Vec3.scale 18
in
Mat4.mul
(Mat4.makePerspective 60 (width / height) 0.01 1000)
(Mat4.makeLookAt eye (vec3 0 -(model.dimensions.height / 2) 0) Vec3.j)
(Mat4.makeLookAt eye (vec3 0 -9 0) Vec3.j)



Expand Down

0 comments on commit 8ff6369

Please sign in to comment.