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


C# Geometry.FixVertex方法代码示例

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


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

示例1: SetLevel


//.........这里部分代码省略.........
        case 9:
            earth.GetComponent<MeshFilter>().mesh = sphere2;
            SetTexture(7);
            source = 42;
            manPos = 775;
            break;
        case 11:
            earth.GetComponent<MeshFilter>().mesh = hemisphere;
            SetTexture(7);
            source = 1331;
            manPos = 475;
            break;
        case 12:
            earth.GetComponent<MeshFilter>().mesh = skull;
            SetTexture(8);
            source = 5794;
            manPos = 781;
            break;
        case 10:
            earth.GetComponent<MeshFilter>().mesh = dragon;
            SetTexture(6);
            source = 7561;
            manPos = 7284;
            break;
        }
        roadBase.SetActive(level == 5);
        hemiCap.SetActive(level == 11);
        skullBase.SetActive(level == 12);
        fire.gameObject.SetActive(level == 10);

        // Adjust settings
        if (useDefaultSettings) {
            Settings.tFactor = tFactor;
            Settings.defaultSource = new List<int>();
            Settings.defaultSource.Add(source);
            Settings.initialManPos = manPos;
            inputT.text = Settings.tFactor.ToString();
        } else {
            Settings.defaultSource = new List<int>();
            foreach (Vertex sourceVertex in hg.s) {
                Settings.defaultSource.Add(sourceVertex.index);
            }
            Settings.initialManPos = man.coord.triangle.index;
        }

        // Set collider to detect mouse hit
        earth.GetComponent<MeshCollider>().sharedMesh = earth.GetComponent<MeshFilter>().mesh;

        // Build geometry data
        g = new Geometry(earth.GetComponent<MeshFilter>().mesh);

        if (level == 6) {
            // Fix certain broken triangles for the triceratops
            g.FixVertex(758);
            g.FixVertex(295);
            g.FixVertex(395);
            g.FixVertex(2449);
        }

        // Start heat method
        hg = new HeatGeodesics(g, Settings.useCholesky, Settings.useAccurateMultisource);
        hg.Initialize();

        List<Vertex> sources = new List<Vertex>();
        foreach (int ind in Settings.defaultSource) {
            sources.Add(g.vertices[ind]);
            lastClickedVertex = g.vertices[ind];
        }
        hg.CalculateGeodesics(sources);

        // Spawn the little man
        if (man.isActiveAndEnabled) {
            man.GetReady(g, hg, g.faces[Settings.initialManPos]);
        }

        // Put the mark at the source vertices
        if (useDefaultSettings) {
            foreach (GameObject oldPin in pins) {
                Destroy(oldPin);
            }
            pins.Clear();
            foreach (int ind in Settings.defaultSource) {
                GameObject newPin = Instantiate(pin);
                pins.Add(newPin);
                newPin.transform.position = g.vertices[ind].p;
                newPin.transform.rotation = Quaternion.LookRotation(g.vertices[ind].CalculateNormalTri());
            }
        }

        // Update counter
        triangleCounter.text = "Triangle Count = " + g.faces.Count;

        if (visualState != 0) {
            if (useDefaultSettings) {
                VisualizeGradient(visualState == 2);
            } else {
                UpdateVisualGradient();
            }
        }
    }
开发者ID:supercontact,项目名称:PathFinding,代码行数:101,代码来源:TestPathFinding.cs


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