2017-09-21 05:17:39 +00:00
|
|
|
module Types where
|
|
|
|
|
|
|
|
import qualified Graphics.Rendering.OpenGL as GL
|
|
|
|
import qualified Graphics.GLUtil as GLU
|
|
|
|
|
|
|
|
import Linear as L
|
|
|
|
|
|
|
|
import SpatialMath
|
|
|
|
|
|
|
|
import Physics.Bullet.Raw as Bullet
|
|
|
|
|
2021-09-10 22:15:31 +00:00
|
|
|
import Control.Concurrent.STM.TVar
|
|
|
|
|
2017-09-21 05:17:39 +00:00
|
|
|
data StateData = StateData
|
2021-09-10 22:15:31 +00:00
|
|
|
{ ships :: TVar [Ship]
|
|
|
|
, camera :: TVar Camera
|
|
|
|
, proj :: TVar (M44 Float)
|
|
|
|
, program :: TVar GLU.ShaderProgram
|
|
|
|
, physics :: TVar Physics
|
|
|
|
, physicsObjects :: TVar PhysicsObjects
|
|
|
|
, quitGame :: TVar Bool
|
2017-09-21 05:17:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
{ poGround :: PhysBody StaticPlaneShape
|
|
|
|
, poBalls :: [PhysBody SphereShape]
|
|
|
|
}
|
|
|
|
|
|
|
|
data PhysBody a = PhysBody
|
|
|
|
{ bodyShape :: a
|
|
|
|
, bodyMotionState :: MotionState
|
|
|
|
, bodyRigidBody :: RigidBody
|
|
|
|
}
|