• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IMesh类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IMesh的典型用法代码示例。如果您正苦于以下问题:C# IMesh类的具体用法?C# IMesh怎么用?C# IMesh使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IMesh类属于命名空间,在下文中一共展示了IMesh类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CloudInCell

 public CloudInCell(IParticleStorage<Particle> particles, IGrid2D grid, IMesh mesh, bool parallel)
 {
     this.particles = particles;
     this.grid = grid;
     this.mesh = mesh;
     this.parallel = parallel;
 }
开发者ID:vlad294,项目名称:PICSolver,代码行数:7,代码来源:CloudInCell.cs


示例2: Smooth

        public void Smooth(IMesh mesh, int limit)
        {
            var smoothedMesh = (Mesh)mesh;

            var mesher = new GenericMesher(config);
            var predicates = config.Predicates();

            // The smoother should respect the mesh segment splitting behavior.
            this.options.SegmentSplitting = smoothedMesh.behavior.NoBisect;

            // Take a few smoothing rounds (Lloyd's algorithm).
            for (int i = 0; i < limit; i++)
            {
                Step(smoothedMesh, factory, predicates);

                // Actually, we only want to rebuild, if the mesh is no longer
                // Delaunay. Flipping edges could be the right choice instead 
                // of re-triangulating...
                smoothedMesh = (Mesh)mesher.Triangulate(Rebuild(smoothedMesh), options);

                factory.Reset();
            }

            smoothedMesh.CopyTo((Mesh)mesh);
        }
开发者ID:cmberryau,项目名称:Triangle.NET-3.5,代码行数:25,代码来源:SimpleSmoother.cs


示例3: CPlayer

        public CPlayer(IGameObjectManager pObjMan, IEngineCore pEngineCore)
            : base(pObjMan, pEngineCore)
        {
            _fVelocity = 0f;
            uiShotPause = 15;

            ObjType = EGameObjectType.GotPlayer;

            _stPos = new TPoint2(Res.GameVpWidth / 2f, Res.GameVpHeight / 2f);
            _fSize = 150f;
            _fColScale = 0.6f;

            dimPl = new TPoint3(_fSize, _fSize, _fSize);

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_INPUT, out pSubSys);
            pInput = (IInput)pSubSys;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;
            pResMan.GetResourceByName(Res.MeshShip, out pBaseObj);
            pMesh = (IMesh)pBaseObj;
            pResMan.GetResourceByName(Res.TexShip, out pBaseObj);
            pTex = (ITexture)pBaseObj;
            pResMan.GetResourceByName(Res.TexSpark, out pBaseObj);
            pTexSpark = (ITexture)pBaseObj;
        }
开发者ID:whztt07,项目名称:DGLE,代码行数:31,代码来源:CPlayer.cs


示例4: Collides

        public bool Collides(
            Ray testRay, 
            IEnumerable<IMesh> meshes, 
            out Vector3 position, 
            out IMesh hitMesh, 
            bool furthest = false)
        {
            var distance = furthest ? 0f : 10000f;
            var closestPosition = Vector3.Zero;
            IMesh closestMesh = null;

            foreach (var mesh in meshes)
            {
                if (mesh.MeshVertexPositions == null)
                {
                    continue;
                }

                for (var a = 0; a < mesh.MeshIndicies.Length; a += 3)
                {
                    var vertexA = mesh.MeshVertexPositions[mesh.MeshIndicies[a]];
                    var vertexB = mesh.MeshVertexPositions[mesh.MeshIndicies[a + 1]];
                    var vertexC = mesh.MeshVertexPositions[mesh.MeshIndicies[a + 2]];

                    float tempDistance;
                    var point = this.m_Collision.CollidesWithTriangle(
                        testRay,
                        vertexA,
                        vertexB,
                        vertexC,
                        out tempDistance,
                        false);
                    if (point != null)
                    {
                        if (!furthest)
                        {
                            if (tempDistance < distance && tempDistance > 0)
                            {
                                distance = tempDistance;
                                closestPosition = point.Value;
                                closestMesh = mesh;
                            }
                        }
                        else
                        {
                            if (tempDistance > distance && tempDistance > 0)
                            {
                                distance = tempDistance;
                                closestPosition = point.Value;
                                closestMesh = mesh;
                            }
                        }
                    }
                }
            }

            position = closestPosition;
            hitMesh = closestMesh;
            return closestPosition != Vector3.Zero;
        }
开发者ID:gusmanb,项目名称:Mir,代码行数:60,代码来源:MeshCollider.cs


示例5: SetTextureVertices

        public unsafe bool SetTextureVertices(IMesh maxMesh, MyMesh myMesh)
        {
            bool countChanged = false;

            if (maxMesh.NumTVerts != myMesh.NumTextureCoordinates)
            {
                maxMesh.SetNumTVerts(myMesh.NumTextureCoordinates, false);
                countChanged = true;
            }

            IntPtr p3h = maxMesh.GetTVertPtr(0).NativePointer;
            float* p3 = (float*)p3h.ToPointer();

            int elementsPerVertex = myMesh.TextureCoordinates.Count / myMesh.NumTextureCoordinates;
            switch (elementsPerVertex)
            {
                case 2:
                    for (int i = 0; i < myMesh.NumTextureCoordinates; i++)
                    {
                        p3[(i * 3) + 0] = myMesh.TextureCoordinates[(i * 2) + 0];
                        p3[(i * 3) + 1] = myMesh.TextureCoordinates[(i * 2) + 1];
                        p3[(i * 3) + 2] = 0.0f;
                    };
                    break;
                case 3:
                    Marshal.Copy(myMesh.TextureCoordinates.ToArray(), 0, p3h, myMesh.NumTextureCoordinates * 3);
                    break;
                default:
                    throw new NotImplementedException(("Unable to handle texture coordinates with " + elementsPerVertex + " elements."));
            }

            return countChanged;
        }
开发者ID:sebjf,项目名称:dazmaxbridge,代码行数:33,代码来源:Geometry.cs


示例6: Load

 public void Load(IMesh mesh, string filePath)
 {
   using (var streamReader = new StreamReader(filePath))
   {
     Load(streamReader, mesh);
   }
 }
开发者ID:dgopena,项目名称:Starter3D.Base,代码行数:7,代码来源:ObjMeshLoader.cs


示例7: Combine

 /// <summary>
 /// Combine this mesh with another.
 /// </summary>
 /// <param name="anotherMesh">Another mesh.</param>
 /// <seealso cref="ConstructiveSolidGeometry.Union"/>
 public virtual void Combine(IMesh anotherMesh)
 {
     BspNode<SplittableTriangle> a = this.ToBspTree();
     BspNode<SplittableTriangle> b = anotherMesh.ToBspTree();
     a.Unite(b);
     this.SetBsp(a);
 }
开发者ID:RoqueDeicide,项目名称:CryCIL,代码行数:12,代码来源:Mesh.CSG.cs


示例8: Write

 public void Write(IMesh mesh, string filename)
 {
     if (mesh.Vertices.Count > 0)
     {
         format.Write(mesh, filename);
     }
 }
开发者ID:cmberryau,项目名称:Triangle.NET-3.5,代码行数:7,代码来源:TriangleFile.cs


示例9: Write

        public void Write(IMesh mesh, string filename)
        {
            var writer = new TriangleWriter();

            writer.WritePoly((Mesh)mesh, Path.ChangeExtension(filename, ".poly"));
            writer.WriteElements((Mesh)mesh, Path.ChangeExtension(filename, ".ele"));
        }
开发者ID:cmberryau,项目名称:Triangle.NET-3.5,代码行数:7,代码来源:TriangleFormat.cs


示例10: Load

 public void Load(IMesh mesh, string filePath)
 {
   var dxfLoad = DxfDocument.Load(filePath);
   var vertices = new List<IVertex>();
   var faces = new List<IFace>();
   var verticesIndexMap = new Dictionary<IVertex, int>();
   int currentVertexIndex = 0;
   foreach (var face3D in dxfLoad.Faces3d)
   {
     var v1 = face3D.FirstVertex;
     var v2 = face3D.SecondVertex;
     var v3 = face3D.ThirdVertex;
     var v4 = face3D.FourthVertex;
     currentVertexIndex = CreateTriangleFace(v1, v2, v3, verticesIndexMap, currentVertexIndex, vertices, faces);
     currentVertexIndex = CreateTriangleFace(v3, v4, v1, verticesIndexMap, currentVertexIndex, vertices, faces);
   }
   foreach (var vertex in vertices)
   {
     mesh.AddVertex(vertex);
   }
   foreach (var face in faces)
   {
     mesh.AddFace(face);
   }
 }
开发者ID:dgopena,项目名称:Starter3D.Base,代码行数:25,代码来源:DxfMeshLoader.cs


示例11: ComputeNormals

        public static VNormal[] ComputeNormals(IMesh mesh)
        {
            var vnorms = new VNormal[mesh.NumVerts];
            var fnorms = new Vector3[mesh.NumFaces];

            for (var index = 0; index < mesh.NumVerts; index++)
            {
                vnorms[index] = new VNormal();
            }

            for (var index = 0; index < mesh.NumFaces; index++)
            {
                var face = mesh.Faces[index];
                Vector3 v0 = mesh.Verts[(int)face.V[0]].ToVector3();
                Vector3 v1 = mesh.Verts[(int)face.V[1]].ToVector3();
                Vector3 v2 = mesh.Verts[(int)face.V[2]].ToVector3();

                fnorms[index] = Vector3.Cross((v1 - v0), (v2 - v1));

                for (var j = 0; j < 3; j++)
                {
                    vnorms[(int)face.V[j]].AddNormal(fnorms[index], face.SmGroup);
                }

                fnorms[index].Normalize();
            }

            for (var index = 0; index < mesh.NumVerts; index++)
            {
                vnorms[index].Normalize();
            }

            return vnorms;
        }
开发者ID:kainhong,项目名称:Babylon.js,代码行数:34,代码来源:Tools.cs


示例12: DestroyMesh

 public void DestroyMesh(ref IMesh _OutMesh)
 {
     if (m_MeshInstanceContainer.ContainsKey(_OutMesh.m_InstanceID)) {
         m_MeshInstanceContainer[_OutMesh.m_InstanceID].Release();
         m_MeshInstanceContainer.Remove(_OutMesh.m_InstanceID);
         _OutMesh = null;
     }
 }
开发者ID:NDark,项目名称:crushpiec,代码行数:8,代码来源:MeshCreator.cs


示例13: Subtract

 /// <summary>
 /// Subtracts another mesh from this one.
 /// </summary>
 /// <param name="anotherMesh">Another mesh.</param>
 /// <seealso cref="ConstructiveSolidGeometry.Subtract"/>
 public virtual void Subtract(IMesh anotherMesh)
 {
     BspNode<SplittableTriangle> a = this.ToBspTree();
     BspNode<SplittableTriangle> b = anotherMesh.ToBspTree();
     a.Invert();
     a.Unite(b);
     a.Invert();
     this.SetBsp(a);
 }
开发者ID:RoqueDeicide,项目名称:CryCIL,代码行数:14,代码来源:Mesh.CSG.cs


示例14: PICMonitor

 public PICMonitor(IGrid2D grid, IMesh mesh, IParticleStorage<Particle> particles, IPICSolver solver)
 {
     this.grid = grid;
     this.particles = particles;
     this.mesh = mesh;
     this.solver = solver;
     GridX = grid.X;
     GridY = grid.Y;
     Status = PICStatus.Created;
 }
开发者ID:vlad294,项目名称:PICSolver,代码行数:10,代码来源:PICMonitor.cs


示例15: vertexPositions

    public static Vector3[] vertexPositions(IMesh mesh){

      Vector3[] positions = new Vector3[mesh.VerticesCount];
      int i = 0;
      foreach(IVertex v in mesh.Vertices) {
        positions [i] = v.Position;
        i++;
      }
      return positions;
    }
开发者ID:dgopena,项目名称:Starter3D.Base,代码行数:10,代码来源:OpenGLMesh.cs


示例16: Mesh_VoxelChunk

 // copy
 public Mesh_VoxelChunk(IMesh _CopyMesh) : base(_CopyMesh)
 {
     Mesh_VoxelChunk _copyVoxelChunk = _CopyMesh as Mesh_VoxelChunk;
     if (_copyVoxelChunk.HasChunk)
     {
         m_ChunkMap = new Dictionary<string, Chunk>(_copyVoxelChunk.ChunkMap);
     }
     if (_copyVoxelChunk.HasModel)
     {
         m_ModelMap = new Dictionary<string, Chunk>(_copyVoxelChunk.ModelMap);
     }
 }
开发者ID:NDark,项目名称:crushpiec,代码行数:13,代码来源:Mesh_VoxelChunk.cs


示例17: faceIndices

    public static uint[] faceIndices(IMesh mesh){

      uint[] faces = new uint[mesh.FacesCount * 3];
      int i = 0;
      foreach (IFace f in mesh.Faces) {
        foreach (int indx in f.VertexIndices) {
          faces [i] = (uint)indx;
          i++;
        }
      }
      return faces;
    }
开发者ID:dgopena,项目名称:Starter3D.Base,代码行数:12,代码来源:OpenGLMesh.cs


示例18: SetPositionVertices

        public bool SetPositionVertices(IMesh maxMesh, MyMesh myMesh)
        {
            bool countChanged = false;

            if (maxMesh.NumVerts != myMesh.NumVertices)
            {
                maxMesh.SetNumVerts(myMesh.NumVertices, false, false);
                countChanged = true;
            }

            IPoint3 p3 = maxMesh.GetVertPtr(0);
            Marshal.Copy(myMesh.Vertices.ToArray(), 0, p3.NativePointer, myMesh.NumVertices * 3);

            return countChanged;
        }
开发者ID:sebjf,项目名称:dazmaxbridge,代码行数:15,代码来源:Geometry.cs


示例19: BiologicalEquation

        public BiologicalEquation(IMesh mesh)
        {
            this.mesh = mesh;

            k = 17;
            Kb = 0.0005;
            Km = 0.0005;
            r = 0.2;
            mmu = 1.5;
            nnu = 0;
            zet = 0;
            c1 = 0;
            c2 = 0;
            dt = 0.0416667;
            // TODO: Take from args.
        }
开发者ID:phamhathanh,项目名称:2DFEM,代码行数:16,代码来源:BiologicalEquation.cs


示例20: Intersect

 /// <summary>
 /// Intersects this mesh with another.
 /// </summary>
 /// <param name="anotherMesh">Another mesh.</param>
 /// <seealso cref="ConstructiveSolidGeometry.Intersection"/>
 public virtual void Intersect(IMesh anotherMesh)
 {
     BspNode<SplittableTriangle> a = this.ToBspTree();
     BspNode<SplittableTriangle> b = anotherMesh.ToBspTree();
     a.Invert();				// Cut geometry that is not common for the meshes.
     b.CutTreeOut(a);		//
     b.Invert();				//
     a.CutTreeOut(b);		//
     // Clean up remains.
     b.CutTreeOut(a);
     // Combine geometry.
     a.AddElements(b.AllElements);
     // Invert everything.
     a.Invert();
     this.SetBsp(a);
 }
开发者ID:RoqueDeicide,项目名称:CryCIL,代码行数:21,代码来源:Mesh.CSG.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IMesher类代码示例发布时间:2022-05-24
下一篇:
C# IMerchelloContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap