RenderObject
will serve as the parent class of geometric objects that can be rendered in the scene. RenderObject
extends Component
, so it has a Transform
.
In the renderbox/components
folder, create a new Java class, RenderObject
. Define it as an abstract class that extends Component
:
public abstract class RenderObject extends Component { private static final String TAG = "RenderObject"; public RenderObject(){ super(); RenderBox.instance.renderObjects.add(this); } }
The first thing we do is have each instance add itself to the list of renderObjects
maintained by the RenderBox
instance. Let's jump over to the RenderBox
class now and add support for this list.
Open the RenderBox.java
file and add a renderObjects
list:
public class RenderBox implements CardboardView.StereoRenderer { public List<RenderObject> renderObjects = new ArrayList<RenderObject>();
Now, back to the RenderObject
class; we'll implement three methods: allocateFloatBuffer...