protected int BatchNeighbours()
        {
            int mNumBatchedParticles = 0;
            int last = Parent.GetChildIndex(this);

            while (++last < Parent.NumChildren)
            {
                SparrowRenderer nextPs = Parent.GetChild(last) as SparrowRenderer;
                if (nextPs != null && !nextPs.IsStateChange(_mTexture.Base, TexSmoothing, BlendMode, _mFilter, PremultiplyAlpha, _mNumParticles))
                {
                    if (nextPs._mNumParticles > 0)
                    {
                        int targetIndex = (_mNumParticles + mNumBatchedParticles) * 32; // 4 * 8
                        int sourceIndex = 0;
                        int sourceEnd   = nextPs._mNumParticles * 32;                   // 4 * 8
                        Array.Resize(ref _vertexes, targetIndex + sourceEnd);
                        while (sourceIndex < sourceEnd)
                        {
                            _vertexes[targetIndex++] = nextPs._vertexes[sourceIndex++];
                        }
                        mNumBatchedParticles += nextPs._mNumParticles;
                        nextPs._mBatched      = true;
                        //disable filter of batched system temporarily
                        nextPs.Filter = null;
                    }
                }
                else
                {
                    break;
                }
            }
            return(mNumBatchedParticles);
        }
示例#2
0
 private void CreateRendererIfNeeded()
 {
     if (_renderer == null)
     {
         _renderer                  = new SparrowRenderer();
         _renderer.BlendMode        = _blendMode;
         _renderer.TexSmoothing     = _smoothing;
         _renderer.PremultiplyAlpha = _premultiplyAlpha;
     }
 }