A better looking and faster spot shadow.
1. This improve the looking, the star shape (spike) on long action bar is gone. Shadow is more smooth now. 2. The performance is better, too. For averaging around rect, round rect and circle, the spot shadow itself is 3 times faster. On N7 v1, it could be less than 0.1 ms. b/14976551 b/16712006 Change-Id: I61ed546ee56e7c8dbe504dfcaef12d084904b4b8
This commit is contained in:
@@ -326,9 +326,9 @@ void AmbientShadow::createAmbientShadow(bool isCasterOpaque,
|
||||
shadowVertexBuffer.updateVertexCount(vertexBufferIndex);
|
||||
shadowVertexBuffer.updateIndexCount(indexBufferIndex);
|
||||
|
||||
ShadowTessellator::checkOverflow(vertexBufferIndex, totalVertexCount, "Vertex Buffer");
|
||||
ShadowTessellator::checkOverflow(indexBufferIndex, totalIndexCount, "Index Buffer");
|
||||
ShadowTessellator::checkOverflow(umbraIndex, totalUmbraCount, "Umbra Buffer");
|
||||
ShadowTessellator::checkOverflow(vertexBufferIndex, totalVertexCount, "Ambient Vertex Buffer");
|
||||
ShadowTessellator::checkOverflow(indexBufferIndex, totalIndexCount, "Ambient Index Buffer");
|
||||
ShadowTessellator::checkOverflow(umbraIndex, totalUmbraCount, "Ambient Umbra Buffer");
|
||||
|
||||
#if DEBUG_SHADOW
|
||||
for (int i = 0; i < vertexBufferIndex; i++) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -36,40 +36,6 @@ private:
|
||||
static float projectCasterToOutline(Vector2& outline,
|
||||
const Vector3& lightCenter, const Vector3& polyVertex);
|
||||
|
||||
static int setupAngleList(VertexAngleData* angleDataList,
|
||||
int polyLength, const Vector2* polygon, const Vector2& centroid,
|
||||
bool isPenumbra, const char* name);
|
||||
|
||||
static int convertPolysToVerticesPerRay(
|
||||
bool hasOccludedUmbraArea, const Vector2* poly2d, int polyLength,
|
||||
const Vector2* umbra, int umbraLength, const Vector2* penumbra,
|
||||
int penumbraLength, const Vector2& centroid,
|
||||
Vector2* umbraVerticesPerRay, Vector2* penumbraVerticesPerRay,
|
||||
Vector2* occludedUmbraVerticesPerRay);
|
||||
|
||||
static bool checkClockwise(int maxIndex, int listLength,
|
||||
VertexAngleData* angleList, const char* name);
|
||||
|
||||
static void calculateDistanceCounter(bool needsOffsetToUmbra, int angleLength,
|
||||
const VertexAngleData* allVerticesAngleData, int* distances);
|
||||
|
||||
static void mergeAngleList(int maxUmbraAngleIndex, int maxPenumbraAngleIndex,
|
||||
const VertexAngleData* umbraAngleList, int umbraLength,
|
||||
const VertexAngleData* penumbraAngleList, int penumbraLength,
|
||||
VertexAngleData* allVerticesAngleData);
|
||||
|
||||
static int setupPolyAngleList(float* polyAngleList, int polyAngleLength,
|
||||
const Vector2* poly2d, const Vector2& centroid);
|
||||
|
||||
static bool checkPolyClockwise(int polyAngleLength, int maxPolyAngleIndex,
|
||||
const float* polyAngleList);
|
||||
|
||||
static int getEdgeStartIndex(const int* offsets, int rayIndex, int totalRayNumber,
|
||||
const VertexAngleData* allVerticesAngleData);
|
||||
|
||||
static int getPolyEdgeStartIndex(int maxPolyAngleIndex, int polyLength,
|
||||
const float* polyAngleList, float rayAngle);
|
||||
|
||||
static void computeLightPolygon(int points, const Vector3& lightCenter,
|
||||
float size, Vector3* ret);
|
||||
|
||||
|
||||
@@ -99,6 +99,10 @@ struct Vector2 {
|
||||
return x * v.x + y * v.y;
|
||||
}
|
||||
|
||||
float cross(const Vector2& v) const {
|
||||
return x * v.y - y * v.x;
|
||||
}
|
||||
|
||||
void dump() {
|
||||
ALOGD("Vector2[%.2f, %.2f]", x, y);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user