예제 #1
0
 public static void UpdateDrawLine3D()
 {
     if (Line3D.Count > 0)
     {
         if (!Node.IsInstanceValid(instance))
         {
             Scene.Current.AddChild(instance = new DrawDebugLine3D());
             instance.Owner = Scene.Current;
             var mat = new SpatialMaterial();
             instance.MaterialOverride    = mat;
             mat.VertexColorUseAsAlbedo   = true;
             mat.FlagsUnshaded            = true;
             mat.FlagsDoNotReceiveShadows = true;
         }
         instance.Clear();
         instance.Begin(Mesh.PrimitiveType.Lines);
         foreach (var line in Line3D)
         {
             instance.SetColor(line.color);
             instance.AddVertex(line.origin);
             instance.AddVertex(line.end);
         }
         instance.End();
         Line3D.Clear();
     }
     else if (Node.IsInstanceValid(instance))
     {
         instance.QueueFree();
     }
 }
예제 #2
0
 public void Clear()
 {
     lines.Clear();
     texts.Clear();
 }