Skip to content

Commit

Permalink
Optimized the fixture LightData reset
Browse files Browse the repository at this point in the history
  • Loading branch information
rinold committed Feb 6, 2015
1 parent f188dd5 commit 784de82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
4 changes: 4 additions & 0 deletions src/box2dLight/PositionalLight.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ protected void setMesh() {
@Override
public boolean reportFixture(Fixture fixture) {
if (fixture.getBody() != body) {
if (fixture.getUserData() instanceof LightData) {
LightData data = (LightData)fixture.getUserData();
data.shadowsDropped = 0;
}
affectedFixtures.add(fixture);
}
return true;
Expand Down
14 changes: 0 additions & 14 deletions src/box2dLight/RayHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.Fixture;
import com.badlogic.gdx.physics.box2d.World;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Disposable;
Expand Down Expand Up @@ -79,8 +77,6 @@ public class RayHandler implements Disposable {
* <p>NOTE: DO NOT MODIFY THIS LIST
*/
final Array<Light> disabledLights = new Array<Light>(false, 16);

final Array<Body> bodies = new Array<Body>();

final LightMap lightMap;
final ShaderProgram lightShader;
Expand Down Expand Up @@ -283,16 +279,6 @@ public void updateAndRender() {
* @see #render()
*/
public void update() {
world.getBodies(bodies);
for (Body body : bodies) {
for (Fixture fixture : body.getFixtureList()) {
if (fixture.getUserData() instanceof LightData) {
LightData data = (LightData)fixture.getUserData();
data.shadowsDropped = 0;
}
}
}

for (Light light : lightList) {
light.update();
}
Expand Down

0 comments on commit 784de82

Please sign in to comment.