本文整理汇总了Python中panda3d.core.GeomTriangles.closePrimitive方法的典型用法代码示例。如果您正苦于以下问题:Python GeomTriangles.closePrimitive方法的具体用法?Python GeomTriangles.closePrimitive怎么用?Python GeomTriangles.closePrimitive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.GeomTriangles
的用法示例。
在下文中一共展示了GeomTriangles.closePrimitive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: buildGeom
# 需要导入模块: from panda3d.core import GeomTriangles [as 别名]
# 或者: from panda3d.core.GeomTriangles import closePrimitive [as 别名]
def buildGeom(self, meshData):
prims = meshData["prims"]
vertices = meshData["vertices"]
normals = meshData["normals"]
texcoords = meshData["texcoords"]
vdata = GeomVertexData('mesh', GeomVertexFormat.getV3n3t2(), Geom.UHStatic)
vwriter = GeomVertexWriter(vdata, 'vertex')
nvwriter = GeomVertexWriter(vdata, 'normal')
tvwriter = GeomVertexWriter(vdata, 'texcoord')
for i in range(len(vertices)):
v = vertices[i]
n = normals[i]
t = texcoords[i]
vwriter.addData3f(v)
nvwriter.addData3f(n)
tvwriter.addData2f(t)
prim = GeomTriangles(Geom.UHStatic)
for i in range(len(prims)):
A, B, C = prims[i]
prim.addVertices(A, B, C)
prim.closePrimitive()
geom = Geom(vdata)
geom.addPrimitive(prim)
geomNode = GeomNode('trig')
geomNode.addGeom(geom)
geomNode.unify(1, True)
return geomNode
示例2: getPrimAndDataFromTri
# 需要导入模块: from panda3d.core import GeomTriangles [as 别名]
# 或者: from panda3d.core.GeomTriangles import closePrimitive [as 别名]
def getPrimAndDataFromTri(triset, matstate):
if triset.normal is None:
triset.generateNormals()
needsTanAndBin = False
if matstate is not None and matstate.hasAttrib(TextureAttrib):
texattr = matstate.getAttrib(TextureAttrib)
for i in range(texattr.getNumOnStages()):
if texattr.getOnStage(i).getMode() == TextureStage.MNormal:
needsTanAndBin = True
if needsTanAndBin and isinstance(triset, collada.triangleset.TriangleSet) and \
len(triset.texcoordset) > 0 and len(triset.textangentset) == 0:
triset.generateTexTangentsAndBinormals()
vdata, indexdata = getVertexData(triset.vertex, triset.vertex_index,
triset.normal, triset.normal_index,
triset.texcoordset, triset.texcoord_indexset,
triset.textangentset, triset.textangent_indexset,
triset.texbinormalset, triset.texbinormal_indexset)
gprim = GeomTriangles(Geom.UHStatic)
gprim.setIndexType(Geom.NTUint32)
gprim.setVertices(indexdata)
gprim.closePrimitive()
return (vdata, gprim)
示例3: draw
# 需要导入模块: from panda3d.core import GeomTriangles [as 别名]
# 或者: from panda3d.core.GeomTriangles import closePrimitive [as 别名]
def draw(self):
if self.rendered_mesh != None:
self.reset_draw()
format=GeomVertexFormat.getV3n3cp()
vdata=GeomVertexData('tri', format, Geom.UHDynamic)
vertex=GeomVertexWriter(vdata, 'vertex')
normal=GeomVertexWriter(vdata, 'normal')
color=GeomVertexWriter(vdata, 'color')
v_mapping = {}
i=0
for v in self.verts.values():
vertex.addData3f(v.pos.x,v.pos.y,v.pos.z)
normal.addData3f(v.norm.x, v.norm.y, v.norm.z)
color.addData4f(v.color[0],v.color[1],v.color[2],v.color[3])
v_mapping[v.ID] = i
i += 1
mesh = Geom(vdata)
for f in self.faces.values():
tri = GeomTriangles(Geom.UHDynamic)
tri.addVertex(v_mapping[f.v1.ID])
tri.addVertex(v_mapping[f.v2.ID])
tri.addVertex(v_mapping[f.v3.ID])
tri.closePrimitive()
mesh.addPrimitive(tri)
snode = GeomNode(self.name)
snode.addGeom(mesh)
self.rendered_mesh = render.attachNewNode(snode)
self.rendered_mesh.setTwoSided(True)
示例4: __build_Tris
# 需要导入模块: from panda3d.core import GeomTriangles [as 别名]
# 或者: from panda3d.core.GeomTriangles import closePrimitive [as 别名]
def __build_Tris(self, sphere, mode):
vdata = GeomVertexData("Data", self.__vformat[mode], Geom.UHStatic)
_num_rows = len(sphere.pts)
# Vertices.
vertices = GeomVertexWriter(vdata, "vertex")
vertices.reserveNumRows(_num_rows)
for pt in sphere.pts:
vertices.addData3f(*pt)
# Map coords.
if mode == "mid":
mapcoords = GeomVertexWriter(vdata, "mapcoord")
mapcoords.reserveNumRows(_num_rows)
for mc in sphere.coords:
u, v = mc[:2]
mapcoords.addData2f(u,v)
# Tris.
prim = GeomTriangles(Geom.UHStatic)
prim.reserveNumVertices(len(sphere.tris))
for tri in sphere.tris:
prim.addVertices(*tri)
prim.closePrimitive()
# Geom.
geom = Geom(vdata)
geom.addPrimitive(prim)
geom_node = GeomNode("geom")
geom_node.addGeom(geom)
geom_np = NodePath(geom_node)
return geom_np
示例5: load
# 需要导入模块: from panda3d.core import GeomTriangles [as 别名]
# 或者: from panda3d.core.GeomTriangles import closePrimitive [as 别名]
def load(self):
if panda3d is None: raise ImportError("Cannot locate Panda3D")
#KLUDGE
if self.material is not None and self.colors is None:
col = self.material.getAmbient()
col = (col[0] / col[3], col[1] / col[3], col[2] / col[3], 1.0)
self.colors = (col,) * len(self.vertices)
#/KLUDGE
geom = make_geom(self.vertices, self.normals, self.colors, self.texcoords)
prim = GeomTriangles(Geom.UHStatic)
for face in self.faces:
#TODO: proper tesselation! the current one only works for convex faces
first = face[0]
curr = face[1]
for v in face[2:]:
prim.addVertex(curr)
prim.addVertex(v)
prim.addVertex(first)
curr = v
prim.closePrimitive()
geom.addPrimitive(prim)
node = GeomNode(self.name)
node.addGeom(geom)
self.node = NodePath(node)
self.node.setTwoSided(True)
if self.material is not None: self.node.setMaterial(self.material, priority=1)
self.loaded = True
示例6: makeGeom
# 需要导入模块: from panda3d.core import GeomTriangles [as 别名]
# 或者: from panda3d.core.GeomTriangles import closePrimitive [as 别名]
def makeGeom():
# Vertex data
fmt = GeomVertexFormat.getV3n3t2()
vdata = GeomVertexData('', fmt, Geom.UHStatic)
vertex = GeomVertexWriter(vdata, InternalName.getVertex())
normal = GeomVertexWriter(vdata, InternalName.getNormal())
texcoord = GeomVertexWriter(vdata, InternalName.getTexcoord())
for (x, y, z) in vertices:
vertex.addData3f(x, y, z)
normal.addData3f(0, 0, 0)
# Privitive
prim = GeomTriangles(Geom.UHStatic)
for (i1, i2, i3) in indices:
prim.addVertices(i1, i2, i3)
prim.closePrimitive()
# Geom
geom = Geom(vdata)
geom.addPrimitive(prim)
return geom
示例7: draw_face
# 需要导入模块: from panda3d.core import GeomTriangles [as 别名]
# 或者: from panda3d.core.GeomTriangles import closePrimitive [as 别名]
def draw_face(self,f,f_color):
#add normal
format = GeomVertexFormat.getV3n3cp()
vdata=GeomVertexData('vert', format, Geom.UHDynamic)
vertex=GeomVertexWriter(vdata, 'vertex')
color=GeomVertexWriter(vdata, 'color')
normal=GeomVertexWriter(vdata, 'normal')
vertex.addData3f(f.v1.pos)
normal.addData3f(f.v1.norm.x, f.v1.norm.y, f.v1.norm.z)
color.addData4f(f_color)
vertex.addData3f(f.v2.pos)
normal.addData3f(f.v2.norm.x, f.v2.norm.y, f.v2.norm.z)
color.addData4f(f_color)
vertex.addData3f(f.v3.pos)
normal.addData3f(f.v3.norm.x, f.v3.norm.y, f.v3.norm.z)
color.addData4f(f_color)
mesh = Geom(vdata)
tri = GeomTriangles(Geom.UHDynamic)
tri.addVertex(0)
tri.addVertex(1)
tri.addVertex(2)
tri.closePrimitive()
mesh.addPrimitive(tri)
face_node = GeomNode(self.mesh.name+'_face_'+str(f.ID))
face_node.addGeom(mesh)
face_node.setTag('ID',str(f.ID))
rendered_face = self.render_root.attachNewNode(face_node)
rendered_face.setTwoSided(True)
self.render_nodes['face_'+str(f.ID)] = rendered_face
示例8: __init__
# 需要导入模块: from panda3d.core import GeomTriangles [as 别名]
# 或者: from panda3d.core.GeomTriangles import closePrimitive [as 别名]
def __init__(self):
ShowBase.__init__(self)
PanditorDisableMouseFunc()
camera.setPos(0.0, 0.0, 50.0)
camera.lookAt(0.0)
PanditorEnableMouseFunc()
# 1) create GeomVertexData
frmt = GeomVertexFormat.getV3n3cp()
vdata = GeomVertexData('triangle', frmt, Geom.UHDynamic)
# 2) create Writers/Rewriters (must all be created before any readers and readers are one-pass-temporary)
vertex = GeomVertexRewriter(vdata, 'vertex')
normal = GeomVertexRewriter(vdata, 'normal')
color = GeomVertexRewriter(vdata, 'color')
zUp = Vec3(0, 0, 1)
wt = Vec4(1.0, 1.0, 1.0, 1.0)
gr = Vec4(0.5, 0.5, 0.5, 1.0)
# 3) write each column on the vertex data object (for speed, have a different writer for each column)
def addPoint(x, y, z):
vertex.addData3f(x, y, z)
normal.addData3f(zUp)
color.addData4f(wt)
addPoint(0.0, 0.0, 0.0)
addPoint(5.0, 0.0, 0.0)
addPoint(0.0, 5.0, 0.0)
addPoint(5.0, 5.0, 0.0)
# 4) create a primitive and add the vertices via index (not truely associated with the actual vertex table, yet)
tris = GeomTriangles(Geom.UHDynamic)
tris.addVertices(0, 1, 2)
tris.closePrimitive() # exception thrown if verts added != 3, other types inform Panda how many verts/primitive
tris.addVertices(2, 1, 3)
print "vdataPoints", vdata.getArrays()[0]
# 5.1) (adding to scene) create a Geom and add primitives of like base-type i.e. triangles and triangle strips
geom = Geom(vdata)
geom.addPrimitive(tris)
# 5.2) create a GeomNode to hold the Geom(s) and add the Geom(s)
gn = GeomNode('gnode')
gn.addGeom(geom)
# 5.3) attache the node to the scene
gnNodePath = render.attachNewNode(gn)
geomPts = Geom(vdata)
pts = GeomPoints(Geom.UHStatic)
pts.addVertices(0, 1, 2)
pts.closePrimitive()
geomPts.addPrimitive(pts)
pointsNode = GeomNode('points_node')
pointsNode.addGeom(geomPts)
pointsNP = render.attachNewNode(pointsNode)
pointsNP.setZ(0.5)
render.ls()
示例9: create_mesh
# 需要导入模块: from panda3d.core import GeomTriangles [as 别名]
# 或者: from panda3d.core.GeomTriangles import closePrimitive [as 别名]
def create_mesh(parentnp, debug=False, invert=False):
"""This creates a simple 17x17 grid mesh for the sides of our cube.
The ultimate goal is to use a LOD system, probably based on quadtrees.
If debug is true then we get a color gradiant on our vertexes."""
x = -1.0
y = -1.0
vertex_count = 0
u = 0.0
v = 0.0
WIDTH_STEP = 2 / 16.0
while y <= 1.0:
while x <= 1.0:
vertex.addData3f(x, y, 0)
if invert:
normal.addData3f(myNormalize((Vec3(2 * x + 1, 2 * y + 1, 2 * 0 - 1))))
else:
normal.addData3f(myNormalize((Vec3(2 * x - 1, 2 * y - 1, 2 * 0 - 1))))
if debug:
color.addData4f(1.0, u, v, 1.0)
texcoord.addData2f(u, v)
vertex_count += 1
x += WIDTH_STEP
u += WIDTH_STEP / 2.0
x = -1.0
u = 0
y += WIDTH_STEP
v += WIDTH_STEP / 2.0
print vertex_count
triangles = []
for y in range(0, 16):
for x in range(0, 16):
v = 17 * y + x
tri = GeomTriangles(Geom.UHDynamic)
tri.addVertex(v)
tri.addVertex(v + 1)
tri.addVertex(v + 17)
tri.closePrimitive()
triangles.append(tri)
tri = GeomTriangles(Geom.UHDynamic)
tri.addVertex(v + 1)
tri.addVertex(v + 18)
tri.addVertex(v + 17)
tri.closePrimitive()
triangles.append(tri)
mesh = Geom(vdata)
for t in triangles:
mesh.addPrimitive(t)
mnode = GeomNode("quadface")
mnode.addGeom(mesh)
nodePath = parentnp.attachNewNode(mnode)
return nodePath
示例10: make_square
# 需要导入模块: from panda3d.core import GeomTriangles [as 别名]
# 或者: from panda3d.core.GeomTriangles import closePrimitive [as 别名]
def make_square(x1, y1, z1, x2, y2, z2, tex_coord):
format = GeomVertexFormat.getV3n3t2()
vdata = GeomVertexData("square", format, Geom.UHStatic)
vertex = GeomVertexWriter(vdata, "vertex")
normal = GeomVertexWriter(vdata, "normal")
texcoord = GeomVertexWriter(vdata, "texcoord")
# make sure we draw the sqaure in the right plane
if x1 != x2:
vertex.addData3f(x1, y1, z1)
vertex.addData3f(x2, y1, z1)
vertex.addData3f(x2, y2, z2)
vertex.addData3f(x1, y2, z2)
else:
vertex.addData3f(x1, y1, z1)
vertex.addData3f(x2, y2, z1)
vertex.addData3f(x2, y2, z2)
vertex.addData3f(x1, y1, z2)
normal.addData3f(my_normalize(Vec3(2 * x1 - 1, 2 * y1 - 1, 2 * z1 - 1)))
normal.addData3f(my_normalize(Vec3(2 * x2 - 1, 2 * y2 - 1, 2 * z1 - 1)))
normal.addData3f(my_normalize(Vec3(2 * x2 - 1, 2 * y2 - 1, 2 * z2 - 1)))
normal.addData3f(my_normalize(Vec3(2 * x1 - 1, 2 * y1 - 1, 2 * z2 - 1)))
# adding different colors to the vertex for visibility
u1, v1, u2, v2 = tex_coord
texcoord.addData2f(u1, v2)
texcoord.addData2f(u1, v1)
texcoord.addData2f(u2, v1)
texcoord.addData2f(u2, v2)
# quads arent directly supported by the Geom interface
# you might be interested in the CardMaker class if you are
# interested in rectangle though
tri1 = GeomTriangles(Geom.UHStatic)
tri2 = GeomTriangles(Geom.UHStatic)
tri1.addVertex(0)
tri1.addVertex(1)
tri1.addVertex(3)
tri2.addConsecutiveVertices(1, 3)
tri1.closePrimitive()
tri2.closePrimitive()
square = Geom(vdata)
square.addPrimitive(tri1)
square.addPrimitive(tri2)
return square
示例11: createTriangle
# 需要导入模块: from panda3d.core import GeomTriangles [as 别名]
# 或者: from panda3d.core.GeomTriangles import closePrimitive [as 别名]
def createTriangle(v1, v2, v3, is_flat=False):
x1 = v1.x
y1 = v1.y
z1 = v1.z
x2 = v2.x
y2 = v2.y
z2 = v2.z
x3 = v3.x
y3 = v3.y
z3 = v3.z
format=GeomVertexFormat.getV3n3cp()
vdata=GeomVertexData('tri', format, Geom.UHDynamic)
vertex=GeomVertexWriter(vdata, 'vertex')
normal=GeomVertexWriter(vdata, 'normal')
color=GeomVertexWriter(vdata, 'color')
vertex.addData3f(x1, y1, z1)
vertex.addData3f(x2, y2, z2)
vertex.addData3f(x3, y3, z3)
if is_flat:
normVector = norm(Vec3( (x1 + x2 + x3)/3.0, (y1 + y2 + y3)/3.0, (z1+ z2+ z3)/3.0))
normal.addData3f(normVector)
normal.addData3f(normVector)
normal.addData3f(normVector)
else:
normal.addData3f(norm(Vec3(x1,y1,z1)))
normal.addData3f(norm(Vec3(x2,y2,z2)))
normal.addData3f(norm(Vec3(x3,y3,z3)))
#adding different colors to the vertex for visibility
color.addData4f(0.5,0.5,0.5,1.0)
color.addData4f(0.5,0.5,0.5,1.0)
color.addData4f(0.5,0.5,0.5,1.0)
tri = GeomTriangles(Geom.UHDynamic)
tri.addVertex(0)
tri.addVertex(1)
tri.addVertex(2)
tri.closePrimitive()
output_tri = Geom(vdata)
output_tri.addPrimitive(tri)
return output_tri
示例12: createTetraeder
# 需要导入模块: from panda3d.core import GeomTriangles [as 别名]
# 或者: from panda3d.core.GeomTriangles import closePrimitive [as 别名]
def createTetraeder(self, iterations):
'''
Note that the first and the last node of the Thetha_Range should be 0 and 180 Degrees
because this will be just one time added to verticies
'''
#Format
format = GeomVertexFormat.getV3n3cpt2()
#VertexData
vdata = GeomVertexData('name', format, Geom.UHDynamic)
##VertexWriter
vertex = GeomVertexWriter(vdata, 'vertex')
normal = GeomVertexWriter(vdata, 'normal')
color = GeomVertexWriter(vdata, 'color')
texcoord = GeomVertexWriter(vdata, 'texcoord')
vertex.addData3f(0,1.434,-0.507)
vertex.addData3f(-1.242,-0.717,-0.507)
vertex.addData3f(1.242,-0.717,-0.507)
vertex.addData3f(0,0,1.521)
color.addData4f(1,1,1,1)
color.addData4f(1,1,1,1)
color.addData4f(1,1,1,1)
color.addData4f(1,1,1,1)
normal.addData3f(0,1.434,-0.507)
normal.addData3f(-1.242,-0.717,-0.507)
normal.addData3f(1.242,-0.717,-0.507)
normal.addData3f(0,0,1.521)
### Create Geom
geom = Geom(vdata)
### Create Primitives
prim = GeomTriangles(Geom.UHStatic)
prim.addVertices(0, 1, 2)
prim.addVertices(0, 1, 3)
prim.addVertices(1, 2, 3)
prim.addVertices(2, 0, 3)
prim.closePrimitive()
geom.addPrimitive(prim)
node = GeomNode('gnode')
node.addGeom(geom)
return node
示例13: makeGeomNode
# 需要导入模块: from panda3d.core import GeomTriangles [as 别名]
# 或者: from panda3d.core.GeomTriangles import closePrimitive [as 别名]
def makeGeomNode():
vdata = GeomVertexData('handleData', GeomVertexFormat.getV3(),
Geom.UHStatic)
v = GeomVertexWriter(vdata, 'vertex')
length = 1.0
gapLen = 0.2
coneLen = 0.18
coneRad = 0.06
circRes = 10
v.addData3f(0, 0, -length/2.0) # back cone butt
v.addData3f(0, 0, -length/2.0 + coneLen) # back cone point
v.addData3f(0, 0, -gapLen/2.0)
v.addData3f(0, 0, gapLen/2.0)
v.addData3f(0, 0, length/2.0 - coneLen) # front cone butt
v.addData3f(0, 0, length/2.0) # font cone point
# Add vertices for the cone's circles.
for z in [-length/2.0, length/2.0 - coneLen]:
for i in xrange(circRes):
theta = i*(2*pi/circRes)
v.addData3f(coneRad*sin(theta), coneRad*cos(theta), z)
lines = Geom(vdata)
# Make prims for the two lines.
for vertices in [(0, 2), (3, 5)]:
line = GeomLines(Geom.UHStatic)
line.addVertices(*vertices)
line.closePrimitive()
lines.addPrimitive(line)
cones = Geom(vdata)
# Make prims for the cones.
for back, circ in [(0, 6), (4, 6 + circRes)]:
point = back + 1
cone = GeomTriangles(Geom.UHStatic)
for i in xrange(circRes):
if i + 1 == circRes:
cone.addVertices(back, circ, circ + i)
cone.addVertices(point, circ + i, circ)
else:
cone.addVertices(back, circ + i + 1, circ + i)
cone.addVertices(point, circ + i, circ + i + 1)
cone.closePrimitive()
cones.addPrimitive(cone)
node = GeomNode('geomnode')
node.addGeom(lines)
node.addGeom(cones)
return node
示例14: create_geom
# 需要导入模块: from panda3d.core import GeomTriangles [as 别名]
# 或者: from panda3d.core.GeomTriangles import closePrimitive [as 别名]
def create_geom(self, sidelength):
# Set up the vertex arrays
vformat = GeomVertexFormat.getV3n3c4()
vdata = GeomVertexData("Data", vformat, Geom.UHDynamic)
vertex = GeomVertexWriter(vdata, 'vertex')
normal = GeomVertexWriter(vdata, 'normal')
color = GeomVertexWriter(vdata, 'color')
geom = Geom(vdata)
# Write vertex data
for x in range(0, sidelength):
for y in range(0, sidelength):
# vertex_number = x * sidelength + y
v_x, v_y, v_z = self.map_b[(x, y)]
n_x, n_y, n_z = 0.0, 0.0, 1.0
c_r, c_g, c_b, c_a = 0.5, 0.5, 0.5, 0.5
vertex.addData3f(v_x, v_y, v_z)
normal.addData3f(n_x, n_y, n_z)
color.addData4f(c_r, c_g, c_b, c_a)
# Add triangles
for x in range(0, sidelength - 1):
for y in range(0, sidelength - 1):
# The vertex arrangement (y up, x right)
# 2 3
# 0 1
v_0 = x * sidelength + y
v_1 = x * sidelength + (y + 1)
v_2 = (x + 1) * sidelength + y
v_3 = (x + 1) * sidelength + (y + 1)
if (x+y)%1 == 0: # An even square
tris = GeomTriangles(Geom.UHStatic)
tris.addVertices(v_0, v_2, v_3)
tris.closePrimitive()
geom.addPrimitive(tris)
tris = GeomTriangles(Geom.UHStatic)
tris.addVertices(v_3, v_1, v_0)
tris.closePrimitive()
geom.addPrimitive(tris)
else: # An odd square
tris = GeomTriangles(Geom.UHStatic)
tris.addVertices(v_1, v_0, v_2)
tris.closePrimitive()
geom.addPrimitive(tris)
tris = GeomTriangles(Geom.UHStatic)
tris.addVertices(v_2, v_3, v_1)
tris.closePrimitive()
geom.addPrimitive(tris)
# Create the actual node
node = GeomNode('geom_node')
node.addGeom(geom)
# Remember GeomVertexWriters to adjust vertex data later
#self.vertex_writer = vertex
#self.color_writer = color
self.vdata = vdata
return node
示例15: makeNode
# 需要导入模块: from panda3d.core import GeomTriangles [as 别名]
# 或者: from panda3d.core.GeomTriangles import closePrimitive [as 别名]
def makeNode(self, pointmap=(lambda x, y: (x, y, 0))):
vt = tuple(self.vertices)
t = Triangulator()
fmt = GeomVertexFormat.getV3()
vdata = GeomVertexData('name', fmt, Geom.UHStatic)
vertex = GeomVertexWriter(vdata, 'vertex')
for x, y in vt:
t.addPolygonVertex(t.addVertex(x, y))
vertex.addData3f(pointmap(x, y))
t.triangulate()
prim = GeomTriangles(Geom.UHStatic)
for n in xrange(t.getNumTriangles()):
prim.addVertices(t.getTriangleV0(n),t.getTriangleV1(n),t.getTriangleV2(n))
prim.closePrimitive()
geom = Geom(vdata)
geom.addPrimitive(prim)
node = GeomNode('gnode')
node.addGeom(geom)
return node