diff --git a/src/ifcblenderexport/blenderbim/bim/decoration.py b/src/ifcblenderexport/blenderbim/bim/decoration.py index 5bccfd7a60..fdf9321d8b 100644 --- a/src/ifcblenderexport/blenderbim/bim/decoration.py +++ b/src/ifcblenderexport/blenderbim/bim/decoration.py @@ -25,10 +25,13 @@ class BaseDecorator(): VERT_GLSL = """ uniform mat4 viewMatrix; in vec3 pos; + in uint style; out vec4 gl_Position; + out uint vstyle; void main() { gl_Position = viewMatrix * vec4(pos, 1.0); + vstyle = style; } """ GEOM_GLSL = """ @@ -44,15 +47,43 @@ class BaseDecorator(): EndPrimitive(); } """ + FRAG_GLSL = """ - uniform vec3 color; out vec4 fragColor; void main() { - fragColor = vec4(color, 1.0); + fragColor = vec4(1.0, 1.0, 1.0, 1.0); } """ + LIB_GLSL = """ + void arrow_head(in vec2 p0, in vec2 p1, out vec2 head[3]) { + vec2 nose = normalize(p1 - p0) * ARROW_SIZE; + float c = cos(ARROW_ANGLE), s = sin(ARROW_ANGLE); + head[0] = nose; + head[1] = mat2(c, -s, +s, c) * nose; + head[2] = mat2(c, +s, -s, c) * nose; + } + + void circle_head(in vec2 p0, in vec2 p1, out vec2 head[CIRCLE_SEGS]) { + vec2 nose = normalize(p1 - p0) * CIRCLE_SIZE ; + float angle = PI / (CIRCLE_SEGS / 2); + for(int i = 0; i