PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/tutorial/vision/opengl/pyramid.e

http://github.com/tybor/Liberty
Specman e | 37 lines | 29 code | 7 blank | 1 comment | 0 complexity | 7d40b2f205db1ceabd941c1aa55bcd0a MD5 | raw file
 1class PYRAMID
 2
 3inherit
 4	GL_OBJECT
 5
 6creation
 7	make_at_origin, make_with_position
 8
 9feature{ANY}
10	build is
11		do
12			create vertices.make(5)
13			vertices.put(create {VERTEX}.make_with_color_object(0, 1, 0, full_red), 0)
14			vertices.put(create {VERTEX}.make_with_color_object(-1, -1, -1, full_green), 1)
15			vertices.put(create {VERTEX}.make_with_color_object(1, -1, -1, full_blue), 2)
16			vertices.put(create {VERTEX}.make_with_color_object(1, -1, 1, full_magenta), 3)
17			vertices.put(create {VERTEX}.make_with_color_object(-1, -1, 1, full_cyan), 4)
18
19			-- Vertices must be given in counter-clockwise order when look toward the facet
20			facets.add_last(create {FACET}.make(vertices.item(0), vertices.item(2), vertices.item(1)))
21			facets.add_last(create {FACET}.make(vertices.item(0), vertices.item(3), vertices.item(2)))
22			facets.add_last(create {FACET}.make(vertices.item(0), vertices.item(4), vertices.item(3)))
23			facets.add_last(create {FACET}.make(vertices.item(0), vertices.item(1), vertices.item(4)))
24			facets.add_last(create {FACET}.make(vertices.item(4), vertices.item(1), vertices.item(3)))
25			facets.add_last(create {FACET}.make(vertices.item(1), vertices.item(2), vertices.item(3)))
26		end
27
28	turn(ang_x, ang_y : REAL) is
29		do
30			set_pitch(ang_x)
31			set_heading(ang_y)
32		end
33
34feature {}
35	vertices: FAST_ARRAY[VERTEX]
36
37end