packages feed

GLUtil 0.8.6 → 0.8.7

raw patch · 4 files changed

+61/−17 lines, 4 filesdep +hppdep ~OpenGL

Dependencies added: hpp

Dependency ranges changed: OpenGL

Files

CHANGELOG.md view
@@ -1,17 +1,18 @@-0.8.2----+# 0.8.7 +* Use `hpp` as a preprocessor rather than `cpphs`++# 0.8.2+ * Do not print shader info log if it contains only \NUL -0.8.1----+# 0.8.1  * Added `orthoMatrix` to `Camera3D`  * Added `loadShaderFamily` to load all vertex, geometry, and fragment   shaders based on a root file name. -0.8----+# 0.8  * Generalized `setUniform` to work with any instance of `AsUniform`. Specifically, this enables the use of types from the `linear` package.
GLUtil.cabal view
@@ -1,5 +1,5 @@ Name:                GLUtil-Version:             0.8.6+Version:             0.8.7 Synopsis:            Miscellaneous OpenGL utilities. License:             BSD3 License-file:        LICENSE@@ -51,12 +51,13 @@                        containers >= 0.5,                        directory,                        filepath,+                       hpp >= 0.1 && < 0.2,                        linear >= 1.1.3,                        JuicyPixels >= 3,                        OpenGLRaw >= 1.1,-                       OpenGL >= 2.9.2 && < 2.13,+                       OpenGL >= 2.9.2 && < 2.14,                        transformers >= 0.3,                        vector >= 0.7-  Build-tools:         cpphs+  Build-tools:            GHC-Options:         -Odph -Wall   HS-Source-Dirs:      src
src/Graphics/GLUtil/Camera3D.hs view
@@ -7,15 +7,18 @@ module Graphics.GLUtil.Camera3D   (-- * Camera movement    Camera(..), panRad, pan, tiltRad, tilt, rollRad, roll, dolly,+   panGlobalRad, panGlobal, tiltGlobalRad, tiltGlobal, rollGlobalRad,+   rollGlobal,    -- * Camera initialization    rosCamera, fpsCamera,    -- * Matrices    projectionMatrix, orthoMatrix, camMatrix,    -- * Miscellaneous    deg2rad) where-import Linear (Conjugate(conjugate), Epsilon, V3(..), V4(..))-import Linear.Matrix (mkTransformation, M44)-import Linear.Quaternion (Quaternion, axisAngle, rotate)+import           Linear            (Conjugate (conjugate), Epsilon, V3 (..),+                                    V4 (..))+import           Linear.Matrix     (M44, mkTransformation)+import           Linear.Quaternion (Quaternion, axisAngle, rotate)  -- | A 'Camera' may be translated and rotated to provide a coordinate -- frame into which 3D points may be transformed.@@ -26,17 +29,30 @@                        , location    :: V3 a }  -- | Pan a camera view (turn side-to-side) by an angle given in+-- radians. Panning is about the camera's up-axis (e.g. the positive+-- Y axis for 'fpsCamera').+panRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a+panRad theta c = c { orientation = orientation c * r }+  where r = axisAngle (upward c) theta++-- | Pan a camera view (turn side-to-side) by an angle given in+-- degrees. Panning is about the camera's up-axis (e.g. the positive+-- Y axis for 'fpsCamera').+pan :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a+pan = panRad . deg2rad++-- | Pan a camera view (turn side-to-side) by an angle given in -- radians. Panning is about the world's up-axis as captured by the -- initial camera state (e.g. the positive Y axis for 'fpsCamera').-panRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a-panRad theta c = c { orientation = r * orientation c }+panGlobalRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a+panGlobalRad theta c = c { orientation = r * orientation c }   where r = axisAngle (upward c) theta  -- | Pan a camera view (turn side-to-side) by an angle given in -- degrees. Panning is about the world's up-axis as captured by the -- initial camera state (e.g. the positive Y axis for 'fpsCamera').-pan :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a-pan = panRad . deg2rad+panGlobal :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a+panGlobal = panGlobalRad . deg2rad  -- | Tilt a camera view (up-and-down) by an angle given in -- radians. Tilting is about the camera's horizontal axis (e.g. the@@ -51,6 +67,19 @@ tilt :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a tilt = tiltRad . deg2rad +-- | Tilt a camera view (up-and-down) by an angle given in+-- radians. Tilting is about the world's horizontal axis as captured by+-- the initial camera state (e.g. the positive X axis for 'fpsCamera').+tiltGlobalRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a+tiltGlobalRad theta c = c { orientation = r * orientation c }+  where r = axisAngle (rightward c) theta++-- | Tilt a camera view (up-and-down) by an angle given in degrees.+-- Tilting is about the world's horizontal axis as captured by the+-- initial camera state (e.g. the positive X axis for 'fpsCamera').+tiltGlobal :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a+tiltGlobal = tiltGlobalRad . deg2rad+ -- | Roll a camera view about its view direction by an angle given in -- radians. Rolling is about the camera's forward axis (e.g. the -- negative Z axis for 'fpsCamera').@@ -63,6 +92,19 @@ -- negative Z axis for 'fpsCamera'). roll :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a roll = rollRad . deg2rad++-- | Roll a camera view about its view direction by an angle given in+-- radians. Rolling is about the world's forward axis as captured by+-- the initial camera state (e.g. the negative Z axis for 'fpsCamera').+rollGlobalRad :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a+rollGlobalRad theta c = c { orientation = r * orientation c }+  where r = axisAngle (forward c) theta++-- | Roll a camera view about its view direction by an angle given in+-- degrees. Rolling is about the world's forward axis as captured by the+-- initial camera state (e.g. the negative Z axis for 'fpsCamera').+rollGlobal :: (Epsilon a, RealFloat a) => a -> Camera a -> Camera a+rollGlobal = rollGlobalRad . deg2rad  -- | Translate a camera's position by the given vector. dolly :: (Conjugate a, Epsilon a, RealFloat a) => V3 a -> Camera a -> Camera a
src/Graphics/GLUtil/Linear.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE DefaultSignatures, FlexibleInstances, FlexibleContexts,              ScopedTypeVariables #-}-{-# OPTIONS_GHC -cpp -pgmPcpphs -optP--cpp -optP--hashes #-}+{-# OPTIONS_GHC -cpp -pgmPhpp -optP--cpp #-} -- |Support for writing "Linear" types to uniform locations in -- shader programs. module Graphics.GLUtil.Linear (AsUniform(..)) where