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')