Ejemplo n.º 1
0
        public void UpdateModels()
        {
            SgtHelper.BeginRandomSeed(Seed);
            {
                for (var i = 0; i < PlaneCount; i++)
                {
                    var model = SgtHelper.GetIndex(ref models, i);

                    if (model == null)
                    {
                        model = models[i] = SgtProminenceModel.Create(this);
                    }

                    model.SetRotation(Random.rotationUniform);
                    model.SetMaterial(material);
                    model.SetMesh(mesh);
                }
            }
            SgtHelper.EndRandomSeed();

            // Remove any excess
            if (models != null)
            {
                var min = Mathf.Max(0, PlaneCount);

                for (var i = models.Count - 1; i >= min; i--)
                {
                    SgtProminenceModel.Pool(models[i]);

                    models.RemoveAt(i);
                }
            }
        }
Ejemplo n.º 2
0
        public void UpdateModels()
        {
            var angleStep = SgtHelper.Divide(360.0f, Segments);

            for (var i = 0; i < Segments; i++)
            {
                var model    = SgtHelper.GetIndex(ref models, i);
                var angle    = angleStep * i;
                var rotation = Quaternion.Euler(0.0f, angle, 0.0f);

                if (model == null)
                {
                    model = models[i] = SgtAccretionModel.Create(this);
                }

                model.SetMesh(Mesh);
                model.SetMaterial(material);
                model.SetRotation(rotation);
            }

            // Remove any excess
            if (models != null)
            {
                var min = Mathf.Max(0, Segments);

                for (var i = models.Count - 1; i >= min; i--)
                {
                    SgtAccretionModel.Pool(models[i]);

                    models.RemoveAt(i);
                }
            }
        }
Ejemplo n.º 3
0
        public void UpdateMeshesAndModels()
        {
            if (meshes == null)
            {
                meshes = new List <Mesh>();
            }

            if (PathDetail > 0 && PathLengthMin > 0.0f && PathLengthMax > 0.0f)
            {
                var meshCount   = 1;
                var mesh        = GetMesh(0);
                var vertexCount = 0;

                SgtHelper.BeginRandomSeed(Seed);
                {
                    for (var i = 0; i < PathCount; i++)
                    {
                        AddPath(ref mesh, ref meshCount, ref vertexCount);
                    }
                }
                SgtHelper.EndRandomSeed();

                BakeMesh(mesh);

                for (var i = meshes.Count - 1; i >= meshCount; i--)
                {
                    var extraMesh = meshes[i];

                    if (extraMesh != null)
                    {
                        extraMesh.Clear(false);

                        SgtObjectPool <Mesh> .Add(extraMesh);
                    }

                    meshes.RemoveAt(i);
                }
            }

            for (var i = 0; i < meshes.Count; i++)
            {
                var model = SgtHelper.GetIndex(ref models, i);

                if (model == null)
                {
                    model = models[i] = SgtAuroraModel.Create(this);
                }

                model.SetMesh(meshes[i]);
                model.SetMaterial(material);
            }

            // Remove any excess
            if (models != null)
            {
                var min = Mathf.Max(0, meshes.Count);

                for (var i = models.Count - 1; i >= min; i--)
                {
                    SgtAuroraModel.Pool(models[i]);

                    models.RemoveAt(i);
                }
            }
        }