mischief-math-0.1.0.0: src/Mischief/Math.hs
{-# OPTIONS_GHC -Wno-unused-imports #-}
module Mischief.Math
( -- * Dependencies
-- $deps
-- * How to Use
-- $howtouse
-- * Transform Propagation
-- $prop
module Linear,
module Mischief.Math.Quat,
module Mischief.Math.Transform,
module Mischief.Math.Transform.Plugin,
)
where
import Linear
import Mischief.ECS
import Mischief.Math.Quat (Quat)
import Mischief.Math.Transform (GlobalTransform (..), Transform (..))
import Mischief.Math.Transform qualified as Transform
import Mischief.Math.Transform.Plugin (TransformPlugin, propTransform)
import Mischief.Math.Vec.Orphans.Default ()
import Mischief.Math.Vec.Orphans.FieldAccessors ()
-- $deps
-- * [mischief-ecs])("Mischief.ECS")
-- $howtouse
-- This library is mostly a wrapper around the "Linear" library, which it also re-exports types, functions and operators from.
--
-- The most notable addition is 'Transform'. A component that encodes the translation (position), rotation and scale of entities.
--
-- Transform is usually constructed with its 'Default' instance, optionally specifying some of its fields:
--
-- @
-- insert ('def' {'translation' = 'V3' 5 1 0})
-- @
--
-- To manipulate Transforms, you can import the following module:
--
-- @
-- import "Mischief.Math.Transform" qualified as Transform
-- @
--
-- This module contains a few useful functions, such as @move@ which is used to update the translation:
--
-- @
-- Transform.'Transform.move' ('V3' 5 0 0) transform
-- @
--
-- Other notable functions are @Transform.'Transform.rotate'@. There is also @Transform.'Transform.rotateZ'@ if you wish to rotate
-- a 2d object.
-- $prop
-- You can add 'TransformPlugin' to your app. This will propagate the transform of all entities through the 'ChildOf' component.
-- Basically, each entity's 'Transform' will become their position relative to their parent.
--
-- This plugin also inserts the 'GlobalTransform' component to all relevant entities, which is a wrapper around a Transform that's global.