- PointLight pLgt = new PointLight(new Color3f(1.0f, 1.0f, 1.0f),
- new Point3f(0f, 0f, 2f), new Point3f(0.25f, 0.05f, 0.0f) );
- pLgt.setInfluencingBounds(bounds);
- objTrans.addChild(pLgt);
-
- PointLight pl2 = new PointLight(new Color3f(0.8f, 0.9f, 0.4f),
- new Point3f(6f, 1f, 6f), new Point3f(0.2f, 0.1f, 0.05f) );
- pl2.setInfluencingBounds(bounds);
- objTrans.addChild(pl2);
-
- PointLight pl3 = new PointLight(new Color3f(0.7f, 0.7f, 0.7f),
- new Point3f(0.0f, 12f, -2f), new Point3f(0.1f, 0.1f, 0.0f) );
- pl3.setInfluencingBounds(bounds);
- objTrans.addChild(pl3);
+ // Additional lights depend on whether there's a terrain or not
+ if (showTerrain)
+ {
+ // If there's a terrain, just have directional light from northwest
+ DirectionalLight dl = new DirectionalLight(true,
+ new Color3f(1.0f, 1.0f, 1.0f),
+ new Vector3f(1.0f, -1.0f, 1.0f));
+ dl.setInfluencingBounds(bounds);
+ objTrans.addChild(dl);
+ }
+ else
+ {
+ // There is no terrain, so use point lights as before
+ PointLight pLgt = new PointLight(new Color3f(1.0f, 1.0f, 1.0f),
+ new Point3f(0f, 0f, 2f), new Point3f(0.25f, 0.05f, 0.0f) );
+ pLgt.setInfluencingBounds(bounds);
+ objTrans.addChild(pLgt);
+
+ PointLight pl2 = new PointLight(new Color3f(0.8f, 0.9f, 0.4f),
+ new Point3f(6f, 1f, 6f), new Point3f(0.2f, 0.1f, 0.05f) );
+ pl2.setInfluencingBounds(bounds);
+ objTrans.addChild(pl2);
+
+ PointLight pl3 = new PointLight(new Color3f(0.7f, 0.7f, 0.7f),
+ new Point3f(0.0f, 12f, -2f), new Point3f(0.1f, 0.1f, 0.0f) );
+ pl3.setInfluencingBounds(bounds);
+ objTrans.addChild(pl3);
+ }