/** * collect all nodes * * @param branch */ private void collectNodes(KNode branch) { Camera cam = engine.getCamera(); Iterator<KNode> nodeIterator = branch.getLeafs().iterator(); while (nodeIterator.hasNext()) { KNode n = nodeIterator.next(); n.updateMatrix(); if (n.isVisible()) { if (n instanceof VisualNode) { if (cam == null || (cam != null && cam.isVisible((VisualNode) n))) { visuals.add((VisualNode) n); } } collectNodes(n); } } }
/** * render visual node * * @param gl * @param node */ private void renderVisualNode(GL2 gl, VisualNode node) { // dont render when picking mode is // enabled and node is not pickable ARenderPass cp = engine.getCurrentPass(); if (cp.getId() == ARenderPass.PASS_PICKING && !node.isPickable()) { return; } // load current matrix Matrix4d m = node.getGlobalMatrix(); gl.glLoadMatrixd( new double[] { m.m00, m.m10, m.m20, m.m30, m.m01, m.m11, m.m21, m.m31, m.m02, m.m12, m.m22, m.m32, m.m03, m.m13, m.m23, m.m33, }, 0); // render the node with respect to current pass node.renderNode(gl, engine); }