本文整理汇总了C#中IRenderable.GetWorldTransform方法的典型用法代码示例。如果您正苦于以下问题:C# IRenderable.GetWorldTransform方法的具体用法?C# IRenderable.GetWorldTransform怎么用?C# IRenderable.GetWorldTransform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRenderable
的用法示例。
在下文中一共展示了IRenderable.GetWorldTransform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _getClipModels
/// <param name="depth">Number of iterations.</param>
/// <param name="clipModels">Adds the ClipModel instances to this list.</param>
private static List<ClipModel> _getClipModels(IRenderable entity, Model model, IList<IPortal> portalList, Vector2 centerPoint, IPortal portalEnter, Matrix4 modelMatrix, int depth, int count)
{
List<ClipModel> clipModels = new List<ClipModel>();
if (depth <= 0)
{
return clipModels;
}
List<IPortal> collisions = Portal.GetCollisions(
centerPoint,
Vector2Ext.Transform(model.GetWorldConvexHull(),
entity.GetWorldTransform().GetMatrix() * modelMatrix),
portalList,
PORTAL_CLIP_MARGIN);
List<LineF> clipLines = new List<LineF>();
foreach (IPortal portal in collisions)
{
Vector2[] pv = Portal.GetWorldVerts(portal);
LineF clipLine = new LineF(pv);
LineF portalLine = new LineF(pv);
Vector2 normal = portal.WorldTransform.GetRight();
if (portal.WorldTransform.MirrorX)
{
normal = -normal;
}
Vector2 portalNormal = portal.WorldTransform.Position + normal;
if (portalLine.GetSideOf(centerPoint) != portalLine.GetSideOf(portalNormal))
{
normal *= Portal.EnterMinDistance;
}
else
{
clipLine = clipLine.Reverse();
normal *= -Portal.EnterMinDistance;
}
clipLines.Add(clipLine);
if (portalEnter == null || portal != portalEnter.Linked)
{
Vector2 centerPointNext = Vector2Ext.Transform(portal.WorldTransform.Position + normal, Portal.GetLinkedMatrix(portal));
clipModels.AddRange(_getClipModels(entity, model, portalList, centerPointNext, portal, modelMatrix * Portal.GetLinkedMatrix(portal), depth - 1, count + 1));
}
}
clipModels.Add(new ClipModel(entity, model, clipLines.ToArray(), modelMatrix));
return clipModels;
}
示例2: GetClipModels
public static List<ClipModel> GetClipModels(IRenderable entity, IList<IPortal> portalList, int depth)
{
List<ClipModel> clipModels = new List<ClipModel>();
if (entity.IsPortalable && !entity.DrawOverPortals)
{
foreach (Model m in entity.GetModels())
{
clipModels.AddRange(_getClipModels(entity, m, portalList, entity.GetWorldTransform().Position, null, Matrix4.Identity, depth, 0));
}
}
else
{
foreach (Model m in entity.GetModels())
{
clipModels.Add(new ClipModel(entity, m, new LineF[0], Matrix4.Identity));
}
}
return clipModels;
}