本文整理汇总了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
}
示例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;
}