Skip to content

Conversation

@grizeldi
Copy link
Member

@grizeldi grizeldi commented Dec 2, 2020

When setting the type of a light probe to spherical, previously the center of the area wasn't set to the probe's position.

The code is untested, as I can't currently build the engine locally, so someone testing it would be welcome. The changes are minimal though, so chances of something breaking are small.

When setting the type of a light probe to spherical, previously the center of the area wasn't set to the probe's position.

The code is untested, as I can't currently build the engine, so someone testing it would be welcome.
@riccardobl
Copy link
Member

riccardobl commented Dec 3, 2020

If someone wants to test this quickly, without rebuilding the engine locally, it is always possible to download the maven artifacts for every commit from the actions artifacts, in this case from: https://github.com/jMonkeyEngine/jmonkeyengine/actions/runs/396272941

@grizeldi
Copy link
Member Author

grizeldi commented Dec 4, 2020

Tested it using the following code and it seems to be working. The printed position stays the same.

public class Main extends SimpleApplication {
	private LightProbe probe;

	@Override
	public void simpleInitApp() {
		EnvironmentCamera envCam = new EnvironmentCamera(); //Make an env camera
		stateManager.attach(envCam);
		envCam.initialize(stateManager, this); //Manually initilaize so we can add a probe before the next update happens
		probe = LightProbeFactory.makeProbe(envCam, rootNode);
		probe.getArea().setRadius(10); //Set the probe's radius in world units
		probe.setPosition(new Vector3f(1, 0, -2)); //Position it in 3d space
		rootNode.addLight(probe);
	}

	@Override
	public void simpleUpdate(float tpf) {
		System.out.println("Probe position: " + probe.getPosition());
		switch (probe.getAreaType()){
			case Spherical:
				probe.setAreaType(LightProbe.AreaType.OrientedBox);
				break;
			case OrientedBox:
				probe.setAreaType(LightProbe.AreaType.Spherical);
				break;
		}
	}

	public static void main(String [] args){
		new Main().start();
	}
}

@stephengold stephengold added this to the Future Release milestone Dec 5, 2020
@stephengold stephengold merged commit 69caa65 into master Dec 12, 2020
@grizeldi grizeldi deleted the light-probe-center branch December 15, 2020 11:52
@stephengold stephengold modified the milestones: Future Release, v3.4.0 Mar 13, 2021
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

Successfully merging this pull request may close these issues.

4 participants