module Types where import qualified Data.Vector as V import Foreign import Foreign.Storable (Storable(..)) import Foreign.C.Types (CInt) import Linear import qualified SDL import qualified Vulkan as Vk import qualified VulkanMemoryAllocator as VMA data ShaderContainer = ShaderContainer { containedVertexShader :: Vk.ShaderModule , containedFragmentShader :: Vk.ShaderModule } deriving (Show) data EngineData = EngineData { engineWindow :: SDL.Window , engineWindowDimensions :: V2 CInt , engineLogicalDevice :: Vk.Device , engineSwapchain :: Vk.SwapchainKHR , engineQueue :: Vk.Queue , engineCommandBuffers :: V.Vector Vk.CommandBuffer , engineFramebuffers :: V.Vector Vk.Framebuffer , redEnginePipelines :: V.Vector Vk.Pipeline , rainbowEnginePipelines :: V.Vector Vk.Pipeline , meshPipeline :: V.Vector Vk.Pipeline , engineRenderPass :: Vk.RenderPass , engineInFlightFence :: Vk.Fence , engineImageAvailableSemaphore :: Vk.Semaphore , engineRenderFinishedSemaphore :: Vk.Semaphore , engineMesh :: Mesh } data AllocatedBuffer = AllocatedBuffer { allocatedBuffer :: Vk.Buffer , bufferAllocation :: VMA.Allocation } deriving (Show) data Vertex = Vertex { vertexPosition :: V3 Float , vertexNormal :: V3 Float , vertexColor :: V4 Float } deriving (Show) instance Storable Vertex where sizeOf (Vertex position normal color) = sizeOf position + sizeOf normal + sizeOf color peek _ = undefined poke ptr (Vertex position normal color) = do let castedV3Ptr = castPtr ptr pokeElemOff castedV3Ptr 0 position pokeElemOff castedV3Ptr 1 normal poke (castPtr (ptr `plusPtr` sizeOf position `plusPtr` sizeOf normal)) color alignment _ = undefined data Mesh = Mesh { meshVertices :: V.Vector Vertex , meshBuffer :: AllocatedBuffer } deriving (Show)