{-# OPTIONS_GHC -fplugin Foreign.Storable.Generic.Plugin #-}

{-# LANGUAGE DeriveAnyClass #-}

module Render.Lit.Textured.Model
  ( Model
  , Vertex
  , VertexAttrs(..)

  , module Render.Unlit.Textured.Model
  ) where

import RIO
import Render.Unlit.Textured.Model hiding (Model, Vertex, VertexAttrs)

import Foreign.Storable.Generic (GStorable)
import Geomancy (Vec2)
import Geomancy.Vec3 qualified as Vec3

import Engine.Vulkan.Format (HasVkFormat)
import Resource.Model qualified as Model

type Model buf = Model.Indexed buf Vec3.Packed VertexAttrs
type Vertex = Model.Vertex3d VertexAttrs

data VertexAttrs = VertexAttrs
  { VertexAttrs -> Vec2
vaTexCoord :: Vec2
  , VertexAttrs -> Packed
vaNormal   :: Vec3.Packed
  }
  deriving (VertexAttrs -> VertexAttrs -> Bool
(VertexAttrs -> VertexAttrs -> Bool)
-> (VertexAttrs -> VertexAttrs -> Bool) -> Eq VertexAttrs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: VertexAttrs -> VertexAttrs -> Bool
== :: VertexAttrs -> VertexAttrs -> Bool
$c/= :: VertexAttrs -> VertexAttrs -> Bool
/= :: VertexAttrs -> VertexAttrs -> Bool
Eq, Eq VertexAttrs
Eq VertexAttrs
-> (VertexAttrs -> VertexAttrs -> Ordering)
-> (VertexAttrs -> VertexAttrs -> Bool)
-> (VertexAttrs -> VertexAttrs -> Bool)
-> (VertexAttrs -> VertexAttrs -> Bool)
-> (VertexAttrs -> VertexAttrs -> Bool)
-> (VertexAttrs -> VertexAttrs -> VertexAttrs)
-> (VertexAttrs -> VertexAttrs -> VertexAttrs)
-> Ord VertexAttrs
VertexAttrs -> VertexAttrs -> Bool
VertexAttrs -> VertexAttrs -> Ordering
VertexAttrs -> VertexAttrs -> VertexAttrs
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: VertexAttrs -> VertexAttrs -> Ordering
compare :: VertexAttrs -> VertexAttrs -> Ordering
$c< :: VertexAttrs -> VertexAttrs -> Bool
< :: VertexAttrs -> VertexAttrs -> Bool
$c<= :: VertexAttrs -> VertexAttrs -> Bool
<= :: VertexAttrs -> VertexAttrs -> Bool
$c> :: VertexAttrs -> VertexAttrs -> Bool
> :: VertexAttrs -> VertexAttrs -> Bool
$c>= :: VertexAttrs -> VertexAttrs -> Bool
>= :: VertexAttrs -> VertexAttrs -> Bool
$cmax :: VertexAttrs -> VertexAttrs -> VertexAttrs
max :: VertexAttrs -> VertexAttrs -> VertexAttrs
$cmin :: VertexAttrs -> VertexAttrs -> VertexAttrs
min :: VertexAttrs -> VertexAttrs -> VertexAttrs
Ord, Int -> VertexAttrs -> ShowS
[VertexAttrs] -> ShowS
VertexAttrs -> String
(Int -> VertexAttrs -> ShowS)
-> (VertexAttrs -> String)
-> ([VertexAttrs] -> ShowS)
-> Show VertexAttrs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> VertexAttrs -> ShowS
showsPrec :: Int -> VertexAttrs -> ShowS
$cshow :: VertexAttrs -> String
show :: VertexAttrs -> String
$cshowList :: [VertexAttrs] -> ShowS
showList :: [VertexAttrs] -> ShowS
Show, (forall x. VertexAttrs -> Rep VertexAttrs x)
-> (forall x. Rep VertexAttrs x -> VertexAttrs)
-> Generic VertexAttrs
forall x. Rep VertexAttrs x -> VertexAttrs
forall x. VertexAttrs -> Rep VertexAttrs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. VertexAttrs -> Rep VertexAttrs x
from :: forall x. VertexAttrs -> Rep VertexAttrs x
$cto :: forall x. Rep VertexAttrs x -> VertexAttrs
to :: forall x. Rep VertexAttrs x -> VertexAttrs
Generic, [Format]
[Format] -> HasVkFormat VertexAttrs
forall a. [Format] -> HasVkFormat a
$cgetVkFormat :: [Format]
getVkFormat :: [Format]
HasVkFormat)

instance GStorable VertexAttrs