def render(self, detailSize): # set up some buffers count = 20000 P = [] Cs = [] w = [] random.seed(997) for i in range(count): P.append( pimath.V3f(random.uniform(-self.dim, self.dim), random.uniform(-self.dim, self.dim), random.uniform(-self.dim, self.dim))) Cs.append( pimath.V3f(random.uniform(0.05, 1), random.uniform(0.05, 1), random.uniform(0.05, 1))) w.append(random.uniform(0.5 * self.point_radius, self.point_radius)) # form a table from our buffers with required renderman info t = n.ObjectTable() t['P'] = n.V3fBuffer(count, pimath.V3f(0, 0, 0)) t['P'].contents = P t['P'].attribs['token'] = 'P' if 1: # colour per point t['Cs'] = n.V3fBuffer(count, pimath.V3f(0, 0, 0)) t['Cs'].contents = Cs t['Cs'].attribs['token'] = 'vertex color Cs' else: # constant colour across all points t['Cs'] = n.AttribTable() t['Cs']['value'] = pimath.V3f(1, 0, 0) t['Cs']['token'] = 'constant color Cs' if 0: # varying width t['width'] = n.FloatBuffer(count, 0.0) t['width'].contents = w t['width'].attribs['token'] = 'varying float width' else: if 1: # constants either as attrib table t['width'] = n.AttribTable() t['width']['value'] = 0.05 t['width']['token'] = 'constant float constantwidth' else: # or buffer of length 1 t['width'] = n.FloatBuffer(1, 0.03) t['width'].attribs['token'] = 'constant float constantwidth' # render ri.TransformBegin() ri.Translate(self.centre[0], self.centre[1], self.centre[2]) nd.points(t) ri.TransformEnd()
def render(self, detailSize): print 'PtcProc.render()' ptc = nd.load(self.path) #ptc['firstN'] = 20000 # render nd.points(ptc)
def render(self, detailSize): print 'PtcProc.render()' ptc = nd.load( self.path ) #ptc['firstN'] = 20000 # render nd.points(ptc)
def render(self, detailSize): # set up some buffers count = 20000 P = [] Cs = [] w = [] random.seed(997) for i in range(count): P.append(pimath.V3f(random.uniform(-self.dim, self.dim), random.uniform(-self.dim, self.dim), random.uniform(-self.dim, self.dim)) ) Cs.append(pimath.V3f(random.uniform(0.05, 1), random.uniform(0.05, 1), random.uniform(0.05, 1))) w.append(random.uniform(0.5 * self.point_radius, self.point_radius)) # form a table from our buffers with required renderman info t = n.ObjectTable() t['P'] = n.V3fBuffer(count, pimath.V3f(0, 0, 0)) t['P'].contents = P t['P'].attribs['token'] = 'P' if 1: # colour per point t['Cs'] = n.V3fBuffer(count, pimath.V3f(0, 0, 0)) t['Cs'].contents = Cs t['Cs'].attribs['token'] = 'vertex color Cs' else: # constant colour across all points t['Cs'] = n.AttribTable() t['Cs']['value'] = pimath.V3f(1,0,0) t['Cs']['token'] = 'constant color Cs' if 0: # varying width t['width'] = n.FloatBuffer(count, 0.0) t['width'].contents = w t['width'].attribs['token'] = 'varying float width' else: if 1: # constants either as attrib table t['width'] = n.AttribTable() t['width']['value'] = 0.05 t['width']['token'] = 'constant float constantwidth' else: # or buffer of length 1 t['width'] = n.FloatBuffer(1, 0.03) t['width'].attribs['token'] = 'constant float constantwidth' # render ri.TransformBegin() ri.Translate(self.centre[0], self.centre[1], self.centre[2]) nd.points(t) ri.TransformEnd()