hw/examples/example02/Types.hs
2021-09-11 00:15:31 +02:00

60 lines
1.5 KiB
Haskell

module Types where
import qualified Graphics.Rendering.OpenGL as GL
import qualified Graphics.GLUtil as GLU
import Control.Concurrent.STM.TVar
import Linear as L
import SpatialMath
import Physics.Bullet.Raw as Bullet
data StateData = StateData
{ ships :: TVar [Ship]
, planet :: TVar Ship
, oplanets :: TVar [Ship]
, camera :: TVar Camera
, proj :: TVar (M44 Float)
, program :: TVar GLU.ShaderProgram
, program2 :: TVar GLU.ShaderProgram
, physics :: TVar Physics
, physicsObjects :: TVar PhysicsObjects
, focusIndex :: TVar Int
, nextStep :: TVar Bool
}
data Ship = Ship
{ shipVao :: GL.VertexArrayObject
, shipVaoLen :: Int
, shipPos :: V3 Float
, shipRot :: Quaternion Float
}
data Camera = Camera
{ cameraFocus :: V3 Float
, cameraRot :: Euler Float
, cameraDist :: Float
}
data Physics = Physics
{ pBroadphase :: DbvtBroadphase
, pConfig :: DefaultCollisionConfiguration
, pDispatcher :: CollisionDispatcher
, pSolver :: SequentialImpulseConstraintSolver
, pWorld :: DiscreteDynamicsWorld
}
data PhysicsObjects = PhysicsObjects
{ poBigBall :: PhysBody SphereShape
, poSmallBalls :: [PhysBody SphereShape]
, poBigBalls :: [PhysBody SphereShape]
}
data PhysBody a = PhysBody
{ bodyShape :: a
, bodyMotionState :: MotionState
, bodyRigidBody :: RigidBody
, bodyMass :: Double
} deriving (Eq)