當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。