コード例 #1
0
    public static void DrawShadowsAndMask(LightingBuffer2D buffer, int layer)
    {
        buffer.CalculateCoords();

        drawMask = false;
        if (buffer.lightSource.layerSetting[layer].type != LightingLayerType.ShadowOnly)
        {
            drawMask = true;
        }

        drawShadows = false;
        if (buffer.lightSource.layerSetting[layer].type != LightingLayerType.MaskOnly)
        {
            drawShadows = true;
        }

        GL.PushMatrix();

        if (LightingManager2D.Get().lightingSpriteAtlas&& SpriteAtlasManager.Get().atlasTexture != null)
        {
            DrawWithAtlas(buffer, layer);
        }
        else
        {
            DrawWithoutAtlas(buffer, layer);
        }

        GL.PopMatrix();
    }
コード例 #2
0
    static public void DrawShadowsAndMask(LightingBuffer2D buffer, int layer)
    {
        buffer.CalculateCoords();

        offset.x = -buffer.lightSource.transform.position.x;
        offset.y = -buffer.lightSource.transform.position.y;

        manager = LightingManager2D.Get();

        layerSettings = buffer.lightSource.layerSetting[layer];

        z = buffer.transform.position.z;
        lightSizeSquared = Mathf.Sqrt(buffer.lightSource.lightSize * buffer.lightSource.lightSize + buffer.lightSource.lightSize * buffer.lightSource.lightSize);

        SortObjects(buffer, layer);

        drawMask = false;
        if (buffer.lightSource.layerSetting[layer].type != LightingLayerType.ShadowOnly)
        {
            drawMask = true;
        }

        drawShadows = false;
        if (buffer.lightSource.layerSetting[layer].type != LightingLayerType.MaskOnly)
        {
            drawShadows = true;
        }

        GL.PushMatrix();

        if (manager.lightingSpriteAtlas && SpriteAtlasManager.Get().atlasTexture != null)
        {
            DrawWithAtlas(buffer, layer);
        }
        else
        {
            DrawWithoutAtlas(buffer, layer);
        }

        GL.PopMatrix();
    }