Add a check to see if the NB_PROBES identifier is defined. Fixes #1340
This commit is contained in:
parent
6d2ea28108
commit
ded268a660
@ -2,6 +2,9 @@
|
|||||||
#ifndef PI
|
#ifndef PI
|
||||||
#define PI 3.14159265358979323846264
|
#define PI 3.14159265358979323846264
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NB_PROBES
|
||||||
|
#define NB_PROBES 0
|
||||||
|
#endif
|
||||||
|
|
||||||
//Specular fresnel computation
|
//Specular fresnel computation
|
||||||
vec3 F_Shlick(float vh, vec3 F0){
|
vec3 F_Shlick(float vh, vec3 F0){
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
package jme3test.light.pbr;
|
||||||
|
|
||||||
|
import com.jme3.app.SimpleApplication;
|
||||||
|
import com.jme3.asset.plugins.UrlLocator;
|
||||||
|
import com.jme3.environment.EnvironmentCamera;
|
||||||
|
import com.jme3.environment.LightProbeFactory;
|
||||||
|
import com.jme3.environment.generation.JobProgressAdapter;
|
||||||
|
import com.jme3.light.DirectionalLight;
|
||||||
|
import com.jme3.light.LightProbe;
|
||||||
|
import com.jme3.math.ColorRGBA;
|
||||||
|
import com.jme3.math.Vector3f;
|
||||||
|
import com.jme3.scene.Spatial;
|
||||||
|
import com.jme3.system.AppSettings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: rvandoosselaer
|
||||||
|
*/
|
||||||
|
public class TestIssue1340 extends SimpleApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
TestIssue1340 testIssue1340 = new TestIssue1340();
|
||||||
|
testIssue1340.setSettings(createSettings());
|
||||||
|
testIssue1340.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static AppSettings createSettings() {
|
||||||
|
AppSettings settings = new AppSettings(true);
|
||||||
|
settings.setRenderer(AppSettings.LWJGL_OPENGL32);
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void simpleInitApp() {
|
||||||
|
stateManager.attach(new EnvironmentCamera(32));
|
||||||
|
|
||||||
|
DirectionalLight light = new DirectionalLight(Vector3f.UNIT_Y.negate(), ColorRGBA.White);
|
||||||
|
rootNode.addLight(light);
|
||||||
|
|
||||||
|
assetManager.registerLocator("https://github.com/KhronosGroup/glTF-Sample-Models/raw/master/2.0/RiggedFigure/", UrlLocator.class);
|
||||||
|
|
||||||
|
Spatial model = assetManager.loadModel("/glTF-Embedded/RiggedFigure.gltf");
|
||||||
|
rootNode.attachChild(model);
|
||||||
|
|
||||||
|
viewPort.setBackgroundColor(ColorRGBA.LightGray);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* #ifndef NB_PROBES
|
||||||
|
* #define NB_PROBES 0
|
||||||
|
* #endif
|
||||||
|
*/
|
||||||
|
int frame;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void simpleUpdate(float tpf) {
|
||||||
|
frame++;
|
||||||
|
if (frame == 2) {
|
||||||
|
LightProbeFactory.makeProbe(stateManager.getState(EnvironmentCamera.class), rootNode, new JobProgressAdapter<LightProbe>() {
|
||||||
|
@Override
|
||||||
|
public void done(LightProbe result) {
|
||||||
|
enqueue(() -> rootNode.addLight(result));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user