Some update of the code
This commit is contained in:
parent
b107d761d0
commit
7f2eb20fb7
2 changed files with 6 additions and 2 deletions
|
@ -36,6 +36,7 @@ Here is a real working code, I've hidden most display functions.
|
||||||
The YGL, is a kind of framework to display 3D functions.
|
The YGL, is a kind of framework to display 3D functions.
|
||||||
But it can easily be extended to many kind of representation.
|
But it can easily be extended to many kind of representation.
|
||||||
|
|
||||||
|
> import Debug.Trace (trace)
|
||||||
> import YGL -- Most the OpenGL Boilerplate
|
> import YGL -- Most the OpenGL Boilerplate
|
||||||
> import Mandel -- The 3D Mandelbrot maths
|
> import Mandel -- The 3D Mandelbrot maths
|
||||||
|
|
||||||
|
@ -193,7 +194,9 @@ Because we consider partial functions
|
||||||
> if and [ findMaxOrdFor (ymandel (x+xeps) (y+yeps)) 0 1 20 < 0.000001 |
|
> if and [ findMaxOrdFor (ymandel (x+xeps) (y+yeps)) 0 1 20 < 0.000001 |
|
||||||
> val <- [res], xeps <- [-val,val], yeps<-[-val,val]]
|
> val <- [res], xeps <- [-val,val], yeps<-[-val,val]]
|
||||||
> then Nothing
|
> then Nothing
|
||||||
> else Just (z,colorFromValue (ymandel x y z))
|
> else Just (z,colorFromValue ((ymandel x y z) * 64))
|
||||||
|
|
||||||
|
With the color function.
|
||||||
|
|
||||||
> colorFromValue n =
|
> colorFromValue n =
|
||||||
> let
|
> let
|
||||||
|
@ -223,3 +226,4 @@ This file is commented a lot.
|
||||||
- [`YGL.hs`](code/05_Mandelbulb/YGL.hs), the 3D rendering framework
|
- [`YGL.hs`](code/05_Mandelbulb/YGL.hs), the 3D rendering framework
|
||||||
- [`Mandel`](code/05_Mandelbulb/Mandel.hs), the mandel function
|
- [`Mandel`](code/05_Mandelbulb/Mandel.hs), the mandel function
|
||||||
- [`ExtComplex`](code/05_Mandelbulb/ExtComplex.hs), the extended complexes
|
- [`ExtComplex`](code/05_Mandelbulb/ExtComplex.hs), the extended complexes
|
||||||
|
|
||||||
|
|
|
@ -324,7 +324,7 @@ drawObject shape = do
|
||||||
-- We will print only Triangles
|
-- We will print only Triangles
|
||||||
renderPrimitive Triangles $ do
|
renderPrimitive Triangles $ do
|
||||||
-- solarized base3 color
|
-- solarized base3 color
|
||||||
color $ hexColor "#fdf603"
|
-- color $ hexColor "#fdf603"
|
||||||
mapM_ drawAtom (atoms shape)
|
mapM_ drawAtom (atoms shape)
|
||||||
|
|
||||||
-- simply draw an Atom
|
-- simply draw an Atom
|
||||||
|
|
Loading…
Reference in a new issue