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


C# Model.GetVerticesAndIndices方法代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.Model.GetVerticesAndIndices方法的典型用法代码示例。如果您正苦于以下问题:C# Model.GetVerticesAndIndices方法的具体用法?C# Model.GetVerticesAndIndices怎么用?C# Model.GetVerticesAndIndices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Xna.Framework.Graphics.Model的用法示例。


在下文中一共展示了Model.GetVerticesAndIndices方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BoxModelPhysics

 /// <summary>
 /// Create box model physics.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="model">The visual model.</param>
 /// <param name="position">The position of the box entity.</param>
 /// <param name="mass">The physics mass.</param>
 public BoxModelPhysics(XiGame game, Model model, Vector3 position, float mass)
 {
     this.game = game;
     Vector3[] vertices;
     int[] indices;
     model.GetVerticesAndIndices(out vertices, out indices);
     BoundingBox boundingBox = BoundingBox.CreateFromPoints(vertices);
     body = new BEPUphysics.Entities.Box(
         position,
         Math.Max(Math.Abs(boundingBox.Max.X), Math.Abs(boundingBox.Min.X)) * 2,
         Math.Max(Math.Abs(boundingBox.Max.Y), Math.Abs(boundingBox.Min.Y)) * 2,
         Math.Max(Math.Abs(boundingBox.Max.Z), Math.Abs(boundingBox.Min.Z)) * 2,
         mass);
     /*
     this alternative method does not work and I don't know why -
     Box box = new Box(
         (boundingBox.Max + boundingBox.Min) * 0.5f,
         boundingBox.Max.X - boundingBox.Min.X,
         boundingBox.Max.Y - boundingBox.Min.Y,
         boundingBox.Max.Z - boundingBox.Min.Z,
         Mass);
     body = new CompoundBody();
     body.addBody(box);
     */
 }
开发者ID:Zergleb,项目名称:XiGameEngine,代码行数:32,代码来源:BoxModelPhysics.cs

示例2: StaticMeshModelPhysics

 /// <summary>
 /// Create sphere model physics.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="model">The visual model.</param>
 /// <param name="position">The position of the static mesh entity.</param>
 /// <param name="mass">The physics mass.</param>
 public StaticMeshModelPhysics(XiGame game, Model model, Vector3 position, float mass)
 {
     this.game = game;
     StaticTriangleGroup.StaticTriangleGroupVertex[] vertices;
     int[] indices;
     model.GetVerticesAndIndices(out vertices, out indices);
     TriangleMesh triangleMesh = new TriangleMesh(vertices, indices);
     staticTriangleGroup = new StaticTriangleGroup(triangleMesh);
 }
开发者ID:Zergleb,项目名称:XiGameEngine,代码行数:16,代码来源:StaticMeshModelPhysics.cs

示例3: SphereModelPhysics

 /// <summary>
 /// Create sphere model physics.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="model">The visual model.</param>
 /// <param name="position">The position of the sphere entity.</param>
 /// <param name="mass">The physics mass.</param>
 public SphereModelPhysics(XiGame game, Model model, Vector3 position, float mass)
 {
     this.game = game;
     Vector3[] vertices;
     int[] indices;
     model.GetVerticesAndIndices(out vertices, out indices);
     BoundingSphere boundingSphere = BoundingSphere.CreateFromPoints(vertices);
     body = new Sphere(position, boundingSphere.Radius, mass);
 }
开发者ID:Zergleb,项目名称:XiGameEngine,代码行数:16,代码来源:SphereModelPhysics.cs

示例4: CapsuleModelPhysics

 /// <summary>
 /// Create capsule model physics.
 /// </summary>
 /// <param name="game">The game.</param>
 /// <param name="model">The visual model.</param>
 /// <param name="position">The position of the sphere entity.</param>
 /// <param name="mass">The physics mass.</param>
 public CapsuleModelPhysics(XiGame game, Model model, Vector3 position, float mass)
 {
     this.game = game;
     Vector3[] vertices;
     int[] indices;
     model.GetVerticesAndIndices(out vertices, out indices);
     BoundingSphere boundingSphere = BoundingSphere.CreateFromPoints(vertices);
     body = new Capsule(position, boundingSphere.Radius, boundingSphere.Radius * 0.5f, mass);
     game.SceneSpace.Add(body);
 }
开发者ID:bryanedds,项目名称:Xi,代码行数:17,代码来源:CapsuleModelPhysics.cs


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