Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7d34fa7 authored by Teng-Hui Zhu's avatar Teng-Hui Zhu Committed by android-build-merger
Browse files

Make umbra lighter when the blocker is too high and has no real umbra area....

Make umbra lighter when the blocker is too high and has no real umbra area. am: 9c555566 am: 9ad59993
am: 6ff1730d

Change-Id: Ia7855238cfb893d591ff404a1f17ada76dd79ff0
parents f4dfa84c 6ff1730d
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -927,9 +927,13 @@ void SpotShadow::generateTriangleStrip(bool isCasterOpaque, float shadowStrength
        AlphaVertex::set(&shadowVertices[vertexBufferIndex++], newPenumbra[i].x,
                newPenumbra[i].y, PENUMBRA_ALPHA);
    }
    // Since the umbra can be a faked one when the occluder is too high, the umbra should be lighter
    // in this case.
    float scaledUmbraAlpha = UMBRA_ALPHA * shadowStrengthScale;

    for (int i = 0; i < umbraLength; i++) {
        AlphaVertex::set(&shadowVertices[vertexBufferIndex++], umbra[i].x, umbra[i].y,
                UMBRA_ALPHA);
                scaledUmbraAlpha);
    }

    for (int i = 0; i < verticesPairIndex; i++) {
@@ -969,14 +973,14 @@ void SpotShadow::generateTriangleStrip(bool isCasterOpaque, float shadowStrength
            indexBuffer[indexBufferIndex++] = newPenumbraLength + i;
            indexBuffer[indexBufferIndex++] = vertexBufferIndex;
            AlphaVertex::set(&shadowVertices[vertexBufferIndex++],
                    closerVertex.x, closerVertex.y, UMBRA_ALPHA);
                    closerVertex.x, closerVertex.y, scaledUmbraAlpha);
        }
    } else {
        // If there is no occluded umbra at all, then draw the triangle fan
        // starting from the centroid to all umbra vertices.
        int lastCentroidIndex = vertexBufferIndex;
        AlphaVertex::set(&shadowVertices[vertexBufferIndex++], centroid.x,
                centroid.y, UMBRA_ALPHA);
                centroid.y, scaledUmbraAlpha);
        for (int i = 0; i < umbraLength; i++) {
            indexBuffer[indexBufferIndex++] = newPenumbraLength + i;
            indexBuffer[indexBufferIndex++] = lastCentroidIndex;