def _makeGeom(array,ctup,i,pipe, geomType=GeomPoints): #XXX testing multiple Geom version ... for perf seems like it will be super slow #SUUUPER slow TONS of draw calls #wwwayyy better to make a bunch of geoms ahead of time... """ multiprocessing capable geometery maker """ fmt = GeomVertexFormat.getV3c4() cloudNode = GeomNode('bin %s selectable'%(i)) for point in array: vertexData = GeomVertexData('poitn', fmt, Geom.UHStatic) GeomVertexWriter(vertexData, 'vertex').addData3f(*point) GeomVertexWriter(vertexData, 'color').addData4f(*ctup) #verts.addData3f(*point) #color.addData4f(*ctup) points = geomType(Geom.UHStatic) points.addVertex(0) points.closePrimitive() cloudGeom = Geom(vertexData) cloudGeom.addPrimitive(points) cloudNode.addGeom(cloudGeom) #TODO figure out if it is faster to add and subtract Geoms from geom nodes... #output[i] = cloudNode #print('ping',{i:cloudNode}) #pipe.send((i,)) #out = q.get() #print('pong',out) #q.put(out) if pipe == None: return (cloudNode) pipe.send(cloudNode.encodeToBamStream()) #FIXME make this return a pointer NOPE
def makeGeom(index_counter, array, ctup, i, pipe, geomType=GeomPoints): """ multiprocessing capable geometery maker """ #man = indexMan(('127.0.0.1',5000), authkey='none') #man.connect() #index = man.index() index = {} fmt = GeomVertexFormat.getV3c4() vertexData = GeomVertexData( 'points', fmt, Geom.UHDynamic ) #FIXME use the index for these too? with setPythonTag, will have to 'reserve' some #vertexData.setPythonTag('uid',index.reserve()) #maybe we don't need this? the geom should have it all? cloudGeom = Geom(vertexData) #cloudGeom.setPythonTag('uid',index.reserve()) cloudNode = GeomNode('bin %s selectable' % (i)) uid = next(index_counter) index[uid] = None cloudNode.setPythonTag( 'uid', uid ) #FIXME we return cloudnode elsewhere... maybe on the other end we can set the uid in the index properly? points = array verts = GeomVertexWriter(vertexData, 'vertex') color = GeomVertexWriter(vertexData, 'color') for point in points: index[next(index_counter)] = [ point, cloudNode.getPythonTag('uid'), None ] #FIXME we're gonna need a decode on the other end? verts.addData3f(*point) color.addData4f(*ctup) points = geomType(Geom.UHDynamic) points.addConsecutiveVertices(0, len(array)) points.closePrimitive() cloudGeom.addPrimitive(points) cloudNode.addGeom( cloudGeom ) #TODO figure out if it is faster to add and subtract Geoms from geom nodes... #output[i] = cloudNode #print('ping',{i:cloudNode}) #pipe.send((i,)) #out = q.get() #print('pong',out) #q.put(out) if pipe == None: return cloudNode, index pipe.send( cloudNode.encodeToBamStream()) #FIXME make this return a pointer NOPE pipe.send(index) #FIXME make this return a pointer NOPE
def makeGeom(index_counter, array,ctup,i,pipe, geomType=GeomPoints): """ multiprocessing capable geometery maker """ #man = indexMan(('127.0.0.1',5000), authkey='none') #man.connect() #index = man.index() index = {} fmt = GeomVertexFormat.getV3c4() vertexData = GeomVertexData('points', fmt, Geom.UHDynamic) #FIXME use the index for these too? with setPythonTag, will have to 'reserve' some #vertexData.setPythonTag('uid',index.reserve()) #maybe we don't need this? the geom should have it all? cloudGeom = Geom(vertexData) #cloudGeom.setPythonTag('uid',index.reserve()) cloudNode = GeomNode('bin %s selectable'%(i)) uid = next(index_counter) index[uid] = None cloudNode.setPythonTag('uid',uid) #FIXME we return cloudnode elsewhere... maybe on the other end we can set the uid in the index properly? points = array verts = GeomVertexWriter(vertexData, 'vertex') color = GeomVertexWriter(vertexData, 'color') for point in points: index[next(index_counter)]=[point,cloudNode.getPythonTag('uid'),None] #FIXME we're gonna need a decode on the other end? verts.addData3f(*point) color.addData4f(*ctup) points = geomType(Geom.UHDynamic) points.addConsecutiveVertices(0,len(array)) points.closePrimitive() cloudGeom.addPrimitive(points) cloudNode.addGeom(cloudGeom) #TODO figure out if it is faster to add and subtract Geoms from geom nodes... #output[i] = cloudNode #print('ping',{i:cloudNode}) #pipe.send((i,)) #out = q.get() #print('pong',out) #q.put(out) if pipe == None: return cloudNode, index pipe.send(cloudNode.encodeToBamStream()) #FIXME make this return a pointer NOPE pipe.send(index) #FIXME make this return a pointer NOPE
def _makeGeom( array, ctup, i, pipe, geomType=GeomPoints ): #XXX testing multiple Geom version ... for perf seems like it will be super slow #SUUUPER slow TONS of draw calls #wwwayyy better to make a bunch of geoms ahead of time... """ multiprocessing capable geometery maker """ fmt = GeomVertexFormat.getV3c4() cloudNode = GeomNode('bin %s selectable' % (i)) for point in array: vertexData = GeomVertexData('poitn', fmt, Geom.UHStatic) GeomVertexWriter(vertexData, 'vertex').addData3f(*point) GeomVertexWriter(vertexData, 'color').addData4f(*ctup) #verts.addData3f(*point) #color.addData4f(*ctup) points = geomType(Geom.UHStatic) points.addVertex(0) points.closePrimitive() cloudGeom = Geom(vertexData) cloudGeom.addPrimitive(points) cloudNode.addGeom( cloudGeom ) #TODO figure out if it is faster to add and subtract Geoms from geom nodes... #output[i] = cloudNode #print('ping',{i:cloudNode}) #pipe.send((i,)) #out = q.get() #print('pong',out) #q.put(out) if pipe == None: return (cloudNode) pipe.send( cloudNode.encodeToBamStream()) #FIXME make this return a pointer NOPE