added juicypixels, added gray dummy-image for output

This commit is contained in:
Nicole Dresselhaus 2014-10-22 01:25:38 +02:00
parent 0bac190174
commit 89a83a1579
3 changed files with 10 additions and 4 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
cabal.sandbox.config
dist/
*.swp
out.png

View File

@ -62,7 +62,8 @@ executable raytrace
build-depends: base >=4.7 && <4.8,
attoparsec >= 0.12,
bytestring >= 0.10,
linear >= 1.10
linear >= 1.10,
JuicyPixels >= 3.1
-- Directories containing source files.
-- hs-source-dirs:

View File

@ -2,6 +2,8 @@
module Main where
import Control.Applicative
import Codec.Picture.Png
import Codec.Picture.Types
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as B8
@ -65,8 +67,9 @@ validateScene obs = do
, sceneObjects = objects
}
render :: Scene -> IO ()
render s = putStrLn "rendering currently not implemented"
render :: Scene -> Image PixelRGB8
render s = generateImage pixelRenderer 250 300
where pixelRenderer x y = PixelRGB8 128 128 128
main :: IO ()
main = do
@ -80,4 +83,5 @@ main = do
Left error -> putStrLn $ "Error: " ++ error
Right s -> do
print s
render s
im <- return $ render s
writePng "out.png" im