Ejemplo n.º 1
0
        protected (VertexPositionNormalTextureColor[] vertices, int[] indexes) GetVertices(IBlockAccess world,
                                                                                           Vector3 position, Block baseBlock,
                                                                                           BlockStateModel[] models)
        {
            using (var verts = new PooledList <VertexPositionNormalTextureColor>(ClearMode.Auto))
            {
                var indexResult = new List <int>(24 * models.Length);

                int biomeId = 0;                //world == null ? 0 : world.GetBiome((int) position.X, 0, (int) position.Z);
                var biome   = BiomeUtils.GetBiomeById(biomeId);

                if (UseRandomizer)
                {
                    //var rndIndex = FastRandom.Next() % Models.Length;
                    CalculateModel(
                        world, position, baseBlock, models[0], verts, indexResult, biomeId, biome);
                }
                else
                {
                    for (var bsModelIndex = 0; bsModelIndex < models.Length; bsModelIndex++)
                    {
                        var bsModel = models[bsModelIndex];

                        if (bsModel.Model == null)
                        {
                            continue;
                        }

                        CalculateModel(
                            world, position, baseBlock, bsModel, verts, indexResult, biomeId,
                            biome);
                    }
                }

                return(verts.ToArray(), indexResult.ToArray());
            }
        }