Skip to content

Commit

Permalink
Correcting dynamic shadows color gradient
Browse files Browse the repository at this point in the history
  • Loading branch information
rinold committed Feb 7, 2015
1 parent da35f6d commit 5d207d1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
13 changes: 7 additions & 6 deletions src/box2dLight/DirectionalLight.java
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ protected void updateDynamicShadowMeshes() {

segments[size++] = tmpVec.x;
segments[size++] = tmpVec.y;
segments[size++] = colBits;
segments[size++] = zeroColorBits;
segments[size++] = f;

segments[size++] = tmpEnd.x;
Expand All @@ -328,7 +328,7 @@ protected void updateDynamicShadowMeshes() {
tmpStart.set(center).add(tmpVec);
segments[size++] = tmpStart.x;
segments[size++] = tmpStart.y;
segments[size++] = colBits;
segments[size++] = zeroColorBits;
segments[size++] = f;

tmpEnd.set(tmpStart).sub(lstart).limit(l).add(tmpStart);
Expand All @@ -347,7 +347,7 @@ protected void updateDynamicShadowMeshes() {

segments[size++] = tmpVec.x;
segments[size++] = tmpVec.y;
segments[size++] = colBits;
segments[size++] = zeroColorBits;
segments[size++] = f;

tmpEnd.set(tmpVec).sub(lstart).limit(l).add(tmpVec);
Expand All @@ -360,8 +360,8 @@ protected void updateDynamicShadowMeshes() {
tmpVec.set(fixture.getBody().getWorldPoint(tmpVec));
segments[size++] = tmpVec.x;
segments[size++] = tmpVec.y;
segments[size++] = colBits;
segments[size++] = 1f;
segments[size++] = zeroColorBits;
segments[size++] = f;

tmpEnd.set(tmpVec).sub(lstart).limit(l).add(tmpVec);
segments[size++] = tmpEnd.x;
Expand Down Expand Up @@ -428,7 +428,8 @@ public void setHeight(float degrees) {
if (degrees > 180f) {
height = -1f;
}
else if (degrees != 90f) height = Math.abs(degrees - 90f);
else if (degrees > 90f) height = degrees - 90f;
else height = degrees;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/box2dLight/PointLight.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ protected void updateDynamicShadowMeshes() {

segments[size++] = tmpVec.x;
segments[size++] = tmpVec.y;
segments[size++] = colBits;
segments[size++] = zeroColorBits;
segments[size++] = f;

segments[size++] = tmpEnd.x;
Expand All @@ -200,7 +200,7 @@ protected void updateDynamicShadowMeshes() {
tmpStart.set(center).add(tmpVec);
segments[size++] = tmpStart.x;
segments[size++] = tmpStart.y;
segments[size++] = colBits;
segments[size++] = zeroColorBits;
segments[size++] = f;

tmpEnd.set(tmpStart).sub(start).limit(l).add(tmpStart);
Expand All @@ -221,7 +221,7 @@ protected void updateDynamicShadowMeshes() {

segments[size++] = tmpVec.x;
segments[size++] = tmpVec.y;
segments[size++] = colBits;
segments[size++] = zeroColorBits;
segments[size++] = f;

tmpEnd.set(tmpVec).sub(start).limit(l).add(tmpVec);
Expand All @@ -237,7 +237,7 @@ protected void updateDynamicShadowMeshes() {

segments[size++] = tmpVec.x;
segments[size++] = tmpVec.y;
segments[size++] = colBits;
segments[size++] = zeroColorBits;
segments[size++] = f;

tmpEnd.set(tmpVec).sub(start).limit(l).add(tmpVec);
Expand Down

0 comments on commit 5d207d1

Please sign in to comment.