Hello JME Community. I started playing with JME about 6 months ago, but am recently discovering some new challenges. I have lurked on this forum for a LONG time and I finally found something I cant seem to get an answer to as a lurker.
So yes, this is my first of probably many posts.
My Issue: I am writing a 3d puzzle game. For simplicities sake, I will just say I need to render a cube of smaller cubes. I have created a data structure for this effort. Essentially, a Cube is an ArrayList of Rows. A Row is an ArrayList of Columns. A Collumn is an ArrayList of Boxes. A Box is a combination of com.jme.scene.shape.Box and some other simple functionality.
Cube extends Node so I can attach it to the scene. Row extends ArrayList<Col>. Col extends ArrayList<Box>. Box extends com.jme.scene.shape.Box.
Currently I am trying to override Cube<Node>'s draw/onDraw method to incorporate the draw/onDraw method of the Box by delegating the call down the datastructure ie, row calls its col's draw method and col calls its boxes draw method. I dont see why I am not seeing anything rendered. In the end I thought this was how Node worked anyway.
Here is some code to give you a better idea.
CUBE: onDraw()
@Override
public void onDraw(Renderer r) {
if (children == null) {
return;
}
for (Row row : listOfRows) {
row.onDraw(r);
}
Spatial child;
for (int i = 0, cSize = children.size(); i < cSize; i++) {
child = children.get(i);
if (child != null)
child.onDraw(r);
}
Debugger.getInstance().println("CUBE DRAWN");
}
ROW: onDraw()
public void onDraw(Renderer r) {
for (Col col : this) {
col.onDraw(r);
}
Debugger.getInstance().println("ROW" + location + " DRAWN");
}
COL: onDraw()
public void onDraw(Renderer r){
for(Box box:this){
box.draw(r);
//box.onDraw(r); NOT SURE WHICH ONE I WANT
Debugger.getInstance().println("BOX"+box.location.x+box.location.y+box.location.z+" DRAWN");
}
Debugger.getInstance().println("COL"+location.x+location.y+" DRAWN");
}
Box's draw method is call to com.jme.scene.shape.Box's draw.
At the risk of saying too much, I will also mention that I have tried delegating the call on Cube's setModelBound the same way to each of the boxes setModelBound.
The same goes for updating the bounding boxes.
Alright, thanks for any help! let me know if you want to see anything else.