當前位置: 首頁>>代碼示例>>C#>>正文


C# BoundingBox.AddBox方法代碼示例

本文整理匯總了C#中BoundingBox.AddBox方法的典型用法代碼示例。如果您正苦於以下問題:C# BoundingBox.AddBox方法的具體用法?C# BoundingBox.AddBox怎麽用?C# BoundingBox.AddBox使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BoundingBox的用法示例。


在下文中一共展示了BoundingBox.AddBox方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PerformRelevantOperation

    public override void PerformRelevantOperation(string name, int iShapeIndex, int iShapeCount)
    {
      base.PerformRelevantOperation(name, iShapeIndex, iShapeCount);

      if (name == RO_RECENTER)
      {
        ShapeCollection shapes = GetRelevantShapes();
        TriggerRecenterPosition(shapes);
        return;
      }

     #if (MESHGROUP_USE_LINKING)
      if (name == RO_ADJUST_BBOX)
      {
        ShapeLink src = GetGroupStaticMeshesLinkSource();
        if (src == null || src.Links.Count == 0)
          return;

        BoundingBox newbbox = new BoundingBox();
        foreach (LinkTarget tgt in src.Links)
        {
          BoundingBox bbox = tgt.OwnerShape.AbsoluteBoundingBox;
          if (bbox != null && bbox.Valid)
            newbbox.AddBox(bbox);
        }
        if (newbbox.Valid)
        {
          EditorManager.Actions.StartGroup(RO_ADJUST_BBOX);
          Vector3F size = new Vector3F(newbbox.SizeX,newbbox.SizeY,newbbox.SizeZ);
          EditorManager.Actions.Add(new MoveShapeAction(this,this.Position,newbbox.Center));
          EditorManager.Actions.Add(SetPropertyAction.CreateSetPropertyAction(this, "BoxSize", size));

          EditorManager.Actions.EndGroup();
        }
      }

      if (name == RO_LINK_TO_TOUCHING_SHAPES || name == RO_LINK_TO_SHAPES_INSIDE)
      {
        EvaluateBBoxLinksVisitor visitor = new EvaluateBBoxLinksVisitor(this, name == RO_LINK_TO_TOUCHING_SHAPES);
        foreach (Layer layer in EditorManager.Scene.Layers)
          if (layer.Modifiable)
            layer.Root.RunVisitor(visitor);

        if (visitor.RelevantTargets.Count > 0)
        {
          LinkSource linkSrc = GetGroupStaticMeshesLinkSource();
          EditorManager.Actions.StartGroup(name);
          foreach (LinkTarget target in visitor.RelevantTargets)
            EditorManager.Actions.Add(new LinkAction(linkSrc, target));

          EditorManager.Actions.EndGroup();
        }
      }
     #endif
    }
開發者ID:hxzpily,項目名稱:projectanarchy,代碼行數:55,代碼來源:StaticMeshGroupShape.cs

示例2: GetShapePosAndBox

        bool GetShapePosAndBox(ShapeBase shape, out Vector3F pos, out BoundingBox box)
        {
            if (shape.HasChildren())
              {
            int iValidCount = 0;
            BoundingBox baccum = new BoundingBox();
            Vector3F paccum = Vector3F.Zero;
            foreach (ShapeBase child in shape.ChildCollection)
            {
              BoundingBox b1;
              Vector3F p1;
              if (!GetShapePosAndBox(child, out p1, out b1))
            continue;
              iValidCount++;
              paccum += p1;
              if (b1 != null && b1.Valid)
            baccum.AddBox(b1);
            }
            pos = paccum;
            box = baccum;
            if (iValidCount == 0)
              return false;
            pos *= (1.0f / (float)iValidCount); // average position
            return true;
              }

              if (shape is Shape3D)
              {
            pos = ((Shape3D)shape).Position;
            box = ((Shape3D)shape).AbsoluteBoundingBox;
            if (box == null || !box.Valid)
              box = null;
            return true;
              }
              pos = Vector3F.Zero;
              box = null;
              return false;
        }
開發者ID:romance-ii,項目名稱:projectanarchy,代碼行數:38,代碼來源:SortShapesIntoZonesAction.cs


注:本文中的BoundingBox.AddBox方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。