make arrows clearer
authorhgn <hgodden00@gmail.com>
Wed, 9 Aug 2023 12:18:56 +0000 (13:18 +0100)
committerhgn <hgodden00@gmail.com>
Wed, 9 Aug 2023 12:18:56 +0000 (13:18 +0100)
blender_export.py

index 8d4c12fb12e5148289065050db153ce0f3d1346c..d8fb6aec0ba0e5609e853d1287146b82b741783d 100644 (file)
@@ -3612,7 +3612,7 @@ def cv_tangent_basis( n, tx, ty ):
 
 # Draw coloured arrow
 #
-def cv_draw_arrow( p0, p1, c0, size=0.25 ):
+def cv_draw_arrow( p0, p1, c0, size=0.25, outline=True ):
 #{
    global cv_view_verts, cv_view_colours
 
@@ -3623,10 +3623,26 @@ def cv_draw_arrow( p0, p1, c0, size=0.25 ):
    tx = Vector((1,0,0))
    ty = Vector((1,0,0))
    cv_tangent_basis( n, tx, ty )
-   
+   tx *= 0.5
+   ty *= 0.5
+
+   if outline:#{
+      cv_draw_lines()
+      gpu.state.line_width_set(1.0)
+   #}
+
    cv_view_verts += [p0,p1, midpt+(tx-n)*size,midpt, midpt+(-tx-n)*size,midpt ]
    cv_view_colours += [c0,c0,c0,c0,c0,c0]
-   #cv_draw_lines()
+   cv_draw_lines()
+
+   if outline:#{
+      gpu.state.line_width_set(3.0)
+      cv_view_verts += [p0,p1,midpt+(tx-n)*size,midpt,midpt+(-tx-n)*size,midpt]
+      b0 = (0,0,0)
+      cv_view_colours += [b0,b0,b0,b0,b0,b0]
+      cv_draw_lines()
+      gpu.state.line_width_set(2.0)
+   #}
 #}
 
 def cv_draw_line_dotted( p0, p1, c0, dots=10 ):
@@ -3949,17 +3965,17 @@ def cv_ent_volume( obj ):
    data = obj.SR_data.ent_volume[0]
 
    if data.subtype == '0':#{
-      cv_draw_ucube( obj.matrix_world, (0,1,0) )
+      cv_draw_ucube( obj.matrix_world, (0,1,0), Vector((0.99,0.99,0.99)) )
 
       if data.target:#{
-         cv_draw_arrow( obj.location, data.target.location, (0,1,0) )
+         cv_draw_arrow( obj.location, data.target.location, (1,1,1) )
       #}
    #}
    elif data.subtype == '1':#{
       cv_draw_ucube( obj.matrix_world, (1,1,0) )
 
       if data.target:#{
-         cv_draw_arrow( obj.location, data.target.location, (1,1,0) )
+         cv_draw_arrow( obj.location, data.target.location, (1,1,1) )
       #}
    #}
 #}
@@ -4178,14 +4194,14 @@ def cv_draw_route( route, dij ):
       path = solve_graph( dij, gi.name, gj.name )
 
       if path:#{
-         cv_draw_arrow(gi.location,dij.points[path[0]],cc,1.5)
-         cv_draw_arrow(dij.points[path[len(path)-1]],gj.location,cc,1.5)
+         cv_draw_arrow(gi.location,dij.points[path[0]],cc,1.5,False)
+         cv_draw_arrow(dij.points[path[len(path)-1]],gj.location,cc,1.5,False)
          for j in range(len(path)-1):#{
             i0 = path[j]
             i1 = path[j+1]
             o0 = dij.points[ i0 ]
             o1 = dij.points[ i1 ]
-            cv_draw_arrow(o0,o1,cc,1.5)
+            cv_draw_arrow(o0,o1,cc,1.5,False)
          #}
       #}
       else:#{
@@ -4205,7 +4221,7 @@ def cv_draw():#{
    cv_view_colours = []
 
    cv_view_shader.bind()
-   gpu.state.depth_mask_set(False)
+   gpu.state.depth_mask_set(True)
    gpu.state.line_width_set(2.0)
    gpu.state.face_culling_set('BACK')
    gpu.state.depth_test_set('LESS')
@@ -4240,26 +4256,26 @@ def cv_draw():#{
          elif ent_type == 'ent_challenge':#{
             data = obj.SR_data.ent_challenge[0]
             if data.proxima:#{
-               cv_draw_arrow( obj.location, data.proxima.location, (0,0.2,1.0) )
+               cv_draw_arrow( obj.location, data.proxima.location, (1,1,1) )
             #}
             if data.target:
-               cv_draw_arrow( obj.location, data.target.location, (0,1.0,0.0) )
+               cv_draw_arrow( obj.location, data.target.location, (1,1,1) )
          #}
          elif ent_type == 'ent_relay':#{
             data = obj.SR_data.ent_relay[0]
             if data.target0:
-               cv_draw_arrow( obj.location, data.target0.location, (0,1,0) )
+               cv_draw_arrow( obj.location, data.target0.location, (1,1,1) )
             if data.target1:
-               cv_draw_arrow( obj.location, data.target1.location, (0,1,0) )
+               cv_draw_arrow( obj.location, data.target1.location, (1,1,1) )
             if data.target2:
-               cv_draw_arrow( obj.location, data.target2.location, (0,1,0) )
+               cv_draw_arrow( obj.location, data.target2.location, (1,1,1) )
             if data.target3:
-               cv_draw_arrow( obj.location, data.target3.location, (0,1,0) )
+               cv_draw_arrow( obj.location, data.target3.location, (1,1,1) )
          #}
          elif ent_type == 'ent_unlock':#{
             data = obj.SR_data.ent_unlock[0]
             if data.target:
-               cv_draw_arrow( obj.location, data.target.location, (0,1.0,0.0) )
+               cv_draw_arrow( obj.location, data.target.location, (1,1,1) )
             cc1 = (0.4,0.3,0.2)
             info_cu = Vector((1.2,0.01,0.72))*0.5
             info_co = Vector((0.0,0.0,0.72))*0.5