本文整理汇总了Python中AvatarInputHandler.DynamicCameras.CameraDynamicConfig类的典型用法代码示例。如果您正苦于以下问题:Python CameraDynamicConfig类的具体用法?Python CameraDynamicConfig怎么用?Python CameraDynamicConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CameraDynamicConfig类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, dataSec, aim):
CallbackDelayer.__init__(self)
TimeDeltaMeter.__init__(self)
self.__shiftKeySensor = None
self.__movementOscillator = None
self.__impulseOscillator = None
self.__noiseOscillator = None
self.__dynamicCfg = CameraDynamicConfig()
self.__accelerationSmoother = None
self.__readCfg(dataSec)
self.__cam = None
self.__aim = None
self.__onChangeControlMode = None
self.__aimingSystem = None
self.__curSense = 0
self.__curScrollSense = 0
self.__postmortemMode = False
self.__vehiclesToCollideWith = set()
self.__focalPointDist = 1.0
self.__autoUpdateDxDyDz = Vector3(0.0)
self.__defaultAimOffset = (0.0, 0.0)
if aim is None:
return
else:
self.__aim = weakref.proxy(aim)
self.__cam = BigWorld.HomingCamera()
aimOffset = self.__aim.offset()
self.__cam.aimPointClipCoords = Vector2(aimOffset)
self.__defaultAimOffset = (aimOffset[0], aimOffset[1])
return
示例2: __init__
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
else:
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)
return
示例3: __init__
def __init__(self, dataSec, defaultOffset = None):
CallbackDelayer.__init__(self)
TimeDeltaMeter.__init__(self)
self.__shiftKeySensor = None
self.__movementOscillator = None
self.__impulseOscillator = None
self.__noiseOscillator = None
self.__dynamicCfg = CameraDynamicConfig()
self.__accelerationSmoother = None
self.__readCfg(dataSec)
self.__onChangeControlMode = None
self.__aimingSystem = None
self.__curSense = 0
self.__curScrollSense = 0
self.__postmortemMode = False
self.__vehiclesToCollideWith = set()
self.__focalPointDist = 1.0
self.__autoUpdateDxDyDz = Vector3(0.0)
self.__updatedByKeyboard = False
if defaultOffset is not None:
self.__defaultAimOffset = defaultOffset
self.__cam = BigWorld.HomingCamera(self.__adCfg['enable'])
if self.__adCfg['enable']:
self.__cam.initAdvancedCollider(self.__adCfg['fovRatio'], self.__adCfg['rollbackSpeed'], self.__adCfg['minimalCameraDistance'], self.__adCfg['speedThreshold'], self.__adCfg['minimalVolume'])
for group_name in VOLUME_GROUPS_NAMES:
self.__cam.addVolumeGroup(self.__adCfg['volumeGroups'][group_name])
self.__cam.aimPointClipCoords = defaultOffset
else:
self.__defaultAimOffset = Vector2()
self.__cam = None
return
示例4: __init__
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 = SniperAimingSystem(dataSec)
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.__applyZoom)
return
示例5: __init__
def __init__(self, dataSec, defaultOffset = None):
CallbackDelayer.__init__(self)
TimeDeltaMeter.__init__(self)
self.__shiftKeySensor = None
self.__movementOscillator = None
self.__impulseOscillator = None
self.__noiseOscillator = None
self.__dynamicCfg = CameraDynamicConfig()
self.__accelerationSmoother = None
self.__readCfg(dataSec)
self.__onChangeControlMode = None
self.__aimingSystem = None
self.__curSense = 0
self.__curScrollSense = 0
self.__postmortemMode = False
self.__vehiclesToCollideWith = set()
self.__focalPointDist = 1.0
self.__autoUpdateDxDyDz = Vector3(0.0)
self.__updatedByKeyboard = False
if defaultOffset is not None:
self.__defaultAimOffset = defaultOffset
self.__cam = BigWorld.HomingCamera()
self.__cam.aimPointClipCoords = defaultOffset
else:
self.__defaultAimOffset = Vector2()
self.__cam = None
return
示例6: __init__
def __init__(self, dataSec, aim):
CallbackDelayer.__init__(self)
self.__positionOscillator = None
self.__positionNoiseOscillator = None
self.__dynamicCfg = CameraDynamicConfig()
self.__readCfg(dataSec)
self.__cam = BigWorld.CursorCamera()
self.__curSense = self.__cfg['sensitivity']
self.__onChangeControlMode = None
self.__aimingSystem = StrategicAimingSystem(self.__cfg['distRange'][0], StrategicCamera._CAMERA_YAW)
self.__prevTime = BigWorld.time()
self.__aimOffsetFunc = None
if aim is None:
self.__aimOffsetFunc = lambda x = None: (0, 0)
else:
self.__aimOffsetFunc = aim.offset
self.__autoUpdatePosition = False
self.__dxdydz = Vector3(0, 0, 0)
self.__needReset = 0
示例7: ArcadeCamera
class ArcadeCamera(ICamera, CallbackDelayer, TimeDeltaMeter):
REASONS_AFFECT_CAMERA_DIRECTLY = (ImpulseReason.MY_SHOT,
ImpulseReason.OTHER_SHOT,
ImpulseReason.VEHICLE_EXPLOSION,
ImpulseReason.HE_EXPLOSION)
_DYNAMIC_ENABLED = True
@staticmethod
def enableDynamicCamera(enable):
ArcadeCamera._DYNAMIC_ENABLED = enable
@staticmethod
def isCameraDynamic():
return ArcadeCamera._DYNAMIC_ENABLED
_FILTER_LENGTH = 5
_DEFAULT_MAX_ACCELERATION_DURATION = 1.5
_FOCAL_POINT_CHANGE_SPEED = 100.0
_FOCAL_POINT_MIN_DIFF = 5.0
_MIN_REL_SPEED_ACC_SMOOTHING = 0.7
def getReasonsAffectCameraDirectly(self):
return ArcadeCamera.REASONS_AFFECT_CAMERA_DIRECTLY
def __getVehicleMProv(self):
refinedMProv = self.__aimingSystem.vehicleMProv
return refinedMProv.b.source
def __setVehicleMProv(self, vehicleMProv):
prevAimRel = self.__cam.aimPointProvider.a if self.__cam.aimPointProvider is not None else None
refinedVehicleMProv = self.__refineVehicleMProv(vehicleMProv)
self.__aimingSystem.vehicleMProv = refinedVehicleMProv
self.__setupCameraProviders(refinedVehicleMProv)
self.__cam.speedTreeTarget = self.__aimingSystem.vehicleMProv
self.__aimingSystem.update(0.0)
if prevAimRel is not None:
self.__cam.aimPointProvider.a = prevAimRel
baseTranslation = Matrix(refinedVehicleMProv).translation
relativePosition = self.__aimingSystem.matrix.translation - baseTranslation
self.__setCameraPosition(relativePosition)
return
camera = property(lambda self: self.__cam)
angles = property(lambda self: (self.__aimingSystem.yaw, self.__aimingSystem.pitch))
aimingSystem = property(lambda self: self.__aimingSystem)
vehicleMProv = property(__getVehicleMProv, __setVehicleMProv)
def __init__(self, dataSec, aim):
CallbackDelayer.__init__(self)
TimeDeltaMeter.__init__(self)
self.__shiftKeySensor = None
self.__movementOscillator = None
self.__impulseOscillator = None
self.__noiseOscillator = None
self.__dynamicCfg = CameraDynamicConfig()
self.__accelerationSmoother = None
self.__readCfg(dataSec)
self.__cam = None
self.__aim = None
self.__onChangeControlMode = None
self.__aimingSystem = None
self.__curSense = 0
self.__curScrollSense = 0
self.__postmortemMode = False
self.__vehiclesToCollideWith = set()
self.__focalPointDist = 1.0
self.__autoUpdateDxDyDz = Vector3(0.0)
self.__defaultAimOffset = (0.0, 0.0)
if aim is None:
return
else:
self.__aim = weakref.proxy(aim)
self.__cam = BigWorld.HomingCamera()
aimOffset = self.__aim.offset()
self.__cam.aimPointClipCoords = Vector2(aimOffset)
self.__defaultAimOffset = (aimOffset[0], aimOffset[1])
return
def create(self, pivotPos, onChangeControlMode = None, postmortemMode = False):
self.__onChangeControlMode = onChangeControlMode
self.__postmortemMode = postmortemMode
targetMat = self.getTargetMProv()
self.__aimingSystem = ArcadeAimingSystem(self.__refineVehicleMProv(targetMat), pivotPos.y, pivotPos.z, self.__calcAimMatrix(), self.__cfg['angleRange'], not postmortemMode)
self.setCameraDistance(self.__cfg['startDist'])
self.__aimingSystem.pitch = self.__cfg['startAngle']
self.__aimingSystem.yaw = Math.Matrix(targetMat).yaw
self.__updateAngles(0, 0)
cameraPosProvider = Math.Vector4Translation(self.__aimingSystem.matrix)
self.__cam.cameraPositionProvider = cameraPosProvider
def getTargetMProv(self):
replayCtrl = BattleReplay.g_replayCtrl
if replayCtrl.isPlaying and replayCtrl.playerVehicleID != 0:
vehicleID = replayCtrl.playerVehicleID
else:
vehicleID = BigWorld.player().playerVehicleID
return BigWorld.entity(vehicleID).matrix
def reinitMatrix(self):
self.__setVehicleMProv(self.getTargetMProv())
#.........这里部分代码省略.........
示例8: StrategicCamera
class StrategicCamera(ICamera, CallbackDelayer):
_CAMERA_YAW = 0.0
_DYNAMIC_ENABLED = True
ABSOLUTE_VERTICAL_FOV = math.radians(60.0)
@staticmethod
def enableDynamicCamera(enable):
StrategicCamera._DYNAMIC_ENABLED = enable
@staticmethod
def isCameraDynamic():
return StrategicCamera._DYNAMIC_ENABLED
camera = property(lambda self: self.__cam)
aimingSystem = property(lambda self: self.__aimingSystem)
def __init__(self, dataSec, aim):
CallbackDelayer.__init__(self)
self.__positionOscillator = None
self.__positionNoiseOscillator = None
self.__dynamicCfg = CameraDynamicConfig()
self.__readCfg(dataSec)
self.__cam = BigWorld.CursorCamera()
self.__curSense = self.__cfg['sensitivity']
self.__onChangeControlMode = None
self.__aimingSystem = StrategicAimingSystem(self.__cfg['distRange'][0], StrategicCamera._CAMERA_YAW)
self.__prevTime = BigWorld.time()
self.__aimOffsetFunc = None
if aim is None:
self.__aimOffsetFunc = lambda x = None: (0, 0)
else:
self.__aimOffsetFunc = aim.offset
self.__autoUpdatePosition = False
self.__dxdydz = Vector3(0, 0, 0)
self.__needReset = 0
def create(self, onChangeControlMode = None):
self.__onChangeControlMode = onChangeControlMode
self.__camDist = self.__cfg['camDist']
self.__cam.pivotMaxDist = 0.0
self.__cam.maxDistHalfLife = 0.01
self.__cam.movementHalfLife = 0.0
self.__cam.turningHalfLife = -1
self.__cam.pivotPosition = Math.Vector3(0.0, self.__camDist, 0.0)
def destroy(self):
CallbackDelayer.destroy(self)
self.disable()
self.__onChangeControlMode = None
self.__cam = None
self._writeUserPreferences()
self.__aimingSystem.destroy()
self.__aimingSystem = None
def enable(self, targetPos, saveDist):
self.__prevTime = BigWorld.time()
self.__aimingSystem.enable(targetPos)
srcMat = mathUtils.createRotationMatrix((0.0, -math.pi * 0.499, 0.0))
self.__cam.source = srcMat
if not saveDist:
self.__camDist = self.__cfg['camDist']
self.__cam.pivotPosition = Math.Vector3(0.0, self.__camDist, 0.0)
camTarget = Math.MatrixProduct()
camTarget.b = self.__aimingSystem.matrix
self.__cam.target = camTarget
BigWorld.camera(self.__cam)
BigWorld.player().positionControl.moveTo(self.__aimingSystem.matrix.translation)
BigWorld.player().positionControl.followCamera(True)
FovExtended.instance().enabled = False
BigWorld.projection().fov = StrategicCamera.ABSOLUTE_VERTICAL_FOV
self.__cameraUpdate()
self.delayCallback(0.0, self.__cameraUpdate)
self.__needReset = 1
def disable(self):
self.__aimingSystem.disable()
self.stopCallback(self.__cameraUpdate)
BigWorld.camera(None)
BigWorld.player().positionControl.followCamera(False)
self.__positionOscillator.reset()
FovExtended.instance().resetFov()
FovExtended.instance().enabled = True
def teleport(self, pos):
self.moveToPosition(pos)
def setMaxDist(self):
distRange = self.__cfg['distRange']
if len(distRange) > 1:
self.__camDist = distRange[1]
def restoreDefaultsState(self):
LOG_ERROR('StrategiCamera::restoreDefaultState is obsolete!')
return
vPos = BigWorld.player().getOwnVehiclePosition()
self.__camDist = self.__cfg['camDist']
self.__cam.pivotMaxDist = 0.0
self.__cam.maxDistHalfLife = 0.01
self.__cam.movementHalfLife = 0.0
self.__cam.turningHalfLife = 0.01
#.........这里部分代码省略.........
示例9: SniperCamera
class SniperCamera(ICamera, CallbackDelayer):
_DYNAMIC_ENABLED = True
@staticmethod
def enableDynamicCamera(enable):
SniperCamera._DYNAMIC_ENABLED = enable
@staticmethod
def isCameraDynamic():
return SniperCamera._DYNAMIC_ENABLED
_FILTER_LENGTH = 5
_DEFAULT_MAX_ACCELERATION_DURATION = 1.5
_MIN_REL_SPEED_ACC_SMOOTHING = 0.7
camera = property(lambda self: self.__cam)
aimingSystem = property(lambda self: self.__aimingSystem)
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
else:
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)
return
def create(self, onChangeControlMode = None):
self.__onChangeControlMode = onChangeControlMode
def destroy(self):
self.disable()
self.__onChangeControlMode = None
self.__cam = None
self._writeUserPreferences()
self.__aimingSystem.destroy()
self.__aimingSystem = None
self.__aim = None
CallbackDelayer.destroy(self)
return
def enable(self, targetPos, saveZoom):
self.__prevTime = BigWorld.time()
player = BigWorld.player()
if saveZoom:
self.__zoom = self.__cfg['zoom']
else:
self.__cfg['zoom'] = self.__zoom = self.__cfg['zooms'][0]
self.__applyZoom(self.__zoom)
self.__setupCamera(targetPos)
vehicle = BigWorld.entity(player.playerVehicleID)
if self.__waitVehicleCallbackId is not None:
BigWorld.cancelCallback(self.__waitVehicleCallbackId)
if vehicle is None:
self.__whiteVehicleCallbackId = BigWorld.callback(0.1, self.__waitVehicle)
else:
self.__showVehicle(False)
BigWorld.camera(self.__cam)
if self.__cameraUpdate(False) >= 0.0:
self.delayCallback(0.0, self.__cameraUpdate)
return
def disable(self):
BigWorld.camera(None)
if self.__waitVehicleCallbackId is not None:
BigWorld.cancelCallback(self.__waitVehicleCallbackId)
self.__waitVehicleCallbackId = None
self.__showVehicle(True)
self.stopCallback(self.__cameraUpdate)
self.__aimingSystem.disable()
self.__movementOscillator.reset()
self.__impulseOscillator.reset()
self.__noiseOscillator.reset()
self.__accelerationSmoother.reset()
self.__autoUpdateDxDyDz.set(0)
FovExtended.instance().resetFov()
return
def getUserConfigValue(self, name):
return self.__userCfg.get(name)
def setUserConfigValue(self, name, value):
if name not in self.__userCfg:
#.........这里部分代码省略.........