com.badlogic.gdx.graphics.g3d.environment.DirectionalShadowLight Java Examples

The following examples show how to use com.badlogic.gdx.graphics.g3d.environment.DirectionalShadowLight. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GameRenderer.java    From GdxDemo3D with Apache License 2.0 6 votes vote down vote up
public void setEnvironmentLights(Array<BaseLight<?>> lights, Vector3 sunDirection) {
	environment = new Environment();
	environment.add((shadowLight = new DirectionalShadowLight(
			GameSettings.SHADOW_MAP_WIDTH,
			GameSettings.SHADOW_MAP_HEIGHT,
			GameSettings.SHADOW_VIEWPORT_WIDTH,
			GameSettings.SHADOW_VIEWPORT_HEIGHT,
			GameSettings.SHADOW_NEAR,
			GameSettings.SHADOW_FAR))
			.set(GameSettings.SHADOW_INTENSITY,
					GameSettings.SHADOW_INTENSITY,
					GameSettings.SHADOW_INTENSITY,
					sunDirection.nor()));
	environment.shadowMap = shadowLight;

	float ambientLight = GameSettings.SCENE_AMBIENT_LIGHT;
	environment.set(new ColorAttribute(ColorAttribute.AmbientLight, ambientLight, ambientLight, ambientLight, 1));
	for (BaseLight<?> light : lights) {
		environment.add(light);
	}
}
 
Example #2
Source File: BulletSteeringTest.java    From gdx-ai with Apache License 2.0 6 votes vote down vote up
@Override
public void dispose () {
	world.dispose();
	world = null;

	for (Disposable disposable : disposables)
		disposable.dispose();
	disposables.clear();

	modelBatch.dispose();
	modelBatch = null;

	shadowBatch.dispose();
	shadowBatch = null;

	if (shadows) ((DirectionalShadowLight)light).dispose();
	light = null;
}
 
Example #3
Source File: BulletSteeringTest.java    From gdx-ai with Apache License 2.0 5 votes vote down vote up
protected void renderWorld () {
	if (shadows) {
		((DirectionalShadowLight)light).begin(Vector3.Zero, camera.direction);
		shadowBatch.begin(((DirectionalShadowLight)light).getCamera());
		world.render(shadowBatch, null);
		shadowBatch.end();
		((DirectionalShadowLight)light).end();
	}

	modelBatch.begin(camera);
	world.render(modelBatch, environment);
	modelBatch.end();
}