Clear() public method

public Clear ( ) : void
return void
Esempio n. 1
0
 private void FixedUpdate()
 {
     // Clear & Refill Octree
     octree.Clear();
     for (int i = 0; i < EntityManager.EntityCount; i++)
     {
         octree.Insert(EntityManager.GetEntity(i));
     }
 }
Esempio n. 2
0
        public void CreateMesh(List <Vector3> vertices, List <TriangleVertexIndices> triangleVertexIndices, int maxTrianglesPerCell, float minCellSize)
        {
            var numVertices = vertices.Count;

            Octree.Clear(true);
            Octree.AddTriangles(vertices, triangleVertexIndices);
            Octree.BuildOctree(maxTrianglesPerCell, minCellSize);

            this.maxTrianglesPerCell = maxTrianglesPerCell;
            this.minCellSize         = minCellSize;
        }
        public override void Process(Bitmap bitmap)
        {
            buildOctree = true; quantize = false;
            base.Process(bitmap);

            palette = octree.MakePalette(PaletteSize);

            buildOctree = false; quantize = true;
            base.Process(bitmap);

            octree.Clear();
        }
Esempio n. 4
0
        public static void Set(this Octree octree, VoxelandData.OctNode root, LinearArrayHeap <byte> allocator)
#endif
        {
            int num = root.CountNodes() * 4;

            octree.Clear(allocator);

#if BelowZero
            var octreeData = allocator.Get(num);
#else
            var octreeData = allocator.Allocate(num);
#endif
            octree.data = octreeData;

            ushort num2 = 1;
            octree.SetInternal(root, 0, ref num2);
        }
Esempio n. 5
0
    public static double SunShineSim(TreeModel treeModel, PhotosyntheticModels type)
    {
        double biomass = 0.0;

        switch (type)
        {
        case PhotosyntheticModels.LightResponse:
            Octree octree = Octree.Build(treeModel);
            biomass =
                octree == null?         //无模型,说明未出苗
                MaizeParams.SEED_BIOMASS : DailySunShineSimluation(treeModel, DateTime.Now, 119, 26, octree, 0.1f, 100, 100);
            if (octree != null)
            {
                octree.Clear();
            }
            break;

        default:
            GameObject go = treeModel.TreeModelInstance;

            if (go != null)
            {
                Mesh.AddBoxColliderInParent(go);
            }

            biomass =
                treeModel.GetLeafIndexes().Count != 0 ?         //无叶片,说明未出苗
                BeerRule.BiomassCal(treeModel) / FunctionSim.ComputeDaysInGC(treeModel) : MaizeParams.SEED_BIOMASS;
            break;
        }

        if (biomass != MaizeParams.SEED_BIOMASS)
        {
            biomass *= EnvironmentEffect.TemperatureStressFactor(treeModel) * EnvironmentEffect.WaterStressFactor(treeModel) * EnvironmentEffect.SunshineStress(treeModel);
        }

        return(biomass);
    }
Esempio n. 6
0
    // Update is called once per frame
    void Update()
    {
        float _FParticleRadius = ParticlePrefab.gameObject.transform.GetChild(0).GetComponent <SpriteRenderer>().bounds.size.x / 2;

        if (RootOcTree != null)
        {
            RootOcTree.Clear();
        }

        RootOcTree = null;

        if (_Clear)
        {
            _Clear = false;
            foreach (GameObject particleObj in _Particles)
            {
                Destroy(particleObj);
            }

            _Particles.Clear();
        }

        RootOcTree = new Octree(CubeCenter, CubeWidth, _FParticleRadius, this);

        if (_UpdateDepth)
        {
            _UpdateDepth                = false;
            Octree.SMaxDepthToStopAt    = Convert.ToInt32(InputMaxDepthSlider.value * _NewMaxDepth);
            TextBoxCurrentMaxDepth.text = "Depth : " + Octree.SMaxDepthToStopAt;
        }

        if (_UpdateSplitAt)
        {
            _UpdateSplitAt             = false;
            _NewSplitAt               -= 1;
            Octree.SMaxChildren        = Convert.ToInt32(InputSplitAtSlider.value * _NewSplitAt) + 1;
            TextBoxCurrentSplitAt.text = "Split after : " + (Octree.SMaxChildren);
            //Octree.SMaxChildren += 1;
        }

        foreach (GameObject obj in _Particles)
        {
            obj.gameObject.transform.GetChild(0).GetComponent <SpriteRenderer>().color = Color.white;

            RootOcTree.Insert(obj);
        }

        if (_KeyboardCameraControl.LockCursor)
        {
            if (ParticleSpawner.activeSelf)
            {
                SpawnParticleOnClick();
            }
        }


        //frustum
        //if (_ShowTraversal)
        if (RootOcTree.FrustumLiesIn(DrawFrustum.AllPoints))
        {
            RootOcTree.IsWithinFrustum(DrawFrustum.AllPoints);
        }

        UpdateText();
    }