/*
     */
    public InstancedMeshInfo MeshChunkItems(Vector3Int chunkIndex, ChunkLayer <Block> chunkLayer)
    {
        InstancedMeshInfo instancedMeshInfo = new InstancedMeshInfo(modelTypeCount);
        Chunk <Block>     chunk             = chunkLayer.GetChunk(chunkIndex);
        Vector3           chunkStart        = chunkIndex.Multiply(chunkSettings.ChunkWorldLen);

        for (int x = 0; x < chunkSL; x++)
        {
            for (int y = 0; y < chunkSL; y++)
            {
                for (int z = 0; z < chunkSL; z++)
                {
                    Vector3Int     indexInChunk   = new Vector3Int(x, y, z);
                    Vector3        position       = new Vector3(x, y, z) * chunkSettings.VoxelSize + chunkStart;
                    Block          block          = chunk.GetVoxel(indexInChunk);
                    int            blockType      = block.blockType;
                    TechnicalBlock technicalBlock = block.technicalBlock;
                    if (technicalBlock != null)
                    {
                        TechnicalBlock.ModelInfo[] itemMeshes = technicalBlock.GetDynamicMesh();
                        for (int i = 0; i < itemMeshes.Length; i++)
                        {
                            if (itemMeshes[i].modelType != 0)
                            {
                                Matrix4x4 transform = itemMeshes[i].transform;
                                transform = Matrix4x4.Translate(position) * transform;
                                instancedMeshInfo.AddInstance(transform, itemMeshes[i].modelType);
                            }
                        }
                    }
                }
            }
        }
        return(instancedMeshInfo);
    }