def launch(spaceName): global g_enablePostProcessing global g_offlineModeEnabled print 'Entering offline space', spaceName BigWorld.clearAllSpaces() BigWorld.worldDrawEnabled(False) _displayGUI(spaceName) spaceID = BigWorld.createSpace() BigWorld.addSpaceGeometryMapping(spaceID, None, spaceName) _loadCameraTransforms() camera = BigWorld.FreeCamera() camera.spaceID = spaceID BigWorld.camera(camera) _setCameraTransform(g_curCameraTransform) BigWorld.camera().fixed = True BigWorld.projection().fov = math.radians(75.0) BigWorld.setWatcher('Client Settings/Strafe Rate', 175.0) BigWorld.setWatcher('Client Settings/Camera Mass', 5.0) BigWorld.setCursor(GUI.mcursor()) GUI.mcursor().visible = True GUI.mcursor().clipped = False g_offlineModeEnabled = True BigWorld.callback(1.0, _offlineLoadCheck) g_postProcessing.init() _enablePostProcessing(g_enablePostProcessing, 'arcade') return
def __init__(self, configDataSec): CallbackDelayer.__init__(self) TimeDeltaMeter.__init__(self, time.clock) self._cam = BigWorld.FreeCamera() self._cam.invViewProvider = Math.MatrixProduct() self.__cameraTransition = BigWorld.TransitionCamera() self.__ypr = Math.Vector3() self.__position = Math.Vector3() self.__defaultFov = BigWorld.projection().fov self.__velocity = Math.Vector3() self.__isVerticalVelocitySeparated = False self.__yprVelocity = Math.Vector3() self.__zoomVelocity = 0.0 self._inertiaEnabled = False self._movementInertia = None self._rotationInertia = None self._movementSensor = None self._verticalMovementSensor = None self._rotationSensor = None self._zoomSensor = None self._targetRadiusSensor = None self._mouseSensitivity = 0.0 self._scrollSensitivity = 0.0 self.__rotateAroundPointEnabled = False self.__rotationRadius = 40.0 self._alignerToLand = _AlignerToLand() self.__predefinedVelocities = {} self.__predefinedVerticalVelocities = {} self._keySwitches = {} self._readCfg(configDataSec) self.__isModeOverride = False self.__basisMProv = _VehicleBounder() self.__entityPicker = _VehiclePicker() return
def __init__(self, dataSec, defaultOffset=None, binoculars=None): CallbackDelayer.__init__(self) self.__impulseOscillator = None self.__movementOscillator = None self.__noiseOscillator = None self.__dynamicCfg = CameraDynamicConfig() self.__accelerationSmoother = None self.__readCfg(dataSec) if binoculars is None: return else: self.__cam = BigWorld.FreeCamera() self.__zoom = self.__cfg['zoom'] self.__curSense = 0 self.__curScrollSense = 0 self.__waitVehicleCallbackId = None self.__onChangeControlMode = None self.__aimingSystem = None self.__binoculars = binoculars self.__defaultAimOffset = defaultOffset or Vector2() self.__crosshairMatrix = createCrosshairMatrix( offsetFromNearPlane=self.__dynamicCfg['aimMarkerDistance']) self.__prevTime = BigWorld.time() self.__autoUpdateDxDyDz = Vector3(0, 0, 0) if BattleReplay.g_replayCtrl.isPlaying: BattleReplay.g_replayCtrl.setDataCallback( 'applyZoom', self.__applySerializedZoom) return
def launch(spaceName): global g_offlineModeEnabled print 'Entering offline space', spaceName BigWorld.clearAllSpaces() BigWorld.worldDrawEnabled(False) _displayGUI(spaceName) spaceID = BigWorld.createSpace() visibilityMask = game_mode_emulator.gameModeVisibilityMask() BigWorld.addSpaceGeometryMapping(spaceID, None, spaceName, visibilityMask) _loadCameraTransforms() camera = BigWorld.FreeCamera() camera.spaceID = spaceID BigWorld.camera(camera) _setCameraTransform(g_curCameraTransform) BigWorld.camera().fixed = True BigWorld.projection().fov = math.radians(75.0) BigWorld.setWatcher('Client Settings/Strafe Rate', 175.0) BigWorld.setWatcher('Client Settings/Camera Mass', 5.0) BigWorld.setCursor(GUI.mcursor()) GUI.mcursor().visible = True GUI.mcursor().clipped = False g_offlineModeEnabled = True BigWorld.callback(1.0, _offlineLoadCheck) createFakeAvatar() return
def __init__(self, dataSec, aim, binoculars): CallbackDelayer.__init__(self) self.__impulseOscillator = None self.__movementOscillator = None self.__noiseOscillator = None self.__dynamicCfg = CameraDynamicConfig() self.__accelerationSmoother = None self.__readCfg(dataSec) if aim is None or binoculars is None: return self.__cam = BigWorld.FreeCamera() self.__zoom = self.__cfg['zoom'] self.__curSense = 0 self.__curScrollSense = 0 self.__waitVehicleCallbackId = None self.__onChangeControlMode = None self.__aimingSystem = SniperAimingSystem(dataSec) self.__aim = weakref.proxy(aim) self.__binoculars = binoculars self.__defaultAimOffset = self.__aim.offset() self.__defaultAimOffset = (self.__defaultAimOffset[0], self.__defaultAimOffset[1]) self.__crosshairMatrix = createCrosshairMatrix( offsetFromNearPlane=self.__dynamicCfg['aimMarkerDistance']) self.__prevTime = BigWorld.time() self.__autoUpdateDxDyDz = Vector3(0, 0, 0)
def __init__(self, configDataSec): CallbackDelayer.__init__(self) self.__cam = BigWorld.FreeCamera() self.__ypr = Math.Vector3() self.__position = Math.Vector3() self.__defaultFov = BigWorld.projection().fov self.__velocity = Math.Vector3() self.__isVerticalVelocitySeparated = False self.__yprVelocity = Math.Vector3() self.__zoomVelocity = 0.0 self.__inertiaEnabled = False self.__movementInertia = None self.__rotationInertia = None self.__movementSensor = None self.__verticalMovementSensor = None self.__rotationSensor = None self.__zoomSensor = None self.__targetRadiusSensor = None self.__mouseSensitivity = 0.0 self.__scrollSensitivity = 0.0 self.__prevTime = 0.0 self.__rotateAroundPointEnabled = False self.__rotationRadius = 40.0 self.__boundVehicleMProv = None self.__alignerToLand = _AlignerToLand() self.__predefinedVelocities = {} self.__predefinedVerticalVelocities = {} self.__keySwitches = {} self.__readCfg(configDataSec) self.__aim = None return
def enable(self, doEnable): if self.__isEnabled == doEnable: return from cameras import FovExtended if not doEnable: self.__isEnabled = False BigWorld.camera(self.__savedCamera) BigWorld.wg_enableSuperShot(False, False) for k, v in self.__savedWatchers.iteritems(): BigWorld.setWatcher(k, v) FovExtended.instance().enabled = True BigWorld.projection().nearPlane = self.__nearPlane BigWorld.projection().farPlane = self.__farPlane BigWorld.setWatcher('Render/Fog/enabled', True) BigWorld.setWatcher('Occlusion Culling/Enabled', True) BigWorld.setWatcher('Render/Terrain/AdaptiveMesh/cascades enabled', True) BigWorld.setWatcher('Render/Water/out land water', True) LOG_DEBUG('Vertical screenshot camera is disabled') return self.__isEnabled = True self.__savedCamera = BigWorld.camera() FovExtended.instance().enabled = False arenaBB = BigWorld.player().arena.arenaType.spaceBoundingBox centerXZ = Math.Vector2(0.5 * (arenaBB[0][0] + arenaBB[1][0]), 0.5 * (arenaBB[0][1] + arenaBB[1][1])) halfSizesXZ = Math.Vector2(0.5 * (arenaBB[1][0] - arenaBB[0][0]), 0.5 * (arenaBB[1][1] - arenaBB[0][1])) camFov = math.radians(15.0) camPos = Math.Vector3(centerXZ.x, 0, centerXZ.z) aspectRatio = BigWorld.getAspectRatio() camPos.y = max(halfSizesXZ.x / math.sin(0.5 * camFov * aspectRatio), halfSizesXZ.y / math.sin(0.5 * camFov)) camMatr = Math.Matrix() camMatr.setRotateYPR(Math.Vector3(0.0, math.pi * 0.5, 0.0)) camMatr.translation = camPos camMatr.invert() self.__cam = BigWorld.FreeCamera() self.__cam.set(camMatr) BigWorld.camera(self.__cam) BigWorld.wg_enableSuperShot(True, False) self.__savedWatchers = {} for name in self.__watcherNames: try: self.__savedWatchers[name] = BigWorld.getWatcher(name) if name.startswith('Visibility'): BigWorld.setWatcher(name, False) except TypeError: LOG_WARNING('Failed to get/set watcher', name) self.__nearPlane = BigWorld.projection().nearPlane self.__farPlane = BigWorld.projection().farPlane BigWorld.setWatcher('Render/Fog/enabled', False) BigWorld.projection().fov = camFov BigWorld.projection().nearPlane = max(0.1, camPos.y - 1000.0) BigWorld.projection().farPlane = camPos.y + 1000 BigWorld.setWatcher('Render/Shadows/qualityPreset', 4) BigWorld.setWatcher('Client Settings/Script tick', False) BigWorld.setWatcher('Occlusion Culling/Enabled', False) BigWorld.setWatcher('Render/Terrain/AdaptiveMesh/cascades enabled', False) BigWorld.setWatcher('Render/Water/out land water', False) LOG_DEBUG('Vertical screenshot camera is enabled')
def enable(self, doEnable): if self.__isEnabled == doEnable: return from cameras import FovExtended if not doEnable: self.__isEnabled = False BigWorld.camera(self.__savedCamera) BigWorld.wg_enableSuperShot(False, False) for k, v in self.__savedWatchers.iteritems(): BigWorld.setWatcher(k, v) FovExtended.instance().enabled = True LOG_DEBUG('Vertical screenshot camera is disabled') return self.__isEnabled = True self.__savedCamera = BigWorld.camera() FovExtended.instance().enabled = False arenaBB = BigWorld.wg_getSpaceBounds() centerXZ = Math.Vector2(0.5 * (arenaBB[0] + arenaBB[2]), 0.5 * (arenaBB[1] + arenaBB[3])) halfSizesXZ = Math.Vector2(0.5 * (arenaBB[2] - arenaBB[0]), 0.5 * (arenaBB[3] - arenaBB[1])) camFov = math.radians(15.0) camPos = Math.Vector3(centerXZ.x, 0, centerXZ.z) aspectRatio = 1.0 if not BigWorld.isVideoWindowed(): aspectRatio = BigWorld.getFullScreenAspectRatio() else: aspectRatio = BigWorld.screenWidth() / BigWorld.screenHeight() camPos.y = max(halfSizesXZ.x / math.sin(0.5 * camFov * aspectRatio), halfSizesXZ.y / math.sin(0.5 * camFov)) camMatr = Math.Matrix() camMatr.setRotateYPR(Math.Vector3(0.0, math.pi * 0.5, 0.0)) camMatr.translation = camPos camMatr.invert() self.__cam = BigWorld.FreeCamera() self.__cam.set(camMatr) BigWorld.camera(self.__cam) BigWorld.wg_enableSuperShot(True, False) self.__savedWatchers = {} for name in self.__watcherNames: try: self.__savedWatchers[name] = BigWorld.getWatcher(name) if name.startswith('Visibility'): BigWorld.setWatcher(name, False) except TypeError: LOG_WARNING('Failed to get/set watcher', name) BigWorld.setWatcher('Client Settings/std fog/enabled', False) BigWorld.projection().fov = camFov BigWorld.setWatcher('Render/Fov', camFov) BigWorld.setWatcher('Render/Near Plane', max(0.1, camPos.y - 1000.0)) BigWorld.setWatcher('Render/Far Plane', camPos.y + 1000.0) BigWorld.setWatcher('Render/Objects Far Plane/Enabled', False) BigWorld.setWatcher('Render/Shadows/qualityPreset', 7) BigWorld.setWatcher('Client Settings/Script tick', False) LOG_DEBUG('Vertical screenshot camera is enabled')
def createExternalFeed(feedName, matrixProvider): sceneRenderer = BigWorld.PySceneRenderer(64, 64) camera = BigWorld.FreeCamera() camera.invViewProvider = matrixProvider sceneRenderer.cameras = [camera] sceneRenderer.dynamic = 1 sceneRenderer.render() BigWorld.addTextureFeed(feedName, sceneRenderer.texture) return sceneRenderer
def createStriffFeed(): camera = BigWorld.FreeCamera() m = Math.Matrix() m.setRotateYPR((2.69752, 0.467126, 0.0)) m.translation = (-36.5, 28.6, 87.46) s = GUI.load('gui/video_feed.gui') camera.set(m) s.script.active(1, camera) return s
def __init__(self, dataSec): self.__readCfg(dataSec) self.__cam = BigWorld.FreeCamera() self.__angles = [0.0, 0.0] self.__dxdydz = [0.0, 0.0, 0.0] self.__zoom = self.__cfg['zoom'] self.__fov = BigWorld.projection().fov self.__curSense = 0 self.__curScrollSense = 0 self.__autoUpdate = False self.__autoUpdateCallbackId = None self.__waitVehicleCallbackId = None self.__onChangeControlMode = None self.__pitchCompensation = 0 self.__pitchCompensationTimestamp = BigWorld.time() return
def moveToGameObject(self, gameObject=None, instantly=False): if not self.__isActive: return else: self.__instantly = instantly self.__prevParams = deepcopy(self.__currentParams) if gameObject: self.__readCameraParamsFromGameObject(gameObject) self.__setupCamera() else: self.__currentParams = deepcopy(self.__defaultParams) if self.__currentParams.dofParams: self.__dofHelper = BigWorld.PyCustomizationHelper( None, 0, False, None) self.__dofHelper.setDOFparams(*self.__currentParams.dofParams) self.__dofHelper.setDOFenabled(True) elif self.__dofHelper is not None: self.__dofHelper.setDOFenabled(False) self.__dofHelper = None if self.__flightCam.isInTransition(): tempCam = BigWorld.FreeCamera() tempCam.set(self.__flightCam.matrix) BigWorld.camera(tempCam) self.__flightCam.finish() if gameObject: self.__moveToCamera() else: point = self.__initialCam.target.translation + Math.Vector3( 0, self.__initialCam.pivotMaxDist, 0) self.__moveToCamera(point) else: self.__moveThroughFlightPoint() self.__prevHorizontalFov = FovExtended.instance( ).getLastSetHorizontalFov() self.__currentHorizontalFov = self.__currentParams.fov if not self.__currentHorizontalFov: self.__currentHorizontalFov = FovExtended.instance( ).horizontalFov if self.__instantly: self.__setHorizontalFov(self.__currentHorizontalFov) return
def __init__(self): self.__cam = BigWorld.FreeCamera()