当前位置: 首页>>代码示例>>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;未经允许,请勿转载。