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


C# Chunk.CreateSeamChunk方法代码示例

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


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

示例1: FinishUpChunkLoading

    void FinishUpChunkLoading()
    {
        if (finishedChunk)
        {
            finishedChunk = false;
            busy = false;

            if (changingChunk == null)
            {
                if (thread.m_Root != null && loadingChunk != null)
                {
                    //if (loadingChunk.LOD == 6)
                    //Debug.Log ("Chunk time on CPU: " + (Time.realtimeSinceStartup - cpuStartTime));
                    loadingChunk.CreateSeamChunk(thread.m_Root, thread.m_Root.min);
                    if (loadingChunk.GenerateMesh(thread.m_Vertices, thread.m_Normals, thread.m_Indices) > 0)
                        loadingChunk.containsNothing = false;

                    List<Chunk> seamChunks = new List<Chunk>();
                    bool foundAllEight = FindSeamChunks(loadingChunk, seamChunks);

                    if (foundAllEight)
                    {
                        List<OctreeNode> seams = FindSeamNodes(loadingChunk, seamChunks);
                        OctreeNode seamRoot = loadingChunk.BuildSeamTree(seams, loadingChunk.min, octreeSize * 2);
                        if (seamRoot != null)
                        {
                            Chunk seamChunk = new Chunk();
                            seamChunk.LOD = 6;
                            seamChunk.CreateSeamChunk(seamRoot, seamRoot.min);
                            seamChunk.GenerateMesh();
                            //Debug.Log (seamChunk.GenerateMesh());
                            seamChunk.DestroyOctree();
                            loadingChunk.seamChunk = seamChunk;
                        }
                    }

                    //loadingChunk.DestroyOctree();
                }

                if (loadingChunk != null && thread.m_Root == null)
                    loadingChunk.DestroyMesh();

                if (loadingChunk != null)
                    chunks.Add(loadingChunk.min, loadingChunk);
            }
            else
            {
                if (thread.m_Root != null && changingChunk != null)
                {
                    changingChunk.clearMesh();
                    changingChunk.DestroyOctree();
                    changingChunk.CreateSeamChunk(thread.m_Root, thread.m_Root.min);
                    //float meshReloadStart = Time.realtimeSinceStartup;
                    changingChunk.GenerateMesh(thread.m_Vertices, thread.m_Normals, thread.m_Indices);
                    //Debug.Log (Time.realtimeSinceStartup - meshReloadStart);

                    List<Chunk> seamChunks = new List<Chunk>();
                    bool foundAllEight = FindSeamChunks(changingChunk, seamChunks);

                    if (foundAllEight)
                    {
                        List<OctreeNode> seams = FindSeamNodes(changingChunk, seamChunks);
                        OctreeNode seamRoot = changingChunk.BuildSeamTree(seams, changingChunk.min, octreeSize * 2);
                        if (seamRoot != null)
                        {
                            Chunk seamChunk = changingChunk.seamChunk;
                            if (seamChunk == null)
                            {
                                seamChunk = new Chunk();
                                changingChunk.seamChunk = seamChunk;
                            }

                            if (seamChunk != null)
                            {
                                seamChunk.LOD = 6;
                                seamChunk.CreateSeamChunk(seamRoot, seamRoot.min);
                                seamChunk.GenerateMesh();
                                //Debug.Log (seamChunk.GenerateMesh());
                                seamChunk.DestroyOctree();
                            }
                        }
                    }

                    //changingChunk.DestroyOctree();
                    changingChunk = null;
                }

            }

            thread.m_Vertices.Clear();
            thread.m_Normals.Clear();
            thread.m_Indices.Clear();
            loadingChunk = null;
            thread.m_Root = null;
        }
    }
开发者ID:Colt-Zero,项目名称:DualContouringGPU,代码行数:96,代码来源:Test.cs


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