Fine tuning the Earth
If you're a space geek, you might be thinking that there are a few things we could do to our Earth model. For one, we should add the night view texture. (Mars and the other planets don't need one because their cities shut off all their lights at night.) Also, the Earth is slightly tilted on its axis. We can fix that.
The night texture
First, let's add the night texture. To do this, let's make an Earth
Java class a subclass of a Planet
. Right-click on your Java solarsystem
folder, select New | Java Class, and name it Earth
. Then, start defining it like this:
public class Earth extends Planet { public Earth(float distance, float radius, float rotation, float orbit, int texId, int nightTexId, Transform origin) { super(distance, radius, rotation, orbit, origin); transform.addComponent(new Sphere(texId, nightTexId)); } }
This requires that we add a new constructor to the Planet
class, which omits texId
, since the Earth constructor creates the new Sphere...