当前位置: 首页>>代码示例>>Python>>正文


Python GeomVertexFormat.getV3n3方法代码示例

本文整理汇总了Python中panda3d.core.GeomVertexFormat.getV3n3方法的典型用法代码示例。如果您正苦于以下问题:Python GeomVertexFormat.getV3n3方法的具体用法?Python GeomVertexFormat.getV3n3怎么用?Python GeomVertexFormat.getV3n3使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在panda3d.core.GeomVertexFormat的用法示例。


在下文中一共展示了GeomVertexFormat.getV3n3方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: regesterGeomRequirements

# 需要导入模块: from panda3d.core import GeomVertexFormat [as 别名]
# 或者: from panda3d.core.GeomVertexFormat import getV3n3 [as 别名]
    def regesterGeomRequirements(self, LOD, collection):

        n = NodePath("tmp")

        if self.barkTexture is not None:
            n.setTexture(self.barkTexture)
            n.setShaderInput("diffTex", self.barkTexture)
            format = GeomVertexFormat.getV3n3t2()
        else:
            format = GeomVertexFormat.getV3n3()
            n.setColor(0.4, 0.3, 0.3, 1)

        # n.setShader(customLoader.makeShader(n))

        trunkRequirements = meshManager.GeomRequirements(geomVertexFormat=format, renderState=n.getState())

        n = NodePath("tmp")

        if self.leafTexture is not None:
            # n.setTag("alpha","")
            n.setShaderInput("alpha", 0, 0, 0)  # marker we need cutout alpha
            n.setTexture(self.leafTexture)
            n.setShaderInput("diffTex", self.leafTexture)
            format = GeomVertexFormat.getV3n3t2()
        else:
            format = GeomVertexFormat.getV3n3c4()

        # n.setShader(customLoader.makeShader(n,debugCodePrefix="tree",debugGraphPrefix="tree"))

        leafRequirements = meshManager.GeomRequirements(geomVertexFormat=format, renderState=n.getState())

        self.trunkDataIndex[LOD] = collection.add(trunkRequirements)
        self.leafDataIndex[LOD] = collection.add(leafRequirements)
开发者ID:rasrenato,项目名称:Panda3D-Terrain-System,代码行数:35,代码来源:treeFactory.py

示例2: regesterGeomRequirements

# 需要导入模块: from panda3d.core import GeomVertexFormat [as 别名]
# 或者: from panda3d.core.GeomVertexFormat import getV3n3 [as 别名]
    def regesterGeomRequirements(self,LOD,collection):
        
        n=NodePath('tmp')
        
        if self.leafTexture is not None:
            n.setTexture(self.leafTexture)
            n.setShaderInput('diffTex',self.leafTexture)
            format=GeomVertexFormat.getV3n3t2()
        else:
            n.setColor(.1,.3,.1,1)
            format=GeomVertexFormat.getV3n3()

        #n.setShader(customLoader.makeShader(n,debugCodePrefix="fern",debugGraphPrefix="fern"))
        
        leafRequirements=meshManager.GeomRequirements(
                geomVertexFormat=format,
                renderState=n.getState(),
                )
        
        self.leafDataIndex[LOD]=collection.add(leafRequirements)
开发者ID:jorjuato,项目名称:Panda3D-Terrain-System,代码行数:22,代码来源:fernFactory.py

示例3: addTriMeshSB

# 需要导入模块: from panda3d.core import GeomVertexFormat [as 别名]
# 或者: from panda3d.core.GeomVertexFormat import getV3n3 [as 别名]
    def addTriMeshSB(self,vertices, faces,normals = None,ghost=False,**kw):
        #step 1) create GeomVertexData and add vertex information
        # Soft body world information
        info = self.world.getWorldInfo()
        info.setAirDensity(0.0)
        info.setWaterDensity(0)
        info.setWaterOffset(0)
        info.setWaterNormal(Vec3(0, 0, 0))
        
        format=GeomVertexFormat.getV3n3() #getV3()#http://www.panda3d.org/manual/index.php/Pre-defined_vertex_formats
#        vdata = GeomVertexData('name', format, Geom.UHStatic)
        vdata=GeomVertexData("Mesh", format, Geom.UHStatic)
        
        vertexWriter=GeomVertexWriter(vdata, "vertex")
        [vertexWriter.addData3f(v[0],v[1],v[2]) for v in vertices]

        if normals is not None :
            normalWriter = GeomVertexWriter(vdata, 'normal')
            [normalWriter.addData3f(n[0],n[1],n[2]) for n in normals] 
        else :
            print "we need normals to bind geom to SoftBody"
            return None
        
        #step 2) make primitives and assign vertices to them
        tris=GeomTriangles(Geom.UHStatic)
        [self.setGeomFaces(tris,face) for face in faces]
        
        #step 3) make a Geom object to hold the primitives
        geom=Geom(vdata)
        geom.addPrimitive(tris)
        
        vdata = geom.getVertexData()
#        print (vdata,vdata.hasColumn(InternalName.getVertex()))
        geomNode = GeomNode('')
        geomNode.addGeom(geom)

        #step 4) create the bullet softbody and node
        bodyNode = BulletSoftBodyNode.makeTriMesh(info, geom)
#        bodyNode.linkGeom(geomNode.modifyGeom(0))
        bodyNode.setName('Tri')
        bodyNode.linkGeom(geom)  
        bodyNode.generateBendingConstraints(1)#???
        #bodyNode.getMaterial(0).setLinearStiffness(0.8)
        bodyNode.getCfg().setPositionsSolverIterations(4)
#        bodyNode.getCfg().setCollisionFlag(BulletSoftBodyConfig.CFVertexFaceSoftSoft, True)
        bodyNode.getCfg().setDynamicFrictionCoefficient(1)
        bodyNode.getCfg().setDampingCoefficient(0.001)
        bodyNode.getCfg().setPressureCoefficient(15000*10.0)  
        bodyNode.getCfg().setPoseMatchingCoefficient(0.2)
        bodyNode.setPose(True, True)
#        bodyNode.randomizeConstraints()
        bodyNode.setTotalMass(50000*10, True)
        
        bodyNP = self.worldNP.attachNewNode(bodyNode)
#        fmt = GeomVertexFormat.getV3n3t2()
#        geom = BulletHelper.makeGeomFromFaces(bodyNode, fmt,True)

#        bodyNode.linkGeom(geomNode.modifyGeom(0))
#        geomNode = GeomNode('')
#        geomNode.addGeom(geom)
        
#        world.attachSoftBody(bodyNode)
#        inodenp.setPos(0, 0, 0.1)
#        self.setRB(bodyNP,**kw)#set po
#        inodenp.setCollideMask(BitMask32.allOn())
        self.world.attachSoftBody(bodyNode)
        geomNP = bodyNP.attachNewNode(geomNode)
        return bodyNP,geomNP
开发者ID:brettbarbaro,项目名称:autoPACK,代码行数:70,代码来源:pandautil.py

示例4: meta_generic

# 需要导入模块: from panda3d.core import GeomVertexFormat [as 别名]
# 或者: from panda3d.core.GeomVertexFormat import getV3n3 [as 别名]
    if sys.argv[1] == '-l':
        for sh in shapes.keys():
            print sh
        sys.exit(0)

    shp = sys.argv[1]
    if not shapes.has_key(shp):
        print "cannot find shape, -l for list"
        sys.exit(-1)



    um = meta_generic(shapes[shp])
    um.polygonize()
    format=GeomVertexFormat.getV3n3()
    vdata=GeomVertexData("vertices", format, Geom.UHStatic)
    vertexWriter=GeomVertexWriter(vdata, "vertex")
    normalWriter=GeomVertexWriter(vdata, "normal")
    print len(um.tri_list), "vertices"
    print len(um.tri_list) / 3.0, "tris"

    for p in um.tri_list:
        vertexWriter.addData3f(p[0],p[1],p[2])
    for p in um.normal_list:
        normalWriter.addData3f(p[0],p[1],p[2])

    for p in reversed(um.tri_list):
        vertexWriter.addData3f(p[0],p[1],p[2])
    for p in reversed(um.normal_list):
        normalWriter.addData3f(-1 * p[0], -1 * p[1], -1 *p[2])
开发者ID:chaomodus,项目名称:pymetasurf,代码行数:32,代码来源:shape.py


注:本文中的panda3d.core.GeomVertexFormat.getV3n3方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。