def showCollisionDebug(self):
        if hasattr(self, 'collisionBufferFrames') and self.collisionBufferFrames:
            for (buffer, frame) in self.collisionBufferFrames:
                frame.unstash()
                buffer.enable()

            return None

        self.collisionBufferFrames = []
        cm = CardMaker('Side')
        cm.setFrame(Vec4(-1, 1, -1, 1))
        side = SceneBuffer('side-buffer', size = (512, 512), clearColor = Vec4(0, 0, 0, 1), sceneGraph = self.render)
        side.camera.setPos(4, 1, 0)
        side.camera.setH(90)
        shot = NodePath(cm.generate())
        shot.setTexture(side.getTexture(), 1)
        df = DirectFrame(geom = shot, relief = None, parent = aspect2d, scale = 0.5, pos = (0.83299999999999996, 0, -0.5), text = 'side', text_scale = 0.10000000000000001, text_pos = (-0.75, 0.75, 0), text_fg = (1, 1, 1, 1))
        self.collisionBufferFrames.append((side, df))
        top = SceneBuffer('top-buffer', size = (512, 512), clearColor = Vec4(0, 0, 0, 1), sceneGraph = self.render)
        top.camera.setPos(0, 1, 4)
        top.camera.setP(-90)
        cm.setName('Top')
        shot = NodePath(cm.generate())
        shot.setTexture(top.getTexture(), 1)
        df = DirectFrame(geom = shot, relief = None, parent = aspect2d, scale = 0.5, pos = (0.83299999999999996, 0, 0.5), text = 'top', text_scale = 0.10000000000000001, text_pos = (-0.75, 0.75, 0), text_fg = (1, 1, 1, 1))
        self.collisionBufferFrames.append((top, df))
        self.mapBall.traverser.showCollisions(self.render)
        colNodes = self.render.findAllMatches('**/camRayNode')
        colNodes.show()
        colNodes = self.render.findAllMatches('**/mouseRayNode')
        colNodes.show()
        self.setPos(-0.5, 0, 0)
        self.setScale(0.82499999999999996)
Ejemplo n.º 2
0
 def __init__(self, parent, **kwargs):
     cm = CardMaker('Portrait')
     cm.setFrame(Vec4(-1, 1, -1, 1))
     b = SceneBuffer('worldmap-buffer', size = (512, 512), clearColor = Vec4(0.84999999999999998))
     b.camLens.setNear(0.001)
     b.camLens.setFar(5.0)
     b.camera.node().getDisplayRegion(0).setIncompleteRender(False)
     self.buffer = b
     shot = NodePath(cm.generate())
     shot.setTexture(b.getTexture(), 1)
     optiondefs = (('relief', None, None), ('geom', shot, None))
     self.defineoptions(kwargs, optiondefs)
     DirectFrame.__init__(self, parent, **None)
     self.initialiseoptions(WorldMap)
     self.setTransparency(1)
     self.radius = 1.0
     self.camY = [
         -0.29999999999999999,
         0.25]
     self.tiltLimit = [ x * math.pi / 180 for x in (27, 33) ]
     self.mapBall = DecoratedMapBall('WorldMapArcBall', self, self.tiltLimit[1], mapSize = 242000, radius = self.radius, scrollFactor = 0.125, camera = b.camera, keepUpright = 1, mouseDownEvent = self.getMouseDownEvent(), mouseUpEvent = self.getMouseUpEvent())
     self.render = b.getSceneRoot()
     self.worldRoot = self.render.attachNewNode('world')
     self.worldRoot.setTransparency(1)
     self.ballRoot = self.worldRoot.attachNewNode('ballRoot')
     self.ballRoot.setY(self.radius / 2.0)
     self.mapBall.reparentTo(self.ballRoot)
     self.mapBall.setInternalHpr(Vec3(0, 90, 0))
     self.mapBall.setNorth(Vec3(0, 1, 0))
     self.mapBall.setY(self.radius)
     self.setZoom(0)
     self.addLocalAvDart()
     self._hasLocalShip = False
     self._fleets = []
     self._enabled = False
 def __init__(self, parent, **kwargs):
     cm = CardMaker('Portrait')
     cm.setFrame(Vec4(-1, 1, -1, 1))
     b = SceneBuffer('worldmap-buffer', size = (512, 512), clearColor = Vec4(0.84999999999999998))
     b.camLens.setNear(0.001)
     b.camLens.setFar(5.0)
     b.camera.node().getDisplayRegion(0).setIncompleteRender(False)
     self.buffer = b
     shot = NodePath(cm.generate())
     shot.setTexture(b.getTexture(), 1)
     optiondefs = (('relief', None, None), ('geom', shot, None))
     self.defineoptions(kwargs, optiondefs)
     DirectFrame.__init__(self, parent)
     self.initialiseoptions(WorldMap)
     self.setTransparency(1)
     self.radius = 1.0
     self.camY = [
         -0.29999999999999999,
         0.25]
     self.tiltLimit = [ x * math.pi / 180 for x in (27, 33) ]
     self.mapBall = DecoratedMapBall('WorldMapArcBall', self, self.tiltLimit[1], mapSize = 242000, radius = self.radius, scrollFactor = 0.125, camera = b.camera, keepUpright = 1, mouseDownEvent = self.getMouseDownEvent(), mouseUpEvent = self.getMouseUpEvent())
     self.render = b.getSceneRoot()
     self.worldRoot = self.render.attachNewNode('world')
     self.worldRoot.setTransparency(1)
     self.ballRoot = self.worldRoot.attachNewNode('ballRoot')
     self.ballRoot.setY(self.radius / 2.0)
     self.mapBall.reparentTo(self.ballRoot)
     self.mapBall.setInternalHpr(Vec3(0, 90, 0))
     self.mapBall.setNorth(Vec3(0, 1, 0))
     self.mapBall.setY(self.radius)
     self.setZoom(0)
     self.addLocalAvDart()
     self._hasLocalShip = False
     self._fleets = []
     self._enabled = False
Ejemplo n.º 4
0
 def showCollisionDebug(self):
     if hasattr(self, 'collisionBufferFrames') and self.collisionBufferFrames:
         for (buffer, frame) in self.collisionBufferFrames:
             frame.unstash()
             buffer.enable()
         
         return None
     
     self.collisionBufferFrames = []
     cm = CardMaker('Side')
     cm.setFrame(Vec4(-1, 1, -1, 1))
     side = SceneBuffer('side-buffer', size = (512, 512), clearColor = Vec4(0, 0, 0, 1), sceneGraph = self.render)
     side.camera.setPos(4, 1, 0)
     side.camera.setH(90)
     shot = NodePath(cm.generate())
     shot.setTexture(side.getTexture(), 1)
     df = DirectFrame(geom = shot, relief = None, parent = aspect2d, scale = 0.5, pos = (0.83299999999999996, 0, -0.5), text = 'side', text_scale = 0.10000000000000001, text_pos = (-0.75, 0.75, 0), text_fg = (1, 1, 1, 1))
     self.collisionBufferFrames.append((side, df))
     top = SceneBuffer('top-buffer', size = (512, 512), clearColor = Vec4(0, 0, 0, 1), sceneGraph = self.render)
     top.camera.setPos(0, 1, 4)
     top.camera.setP(-90)
     cm.setName('Top')
     shot = NodePath(cm.generate())
     shot.setTexture(top.getTexture(), 1)
     df = DirectFrame(geom = shot, relief = None, parent = aspect2d, scale = 0.5, pos = (0.83299999999999996, 0, 0.5), text = 'top', text_scale = 0.10000000000000001, text_pos = (-0.75, 0.75, 0), text_fg = (1, 1, 1, 1))
     self.collisionBufferFrames.append((top, df))
     self.mapBall.traverser.showCollisions(self.render)
     colNodes = self.render.findAllMatches('**/camRayNode')
     colNodes.show()
     colNodes = self.render.findAllMatches('**/mouseRayNode')
     colNodes.show()
     self.setPos(-0.5, 0, 0)
     self.setScale(0.82499999999999996)