Appendix 1: Decorating your room

The default room in Env3D is 10x10x10 and doesn't have very nice textures. You can use the Env.setRoom(Room) method to change the look of your room.

Create a Room class as follows:

public class Room 
    private String textureTop;
    private String textureBottom;
    private String textureNorth;
    private String textureEast;  
    private String textureSouth;
    private String textureWest;
    private double width;
    private double height;
    private double depth;

    private double bgRed;
    private double bgGreen;
    private double bgBlue;


When you set the various texture* fields to point to a particular image file, the texture for the corresponding wall would change (setting these fields to null would make the wall disappear). The dimension of the room is controlled by the width, depth, and height fields. The bg* fields control the background color of your room. If you set all of the bg* fields to 0, the background will be black.

After creating the Room class, do this before adding any objects to your environment:

Room r = new Room();

Things to note:

  • Every time the Env.setRoom() executes, all the objects in the room will be removed. You have to re-add all the objects into the environment to make them re-appear.
  • Unlike 3D objects, mutating the various fields in the Room class have no effect until a setRoom is called.