예제 #1
0
        /// <summary>
        /// Iterates over all blocks in the chunk, creating visual tasks as needed.
        /// </summary>
        /// <param name="properties">The chunk properties.</param>
        /// <param name="tasks">The task list to add to.</param>
        private void VisualBlockIterator(ChunkGroup properties, RemeshTaskStack taskStack)
        {
            var volume = m_ChunkSize.Volume;
            var blocks = properties.Blocks;

            for (int i = 0; i < volume; i++)
            {
                var type = m_BlockList.GetBlockType(blocks[i]);

                if (!type.Visible)
                {
                    continue;
                }

                // TODO Make sure block type is a cube

                for (int j = 0; j < type.FaceCount; j++)
                {
                    var material = type.Face(j).MaterialID;
                    if (m_MaterialBuffer[material])
                    {
                        continue;
                    }

                    m_MaterialBuffer[material] = true;
                    taskStack.AddTask(new VisualRemeshTask(properties, material, PullMesher()));
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Iterates over all blocks in the chunk, creating visual tasks as needed.
        /// </summary>
        /// <param name="properties">The chunk properties.</param>
        /// <param name="tasks">The task list to add to.</param>
        private void VisualBlockIterator(ChunkProperties properties, RemeshTaskStack taskStack)
        {
            var volume = m_BlockWorld.ChunkSize.Volume;
            var blocks = properties.Blocks;

            for (int i = 0; i < volume; i++)
            {
                var type = blocks[i];

                if (!type.IsVisible)
                {
                    continue;
                }

                var faces = type.Faces;
                for (int j = 0; j < 6; j++)
                {
                    var material = faces[j].MaterialID;
                    if (m_MaterialBuffer[material])
                    {
                        continue;
                    }

                    m_MaterialBuffer[material] = true;
                    taskStack.AddTask(new VisualRemeshTask(properties, material, PullMesher()));
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Generates the collision remesh task, as needed.
        /// </summary>
        /// <param name="properties">The chunk properties.</param>
        /// <param name="tasks">The task list to add to.</param>
        private void GenerateCollision(ChunkProperties properties, RemeshTaskStack taskStack)
        {
            int volume = m_BlockWorld.ChunkSize.Volume;

            for (int i = 0; i < volume; i++)
            {
                var type = properties.Blocks[i];

                if (type.IsSolid)
                {
                    taskStack.AddTask(new CollisionRemeshTask(properties, PullMesher()));
                    return;
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Generates the collision remesh task, as needed.
        /// </summary>
        /// <param name="properties">The chunk properties.</param>
        /// <param name="tasks">The task list to add to.</param>
        private void GenerateCollision(ChunkGroup properties, RemeshTaskStack taskStack)
        {
            int volume = m_ChunkSize.Volume;
            var blocks = properties.Blocks;

            for (int i = 0; i < volume; i++)
            {
                var type = m_BlockList.GetBlockType(blocks[i]);

                if (type.Solid)
                {
                    taskStack.AddTask(new CollisionRemeshTask(properties, PullMesher()));
                    return;
                }
            }
        }