本文整理汇总了Python中panda3d.core.GeomNode.setTag方法的典型用法代码示例。如果您正苦于以下问题:Python GeomNode.setTag方法的具体用法?Python GeomNode.setTag怎么用?Python GeomNode.setTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.GeomNode
的用法示例。
在下文中一共展示了GeomNode.setTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_face
# 需要导入模块: from panda3d.core import GeomNode [as 别名]
# 或者: from panda3d.core.GeomNode import setTag [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
示例2: draw_vert
# 需要导入模块: from panda3d.core import GeomNode [as 别名]
# 或者: from panda3d.core.GeomNode import setTag [as 别名]
def draw_vert(self,v, v_color):
format = GeomVertexFormat.getV3cp()
vdata=GeomVertexData('vert', format, Geom.UHDynamic)
vertex=GeomVertexWriter(vdata, 'vertex')
color=GeomVertexWriter(vdata, 'color')
vertex.addData3f(0.0,0.0,0.0)
color.addData4f(v_color)
mesh = Geom(vdata)
point = GeomPoints(Geom.UHDynamic)
point.addVertex(0)
point.closePrimitive()
mesh.addPrimitive(point)
vert_node = GeomNode(self.mesh.name+'_vert_'+str(v.ID))
vert_node.addGeom(mesh)
vert_node.setTag('ID',str(v.ID))
rendered_vert = self.render_root.attachNewNode(vert_node)
rendered_vert.setPos(v.pos.x,v.pos.y,v.pos.z)
rendered_vert.setRenderModeThickness(5.0)
self.render_nodes['vert_'+str(v.ID)] = rendered_vert