summaryrefslogtreecommitdiff
path: root/chart2/opengl/symbolFragmentShader.glsl
blob: bb3e4dab7831ba0c03aa6c68c8b0f8770bbf8f91 (plain)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#version 130

varying vec4 fragmentColor;
uniform int shape;

void main()
{
    vec2 p = gl_PointCoord * 2.0 - vec2(1.0); // (0,0) in the center
    if(shape == 0)
    {
    }
    else if(shape == 1) //diamon
    {
        if (abs(p.x) + abs(p.y) > 1)
            discard;
    }
    else if(shape == 2) // arrow
    {
        if(p.y < 0 && (abs(p.x) + abs(p.y)) > 1)
            discard;
        else if(p.y > 0 && abs(p.x) > 0.5)
            discard;
    }
    else if(shape == 3) //arrow up
    {
        if(p.y > 0 && (abs(p.x) + abs(p.y)) > 1)
            discard;
        else if(p.y < 0 && abs(p.x) > 0.5)
            discard;
    }
    else if(shape == 4) // arrow right
    {
        if(p.x > 0 && (abs(p.x) + abs(p.y)) > 1)
            discard;
        else if(p.x < 0 && abs(p.y) > 0.5)
            discard;
    }
    else if(shape == 5) // arrow left
    {
        if(p.x < 0 && (abs(p.x) + abs(p.y)) > 1)
            discard;
        else if(p.x > 0 && abs(p.y) > 0.5)
            discard;
    }
    else if(shape == 6) // hour glass
    {
        if(abs(p.x) < abs(p.y))
            discard;
    }
    else if(shape == 7) // bow tie
    {
        if(abs(p.y) < abs(p.x))
            discard;
    }
    else if(shape == 8) // circle
    {
        if(dot(p.x, p.y) > 1)
            discard;
    }
    else if(shape == 9) // star
    {
        if(sqrt(abs(p.x))+sqrt(abs(p.y)) > 1)
            discard;
    }
    else if(shape == 10) // X
    {
        if(abs(abs(p.x) - abs(p.y)) > 0.2)
            discard;
    }
    else if(shape == 11) // Plus
    {
        if(abs(p.x) > 0.2 && abs(p.y) > 0.2)
            discard;
    }
    else if(shape == 12) // asterisk
    {
    }
    else if(shape == 13) // horizontal bar
    {
        if(abs(p.y) > 0.2)
            discard;
    }
    else if(shape == 14) // vertical bar
    {
        if(abs(p.x) > 0.2)
            discard;
    }
    
    gl_FragColor = fragmentColor;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */