当前位置: 首页>>代码示例>>C#>>正文


C# IRenderable.GetWorldTransform方法代码示例

本文整理汇总了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;
        }
开发者ID:AyyTee,项目名称:Aventyr,代码行数:51,代码来源:Clip.cs

示例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;
 }
开发者ID:AyyTee,项目名称:Aventyr,代码行数:19,代码来源:Clip.cs


注:本文中的IRenderable.GetWorldTransform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。