當前位置: 首頁>>代碼示例>>Python>>正文


Python core.NodePath方法代碼示例

本文整理匯總了Python中panda3d.core.NodePath方法的典型用法代碼示例。如果您正苦於以下問題:Python core.NodePath方法的具體用法?Python core.NodePath怎麽用?Python core.NodePath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在panda3d.core的用法示例。


在下文中一共展示了core.NodePath方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: getObjectTruePosAndParent

# 需要導入模塊: from panda3d import core [as 別名]
# 或者: from panda3d.core import NodePath [as 別名]
def getObjectTruePosAndParent(self, objKey, parentUid, objectData):
        if self.isChildObject(objKey, parentUid):
            parentUid = self.air.worldCreator.getObjectParentUid(objKey)
            parentData = self.air.worldCreator.getObjectDataByUid(parentUid)

            if parentData['Type'] == 'Island':
                return objectData.get('Pos'), NodePath()

            parentObject = NodePath('psuedo-%s' % parentUid)

            if not 'GridPos' in objectData:
                parentObject.setPos(parentData.get('Pos', Point3(0, 0, 0)))
            
            parentObject.setHpr(parentData.get('Hpr', Point3(0, 0, 0)))
            objectPos = objectData.get('GridPos', objectData.get('Pos', Point3(0, 0, 0)))
            return objectPos, parentObject

        return objectData.get('Pos'), NodePath() 
開發者ID:PiratesOnlineRewritten,項目名稱:Pirates-Online-Rewritten,代碼行數:20,代碼來源:AreaBuilderBaseAI.py

示例2: setObjectTruePosHpr

# 需要導入模塊: from panda3d import core [as 別名]
# 或者: from panda3d.core import NodePath [as 別名]
def setObjectTruePosHpr(self, object, objKey, parentUid, objectData):
        objectPos = objectData.get('Pos', Point3(0, 0, 0))
        objectHpr = objectData.get('Hpr', Point3(0, 0, 0))

        if not self.isChildObject(objKey, parentUid):
            object.setPos(objectPos)
            object.setHpr(objectHpr)
            return object

        parentUid = self.air.worldCreator.getObjectParentUid(objKey)
        parentData = self.air.worldCreator.getObjectDataByUid(parentUid)

        if parentData['Type'] == 'Island':
            object.setPos(objectPos)
            object.setHpr(objectHpr)
            return object

        parentObject = NodePath('psuedo-%s' % parentUid)
        parentObject.setPos(parentData.get('Pos', Point3(0, 0, 0)))
        parentObject.setHpr(parentData.get('Hpr', Point3(0, 0, 0)))

        #if not 'GridPos' in objectData or True:
        object.setPos(parentObject, objectPos)
        object.setHpr(parentObject, objectHpr)
        #else:
        #    object.setPos(objectData.get('GridPos', objectPos))
        #    object.setHpr(parentObject, objectHpr)

        return object 
開發者ID:PiratesOnlineRewritten,項目名稱:Pirates-Online-Rewritten,代碼行數:31,代碼來源:AreaBuilderBaseAI.py

示例3: __init__

# 需要導入模塊: from panda3d import core [as 別名]
# 或者: from panda3d.core import NodePath [as 別名]
def __init__(self):
        super().__init__('scene')
        self.render = None
        self.world = None

        self.camera = None
        self.ui_camera = None

        self.entities = []
        self.hidden = NodePath('hidden')
        self.reflection_map = 'reflection_map_3'

        self.lights = [] 
開發者ID:pokepetter,項目名稱:ursina,代碼行數:15,代碼來源:scene.py

示例4: loadLevelData

# 需要導入模塊: from panda3d import core [as 別名]
# 或者: from panda3d.core import NodePath [as 別名]
def loadLevelData(self,inputData):
        """
        processes the level asloaded from the file. it seperates the input data until the data for each tile is ready.
        each tile data will be passed to loadTile().
        it returns a rigidNode optimized nodepath.
        """
        rigidNode = RigidBodyCombiner("LevelNode")
        levelNode = NodePath(rigidNode)
        #rigidNode.reparentTo(levelNode)
        #this looks heavy but all it does is deleting whitespaces and seperating the content for each tile into a list.
        inputData = inputData.replace("\n","").strip().replace(" ","").lstrip("<").rstrip(">").split("><")
        
        for tileData in inputData:
            tile = self.loadTile(tileData)
            if tile != None:
                tile.reparentTo(levelNode)
                tile.setPos( self.getPosFromTile(tile) )
                tile.setZ(tile,0.00000001) #workaround for rigid body combiner so it does not assume the (0,0) tile as static
            else:
                print("ERROR, could not load tile with data: ",tileData)
        rigidNode.collect()
        inode = rigidNode.getInternalScene().node() #workaround for a boundingvolume issue with rigidbodycombiner
        inode.setBounds(OmniBoundingVolume())  #still workaround
        inode.setFinal(True) #still workaround
        #levelNode.analyze()  
        return levelNode 
開發者ID:tobspr,項目名稱:RenderPipeline-Samples,代碼行數:28,代碼來源:LevelLoader.py

示例5: rebuild

# 需要導入模塊: from panda3d import core [as 別名]
# 或者: from panda3d.core import NodePath [as 別名]
def rebuild(self, view_size):
        self.view_size = view_size
        props = base.win.getProperties()
        y = props.getYSize()
        pxm = float(y) / self.view_size
        hsize = 12 / pxm
        vsize = 40 / pxm
        #print(hsize, vsize)
        cm = CardMaker('card')
        cm.setFrame( LPoint3(-hsize, 0,     0 ),
                     LPoint3( hsize, 0,     0 ),
                     LPoint3( hsize, vsize, 0 ),
                     LPoint3(-hsize, vsize, 0 ) )

        for n in self.nodes:
            n.removeNode()

        self.nodes = []
        for m in self.markers:
            node = NodePath(cm.generate())
            node.setTexture(self.icon, 1)
            node.setTransparency(TransparencyAttrib.MAlpha)
            node.setDepthTest(False)
            node.setDepthWrite(False)
            node.setBin("unsorted", 1)
            ned = m['ned']
            node.setPos(ned[1], ned[0], 0)
            node.reparentTo(self.render)
            self.nodes.append(node) 
開發者ID:UASLab,項目名稱:ImageAnalysis,代碼行數:31,代碼來源:annotations.py

示例6: set_up

# 需要導入模塊: from panda3d import core [as 別名]
# 或者: from panda3d.core import NodePath [as 別名]
def set_up(self):
        self.display_region = base.camNode.get_display_region(0)
        win = self.display_region.get_window()

        self.perspective_lens = PerspectiveLens()
        self.perspective_lens = base.camLens # use panda3d's default for automatic aspect ratio on window resize
        self.lens = self.perspective_lens
        self.perspective_lens.set_aspect_ratio(16/9)
        self.perspective_lens_node = LensNode('perspective_lens_node', self.perspective_lens)
        self.lens_node = self.perspective_lens_node

        self.orthographic_lens = OrthographicLens()
        self.orthographic_lens.set_film_size(self.fov * window.aspect_ratio, self.fov)
        self.orthographic_lens_node = LensNode('orthographic_lens_node', self.orthographic_lens)

        application.base.cam.node().set_lens(self.lens)

        self.orthographic = False
        self.fov = 40
        self.clip_plane_near = 0.1
        self.clip_plane_far = 10000

        self.ui_display_region = win.make_display_region()
        self.ui_display_region.set_sort(20)

        self.ui_camera = NodePath(PandaCamera('ui_camera'))
        self.ui_lens = OrthographicLens()
        # moved set_film_size() to window module for correct aspect ratio after setting window size
        self.ui_lens.set_near_far(-1000, 1000)
        self.ui_camera.node().set_lens(self.ui_lens)
        self._ui_lens_node = LensNode('_ui_lens_node', self.ui_lens)

        self.ui_render = NodePath('ui_render')
        self.ui_render.set_depth_test(0)
        self.ui_render.set_depth_write(0)
        self.ui_camera.reparent_to(self.ui_render)
        self.ui_display_region.set_camera(self.ui_camera)
        scene.ui_camera = self.ui_camera

        self.ui = Entity(eternal=True, name='ui', parent=self.ui_camera, scale=(self.ui_size*.5, self.ui_size*.5))
        self.overlay = Entity(parent=self.ui, model='quad', scale_x=self.aspect_ratio, color=color.clear, eternal=True, z=-99)

        # these get created when setting a shader
        self.filter_manager = None
        self.filter_quad = None
        self.render_texture = None
        self.filter_quad = None
        self.depth_texture = None 
開發者ID:pokepetter,項目名稱:ursina,代碼行數:50,代碼來源:camera.py


注:本文中的panda3d.core.NodePath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。