diff --git a/src/ifcblenderexport/blenderbim/bim/decoration.py b/src/ifcblenderexport/blenderbim/bim/decoration.py index c17926a78c..ee5fc7239a 100644 --- a/src/ifcblenderexport/blenderbim/bim/decoration.py +++ b/src/ifcblenderexport/blenderbim/bim/decoration.py @@ -21,29 +21,40 @@ class BaseDecorator(): DEF_GLSL = """ #define PI 3.141592653589793 + #define COLOR vec4({color[0]}, {color[1]}, {color[2]}, {color[3]}) #define MAX_POINTS 64 #define CIRCLE_SEGS 24 - #define ARROW1_ANGLE PI / 12.0 - #define ARROW2_ANGLE PI / 3.0 - #define ARROW1_SIZE 16.0 - #define ARROW2_SIZE 24.0 - #define CIRCLE1_SIZE 8.0 - #define CIRCLE2_SIZE 8.0 - #define DASH1_SIZE 16.0 - #define DASH2_SIZE 48.0 - #define DASH_GAP 4.0 - #define CROSS_SIZE 16.0 - #define CALLOUT_GAP 8.0 - #define CALLOUT_SIZE 64.0 - #define COLOR vec4({color[0]}, {color[1]}, {color[2]}, {color[3]}) - #define BREAK_LENGTH 32.0 - #define BREAK_WIDTH 16.0 + """ - #define DASH_SIZE 48.0 - #define CIRCLE_SIZE 16.0 - #define DASH_PATTERN 0x03C0FFFFU + LIB_GLSL = """ + #define matCLIP2WIN() vec4(winsize.x/2, winsize.y/2, 1, 1) + #define matWIN2CLIP() vec4(2/winsize.x, 2/winsize.y, 1, 1) + #define CLIP2WIN(v) (clip2win * v / v.w) + #define WIN2CLIP(v) (win2clip * v * v.w) - #define UNPROJ(v, p) (unwindowMatrix * vec4(v, 0, 0) * p.w); + void arrow_head(in vec4 dir, in float size, in float angle, out vec4 head[3]) { + vec4 nose = dir * size; + float c = cos(angle), s = sin(angle); + head[0] = nose; + head[1] = vec4(mat2(c, -s, +s, c) * nose.xy, 0, 0); + head[2] = vec4(mat2(c, +s, -s, c) * nose.xy, 0, 0); + } + + void circle_head(in float size, out vec4 head[CIRCLE_SEGS]) { + float angle_d = PI * 2 / CIRCLE_SEGS; + for(int i = 0; i 0.5) { - discard; - } else { - fragColor = COLOR; - } + uint bit = uint(fract(dist / DASH_SIZE) * 32); + if ((DASH_PATTERN & (1U<