rev: 3827f53bae88e48a594610914ba74b9512ead6dd tukan/testing/test_vertexpainter.sc -rw-r--r-- 1.4 KiB View raw Log this file
3827f53bae88 — Leonard Ritter * more work on module system 3 months ago
                                                                                
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
using import glm

import ..tukan.use
using import tukan.VertexPainter
using import tukan.GLMain
using import tukan.gl

let glmain =
    GLMain
        title = "VertexPainter"
        resizable = true

global t = 0.0

@@ 'on GLMain.on-draw
fn draw (time size glmain)
    let painter = (VertexPainter)
    'setup-depth painter
    GL.BindFramebuffer GL.FRAMEBUFFER 0
    GL.Viewport 0 0 (i32 size.x) (i32 size.y)
    GL.ClearColor 0 0 0.5 1
    GL.Enable GL.CULL_FACE
    GL.Clear
        |
            GL.COLOR_BUFFER_BIT
            GL.DEPTH_BUFFER_BIT
            GL.STENCIL_BUFFER_BIT

    t += (/ 60.0)

    from (methodsof painter) let screen color screen rotate AABB \
        translate quad perspective scale light flush wireframe moveto lineto \
        closepath fill stroke
    # setup view
    light 0 0 1
    perspective size
    translate
        vec3 0 0 3
    rotate
        t * pi * 0.1
        vec3 1 0 0
    # setup object
    #rotate
        t * pi * 0.5
        vec3 1 1 0
    # draw object
    let c0 c1 =
        vec3 -1 -0.5 -0.25
        vec3 1 0.5 0.25
    switch 0
    case 0
        #wireframe;
        color 1 0 0
        AABB c0 c1 0b11
        color 0 1 0
        AABB c0 c1 0b1100
        color 0 0 1
        AABB c0 c1 0b110000
    case 1
        moveto 0 0
        lineto 1 0
        lineto 1.5 0.5
        lineto 1 1
        lineto 0 1
        lineto -0.5 0.5
        closepath;
    default;

'run glmain

;