Beispiel #1
0
    public void StartRender()
    {
        //make the livelayers empty, put those layers in _previousLiveLayers
        List<FRenderLayer> swapLayers = _liveLayers;
        _liveLayers = _previousLiveLayers;
        _previousLiveLayers = swapLayers;

        _topLayer = null;

        _depthToUse = 0;
    }
Beispiel #2
0
    public void StartRender()
    {
        //make the livelayers empty, put those layers in _previousLiveLayers
        List <FRenderLayer> swapLayers = _liveLayers;

        _liveLayers         = _previousLiveLayers;
        _previousLiveLayers = swapLayers;

        _topLayer = null;

        _depthToUse = 0;
    }
Beispiel #3
0
    protected FRenderLayer CreateRenderLayer(FFacetType facetType, int batchIndex, FAtlas atlas, FShader shader)
    {
        //first, check and see if we already have a layer that matches the batchIndex
        int previousLiveLayerCount = _previousLiveLayers.Count;

        for (int p = 0; p < previousLiveLayerCount; ++p)
        {
            FRenderLayer previousLiveLayer = _previousLiveLayers[p];
            if (previousLiveLayer.batchIndex == batchIndex)
            {
                _previousLiveLayers.RemoveAt(p);
                _liveLayers.Add(previousLiveLayer);
                previousLiveLayer.depth = _depthToUse++;
                return(previousLiveLayer);
            }
        }

        //now see if we have a cached (old, now unused layer) that matches the batchIndex
        int cachedLayerCount = _cachedLayers.Count;

        for (int c = 0; c < cachedLayerCount; ++c)
        {
            FRenderLayer cachedLayer = _cachedLayers[c];
            if (cachedLayer.batchIndex == batchIndex)
            {
                _cachedLayers.RemoveAt(c);
                cachedLayer.AddToWorld();
                _liveLayers.Add(cachedLayer);
                cachedLayer.depth = _depthToUse++;
                return(cachedLayer);
            }
        }

        //still no layer found? create a new one!

        FRenderLayer newLayer = facetType.createRenderLayer(_stage, facetType, atlas, shader);

        _liveLayers.Add(newLayer);
        _allLayers.Add(newLayer);
        newLayer.AddToWorld();
        newLayer.depth = _depthToUse++;

        return(newLayer);
    }
Beispiel #4
0
    public void GetRenderLayer(out FRenderLayer renderLayer, out int firstFacetIndex, FFacetType facetType, FAtlas atlas, FShader shader, int numberOfFacetsNeeded)
    {
        int batchIndex = facetType.index * 10000000 + atlas.index * 10000 + shader.index;

        if (_topLayer == null)
        {
            _topLayer = CreateRenderLayer(facetType, batchIndex, atlas, shader);
            _topLayer.Open();
        }
        else
        {
            if (_topLayer.batchIndex != batchIndex) //we're changing layers!
            {
                _topLayer.Close();                  //close the old layer

                _topLayer = CreateRenderLayer(facetType, batchIndex, atlas, shader);
                _topLayer.Open();                 //open the new layer
            }
        }

        renderLayer     = _topLayer;
        firstFacetIndex = _topLayer.GetNextFacetIndex(numberOfFacetsNeeded);
    }
Beispiel #5
0
    public void GetRenderLayer(ref FRenderLayer renderLayer, ref int firstQuadIndex, FAtlas atlas, FShader shader, int numberOfQuadsNeeded)
    {
        int batchIndex = atlas.index * 10000 + shader.index;

        if (_topLayer == null)
        {
            _topLayer = CreateRenderLayer(batchIndex, atlas, shader);
            _topLayer.Open();
        }
        else
        {
            if (_topLayer.batchIndex != batchIndex) //we're changing layers!
            {
                _topLayer.Close();                  //close the old layer

                _topLayer = CreateRenderLayer(batchIndex, atlas, shader);
                _topLayer.Open();                 //open the new layer
            }
        }

        renderLayer    = _topLayer;
        firstQuadIndex = _topLayer.GetNextQuadIndex(numberOfQuadsNeeded);
    }
Beispiel #6
0
    public void GetRenderLayer(ref FRenderLayer renderLayer, ref int firstQuadIndex, FAtlas atlas, FShader shader, int numberOfQuadsNeeded)
    {
        int batchIndex = atlas.index*10000 + shader.index;

        if(_topLayer == null)
        {
            _topLayer = CreateRenderLayer(batchIndex, atlas, shader);
            _topLayer.Open();
        }
        else
        {
            if(_topLayer.batchIndex != batchIndex) //we're changing layers!
            {
                _topLayer.Close(); //close the old layer

                _topLayer = CreateRenderLayer(batchIndex, atlas, shader);
                _topLayer.Open(); //open the new layer
            }
        }

        renderLayer = _topLayer;
        firstQuadIndex = _topLayer.GetNextQuadIndex(numberOfQuadsNeeded);
    }
Beispiel #7
0
    public void GetRenderLayer(out FRenderLayer renderLayer, out int firstFacetIndex, FFacetType facetType, FAtlas atlas, FShader shader, int numberOfFacetsNeeded)
    {
        int batchIndex = facetType.index*10000000 + atlas.index*10000 + shader.index;

        if(_topLayer == null)
        {
            _topLayer = CreateRenderLayer(facetType, batchIndex, atlas, shader);
            _topLayer.Open();
        }
        else
        {
            if(_topLayer.batchIndex != batchIndex) //we're changing layers!
            {
                _topLayer.Close(); //close the old layer

                _topLayer = CreateRenderLayer(facetType, batchIndex, atlas, shader);
                _topLayer.Open(); //open the new layer
            }
        }

        renderLayer = _topLayer;
        firstFacetIndex = _topLayer.GetNextFacetIndex(numberOfFacetsNeeded);
    }
Beispiel #8
0
    protected FRenderLayer CreateRenderLayer(int batchIndex, FAtlas atlas, FShader shader)
    {
        //first, check and see if we already have a layer that matches the batchIndex
        for(int p = 0; p < _previousLiveLayers.Count; ++p)
        {
            FRenderLayer previousLiveLayer = _previousLiveLayers[p];
            if(previousLiveLayer.batchIndex == batchIndex)
            {
                _previousLiveLayers.RemoveAt(p);
                _liveLayers.Add (previousLiveLayer);
                previousLiveLayer.depth = _depthToUse++;
                return previousLiveLayer;
            }
        }

        //now see if we have a cached (old, now unused layer) that matches the batchIndex
        for(int c = 0; c< _cachedLayers.Count; ++c)
        {
            FRenderLayer cachedLayer = _cachedLayers[c];
            if(cachedLayer.batchIndex == batchIndex)
            {
                _cachedLayers.RemoveAt(c);
                cachedLayer.AddToWorld();
                _liveLayers.Add (cachedLayer);
                cachedLayer.depth = _depthToUse++;
                return cachedLayer;
            }
        }

        //still no layer found? create a new one!
        FRenderLayer newLayer = new FRenderLayer(atlas,shader);
        _liveLayers.Add(newLayer);
        newLayer.AddToWorld();
        newLayer.depth = _depthToUse++;

        return newLayer;
    }