int nn = np; int nc = np; int[] index = bbtNode.getIndices(); _vb = Direct.newFloatBuffer(3*4*6*nv); _nb = Direct.newFloatBuffer(3*4*6*nn);
int nn = 4*nq; int nc = 4*nq; int[] index = bbtNode.getIndices(); _vb = Direct.newFloatBuffer(3*nv); _nb = (uvw!=null)?Direct.newFloatBuffer(3*nn):null;
int nn = 3*nt; int nc = 3*nt; int[] index = bbtNode.getIndices(); _vb = Direct.newFloatBuffer(3*nv); _nb = (uvw!=null)?Direct.newFloatBuffer(3*nn):null;
public PointNode( BoundingBoxTree.Node bbtNode, float[] xyz, float[] rgb) { BoundingBox bb = bbtNode.getBoundingBox(); _bs = new BoundingSphere(bb); _np = bbtNode.getSize(); int np = _np; int nv = np; int nc = np; int[] index = bbtNode.getIndices(); _vb = Direct.newFloatBuffer(3*nv); _cb = (rgb!=null)?Direct.newFloatBuffer(3*nc):null; for (int ip=0,iv=0,ic=0; ip<np; ++ip) { int i = 3*index[ip]; _vb.put(iv++,xyz[i+X]); _vb.put(iv++,xyz[i+Y]); _vb.put(iv++,xyz[i+Z]); if (_cb!=null) { _cb.put(ic++,rgb[i+R]); _cb.put(ic++,rgb[i+G]); _cb.put(ic++,rgb[i+B]); } } }
private void test(BoundingBoxTree.Node node, int minSize, float[] x, float[] y, float[] z) { int[] i = node.getIndices(); int n = i.length; assertTrue(minSize<=n); BoundingBox bb = node.getBoundingBox(); for (int j=0; j<n; ++j) { int ij = i[j]; assertTrue(bb.contains(x[ij],y[ij],z[ij])); } BoundingBoxTree.Node left = node.getLeft(); BoundingBoxTree.Node right = node.getRight(); if (left!=null) { assertTrue(bb.contains(left.getBoundingBox())); assertTrue(bb.contains(right.getBoundingBox())); test(left,minSize,x,y,z); test(right,minSize,x,y,z); } else { assertTrue(n/2<minSize); } } }