Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.2 - v1.3 light color differences #38

Closed
Aure77 opened this issue Dec 12, 2014 · 3 comments
Closed

v1.2 - v1.3 light color differences #38

Aure77 opened this issue Dec 12, 2014 · 3 comments

Comments

@Aure77
Copy link

Aure77 commented Dec 12, 2014

I am actually using box2dlights 1.2 with this settings :

// Initialize light ray handler
RayHandler.useDiffuseLight(true);
rayHandler = new RayHandler(world);
rayHandler.setAmbientLight(0.0f);

...
PointLight light = new PointLight(rayHandler, 32, Color.YELLOW, 30, 0, 0);
//light.setStaticLight(true);
light.setSoft(true);
light.attachToBody(body, 0, 0);

That render this :
https://i.imgur.com/rugDUNt.jpg

I have tried to upgrade to 1.3 but I got a strange behavior with same code :
https://i.imgur.com/po5rK3c.jpg
color is dull and light feel more darker.

Why ?

EDIT: I Saw that : rinold@e8c1010#diff-bb6de2497b7e4551aee180796561d089R541 but I cannot modify diffuse blend function from RayHandler (from master). How to make light more flashy ?

@rinold
Copy link
Contributor

rinold commented Dec 13, 2014

Hi @Aure77,

In the 1.3 you can set the previous 1.2 blending model using following code:

rayHandler.diffuseBlendFunc.set(GL20.GL_DST_COLOR, GL20.GL_SRC_COLOR);

@Aure77
Copy link
Author

Aure77 commented Dec 15, 2014

Thanks.
But now, how to access to light list from rayhandler (now not public) ?
Because I would like to remove light but I only now attached body. Previously I do that 👍

for (Light light : rayHandler.lightList) {
  if(currentBody.equals(light.getBody())) {
    light.remove();
    break;
  }
}

There is a lot of changes but I don't find changelog.

@rinold
Copy link
Contributor

rinold commented Dec 16, 2014

If you do not use the Body/Fixture user data you can workaround it when linking light and body:

...
light.attachToBody(body);
body.setUserData(light);
... // and then:
((Light)currentBody.getUserData()).remove();

Regarding the rayHandler.lightList being private think that's not correct and is a side-effect issue introduced in 1.3 version, I'll check it and fix if needed.

@Aure77 Aure77 closed this as completed Dec 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants