added juicypixels, added gray dummy-image for output
This commit is contained in:
parent
0bac190174
commit
89a83a1579
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
|||||||
cabal.sandbox.config
|
cabal.sandbox.config
|
||||||
dist/
|
dist/
|
||||||
*.swp
|
*.swp
|
||||||
|
out.png
|
||||||
|
@ -62,7 +62,8 @@ executable raytrace
|
|||||||
build-depends: base >=4.7 && <4.8,
|
build-depends: base >=4.7 && <4.8,
|
||||||
attoparsec >= 0.12,
|
attoparsec >= 0.12,
|
||||||
bytestring >= 0.10,
|
bytestring >= 0.10,
|
||||||
linear >= 1.10
|
linear >= 1.10,
|
||||||
|
JuicyPixels >= 3.1
|
||||||
|
|
||||||
-- Directories containing source files.
|
-- Directories containing source files.
|
||||||
-- hs-source-dirs:
|
-- hs-source-dirs:
|
||||||
|
10
src/Main.hs
10
src/Main.hs
@ -2,6 +2,8 @@
|
|||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
|
import Codec.Picture.Png
|
||||||
|
import Codec.Picture.Types
|
||||||
import qualified Data.ByteString as B
|
import qualified Data.ByteString as B
|
||||||
import qualified Data.ByteString.Char8 as B8
|
import qualified Data.ByteString.Char8 as B8
|
||||||
|
|
||||||
@ -65,8 +67,9 @@ validateScene obs = do
|
|||||||
, sceneObjects = objects
|
, sceneObjects = objects
|
||||||
}
|
}
|
||||||
|
|
||||||
render :: Scene -> IO ()
|
render :: Scene -> Image PixelRGB8
|
||||||
render s = putStrLn "rendering currently not implemented"
|
render s = generateImage pixelRenderer 250 300
|
||||||
|
where pixelRenderer x y = PixelRGB8 128 128 128
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
@ -80,4 +83,5 @@ main = do
|
|||||||
Left error -> putStrLn $ "Error: " ++ error
|
Left error -> putStrLn $ "Error: " ++ error
|
||||||
Right s -> do
|
Right s -> do
|
||||||
print s
|
print s
|
||||||
render s
|
im <- return $ render s
|
||||||
|
writePng "out.png" im
|
||||||
|
Loading…
Reference in New Issue
Block a user