packages feed

HRay 1.1.1 → 1.2.0

raw patch · 9 files changed

+1744/−75 lines, 9 filesdep −gtkdep ~basenew-uploaderbinary-added

Dependencies removed: gtk

Dependency ranges changed: base

Files

+ ._HRayEngine.lhs view

binary file changed (absent → 197 bytes)

+ ._HRayMath.lhs view

binary file changed (absent → 197 bytes)

+ ._HRayParser.y view

binary file changed (absent → 197 bytes)

HRay.cabal view
@@ -1,20 +1,21 @@ name:                HRay-version:             1.1.1+version:             1.2.0 synopsis:            Haskell raytracer description:         HRay is a ray tracing application written in Haskell as part of my-                     thesis at Ghent University. It's quite simple for now, but I'll probably-                     keep on working on it in the near future.-                     .+                     masters thesis at Ghent University. ++		     It currently supports spheres, planes and metaballs (thanks to Jean-Phillipe Bernardy).+                      For more information, see the homepage or the Haskell wiki entry:                      <http://haskell.org/haskellwiki/HRay>. category:            Graphics license:             BSD3 license-file:        LICENSE author:              boegel-maintainer:          boegel <kenneth [dot] hoste [at] elis [dot] ugent [dot] be>-homepage:            http://trappist.elis.ugent.be/~kehoste/Haskell/HRay/+maintainer:          boegel <kenneth [dot] hoste [at] [dot] ugent [dot] be>+homepage:            http://boegel.kejo.be/ELIS/Haskell/HRay/ -build-depends:       base>3, array, directory, gtk >= 0.9.7+build-depends:       base>3 && <5, array, directory build-type:          Simple data-files:          readme.txt,                      -- and some files to experiment with@@ -28,7 +29,7 @@                      scenes/trans0.hry, scenes/perlinShowMarbleBase.hry,                      scenes/perlinShowWood.hry, scenes/perlinShowPlasma.hry extra-source-files:  HRayGUI.lhs-tested-with:         GHC==6.8.2+tested-with:         GHC==6.12.3  executable:          HRay main-is:             HRayMain.lhs
+ HRay.cabal~ view
@@ -0,0 +1,40 @@+name:                HRay+version:             1.2.0+synopsis:            Haskell raytracer+description:         HRay is a ray tracing application written in Haskell as part of my+                     masters thesis at Ghent University. ++		     It currently supports spheres, planes and metaballs (thanks to Jean-Phillipe Bernardy).++                     For more information, see the homepage or the Haskell wiki entry:+                     <http://haskell.org/haskellwiki/HRay>.+category:            Graphics+license:             BSD3+license-file:        LICENSE+author:              boegel+maintainer:          boegel <kenneth [dot] hoste [at] [dot] ugent [dot] be>+homepage:            http://boegel.kejo.be/ELIS/Haskell/HRay/++build-depends:       base>3 && <5, array, directory+build-type:          Simple+data-files:          readme.txt,+                     -- and some files to experiment with+                     scenes/shadow2.hry, scenes/perlinShowFire.hry,+                     scenes/shadow0.hry, scenes/perlinShowSemiTurb.hry,+                     scenes/perlinShowTurb.hry, scenes/mirror.hry,+                     scenes/shadow1.hry, scenes/perlin0.hry,+                     scenes/perlin1.hry, scenes/trans2.hry,+                     scenes/perlinShowSolid.hry, scenes/circles.hry,+                     scenes/trans1.hry, scenes/perlinShowMarble.hry,+                     scenes/trans0.hry, scenes/perlinShowMarbleBase.hry,+                     scenes/perlinShowWood.hry, scenes/perlinShowPlasma.hry+extra-source-files:  HRayGUI.lhs+tested-with:         GHC==6.12.3++executable:          HRay+main-is:             HRayMain.lhs+other-modules:       HRayEngine, HRayOutput, PixBufExtras,+                     HRayMath, HRayPerlin, HRayParser++ghc-options:         -Wall+ghc-prof-options:    -prof -auto-all
HRayEngine.lhs view
@@ -6,10 +6,10 @@  	========================================================================== -> module HRayEngine (Resolution, Color, Diff(Solid,Perlin), Texture(Texture), TexturedObject,+> module HRayEngine (Resolution, Color, Diff(Solid,Perlin), Texture(Texture), TexturedObject,  >		     Light(AmbientLight,PointLight), Scene(Scene), Camera(Camera), rayTrace) where -> import Data.Maybe+> import Maybe > import HRayMath  @@ -69,7 +69,7 @@  	determines the color at the intersection point 	- if the texture has a solid color, this color is returned-	- if the texture has a noise function to determine the color,+	- if the texture has a noise function to determine the color,  	  this function is used to determine the color for the given point  > colorAt :: (Maybe Intersection) -> Color@@ -103,7 +103,7 @@  > closestInt :: Ray -> (Maybe Intersection) -> TexturedObject -> (Maybe Intersection) -> closestInt r i (o,m) = if d > 10**(-6) && ((isNothing i) || d < (intDist i))+> closestInt r i (o,m) = if d > 10**(-6) && ((isNothing i) || d < (intDist i))  >				then Just (Intersection d r (o,m)) >				else i >    where@@ -127,41 +127,41 @@ > spec i d (PointLight pos int) = int *> (reflCoef * ( ((normalAt i) *. h)**(fromIntegral specCoef) )) >   where >       h  				  = norm ((d *> (-1)) <+> (mkNormVect (intPt i) pos))->	(Texture _ reflCoef specCoef _ _) = intText i+>	(Texture _ reflCoef specCoef _ _) = intText i   -        shades the intersection point+        shades the intersection point  -> shadePt :: Intersection -> Vector -> [TexturedObject] -> Light -> Color+> shadePt :: Intersection -> Vector -> [TexturedObject] -> Light -> Color  -		if there is an ambient light in the scene (always in front of the list), then use it+		if there is an ambient light in the scene (always in front of the list), then use it   > shadePt i d o (AmbientLight int) = int  		illuminate an intersection point with a point light  > shadePt i d o l@(PointLight pos int)->	-- distance between light point and an object is smaller than distance between light point and shaded intersection->       -- => shadow -> no color factor added by this light source+>	-- distance between light point and an object is smaller than distance between light point and shaded intersection +>       -- => shadow -> no color factor added by this light source  >	| s         = (0.0,0.0,0.0)->	-- no shadow -> color factor added by this light source+>	-- no shadow -> color factor added by this light source  >	| otherwise = (diff (Just i) l) <+> (spec (Just i) d l)->	where->		s     = not (isNothing i_s) && (intDist i_s) <= dist (intPt (Just i)) pos->           	i_s = intersect (mkRay (intPt (Just i)) pos) o--        calculates the reflected component at the given intersection point+>	where +>		s     = not (isNothing i_s) && (intDist i_s) <= dist (intPt (Just i)) pos +>           	i_s = intersect (mkRay (intPt (Just i)) pos) o  -> reflectPt :: Int -> Intersection -> Vector -> [TexturedObject] -> [Light] -> Color-> reflectPt depth i d = colorPt depth (Ray (intPt (Just i)) (reflectDir d (normalAt (Just i)))) (0.0,0.0,0.0)+        calculates the reflected component at the given intersection point  +> reflectPt :: Int -> Intersection -> Vector -> [TexturedObject] -> [Light] -> Color +> reflectPt depth i d = colorPt depth (Ray (intPt (Just i)) (reflectDir d (normalAt (Just i)))) (0.0,0.0,0.0) +          calculates the refracted component at the given intersection point -> refractPt :: Int -> Intersection -> Vector -> Color -> [TexturedObject] -> [Light] -> Color-> refractPt depth i d b = if refractedDir == (0.0,0.0,0.0) then (\x y -> (0.0,0.0,0.0))->							   else colorPt depth (Ray (intPt (Just i)) refractedDir) (b *> refrCoef)->   where->	refractedDir                       = refractDir d (normalAt (Just i)) refrIndex->	(Texture _ _ _ refrCoef refrIndex) = intText (Just i)+> refractPt :: Int -> Intersection -> Vector -> Color -> [TexturedObject] -> [Light] -> Color  +> refractPt depth i d b = if refractedDir == (0.0,0.0,0.0) then (\x y -> (0.0,0.0,0.0))  +>							   else colorPt depth (Ray (intPt (Just i)) refractedDir) (b *> refrCoef) +>   where +>	refractedDir                       = refractDir d (normalAt (Just i)) refrIndex  +>	(Texture _ _ _ refrCoef refrIndex) = intText (Just i)             determines the color at the given point of the view plane@@ -170,24 +170,24 @@  		when the maximum depth is reached, recursion stops -> colorPt (-1) _ _ _ _ = (0.0, 0.0, 0.0)+> colorPt (-1) _ _ _ _ = (0.0, 0.0, 0.0)   > colorPt d r@(Ray _ dir) b o l = if (isNothing i) then b else clip $ shadeColor <+> reflectColor <+> refractColor->   where+>   where  >       shadeColor   = foldl (<+>) (0.0,0.0,0.0) (map (shadePt (fromJust i) dir o) l)->       reflectColor = if (reflCoef == 0.0) then (0.0, 0.0, 0.0)->                                          else (reflectPt (d-1) (fromJust i) dir o l) *> reflCoef->       refractColor = if (refrCoef == 0.0) then (0.0, 0.0, 0.0)->                                          else (refractPt (d-1) (fromJust i) dir b o l) *> refrCoef->       i = intersect r o->	(Texture _ reflCoef _ refrCoef _) = intText i+>       reflectColor = if (reflCoef == 0.0) then (0.0, 0.0, 0.0) +>                                          else (reflectPt (d-1) (fromJust i) dir o l) *> reflCoef +>       refractColor = if (refrCoef == 0.0) then (0.0, 0.0, 0.0) +>                                          else (refractPt (d-1) (fromJust i) dir b o l) *> refrCoef +>       i = intersect r o +>	(Texture _ reflCoef _ refrCoef _) = intText i  -	determines the color of one ray through a given point+	determines the color of one ray through a given point  -> rayTracePt :: Int -> Scene -> Point3D -> Color-> rayTracePt d (Scene (Camera eye _) b o l) p = colorPt d (Ray p (mkNormVect eye p)) b o l+> rayTracePt :: Int -> Scene -> Point3D -> Color +> rayTracePt d (Scene (Camera eye _) b o l) p = colorPt d (Ray p (mkNormVect eye p)) b o l           raytraces the scene, and returns a list of colors representing the image -> rayTrace :: Int -> Resolution -> Scene -> Image-> rayTrace d r s@(Scene (Camera _ dim) _ _ _) = (rayTracePt d s) . (mapToWin r dim)+> rayTrace :: Int -> Resolution -> Scene -> Image +> rayTrace d r s@(Scene (Camera _ dim) _ _ _) = (rayTracePt d s) . (mapToWin r dim) 
HRayMath.lhs view
@@ -9,6 +9,7 @@  > module HRayMath where +> import Data.List (sort)          representation of a point in a 2D-space @@ -32,9 +33,14 @@          representation of the supported object types -> data Object =   Sphere Double Point3D->               | Plane (Double,Double,Double,Double)+> data Object =   Sphere Double Point3D -- radius, center+>               | Plane (Double,Double,Double,Double) -- plane coordinates (equation: Ax + By + Cz + D = 0)+>               | Meta [MetaPoint] Double -- points, threshold +	representation of a meta point (see http://www.geisswerks.com/ryan/BLOBS/blobs.html)++> data MetaPoint = MetaPoint Point3D Double -- center, strength+         representation of a ray  > data Ray = Ray Point3D Vector@@ -138,6 +144,30 @@ >   where >	part = (a,b,c) *. dir +> intRayWith (Ray source ray) (Meta points threshold) = if ubound > 0 then solution else []+>    where ubound = sum [(strength/(c-b*b)) | (b, c, strength) <- pointInfo] - threshold+>          pointInfo = [(ray *. (center <-> source),+>                        squaredNorm (center <-> source) + 0.001,+>                        strength) |+>                       MetaPoint center strength <- points]+>	  +>          maximums = [b | (b, _, _) <- pointInfo, b > 0]+>	  +>	   density x = sum [(strength/(x*x-2*b*x+c)) | (b, c, strength) <- pointInfo] - threshold+>	   forwardFindSolution (x0:x1:xs)+>	      | density x1 > 0 = dichoFindSolution x0 x1+>	      | otherwise = forwardFindSolution (x1:xs)+>	   forwardFindSolution (x0:[]) = []+>	   dichoFindSolution x0 x1 +>	      | x1 - x0 < eps = [mid]+>	      | density mid >  0 = dichoFindSolution x0  mid+>	      | density mid <= 0 = dichoFindSolution mid x1+>	      where mid = (x1 + x0) / 2+>	   solution = forwardFindSolution (0:sort maximums)+>          eps = 1.0e-3++> squaredNorm v = v *. v+         function which determines the normal at a certain point on some type of object  > normal :: Point3D -> Object -> Vector@@ -149,6 +179,13 @@         	function which determines the normal at a certain point on a plane  > normal _ (Plane (a,b,c,d)) = norm (a,b,c)++		function which determines the normal at a certain point on a meta point++> normal hit (Meta points threshold) = +>     norm $ foldr1 (<+>) [ (hit<->center) *> (strength / sq (squaredNorm (hit<->center))) +>                           | MetaPoint center strength <- points ]+>     where sq x = x * x   	determines the reflected direction given a certain direction vector and a normal 
+ HRayParser.hs view
@@ -0,0 +1,1579 @@+{-# OPTIONS_GHC -fno-warn-overlapping-patterns #-}+{- +     module HRayParser, which contains a parser which allows to use files containing scene descriptions +     intended for usage with the other modules in the HRay package+ +     author: Kenneth Hoste, 2004-2005+     part of a masters thesis at the University of Ghent, Belgium+-}++module HRayParser (RenderDescr(RenderDescr), readDescr) where++import HRayEngine (Scene(Scene), Texture(Texture), Diff(Solid,Perlin), TexturedObject, +		   Light(AmbientLight, PointLight), Camera(Camera))+import HRayPerlin (perlinSolid, perlinSemiTurbulence,perlinTurbulence,perlinFire,perlinPlasma,perlinMarble,+		   perlinMarbleBase,perlinWood)+import HRayMath (Dimension, Resolution, Object(Sphere,Plane,Meta), MetaPoint(MetaPoint))+import Char (isSpace, isAlpha, isDigit)+++-- representation of a full description of scene which should be rendered+data RenderDescr = RenderDescr Resolution Int Scene+++readDescr :: String -> RenderDescr+readDescr = parseScene.lexer++-- parser produced by Happy Version 1.18.5++data HappyAbsSyn t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17 t18+	= HappyTerminal (Token)+	| HappyErrorToken Int+	| HappyAbsSyn4 t4+	| HappyAbsSyn5 t5+	| HappyAbsSyn6 t6+	| HappyAbsSyn7 t7+	| HappyAbsSyn8 t8+	| HappyAbsSyn9 t9+	| HappyAbsSyn10 t10+	| HappyAbsSyn11 t11+	| HappyAbsSyn12 t12+	| HappyAbsSyn13 t13+	| HappyAbsSyn14 t14+	| HappyAbsSyn15 t15+	| HappyAbsSyn16 t16+	| HappyAbsSyn17 t17+	| HappyAbsSyn18 t18++action_0 (45) = happyShift action_2+action_0 (4) = happyGoto action_3+action_0 _ = happyFail++action_1 (45) = happyShift action_2+action_1 _ = happyFail++action_2 (48) = happyShift action_5+action_2 (5) = happyGoto action_4+action_2 _ = happyFail++action_3 (53) = happyAccept+action_3 _ = happyFail++action_4 (19) = happyShift action_7+action_4 _ = happyFail++action_5 (44) = happyShift action_6+action_5 _ = happyFail++action_6 (48) = happyShift action_9+action_6 _ = happyFail++action_7 (50) = happyShift action_8+action_7 _ = happyFail++action_8 (43) = happyShift action_12+action_8 (6) = happyGoto action_11+action_8 _ = happyFail++action_9 (19) = happyShift action_10+action_9 _ = happyFail++action_10 (52) = happyShift action_15+action_10 _ = happyFail++action_11 (51) = happyShift action_14+action_11 _ = happyFail++action_12 (46) = happyShift action_13+action_12 _ = happyFail++action_13 (21) = happyShift action_18+action_13 (7) = happyGoto action_17+action_13 _ = happyFail++action_14 _ = happyReduce_1++action_15 (19) = happyShift action_16+action_15 _ = happyFail++action_16 (49) = happyShift action_21+action_16 _ = happyFail++action_17 (47) = happyShift action_20+action_17 _ = happyFail++action_18 (48) = happyShift action_19+action_18 _ = happyFail++action_19 (20) = happyShift action_24+action_19 _ = happyFail++action_20 (46) = happyShift action_23+action_20 _ = happyFail++action_21 (49) = happyShift action_22+action_21 _ = happyFail++action_22 _ = happyReduce_2++action_23 (22) = happyShift action_27+action_23 (8) = happyGoto action_26+action_23 _ = happyFail++action_24 (52) = happyShift action_25+action_24 _ = happyFail++action_25 (20) = happyShift action_30+action_25 _ = happyFail++action_26 (47) = happyShift action_29+action_26 _ = happyFail++action_27 (48) = happyShift action_28+action_27 _ = happyFail++action_28 (20) = happyShift action_33+action_28 _ = happyFail++action_29 (46) = happyShift action_32+action_29 _ = happyFail++action_30 (52) = happyShift action_31+action_30 _ = happyFail++action_31 (20) = happyShift action_36+action_31 _ = happyFail++action_32 (39) = happyShift action_35+action_32 _ = happyFail++action_33 (52) = happyShift action_34+action_33 _ = happyFail++action_34 (20) = happyShift action_39+action_34 _ = happyFail++action_35 (16) = happyGoto action_38+action_35 _ = happyReduce_24++action_36 (49) = happyShift action_37+action_36 _ = happyFail++action_37 (48) = happyShift action_44+action_37 _ = happyFail++action_38 (47) = happyShift action_42+action_38 (48) = happyShift action_43+action_38 (15) = happyGoto action_41+action_38 _ = happyFail++action_39 (52) = happyShift action_40+action_39 _ = happyFail++action_40 (20) = happyShift action_48+action_40 _ = happyFail++action_41 _ = happyReduce_25++action_42 (46) = happyShift action_47+action_42 _ = happyFail++action_43 (38) = happyShift action_46+action_43 _ = happyFail++action_44 (19) = happyShift action_45+action_44 _ = happyFail++action_45 (52) = happyShift action_52+action_45 _ = happyFail++action_46 (48) = happyShift action_51+action_46 _ = happyFail++action_47 (42) = happyShift action_50+action_47 _ = happyFail++action_48 (49) = happyShift action_49+action_48 _ = happyFail++action_49 _ = happyReduce_5++action_50 (18) = happyGoto action_58+action_50 _ = happyReduce_28++action_51 (35) = happyShift action_55+action_51 (36) = happyShift action_56+action_51 (37) = happyShift action_57+action_51 (9) = happyGoto action_54+action_51 _ = happyFail++action_52 (19) = happyShift action_53+action_52 _ = happyFail++action_53 (49) = happyShift action_66+action_53 _ = happyFail++action_54 (49) = happyShift action_65+action_54 _ = happyFail++action_55 (20) = happyShift action_64+action_55 _ = happyFail++action_56 (48) = happyShift action_63+action_56 _ = happyFail++action_57 (11) = happyGoto action_62+action_57 _ = happyReduce_10++action_58 (47) = happyShift action_60+action_58 (48) = happyShift action_61+action_58 (17) = happyGoto action_59+action_58 _ = happyFail++action_59 _ = happyReduce_29++action_60 _ = happyReduce_3++action_61 (40) = happyShift action_74+action_61 (41) = happyShift action_75+action_61 _ = happyFail++action_62 (20) = happyShift action_72+action_62 (48) = happyShift action_73+action_62 (10) = happyGoto action_71+action_62 _ = happyFail++action_63 (20) = happyShift action_70+action_63 _ = happyFail++action_64 (48) = happyShift action_69+action_64 _ = happyFail++action_65 (48) = happyShift action_68+action_65 (14) = happyGoto action_67+action_65 _ = happyFail++action_66 _ = happyReduce_4++action_67 (49) = happyShift action_82+action_67 _ = happyFail++action_68 (34) = happyShift action_81+action_68 _ = happyFail++action_69 (20) = happyShift action_80+action_69 _ = happyFail++action_70 (52) = happyShift action_79+action_70 _ = happyFail++action_71 _ = happyReduce_11++action_72 _ = happyReduce_8++action_73 (48) = happyShift action_78+action_73 _ = happyFail++action_74 (48) = happyShift action_77+action_74 _ = happyFail++action_75 (48) = happyShift action_76+action_75 _ = happyFail++action_76 (20) = happyShift action_88+action_76 _ = happyFail++action_77 (20) = happyShift action_87+action_77 _ = happyFail++action_78 (20) = happyShift action_86+action_78 _ = happyFail++action_79 (20) = happyShift action_85+action_79 _ = happyFail++action_80 (52) = happyShift action_84+action_80 _ = happyFail++action_81 (48) = happyShift action_83+action_81 _ = happyFail++action_82 _ = happyReduce_23++action_83 (23) = happyShift action_94+action_83 _ = happyFail++action_84 (20) = happyShift action_93+action_84 _ = happyFail++action_85 (52) = happyShift action_92+action_85 _ = happyFail++action_86 (52) = happyShift action_91+action_86 _ = happyFail++action_87 (52) = happyShift action_90+action_87 _ = happyFail++action_88 (52) = happyShift action_89+action_88 _ = happyFail++action_89 (20) = happyShift action_102+action_89 _ = happyFail++action_90 (20) = happyShift action_101+action_90 _ = happyFail++action_91 (20) = happyShift action_100+action_91 _ = happyFail++action_92 (20) = happyShift action_99+action_92 _ = happyFail++action_93 (52) = happyShift action_98+action_93 _ = happyFail++action_94 (24) = happyShift action_96+action_94 (33) = happyShift action_97+action_94 (13) = happyGoto action_95+action_94 _ = happyFail++action_95 (49) = happyShift action_110+action_95 _ = happyFail++action_96 (48) = happyShift action_109+action_96 _ = happyFail++action_97 (48) = happyShift action_108+action_97 _ = happyFail++action_98 (20) = happyShift action_107+action_98 _ = happyFail++action_99 (52) = happyShift action_106+action_99 _ = happyFail++action_100 (52) = happyShift action_105+action_100 _ = happyFail++action_101 (52) = happyShift action_104+action_101 _ = happyFail++action_102 (52) = happyShift action_103+action_102 _ = happyFail++action_103 (20) = happyShift action_126+action_103 _ = happyFail++action_104 (20) = happyShift action_125+action_104 _ = happyFail++action_105 (20) = happyShift action_124+action_105 _ = happyFail++action_106 (20) = happyShift action_123+action_106 _ = happyFail++action_107 (49) = happyShift action_122+action_107 _ = happyFail++action_108 (25) = happyShift action_114+action_108 (26) = happyShift action_115+action_108 (27) = happyShift action_116+action_108 (28) = happyShift action_117+action_108 (29) = happyShift action_118+action_108 (30) = happyShift action_119+action_108 (31) = happyShift action_120+action_108 (32) = happyShift action_121+action_108 (12) = happyGoto action_113+action_108 _ = happyFail++action_109 (20) = happyShift action_112+action_109 _ = happyFail++action_110 (20) = happyShift action_111+action_110 _ = happyFail++action_111 (19) = happyShift action_141+action_111 _ = happyFail++action_112 (52) = happyShift action_140+action_112 _ = happyFail++action_113 (49) = happyShift action_139+action_113 _ = happyFail++action_114 (48) = happyShift action_138+action_114 _ = happyFail++action_115 (48) = happyShift action_137+action_115 _ = happyFail++action_116 (48) = happyShift action_136+action_116 _ = happyFail++action_117 (48) = happyShift action_135+action_117 _ = happyFail++action_118 (20) = happyShift action_134+action_118 _ = happyFail++action_119 (48) = happyShift action_133+action_119 _ = happyFail++action_120 (48) = happyShift action_132+action_120 _ = happyFail++action_121 (48) = happyShift action_131+action_121 _ = happyFail++action_122 _ = happyReduce_6++action_123 (49) = happyShift action_130+action_123 _ = happyFail++action_124 (49) = happyShift action_129+action_124 _ = happyFail++action_125 (49) = happyShift action_128+action_125 _ = happyFail++action_126 (49) = happyShift action_127+action_126 _ = happyFail++action_127 (49) = happyShift action_153+action_127 _ = happyFail++action_128 (48) = happyShift action_152+action_128 _ = happyFail++action_129 (52) = happyShift action_151+action_129 _ = happyFail++action_130 _ = happyReduce_7++action_131 (20) = happyShift action_150+action_131 _ = happyFail++action_132 (20) = happyShift action_149+action_132 _ = happyFail++action_133 (20) = happyShift action_148+action_133 _ = happyFail++action_134 _ = happyReduce_16++action_135 (20) = happyShift action_147+action_135 _ = happyFail++action_136 (20) = happyShift action_146+action_136 _ = happyFail++action_137 (20) = happyShift action_145+action_137 _ = happyFail++action_138 (20) = happyShift action_144+action_138 _ = happyFail++action_139 _ = happyReduce_21++action_140 (20) = happyShift action_143+action_140 _ = happyFail++action_141 (20) = happyShift action_142+action_141 _ = happyFail++action_142 (20) = happyShift action_164+action_142 _ = happyFail++action_143 (52) = happyShift action_163+action_143 _ = happyFail++action_144 (52) = happyShift action_162+action_144 _ = happyFail++action_145 (52) = happyShift action_161+action_145 _ = happyFail++action_146 (52) = happyShift action_160+action_146 _ = happyFail++action_147 (52) = happyShift action_159+action_147 _ = happyFail++action_148 (52) = happyShift action_158+action_148 _ = happyFail++action_149 (52) = happyShift action_157+action_149 _ = happyFail++action_150 (52) = happyShift action_156+action_150 _ = happyFail++action_151 (20) = happyShift action_155+action_151 _ = happyFail++action_152 (20) = happyShift action_154+action_152 _ = happyFail++action_153 _ = happyReduce_27++action_154 (52) = happyShift action_175+action_154 _ = happyFail++action_155 (49) = happyShift action_174+action_155 _ = happyFail++action_156 (20) = happyShift action_173+action_156 _ = happyFail++action_157 (20) = happyShift action_172+action_157 _ = happyFail++action_158 (20) = happyShift action_171+action_158 _ = happyFail++action_159 (20) = happyShift action_170+action_159 _ = happyFail++action_160 (20) = happyShift action_169+action_160 _ = happyFail++action_161 (20) = happyShift action_168+action_161 _ = happyFail++action_162 (20) = happyShift action_167+action_162 _ = happyFail++action_163 (20) = happyShift action_166+action_163 _ = happyFail++action_164 (49) = happyShift action_165+action_164 _ = happyFail++action_165 _ = happyReduce_22++action_166 (49) = happyShift action_184+action_166 _ = happyFail++action_167 (52) = happyShift action_183+action_167 _ = happyFail++action_168 (52) = happyShift action_182+action_168 _ = happyFail++action_169 (52) = happyShift action_181+action_169 _ = happyFail++action_170 (52) = happyShift action_180+action_170 _ = happyFail++action_171 (52) = happyShift action_179+action_171 _ = happyFail++action_172 (52) = happyShift action_178+action_172 _ = happyFail++action_173 (52) = happyShift action_177+action_173 _ = happyFail++action_174 _ = happyReduce_9++action_175 (20) = happyShift action_176+action_175 _ = happyFail++action_176 (52) = happyShift action_192+action_176 _ = happyFail++action_177 (20) = happyShift action_191+action_177 _ = happyFail++action_178 (20) = happyShift action_190+action_178 _ = happyFail++action_179 (20) = happyShift action_189+action_179 _ = happyFail++action_180 (20) = happyShift action_188+action_180 _ = happyFail++action_181 (20) = happyShift action_187+action_181 _ = happyFail++action_182 (20) = happyShift action_186+action_182 _ = happyFail++action_183 (20) = happyShift action_185+action_183 _ = happyFail++action_184 _ = happyReduce_20++action_185 (49) = happyShift action_200+action_185 _ = happyFail++action_186 (49) = happyShift action_199+action_186 _ = happyFail++action_187 (49) = happyShift action_198+action_187 _ = happyFail++action_188 (49) = happyShift action_197+action_188 _ = happyFail++action_189 (49) = happyShift action_196+action_189 _ = happyFail++action_190 (49) = happyShift action_195+action_190 _ = happyFail++action_191 (49) = happyShift action_194+action_191 _ = happyFail++action_192 (20) = happyShift action_193+action_192 _ = happyFail++action_193 (49) = happyShift action_208+action_193 _ = happyFail++action_194 (19) = happyShift action_207+action_194 _ = happyFail++action_195 (48) = happyShift action_206+action_195 _ = happyFail++action_196 (19) = happyShift action_205+action_196 _ = happyFail++action_197 (48) = happyShift action_204+action_197 _ = happyFail++action_198 (19) = happyShift action_203+action_198 _ = happyFail++action_199 (19) = happyShift action_202+action_199 _ = happyFail++action_200 (20) = happyShift action_201+action_200 _ = happyFail++action_201 _ = happyReduce_12++action_202 (20) = happyShift action_215+action_202 _ = happyFail++action_203 (20) = happyShift action_214+action_203 _ = happyFail++action_204 (20) = happyShift action_213+action_204 _ = happyFail++action_205 (20) = happyShift action_212+action_205 _ = happyFail++action_206 (20) = happyShift action_211+action_206 _ = happyFail++action_207 (20) = happyShift action_210+action_207 _ = happyFail++action_208 (49) = happyShift action_209+action_208 _ = happyFail++action_209 _ = happyReduce_26++action_210 (20) = happyShift action_219+action_210 _ = happyFail++action_211 (52) = happyShift action_218+action_211 _ = happyFail++action_212 (48) = happyShift action_217+action_212 _ = happyFail++action_213 (52) = happyShift action_216+action_213 _ = happyFail++action_214 _ = happyReduce_14++action_215 _ = happyReduce_13++action_216 (20) = happyShift action_223+action_216 _ = happyFail++action_217 (20) = happyShift action_222+action_217 _ = happyFail++action_218 (20) = happyShift action_221+action_218 _ = happyFail++action_219 (20) = happyShift action_220+action_219 _ = happyFail++action_220 _ = happyReduce_19++action_221 (52) = happyShift action_226+action_221 _ = happyFail++action_222 (52) = happyShift action_225+action_222 _ = happyFail++action_223 (52) = happyShift action_224+action_223 _ = happyFail++action_224 (20) = happyShift action_229+action_224 _ = happyFail++action_225 (20) = happyShift action_228+action_225 _ = happyFail++action_226 (20) = happyShift action_227+action_226 _ = happyFail++action_227 (49) = happyShift action_232+action_227 _ = happyFail++action_228 (52) = happyShift action_231+action_228 _ = happyFail++action_229 (49) = happyShift action_230+action_229 _ = happyFail++action_230 (19) = happyShift action_235+action_230 _ = happyFail++action_231 (20) = happyShift action_234+action_231 _ = happyFail++action_232 (19) = happyShift action_233+action_232 _ = happyFail++action_233 (20) = happyShift action_238+action_233 _ = happyFail++action_234 (49) = happyShift action_237+action_234 _ = happyFail++action_235 (20) = happyShift action_236+action_235 _ = happyFail++action_236 _ = happyReduce_15++action_237 (20) = happyShift action_240+action_237 _ = happyFail++action_238 (48) = happyShift action_239+action_238 _ = happyFail++action_239 (20) = happyShift action_241+action_239 _ = happyFail++action_240 _ = happyReduce_17++action_241 (52) = happyShift action_242+action_241 _ = happyFail++action_242 (20) = happyShift action_243+action_242 _ = happyFail++action_243 (52) = happyShift action_244+action_243 _ = happyFail++action_244 (20) = happyShift action_245+action_244 _ = happyFail++action_245 (49) = happyShift action_246+action_245 _ = happyFail++action_246 (20) = happyShift action_247+action_246 _ = happyFail++action_247 _ = happyReduce_18++happyReduce_1 = happyReduce 6 4 happyReduction_1+happyReduction_1 (_ `HappyStk`+	(HappyAbsSyn6  happy_var_5) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenInt happy_var_3)) `HappyStk`+	(HappyAbsSyn5  happy_var_2) `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn4+		 (RenderDescr happy_var_2 happy_var_3 happy_var_5+	) `HappyStk` happyRest++happyReduce_2 = happyReduce 8 5 happyReduction_2+happyReduction_2 (_ `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenInt happy_var_6)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenInt happy_var_4)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn5+		 ((happy_var_4,happy_var_6)+	) `HappyStk` happyRest++happyReduce_3 = happyReduce 15 6 happyReduction_3+happyReduction_3 (_ `HappyStk`+	(HappyAbsSyn18  happy_var_14) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	(HappyAbsSyn16  happy_var_10) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	(HappyAbsSyn8  happy_var_6) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	(HappyAbsSyn7  happy_var_3) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn6+		 (Scene happy_var_3 happy_var_6 happy_var_10 happy_var_14+	) `HappyStk` happyRest++happyReduce_4 = happyReduce 13 7 happyReduction_4+happyReduction_4 (_ `HappyStk`+	(HappyTerminal (TokenInt happy_var_12)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenInt happy_var_10)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_7)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_5)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_3)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn7+		 (Camera (happy_var_3,happy_var_5,happy_var_7) (happy_var_10,happy_var_12)+	) `HappyStk` happyRest++happyReduce_5 = happyReduce 8 8 happyReduction_5+happyReduction_5 (_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_7)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_5)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_3)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn8+		 ((happy_var_3,happy_var_5,happy_var_7)+	) `HappyStk` happyRest++happyReduce_6 = happyReduce 9 9 happyReduction_6+happyReduction_6 (_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_8)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_6)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_4)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_2)) `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn9+		 (Sphere happy_var_2 (happy_var_4,happy_var_6,happy_var_8)+	) `HappyStk` happyRest++happyReduce_7 = happyReduce 10 9 happyReduction_7+happyReduction_7 (_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_9)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_7)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_5)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_3)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn9+		 (Plane (happy_var_3,happy_var_5,happy_var_7,happy_var_9)+	) `HappyStk` happyRest++happyReduce_8 = happySpecReduce_3  9 happyReduction_8+happyReduction_8 (HappyTerminal (TokenDouble happy_var_3))+	(HappyAbsSyn11  happy_var_2)+	_+	 =  HappyAbsSyn9+		 (Meta happy_var_2 happy_var_3+	)+happyReduction_8 _ _ _  = notHappyAtAll ++happyReduce_9 = happyReduce 11 10 happyReduction_9+happyReduction_9 (_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_10)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_7)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_5)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_3)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn10+		 (MetaPoint (happy_var_3,happy_var_5,happy_var_7) happy_var_10+	) `HappyStk` happyRest++happyReduce_10 = happySpecReduce_0  11 happyReduction_10+happyReduction_10  =  HappyAbsSyn11+		 ([]+	)++happyReduce_11 = happySpecReduce_2  11 happyReduction_11+happyReduction_11 (HappyAbsSyn10  happy_var_2)+	(HappyAbsSyn11  happy_var_1)+	 =  HappyAbsSyn11+		 (happy_var_2 : happy_var_1+	)+happyReduction_11 _ _  = notHappyAtAll ++happyReduce_12 = happyReduce 9 12 happyReduction_12+happyReduction_12 ((HappyTerminal (TokenDouble happy_var_9)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_7)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_5)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_3)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn12+		 (perlinSolid (happy_var_3,happy_var_5,happy_var_7) happy_var_9+	) `HappyStk` happyRest++happyReduce_13 = happyReduce 10 12 happyReduction_13+happyReduction_13 ((HappyTerminal (TokenDouble happy_var_10)) `HappyStk`+	(HappyTerminal (TokenInt happy_var_9)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_7)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_5)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_3)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn12+		 (perlinSemiTurbulence (happy_var_3,happy_var_5,happy_var_7) happy_var_9 happy_var_10+	) `HappyStk` happyRest++happyReduce_14 = happyReduce 10 12 happyReduction_14+happyReduction_14 ((HappyTerminal (TokenDouble happy_var_10)) `HappyStk`+	(HappyTerminal (TokenInt happy_var_9)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_7)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_5)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_3)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn12+		 (perlinTurbulence (happy_var_3,happy_var_5,happy_var_7) happy_var_9 happy_var_10+	) `HappyStk` happyRest++happyReduce_15 = happyReduce 17 12 happyReduction_15+happyReduction_15 ((HappyTerminal (TokenDouble happy_var_17)) `HappyStk`+	(HappyTerminal (TokenInt happy_var_16)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_14)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_12)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_10)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_7)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_5)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_3)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn12+		 (perlinFire (happy_var_3,happy_var_5,happy_var_7) (happy_var_10,happy_var_12,happy_var_14) +										            happy_var_16 happy_var_17+	) `HappyStk` happyRest++happyReduce_16 = happySpecReduce_2  12 happyReduction_16+happyReduction_16 (HappyTerminal (TokenDouble happy_var_2))+	_+	 =  HappyAbsSyn12+		 (perlinPlasma happy_var_2+	)+happyReduction_16 _ _  = notHappyAtAll ++happyReduce_17 = happyReduce 18 12 happyReduction_17+happyReduction_17 ((HappyTerminal (TokenDouble happy_var_18)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_16)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_14)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_12)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_10)) `HappyStk`+	(HappyTerminal (TokenInt happy_var_9)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_7)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_5)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_3)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn12+		 (perlinMarble (happy_var_3,happy_var_5,happy_var_7) happy_var_9 happy_var_10 +										              (happy_var_12,happy_var_14,happy_var_16) happy_var_18+	) `HappyStk` happyRest++happyReduce_18 = happyReduce 25 12 happyReduction_18+happyReduction_18 ((HappyTerminal (TokenDouble happy_var_25)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_23)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_21)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_19)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_17)) `HappyStk`+	(HappyTerminal (TokenInt happy_var_16)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_14)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_12)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_10)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_7)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_5)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_3)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn12+		 (perlinMarbleBase (happy_var_3,happy_var_5,happy_var_7) +										                  (happy_var_10,happy_var_12,happy_var_14) +                                                                                                  happy_var_16 happy_var_17 +										                  (happy_var_19,happy_var_21,happy_var_23) happy_var_25+	) `HappyStk` happyRest++happyReduce_19 = happyReduce 12 12 happyReduction_19+happyReduction_19 ((HappyTerminal (TokenDouble happy_var_12)) `HappyStk`+	(HappyTerminal (TokenDouble happy_var_11)) `HappyStk`+	(HappyTerminal (TokenDouble happy_var_10)) `HappyStk`+	(HappyTerminal (TokenInt happy_var_9)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_7)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_5)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_3)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn12+		 (perlinWood (happy_var_3,happy_var_5,happy_var_7) happy_var_9 happy_var_10 happy_var_11 happy_var_12+	) `HappyStk` happyRest++happyReduce_20 = happyReduce 8 13 happyReduction_20+happyReduction_20 (_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_7)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_5)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_3)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn13+		 (Solid (happy_var_3,happy_var_5,happy_var_7)+	) `HappyStk` happyRest++happyReduce_21 = happyReduce 4 13 happyReduction_21+happyReduction_21 (_ `HappyStk`+	(HappyAbsSyn12  happy_var_3) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn13+		 (Perlin happy_var_3+	) `HappyStk` happyRest++happyReduce_22 = happyReduce 11 14 happyReduction_22+happyReduction_22 (_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_10)) `HappyStk`+	(HappyTerminal (TokenDouble happy_var_9)) `HappyStk`+	(HappyTerminal (TokenInt happy_var_8)) `HappyStk`+	(HappyTerminal (TokenDouble happy_var_7)) `HappyStk`+	_ `HappyStk`+	(HappyAbsSyn13  happy_var_5) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn14+		 (Texture happy_var_5 happy_var_7 happy_var_8 happy_var_9 happy_var_10+	) `HappyStk` happyRest++happyReduce_23 = happyReduce 7 15 happyReduction_23+happyReduction_23 (_ `HappyStk`+	(HappyAbsSyn14  happy_var_6) `HappyStk`+	_ `HappyStk`+	(HappyAbsSyn9  happy_var_4) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn15+		 ((happy_var_4,happy_var_6)+	) `HappyStk` happyRest++happyReduce_24 = happySpecReduce_0  16 happyReduction_24+happyReduction_24  =  HappyAbsSyn16+		 ([]+	)++happyReduce_25 = happySpecReduce_2  16 happyReduction_25+happyReduction_25 (HappyAbsSyn15  happy_var_2)+	(HappyAbsSyn16  happy_var_1)+	 =  HappyAbsSyn16+		 (happy_var_2 : happy_var_1+	)+happyReduction_25 _ _  = notHappyAtAll ++happyReduce_26 = happyReduce 17 17 happyReduction_26+happyReduction_26 (_ `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_15)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_13)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_11)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_8)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_6)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_4)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn17+		 (PointLight (happy_var_4,happy_var_6,happy_var_8) (happy_var_11,happy_var_13,happy_var_15)+	) `HappyStk` happyRest++happyReduce_27 = happyReduce 10 17 happyReduction_27+happyReduction_27 (_ `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_8)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_6)) `HappyStk`+	_ `HappyStk`+	(HappyTerminal (TokenDouble happy_var_4)) `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	_ `HappyStk`+	happyRest)+	 = HappyAbsSyn17+		 (AmbientLight (happy_var_4,happy_var_6,happy_var_8)+	) `HappyStk` happyRest++happyReduce_28 = happySpecReduce_0  18 happyReduction_28+happyReduction_28  =  HappyAbsSyn18+		 ([]+	)++happyReduce_29 = happySpecReduce_2  18 happyReduction_29+happyReduction_29 (HappyAbsSyn17  happy_var_2)+	(HappyAbsSyn18  happy_var_1)+	 =  HappyAbsSyn18+		 (happy_var_2 : happy_var_1+	)+happyReduction_29 _ _  = notHappyAtAll ++happyNewToken action sts stk [] =+	action 53 53 notHappyAtAll (HappyState action) sts stk []++happyNewToken action sts stk (tk:tks) =+	let cont i = action i i tk (HappyState action) sts stk tks in+	case tk of {+	TokenInt happy_dollar_dollar -> cont 19;+	TokenDouble happy_dollar_dollar -> cont 20;+	TokenCamera -> cont 21;+	TokenBackground -> cont 22;+	TokenDiff -> cont 23;+	TokenSolid -> cont 24;+	TokenPerlinSolid -> cont 25;+	TokenPerlinSemiTurb -> cont 26;+	TokenPerlinTurb -> cont 27;+	TokenPerlinFire -> cont 28;+	TokenPerlinPlasma -> cont 29;+	TokenPerlinMarble -> cont 30;+	TokenPerlinMarbleBase -> cont 31;+	TokenPerlinWood -> cont 32;+	TokenPerlin -> cont 33;+	TokenTexture -> cont 34;+	TokenSphere -> cont 35;+	TokenPlane -> cont 36;+	TokenMeta -> cont 37;+	TokenTexturedObject -> cont 38;+	TokenObjects -> cont 39;+	TokenPointLight -> cont 40;+	TokenAmbientLight -> cont 41;+	TokenLights -> cont 42;+	TokenScene -> cont 43;+	TokenResolution -> cont 44;+	TokenRenderDescr -> cont 45;+	TokenOpenAcc -> cont 46;+	TokenCloseAcc -> cont 47;+	TokenOpenBrack -> cont 48;+	TokenCloseBrack -> cont 49;+	TokenOpenHook -> cont 50;+	TokenCloseHook -> cont 51;+	TokenComma -> cont 52;+	_ -> happyError' (tk:tks)+	}++happyError_ tk tks = happyError' (tk:tks)++newtype HappyIdentity a = HappyIdentity a+happyIdentity = HappyIdentity+happyRunIdentity (HappyIdentity a) = a++instance Monad HappyIdentity where+    return = HappyIdentity+    (HappyIdentity p) >>= q = q p++happyThen :: () => HappyIdentity a -> (a -> HappyIdentity b) -> HappyIdentity b+happyThen = (>>=)+happyReturn :: () => a -> HappyIdentity a+happyReturn = (return)+happyThen1 m k tks = (>>=) m (\a -> k a tks)+happyReturn1 :: () => a -> b -> HappyIdentity a+happyReturn1 = \a tks -> (return) a+happyError' :: () => [(Token)] -> HappyIdentity a+happyError' = HappyIdentity . happyError++parseScene tks = happyRunIdentity happySomeParser where+  happySomeParser = happyThen (happyParse action_0 tks) (\x -> case x of {HappyAbsSyn4 z -> happyReturn z; _other -> notHappyAtAll })++happySeq = happyDontSeq+++happyError :: [Token] -> a+happyError _ = error "Parse error ! ! !"++data Token+       = TokenInt Int+       | TokenDouble Double+       | TokenCamera+       | TokenBackground+       | TokenDiff+       | TokenSolid+       | TokenPerlinSolid+       | TokenPerlinSemiTurb+       | TokenPerlinTurb+       | TokenPerlinFire+       | TokenPerlinPlasma+       | TokenPerlinMarble+       | TokenPerlinMarbleBase+       | TokenPerlinWood+       | TokenPerlin+       | TokenTexture+       | TokenSphere+       | TokenPlane+       | TokenMeta+       | TokenObjType+       | TokenTexturedObject+       | TokenObjects+       | TokenPointLight+       | TokenAmbientLight+       | TokenLight+       | TokenLights+       | TokenScene+       | TokenResolution+       | TokenRenderDescr+       | TokenOpenAcc+       | TokenCloseAcc+       | TokenOpenBrack+       | TokenCloseBrack+       | TokenOpenHook+       | TokenCloseHook+       | TokenComma++lexer :: String -> [Token]+lexer [] = []+lexer (c:cs) +      | isSpace c = lexer cs+      | isAlpha c = lexVar (c:cs)+      | isDigit c = lexNum (c:cs) 1+lexer ('{':cs) = TokenOpenAcc : lexer cs+lexer ('}':cs) = TokenCloseAcc : lexer cs+lexer ('(':cs) = TokenOpenBrack : lexer cs+lexer (')':cs) = TokenCloseBrack : lexer cs+lexer ('[':cs) = TokenOpenHook : lexer cs+lexer (']':cs) = TokenCloseHook : lexer cs+lexer (',':cs) = TokenComma : lexer cs+lexer ('-':cs) = lexNum cs (-1)++lexNum cs mul+          | (r == '.')  = TokenDouble (mul * (read (num++[r]++num2) :: Double)) : lexer rest2+          | otherwise = TokenInt (round (mul * (read num))) : lexer (r:rest)+          where (num,(r:rest)) = span isDigit cs+	        (num2,rest2)   = span isDigit rest++lexVar cs =+   case span isAlpha cs of+      ("camera",rest)            -> TokenCamera : lexer rest+      ("background",rest)        -> TokenBackground : lexer rest+      ("diff",rest)              -> TokenDiff : lexer rest+      ("solid",rest)             -> TokenSolid : lexer rest+      ("perlinSolid",rest)       -> TokenPerlinSolid : lexer rest+      ("perlinSemiTurb",rest)    -> TokenPerlinSemiTurb : lexer rest+      ("perlinTurb",rest)        -> TokenPerlinTurb : lexer rest+      ("perlinFire",rest)        -> TokenPerlinFire : lexer rest+      ("perlinPlasma",rest)      -> TokenPerlinPlasma : lexer rest+      ("perlinMarble",rest)      -> TokenPerlinMarble : lexer rest+      ("perlinMarbleBase",rest)  -> TokenPerlinMarbleBase : lexer rest+      ("perlinWood",rest)        -> TokenPerlinWood : lexer rest+      ("perlin",rest)            -> TokenPerlin : lexer rest+      ("texture",rest)           -> TokenTexture : lexer rest+      ("sphere",rest)            -> TokenSphere : lexer rest+      ("plane",rest)             -> TokenPlane : lexer rest+      ("meta",rest)              -> TokenMeta : lexer rest+      ("object",rest)            -> TokenTexturedObject : lexer rest+      ("objects",rest)           -> TokenObjects : lexer rest+      ("pointLight",rest)        -> TokenPointLight : lexer rest+      ("ambientLight",rest)      -> TokenAmbientLight : lexer rest+      ("light",rest)             -> TokenLight : lexer rest+      ("lights",rest)            -> TokenLights : lexer rest+      ("scene",rest)             -> TokenScene : lexer rest+      ("resolution",rest)        -> TokenResolution : lexer rest+      ("renderDescr",rest)       -> TokenRenderDescr : lexer rest+{-# LINE 1 "templates/GenericTemplate.hs" #-}+{-# LINE 1 "templates/GenericTemplate.hs" #-}+{-# LINE 1 "<built-in>" #-}+{-# LINE 1 "<command line>" #-}+{-# LINE 1 "templates/GenericTemplate.hs" #-}+-- Id: GenericTemplate.hs,v 1.26 2005/01/14 14:47:22 simonmar Exp ++{-# LINE 30 "templates/GenericTemplate.hs" #-}+++++++++{-# LINE 51 "templates/GenericTemplate.hs" #-}++{-# LINE 61 "templates/GenericTemplate.hs" #-}++{-# LINE 70 "templates/GenericTemplate.hs" #-}++infixr 9 `HappyStk`+data HappyStk a = HappyStk a (HappyStk a)++-----------------------------------------------------------------------------+-- starting the parse++happyParse start_state = happyNewToken start_state notHappyAtAll notHappyAtAll++-----------------------------------------------------------------------------+-- Accepting the parse++-- If the current token is (1), it means we've just accepted a partial+-- parse (a %partial parser).  We must ignore the saved token on the top of+-- the stack in this case.+happyAccept (1) tk st sts (_ `HappyStk` ans `HappyStk` _) =+	happyReturn1 ans+happyAccept j tk st sts (HappyStk ans _) = +	 (happyReturn1 ans)++-----------------------------------------------------------------------------+-- Arrays only: do the next action++{-# LINE 148 "templates/GenericTemplate.hs" #-}++-----------------------------------------------------------------------------+-- HappyState data type (not arrays)++++newtype HappyState b c = HappyState+        (Int ->                    -- token number+         Int ->                    -- token number (yes, again)+         b ->                           -- token semantic value+         HappyState b c ->              -- current state+         [HappyState b c] ->            -- state stack+         c)++++-----------------------------------------------------------------------------+-- Shifting a token++happyShift new_state (1) tk st sts stk@(x `HappyStk` _) =+     let (i) = (case x of { HappyErrorToken (i) -> i }) in+--     trace "shifting the error token" $+     new_state i i tk (HappyState (new_state)) ((st):(sts)) (stk)++happyShift new_state i tk st sts stk =+     happyNewToken new_state ((st):(sts)) ((HappyTerminal (tk))`HappyStk`stk)++-- happyReduce is specialised for the common cases.++happySpecReduce_0 i fn (1) tk st sts stk+     = happyFail (1) tk st sts stk+happySpecReduce_0 nt fn j tk st@((HappyState (action))) sts stk+     = action nt j tk st ((st):(sts)) (fn `HappyStk` stk)++happySpecReduce_1 i fn (1) tk st sts stk+     = happyFail (1) tk st sts stk+happySpecReduce_1 nt fn j tk _ sts@(((st@(HappyState (action))):(_))) (v1`HappyStk`stk')+     = let r = fn v1 in+       happySeq r (action nt j tk st sts (r `HappyStk` stk'))++happySpecReduce_2 i fn (1) tk st sts stk+     = happyFail (1) tk st sts stk+happySpecReduce_2 nt fn j tk _ ((_):(sts@(((st@(HappyState (action))):(_))))) (v1`HappyStk`v2`HappyStk`stk')+     = let r = fn v1 v2 in+       happySeq r (action nt j tk st sts (r `HappyStk` stk'))++happySpecReduce_3 i fn (1) tk st sts stk+     = happyFail (1) tk st sts stk+happySpecReduce_3 nt fn j tk _ ((_):(((_):(sts@(((st@(HappyState (action))):(_))))))) (v1`HappyStk`v2`HappyStk`v3`HappyStk`stk')+     = let r = fn v1 v2 v3 in+       happySeq r (action nt j tk st sts (r `HappyStk` stk'))++happyReduce k i fn (1) tk st sts stk+     = happyFail (1) tk st sts stk+happyReduce k nt fn j tk st sts stk+     = case happyDrop (k - ((1) :: Int)) sts of+	 sts1@(((st1@(HappyState (action))):(_))) ->+        	let r = fn stk in  -- it doesn't hurt to always seq here...+       		happyDoSeq r (action nt j tk st1 sts1 r)++happyMonadReduce k nt fn (1) tk st sts stk+     = happyFail (1) tk st sts stk+happyMonadReduce k nt fn j tk st sts stk =+        happyThen1 (fn stk tk) (\r -> action nt j tk st1 sts1 (r `HappyStk` drop_stk))+       where (sts1@(((st1@(HappyState (action))):(_)))) = happyDrop k ((st):(sts))+             drop_stk = happyDropStk k stk++happyMonad2Reduce k nt fn (1) tk st sts stk+     = happyFail (1) tk st sts stk+happyMonad2Reduce k nt fn j tk st sts stk =+       happyThen1 (fn stk tk) (\r -> happyNewToken new_state sts1 (r `HappyStk` drop_stk))+       where (sts1@(((st1@(HappyState (action))):(_)))) = happyDrop k ((st):(sts))+             drop_stk = happyDropStk k stk++++++             new_state = action+++happyDrop (0) l = l+happyDrop n ((_):(t)) = happyDrop (n - ((1) :: Int)) t++happyDropStk (0) l = l+happyDropStk n (x `HappyStk` xs) = happyDropStk (n - ((1)::Int)) xs++-----------------------------------------------------------------------------+-- Moving to a new state after a reduction++{-# LINE 246 "templates/GenericTemplate.hs" #-}+happyGoto action j tk st = action j j tk (HappyState action)+++-----------------------------------------------------------------------------+-- Error recovery ((1) is the error token)++-- parse error if we are in recovery and we fail again+happyFail  (1) tk old_st _ stk =+--	trace "failing" $ +    	happyError_ tk++{-  We don't need state discarding for our restricted implementation of+    "error".  In fact, it can cause some bogus parses, so I've disabled it+    for now --SDM++-- discard a state+happyFail  (1) tk old_st (((HappyState (action))):(sts)) +						(saved_tok `HappyStk` _ `HappyStk` stk) =+--	trace ("discarding state, depth " ++ show (length stk))  $+	action (1) (1) tk (HappyState (action)) sts ((saved_tok`HappyStk`stk))+-}++-- Enter error recovery: generate an error token,+--                       save the old token and carry on.+happyFail  i tk (HappyState (action)) sts stk =+--      trace "entering error recovery" $+	action (1) (1) tk (HappyState (action)) sts ( (HappyErrorToken (i)) `HappyStk` stk)++-- Internal happy errors:++notHappyAtAll = error "Internal Happy error\n"++-----------------------------------------------------------------------------+-- Hack to get the typechecker to accept our action functions++++++++-----------------------------------------------------------------------------+-- Seq-ing.  If the --strict flag is given, then Happy emits +--	happySeq = happyDoSeq+-- otherwise it emits+-- 	happySeq = happyDontSeq++happyDoSeq, happyDontSeq :: a -> b -> b+happyDoSeq   a b = a `seq` b+happyDontSeq a b = b++-----------------------------------------------------------------------------+-- Don't inline any functions from the template.  GHC has a nasty habit+-- of deciding to inline happyGoto everywhere, which increases the size of+-- the generated parser quite a bit.++{-# LINE 310 "templates/GenericTemplate.hs" #-}+{-# NOINLINE happyShift #-}+{-# NOINLINE happySpecReduce_0 #-}+{-# NOINLINE happySpecReduce_1 #-}+{-# NOINLINE happySpecReduce_2 #-}+{-# NOINLINE happySpecReduce_3 #-}+{-# NOINLINE happyReduce #-}+{-# NOINLINE happyMonadReduce #-}+{-# NOINLINE happyGoto #-}+{-# NOINLINE happyFail #-}++-- end of Happy Template.
HRayParser.y view
@@ -1,26 +1,35 @@ {-{--     module HRayParser, which contains a parser which allows to use files containing scene descriptions+{- +     module HRayParser, which contains a parser which allows to use files containing scene descriptions       intended for usage with the other modules in the HRay package-+       author: Kenneth Hoste, 2004-2005      part of a masters thesis at the University of Ghent, Belgium -}  module HRayParser (RenderDescr(RenderDescr), readDescr) where -import HRayEngine (Scene(Scene), Texture(Texture), Diff(Solid,Perlin), TexturedObject,+import HRayEngine (Scene(Scene), Texture(Texture), Diff(Solid,Perlin), TexturedObject,  		   Light(AmbientLight, PointLight), Camera(Camera)) import HRayPerlin (perlinSolid, perlinSemiTurbulence,perlinTurbulence,perlinFire,perlinPlasma,perlinMarble, 		   perlinMarbleBase,perlinWood)-import HRayMath (Dimension, Resolution, Object(Sphere,Plane))-import Data.Char (isSpace, isAlpha, isDigit)+import HRayMath (Dimension, Resolution, Object(Sphere,Plane,Meta), MetaPoint(MetaPoint))+import Char (isSpace, isAlpha, isDigit) -  }++-- representation of a full description of scene which should be rendered+data RenderDescr = RenderDescr Resolution Int Scene+++readDescr :: String -> RenderDescr+readDescr = parseScene.lexer++}+ %name parseScene %tokentype { Token } -%token+%token        int              { TokenInt $$ }       double           { TokenDouble $$ }       camera           { TokenCamera }@@ -37,8 +46,9 @@       perlinWood       { TokenPerlinWood }       perlin           { TokenPerlin }       texture          { TokenTexture }-      sphere           { TokenSphere }-      plane            { TokenPlane }+      sphere           { TokenSphere }  +      plane            { TokenPlane }  +      meta             { TokenMeta }         object           { TokenTexturedObject }       objects          { TokenObjects }       pointLight       { TokenPointLight }@@ -61,34 +71,40 @@  Resolution  : '(' resolution '(' int ',' int ')' ')'                           { ($4,$6) } -Scene       : scene '{' Camera '}' '{' Background '}'+Scene       : scene '{' Camera '}' '{' Background '}'                      '{' objects Objects '}' '{' lights Lights '}'              { Scene $3 $6 $10 $14 } -Camera      : camera '(' double ',' double ',' double ')'+Camera      : camera '(' double ',' double ',' double ')'                       '(' int ',' int ')'                                       { Camera ($3,$5,$7) ($10,$12) }  Background  : background '(' double ',' double ',' double ')'                  { ($3,$5,$7) }  Object      : sphere double '(' double ',' double ',' double ')'               { Sphere $2 ($4,$6,$8) }             | plane '(' double ',' double ',' double ',' double ')'            { Plane ($3,$5,$7,$9) }+            | meta MetaPoints double               		               { Meta $2 $3 } +MetaPoint   : '(' '(' double ',' double ',' double ')' ',' double ')'          { MetaPoint ($3,$5,$7) $10 }++MetaPoints  : {- empty -}						       { [] }+	    | MetaPoints MetaPoint					       { $2 : $1 }+ NoiseF      : perlinSolid '(' double ',' double ',' double ')' double          { perlinSolid ($3,$5,$7) $9 }             | perlinSemiTurb '(' double ',' double ',' double ')' int double   { perlinSemiTurbulence ($3,$5,$7) $9 $10 }             | perlinTurb '(' double ',' double ',' double ')' int double       { perlinTurbulence ($3,$5,$7) $9 $10 }-            | perlinFire '(' double ',' double ',' double ')'-                         '(' double ',' double ',' double ')' int double       { perlinFire ($3,$5,$7) ($10,$12,$14)+            | perlinFire '(' double ',' double ',' double ')' +                         '(' double ',' double ',' double ')' int double       { perlinFire ($3,$5,$7) ($10,$12,$14)  										            $16 $17 }             | perlinPlasma double                                              { perlinPlasma $2 }             | perlinMarble '(' double ',' double ',' double ')' int double-                           '(' double ',' double ',' double ')' double         { perlinMarble ($3,$5,$7) $9 $10+                           '(' double ',' double ',' double ')' double         { perlinMarble ($3,$5,$7) $9 $10  										              ($12,$14,$16) $18 }-            | perlinMarbleBase '(' double ',' double ',' double ')'+            | perlinMarbleBase '(' double ',' double ',' double ')'                                 '(' double ',' double ',' double ')' int double-                               '(' double ',' double ',' double ')' double     { perlinMarbleBase ($3,$5,$7)-										                  ($10,$12,$14)-                                                                                                  $16 $17+                               '(' double ',' double ',' double ')' double     { perlinMarbleBase ($3,$5,$7) +										                  ($10,$12,$14) +                                                                                                  $16 $17  										                  ($19,$21,$23) $25 }-            | perlinWood '(' double ',' double ',' double ')' int double+            | perlinWood '(' double ',' double ',' double ')' int double                 	        double double                                          { perlinWood ($3,$5,$7) $9 $10 $11 $12 }  Diff        : solid '(' double ',' double ',' double ')'                       { Solid ($3,$5,$7) }@@ -101,7 +117,7 @@ Objects     : {- empty -}                                                      { [] }             | Objects TexturedObject                                           { $2 : $1 } -Light       : '(' pointLight '(' double ',' double ',' double ')'+Light       : '(' pointLight '(' double ',' double ',' double ')'                              '(' double ',' double ',' double ')' ')'           { PointLight ($4,$6,$8) ($11,$13,$15) }             | '(' ambientLight '(' double ',' double ',' double ')' ')'        { AmbientLight ($4,$6,$8) } @@ -109,13 +125,7 @@             | Lights Light                                                     { $2 : $1 }  {--- representation of a full description of scene which should be rendered-data RenderDescr = RenderDescr Resolution Int Scene --readDescr :: String -> RenderDescr-readDescr = parseScene.lexer- happyError :: [Token] -> a happyError _ = error "Parse error ! ! !" @@ -138,6 +148,7 @@        | TokenTexture        | TokenSphere        | TokenPlane+       | TokenMeta        | TokenObjType        | TokenTexturedObject        | TokenObjects@@ -158,7 +169,7 @@  lexer :: String -> [Token] lexer [] = []-lexer (c:cs)+lexer (c:cs)        | isSpace c = lexer cs       | isAlpha c = lexVar (c:cs)       | isDigit c = lexNum (c:cs) 1@@ -195,6 +206,7 @@       ("texture",rest)           -> TokenTexture : lexer rest       ("sphere",rest)            -> TokenSphere : lexer rest       ("plane",rest)             -> TokenPlane : lexer rest+      ("meta",rest)              -> TokenMeta : lexer rest       ("object",rest)            -> TokenTexturedObject : lexer rest       ("objects",rest)           -> TokenObjects : lexer rest       ("pointLight",rest)        -> TokenPointLight : lexer rest