----------------------------------------------------------------------------- -- | -- Copyright : (C) 2015 Dimitri Sabadie -- License : BSD3 -- -- Maintainer : Dimitri Sabadie -- Stability : experimental -- Portability : portable -- ----------------------------------------------------------------------------- module Codec.Wavefront.Face where import Data.List.NonEmpty ( NonEmpty ) -- |A face index is a triplet of indices. @'FaceIndex' vi vti vni@ is a face that indexes the -- locations with @vi@, the texture coordinates with @vti@ and the normals with @vni@. An index set -- to 'Nothing' means /no information/. That is, if @vni == 'Nothing'@, then that 'FaceIndex' -- doesn’t have a normal associated with. data FaceIndex = FaceIndex { faceLocIndex :: {-# UNPACK #-} !Int , faceTexCoordIndex :: !(Maybe Int) , faceNorIndex :: !(Maybe Int) } deriving (Eq,Show) -- |A face gathers several 'FaceIndex' to build up faces, arranged in either 'Triangle', 'Quad' or -- an arbritatry 'Polygon'. data Face = Triangle FaceIndex FaceIndex FaceIndex | Quad FaceIndex FaceIndex FaceIndex FaceIndex | Polygon (NonEmpty FaceIndex) deriving (Eq,Show)