module Shady.CompileImage (ImageB, imageBProg,imSurfB, eyePos) where
import Data.Derivative (powVal)
import qualified Shady.Vec as V
import Shady.Language.Type (R1,R2)
import Shady.Language.Exp ((:=>),pureE)
import Shady.Color
import Shady.Image (Image)
import Shady.CompileE (GLSL)
import Shady.ParamSurf (xyPlane)
import Shady.Lighting (intrinsic,view1)
import Shady.CompileSurface (EyePosE,SurfB,surfBProg)
import Shady.Misc (EyePos)
type ImageB c = R1 :=> Image c
eyePos :: EyePos
eyePos = (0, 0.75, 2.5)
eyePosE :: EyePosE
eyePosE = pureE (V.vec3 ex ey ez) where (ex,ey,ez) = eyePos
imSurfB :: HasColor c => ImageB c -> SurfB
imSurfB imb t = (intrinsic, view1, xyPlane , toColor . imb (powVal t))
imageBProg :: HasColor c => ImageB c -> GLSL R1 R2
imageBProg = surfBProg eyePosE . imSurfB