{-# LANGUAGE DeriveAnyClass #-}

module Render.Unlit.Colored.Model
  ( Model
  , Vertex
  , VertexAttrs
  , rgbF
  , black
  , white

  , InstanceAttrs
  ) where

import RIO

import Geomancy (Transform, Vec4, vec4)
import Geomancy.Vec3 qualified as Vec3
import Resource.Model qualified as Model
import Vulkan.NamedType ((:::))

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

type VertexAttrs = "RGBA" ::: Vec4

type InstanceAttrs = Transform

{-# INLINE rgbF #-}
rgbF :: Float -> Float -> Float -> VertexAttrs
rgbF :: Float -> Float -> Float -> VertexAttrs
rgbF Float
r Float
g Float
b = Float -> Float -> Float -> Float -> VertexAttrs
vec4 Float
r Float
g Float
b Float
1

{-# INLINE black #-}
black :: VertexAttrs
black :: VertexAttrs
black = Float -> Float -> Float -> VertexAttrs
rgbF Float
0 Float
0 Float
0

{-# INLINE white #-}
white :: VertexAttrs
white :: VertexAttrs
white = Float -> Float -> Float -> VertexAttrs
rgbF Float
1 Float
1 Float
1