Game Development Reference
In-Depth Information
modelBatch.dispose();
box.getTexture().dispose();
cone.getTexture().dispose();
cylinder.getTexture().dispose();
raypick.getTexture().dispose();
sphere.getTexture().dispose();
Gdx.app.log(this.getClass().getName(), "Disposed.");
}
Having fun with shadows
It appears that something is missing since we have light and reflection but no
shadows. Shadow in LibGDX is still evolving. The way of using shadows might
change in the next version. However, we will simply put a shadow here just to
make the scene look more complete:
DirectionalShadowLight shadowLight;
ModelBatch shadowBatch;
@Override
public void create() {
. . .
environment = new Environment();
environment.set(new ColorAttribute(ColorAttribute.AmbientLight,
.4f, .4f, .4f, 1f));
environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f,
-0.8f, -0.2f));
shadowLight = new DirectionalShadowLight(1024, 1024, 60, 60,
1f, 300);
shadowLight.set(0.8f, 0.8f, 0.8f, -1f, -.8f, -.2f);
environment.add(shadowLight);
environment.shadowMap = shadowLight;
shadowBatch = new ModelBatch(new DepthShaderProvider());
. . .
}
@Override
public void render() {
//update the world
. . .
shadowLight.begin(Vector3.Zero, cam.direction);
shadowBatch.begin(shadowLight.getCamera());
 
Search WWH ::




Custom Search