The Component class
Our 3D virtual reality scenes consist of various kinds of components. Components may include geometric objects, lights, and cameras. Components can be positioned, rotated, and scaled in 3D space, according to their associated transform. Let's create a Component
class that will serve as the basis for other object classes in the scene.
If you haven't created Component.java
yet, create one now in the renderbox/components
folder. Define it as follows:
public class Component { public Transform transform; public boolean enabled = true; }
We've included an enabled
flag, which will come in handy to easily hide/show objects when we draw our scene.
That's it. Next, we'll define our first component, RenderObject
, to represent geometric objects in the scene.