crocodile 0.1 → 0.1.1
raw patch · 5 files changed
+40/−4 lines, 5 files
Files
- app/src/Main.hs +3/−0
- app/src/RayTrace.hs +3/−1
- app/src/Tests/OctreeTest.hs +24/−0
- app/src/Tests/UnitTests.hs +2/−1
- crocodile.cabal +8/−2
app/src/Main.hs view
@@ -138,6 +138,9 @@ buildPhotonMap (sceneGraph renderSettings) cornellBoxLights numPhotons | otherwise = (Nothing, map notInPhotonMap (lights renderSettings)) + -- Display message about irradiance cache+ Prelude.putStrLn (if useIrradianceCache renderSettings then "Irradiance caching enabled" else "Irrradiance caching disabled")+ -- Render the image let renderSettings' = renderSettings { lights = lights' } let maxMipLevel = 8
app/src/RayTrace.hs view
@@ -117,7 +117,9 @@ photonMapGlobalIllumination :: Maybe PhotonMap -> SurfaceLocation -> IrradianceCache -> Object -> RenderContext -> (Colour, IrradianceCache) photonMapGlobalIllumination (Just photonMap) !surfaceLocation irrCache obj renderContext = case renderMode renderContext of- PhotonMapper -> query irrCache surfaceLocation irradiance'+ PhotonMapper -> if useIrradianceCache renderContext+ then query irrCache surfaceLocation irradiance'+ else (irradiance photonMap (photonMapContext renderContext) (material obj) surfaceLocation, irrCache) _ -> undefined -- Shouldn't hit this path... where irradiance' x = (irradiance photonMap (photonMapContext renderContext) (material obj) x, irrCacheSampleRadius)
+ app/src/Tests/OctreeTest.hs view
@@ -0,0 +1,24 @@+module Tests.OctreeTest where++import Test.HUnit+import Vector+import Octree++test_create = TestCase (assertEqual "create" expectedResult ((create box) :: OctTree Int))+ where+ box = (Vector (-10) (-10) (-10) 1, Vector 10 10 10 1)+ octChildren = [+ (OctTreeDummy (Vector (-10) (-10) (-10) 1, Vector 0 0 0 1)) :: OctTree Int,+ (OctTreeDummy (Vector 0 (-10) (-10) 1, Vector 10 0 0 1)) :: OctTree Int,+ (OctTreeDummy (Vector (-10) 0 (-10) 1, Vector 0 10 0 1)) :: OctTree Int,+ (OctTreeDummy (Vector 0 0 (-10) 1, Vector 10 10 0 1)) :: OctTree Int,+ (OctTreeDummy (Vector (-10) (-10) 0 1, Vector 0 0 10 1)) :: OctTree Int,+ (OctTreeDummy (Vector 0 (-10) 0 1, Vector 10 0 10 1)) :: OctTree Int,+ (OctTreeDummy (Vector (-10) 0 0 1, Vector 0 10 10 1)) :: OctTree Int,+ (OctTreeDummy (Vector 0 0 0 1, Vector 10 10 10 1)) :: OctTree Int+ ]+ expectedResult = (OctTreeNode (Vector (-10) (-10) (-10) 1, Vector 10 10 10 1) octChildren) :: OctTree Int++tests_Octree = TestList [+ TestLabel "Creation" test_create+ ]
app/src/Tests/UnitTests.hs view
@@ -3,8 +3,9 @@ import Tests.VectorTest import Tests.BoundingBoxTest import Tests.ColourTest+import Tests.OctreeTest import Test.HUnit -unitTests = [tests_Vector, tests_BoundingBox, tests_Colour]+unitTests = [tests_Vector, tests_BoundingBox, tests_Colour, tests_Octree] main = mapM runTestTT unitTests
crocodile.cabal view
@@ -8,8 +8,10 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented.-Version: 0.1+Version: 0.1.1 +stability: Experimental+ -- A short (one-line) description of the package. Synopsis: An offline renderer supporting ray tracing and photon mapping @@ -55,4 +57,8 @@ Hs-Source-Dirs: app/src - ghc-options: -O2 -fext-core -fexcess-precision -funfolding-use-threshold=16 -funbox-strict-fields -funfolding-keeness-factor=10 -threaded -rtsopts -fwarn-missing-signatures -Wall -feager-blackholing+ ghc-options: -O2 -fexcess-precision -funbox-strict-fields -threaded -rtsopts -fwarn-missing-signatures -Wall -O2 -fspec-constr -fliberate-case -fstatic-argument-transformation++source-repository head+ type: git+ location: git://github.com/TomHammersey/HaskellRenderer.git