-
Notifications
You must be signed in to change notification settings - Fork 0
/
cube.hs
82 lines (64 loc) · 2.64 KB
/
cube.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
module Cube where
import Graphics.Rendering.OpenGL
import Graphics.UI.GLUT
import State
--(-w)->(-w/10)(w)->(w/10)
cubeFrame w = do
renderPrimitive Lines $ do
vertex $ Vertex3 w (-w) (w/10)
vertex $ Vertex3 w w (w/10)
vertex $ Vertex3 w w (w/10)
vertex $ Vertex3 (-w) w (w/10)
vertex $ Vertex3 (-w) w (w/10)
vertex $ Vertex3 (-w) (-w) (w/10)
vertex $ Vertex3 (-w) (-w) (w/10)
vertex $ Vertex3 w (-w) (w/10)
vertex $ Vertex3 w (-w) (w/10)
vertex $ Vertex3 w (-w) (-w/10)
vertex $ Vertex3 w w (w/10)
vertex $ Vertex3 w w (-w/10)
vertex $ Vertex3 (-w) w (w/10)
vertex $ Vertex3 (-w) w (-w/10)
vertex $ Vertex3 (-w) (-w) (w/10)
vertex $ Vertex3 (-w) (-w) (-w/10)
vertex $ Vertex3 w (-w) (-w/10)
vertex $ Vertex3 w w (-w/10)
vertex $ Vertex3 w w (-w/10)
vertex $ Vertex3 (-w) w (-w/10)
vertex $ Vertex3 (-w) w (-w/10)
vertex $ Vertex3 (-w) (-w) (-w/10)
vertex $ Vertex3 (-w) (-w) (-w/10)
vertex $ Vertex3 w (-w) (-w/10)
cube w (Attributes (x, y, z, w_w, r, d, c, (c_r,c_g,c_b))) = do
--preservingMatrix $ do
renderPrimitive Quads $ do
--color $ Color4 (0.5::GLfloat) 0.5 0.5 1.0
--color $ Color4 (0.5::GLfloat) 0.5 0.5 1.0
vertex $ Vertex3 w w (w/10)
vertex $ Vertex3 w w (-w/10)
vertex $ Vertex3 w (-w) (-w/10)
vertex $ Vertex3 w (-w) (w/10)
vertex $ Vertex3 w w (w/10)
vertex $ Vertex3 w w (-w/10)
vertex $ Vertex3 (-w) w (-w/10)
vertex $ Vertex3 (-w) w (w/10)
--color $ Color4 ((1-(x+1)/4)::GLfloat) (1-(y+1)/4) (1-(z+1)/4) 1.0
vertex $ Vertex3 w w (w/10)
vertex $ Vertex3 w (-w) (w/10)
vertex $ Vertex3 (-w) (-w) (w/10)
vertex $ Vertex3 (-w) w (w/10)
--color $ Color4 (0.5::GLfloat) 0.5 0.5 1
vertex $ Vertex3 (-w) w (w/10)
vertex $ Vertex3 (-w) w (-w/10)
vertex $ Vertex3 (-w) (-w) (-w/10)
vertex $ Vertex3 (-w) (-w) (w/10)
vertex $ Vertex3 w (-w) (w/10)
vertex $ Vertex3 w (-w) (-w/10)
vertex $ Vertex3 (-w) (-w) (-w/10)
vertex $ Vertex3 (-w) (-w) (w/10)
--color $ Color4 (c_r::GLfloat) c_g c_b 1
vertex $ Vertex3 w w (-w/10)
vertex $ Vertex3 w (-w) (-w/10)
vertex $ Vertex3 (-w) (-w) (-w/10)
vertex $ Vertex3 (-w) w (-w/10)
flush