コード例 #1
0
        public void CombineBatch(InstancingBatch batch)
        {
            if (MAXBATCHCOUNT - visibleCount < batch.visibleCount)
            {
                return;
            }
            GPUAnimObj visible   = null;
            GPUAnimObj invisible = null;
            int        n         = batch.visibleCount;

            while (n > 0)
            {
                visible = batch.objs[0];
                if (visibleCount < objs.Count)
                {
                    invisible = objs[visibleCount];
                }
                else
                {
                    invisible = null;
                }
                batch.RemoveObject(visible);
                this.RemoveObject(invisible);
                visible._isVisible = true;
                AddObject(visible);
                batch.AddObject(invisible);
                n--;
            }
            batch.SetValid(false);
            group.combineList.Remove(this);
            group.combineList.Remove(batch);
        }
コード例 #2
0
        public void AddObject(GPUAnimObj o)
        {
            objs.Add(o);
            o.group   = this;
            o._bounds = mesh.bounds;             //to do :calculat the real bounds
            // o.bounds = new Bounds (o.position, new Vector3 (0.1f, 0.1f, 0.1f));
            o._bounds.center = o.position;
            var batch = batches.Find((x) => !x.isfull);

            if (batch == null)
            {
                batch = new InstancingBatch(this);
                batches.Add(batch);
            }
            batch.AddObject(o);
        }
コード例 #3
0
 void RemoveBatch(InstancingBatch batch)
 {
     batches.Remove(batch);
 }