private Tool() {
//utility class
}
public static Node makeRandomEnviromentObjects(Vector3f center, int boxSize, int count, boolean useTransparency) {
Node node = new Node("random_objects");
Renderer renderer = DisplaySystem.getDisplaySystem().getRenderer();
CullState cs = renderer.createCullState();
cs.setCullFace(Face.Back);
node.setRenderState(cs);
if (useTransparency) {
ZBufferState zs = renderer.createZBufferState();
zs.setEnabled(false);
node.setRenderState(zs);
BlendState bs = renderer.createBlendState();
bs.setBlendEnabled(true);
node.setRenderState(bs);
node.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);
}
node.updateRenderState();
Random r = new Random();
Node[] subNode = new Node[5];
TriMesh[] triMesh = new TriMesh[5];
subNode[0] = new Node("spheres");
subNode[0].setRenderState(Tool.createXRayShader());
triMesh[0] = new Sphere("sphere", new Vector3f(0, 0, 0), 10, 10, 5);
triMesh[0].setModelBound(new BoundingSphere());
subNode[1] = new Node("boxes");
triMesh[1] = new Box("box", new Vector3f(0, 0, 0), 5, 5, 5);
triMesh[1].setModelBound(new BoundingBox());
subNode[2] = new Node("toruses");
triMesh[2] = new Torus("torus", 10, 10, 2, 3);
triMesh[2].setModelBound(new BoundingBox());
subNode[3] = new Node("cylinders");
triMesh[3] = new Cylinder("cylinder", 10, 10, 2, 3, true);
triMesh[3].setModelBound(new BoundingBox());
subNode[4] = new Node("pyramids");
triMesh[4] = new Pyramid("pyramid", 10, 10);
triMesh[4].setModelBound(new BoundingBox());
for (int i = 0; i < subNode.length; i++) {
node.attachChild(subNode[i]);
}
List<Vector3f> linesPoint = new ArrayList<Vector3f>(count);
float halfBoxSize = boxSize * 0.5f;
for (int i = 0; i < count; i++) {