Comments (10)
Looking at stack trace - the RayHandler instance passed to PointLight constructor is null. Could you debug or use logging to verify that you are passing the correct initialized RayHandler instance during that lights creation?
from box2dlights.
I am most definitely passing a correct, initialized RayHandler.
from box2dlights.
Also tried to change the color during runtime in test project - works fine. Could you share some code of actual box2dlights usage in your project, that is not working?
from box2dlights.
rayHandler = new RayHandler(world);
rayHandler.useDiffuseLight(false);
rayHandler.setCombinedMatrix(camera.combined);
rayHandler.setAmbientLight(0.0f, 0.0f, 0.0f, 0.0f);
...
a = new PointLight(rayHandler, 1024, Color.CYAN, light, -200, 200);
b = new PointLight(rayHandler, 1024, Color.MAGENTA, light, -200, -200);
c = new PointLight(rayHandler, 1024, Color.YELLOW, light, 250, 100);
d = new PointLight(rayHandler, 1024, Color.MAROON, light, 200, 200);
pl.attachToBody(p.body, 0f, 0f);
pl2.attachToBody(p.body, 0f, 0f);
pl.setXray(false);
pl2.setXray(true);
pl.setSoft(true);
pl2.setSoft(true);
...
public void lightOn() {
new PointLight(rayHandler, 1024, Color.ORANGE, 200, 174, 430); //NullPointerException
c.setColor(Color.BLUE); //NullPointerException
}
Sorry, I'm not really sure how to format it as code here.
from box2dlights.
Yeah your code looks absolutely fine. What version of box2dlights are you using?
You can try to find the code difference with box2dlights demo app (in tests - it's 100% working, tried it today).
from box2dlights.
It's the latest version... Hm. I'll take a look.
Oh, and, just a question - is there any way to reduce the intensity of the center of a PointLight?
What about reducing how incredibly bright it gets when you stack two together (I have a player light that follows the player and a torch, and if the player goes near the torch, it gets almost too intense to see the sprites).
from box2dlights.
What about reducing how incredibly bright it gets when you stack two together
Have you tried using the diffuse light model?
rayHandler.useDiffuseLight(true);
I see you set it to false in your code, is it essential for you?
from box2dlights.
The diffuse model, while being prominent in any 3D work I do (not with this engine of course), doesn't seem to work very well with this. It makes shadows appear as circular blobs about half the radius of the actual sprite, which looks dreadful.
from box2dlights.
The diffuse model, while being prominent in any 3D work I do (not with this engine of course), doesn't seem to work very well with this. It makes shadows appear as circular blobs about half the radius of the actual sprite, which looks dreadful.
This is quite an important comment, I will investigate it. Unfortunately, can't give you any estimates currently.
Also, about the exceptions, have you found any solution or root cause of it?
from box2dlights.
Actually, just today I managed to get it working: instead of calling some of my methods from inner classes and/or objects, I called them directly from the main class and it worked.
from box2dlights.
Related Issues (20)
- When is the 1.5 release? HOT 4
- Lights are duplicated, triplicated, etc HOT 2
- invalid sha1 HOT 2
- Lights under body ignore the body HOT 1
- [Feature Request] Add a way to specify a glClearColor different than black HOT 2
- Not compatible with Libgdx1.9.7 HOT 6
- FrameBuffer pixelformat creating issues after changes in LibGDX 1.9.7? HOT 1
- Adding rayhandler in LibGDx causes issues in InputListener HOT 5
- Limit saturation?
- Do the box2dlights 1.5 release HOT 4
- Rendering 3D Objects while using box2Dlights causes glitches HOT 1
- Potentially broken on GDX 1.9.9 HOT 1
- Help me HOT 1
- RayHandler/LighList access modifier.
- Whitespacing issue HOT 1
- Lights does not render when diffuse is disabled and blur is enabled HOT 1
- RayHadler initialization exception HOT 2
- Licence information HOT 2
- lightList in RayHandler is not accessible HOT 4
- Directional Light has "sides"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from box2dlights.