Exemple #1
0
 def __readCfg(self, dataSec):
     if not dataSec:
         LOG_WARNING('Invalid section <strategicMode/camera> in avatar_input_handler.xml')
     self.__baseCfg = dict()
     bcfg = self.__baseCfg
     bcfg['keySensitivity'] = readFloat(dataSec, 'keySensitivity', 0.005, 10, 0.025)
     bcfg['sensitivity'] = readFloat(dataSec, 'sensitivity', 0.005, 10, 0.025)
     bcfg['scrollSensitivity'] = readFloat(dataSec, 'scrollSensitivity', 0.005, 10, 0.025)
     bcfg['distRange'] = readVec2(dataSec, 'distRange', (1, 1), (10000, 10000), (2, 30))
     ds = Settings.g_instance.userPrefs[Settings.KEY_CONTROL_MODE]
     if ds is not None:
         ds = ds['strategicMode/camera']
     self.__userCfg = dict()
     ucfg = self.__userCfg
     from account_helpers.settings_core.SettingsCore import g_settingsCore
     ucfg['horzInvert'] = g_settingsCore.getSetting('mouseHorzInvert')
     ucfg['vertInvert'] = g_settingsCore.getSetting('mouseVertInvert')
     ucfg['keySensitivity'] = readFloat(ds, 'keySensitivity', 0.0, 10.0, 1.0)
     ucfg['sensitivity'] = readFloat(ds, 'sensitivity', 0.0, 10.0, 1.0)
     ucfg['scrollSensitivity'] = readFloat(ds, 'scrollSensitivity', 0.0, 10.0, 1.0)
     ucfg['camDist'] = readFloat(ds, 'camDist', 0.0, 60.0, 0)
     self.__cfg = dict()
     cfg = self.__cfg
     cfg['keySensitivity'] = bcfg['keySensitivity']
     cfg['sensitivity'] = bcfg['sensitivity']
     cfg['scrollSensitivity'] = bcfg['scrollSensitivity']
     cfg['distRange'] = bcfg['distRange']
     cfg['camDist'] = ucfg['camDist']
     cfg['keySensitivity'] *= ucfg['keySensitivity']
     cfg['sensitivity'] *= ucfg['sensitivity']
     cfg['scrollSensitivity'] *= ucfg['scrollSensitivity']
     cfg['horzInvert'] = ucfg['horzInvert']
     cfg['vertInvert'] = ucfg['vertInvert']
     dynamicsSection = dataSec['dynamics']
     self.__dynamicCfg.readImpulsesConfig(dynamicsSection)
     self.__positionOscillator = createOscillatorFromSection(dynamicsSection['oscillator'], False)
     self.__positionNoiseOscillator = createOscillatorFromSection(dynamicsSection['randomNoiseOscillatorFlat'], False)
Exemple #2
0
def __getOscillator1dParams(oscillatorSection):
    return {'mass': readFloat(oscillatorSection, 'mass', 1e-05, 9000, 3.5),
     'stiffness': readFloat(oscillatorSection, 'stiffness', 1e-05, 9000, 3.5),
     'drag': readFloat(oscillatorSection, 'drag', 1e-05, 9000, 3.5)}
Exemple #3
0
def __getOscillator3dParams(oscillatorSection):
    return {'mass': readFloat(oscillatorSection, 'mass', 1e-05, 9000, 3.5),
     'stiffness': readVec3(oscillatorSection, 'stiffness', (1e-05, 1e-05, 1e-05), (9000, 9000, 9000), 60.0),
     'drag': readVec3(oscillatorSection, 'drag', (1e-05, 1e-05, 1e-05), (9000, 9000, 9000), 9.0)}
 def __readCfg(self, dataSec):
     if dataSec is None:
         LOG_WARNING('Invalid section <arcadeMode/camera> in avatar_input_handler.xml')
     self.__baseCfg = dict()
     bcfg = self.__baseCfg
     bcfg['keySensitivity'] = readFloat(dataSec, 'keySensitivity', 0, 10, 0.01)
     bcfg['sensitivity'] = readFloat(dataSec, 'sensitivity', 0, 10, 0.01)
     bcfg['scrollSensitivity'] = readFloat(dataSec, 'scrollSensitivity', 0, 10, 0.01)
     bcfg['angleRange'] = readVec2(dataSec, 'angleRange', (0, 0), (180, 180), (10, 110))
     distRangeVec = readVec2(dataSec, 'distRange', (1, 1), (100, 100), (2, 20))
     bcfg['distRange'] = MinMax(distRangeVec.x, distRangeVec.y)
     bcfg['minStartDist'] = readFloat(dataSec, 'minStartDist', bcfg['distRange'][0], bcfg['distRange'][1], bcfg['distRange'][0])
     bcfg['optimalStartDist'] = readFloat(dataSec, 'optimalStartDist', bcfg['distRange'][0], bcfg['distRange'][1], bcfg['distRange'][0])
     bcfg['angleRange'][0] = math.radians(bcfg['angleRange'][0]) - math.pi * 0.5
     bcfg['angleRange'][1] = math.radians(bcfg['angleRange'][1]) - math.pi * 0.5
     bcfg['fovMultMinMaxDist'] = MinMax(readFloat(dataSec, 'fovMultMinDist', 0.1, 100, 1.0), readFloat(dataSec, 'fovMultMaxDist', 0.1, 100, 1.0))
     ds = Settings.g_instance.userPrefs[Settings.KEY_CONTROL_MODE]
     if ds is not None:
         ds = ds['arcadeMode/camera']
     self.__userCfg = dict()
     ucfg = self.__userCfg
     from account_helpers.settings_core.SettingsCore import g_settingsCore
     ucfg['horzInvert'] = g_settingsCore.getSetting('mouseHorzInvert')
     ucfg['vertInvert'] = g_settingsCore.getSetting('mouseVertInvert')
     ucfg['sniperModeByShift'] = g_settingsCore.getSetting('sniperModeByShift')
     ucfg['keySensitivity'] = readFloat(ds, 'keySensitivity', 0.0, 10.0, 1.0)
     ucfg['sensitivity'] = readFloat(ds, 'sensitivity', 0.0, 10.0, 1.0)
     ucfg['scrollSensitivity'] = readFloat(ds, 'scrollSensitivity', 0.0, 10.0, 1.0)
     ucfg['startDist'] = readFloat(ds, 'startDist', bcfg['distRange'][0], 500, bcfg['optimalStartDist'])
     if ucfg['startDist'] < bcfg['minStartDist']:
         ucfg['startDist'] = bcfg['optimalStartDist']
     ucfg['startAngle'] = readFloat(ds, 'startAngle', 5, 180, 60)
     ucfg['startAngle'] = math.radians(ucfg['startAngle']) - math.pi * 0.5
     ucfg['fovMultMinMaxDist'] = MinMax(readFloat(ds, 'fovMultMinDist', 0.1, 100, bcfg['fovMultMinMaxDist'].min), readFloat(ds, 'fovMultMaxDist', 0.1, 100, bcfg['fovMultMinMaxDist'].max))
     self.__cfg = dict()
     cfg = self.__cfg
     cfg['keySensitivity'] = bcfg['keySensitivity']
     cfg['sensitivity'] = bcfg['sensitivity']
     cfg['scrollSensitivity'] = bcfg['scrollSensitivity']
     cfg['angleRange'] = bcfg['angleRange']
     cfg['distRange'] = bcfg['distRange']
     cfg['minStartDist'] = bcfg['minStartDist']
     cfg['horzInvert'] = ucfg['horzInvert']
     cfg['vertInvert'] = ucfg['vertInvert']
     cfg['keySensitivity'] *= ucfg['keySensitivity']
     cfg['sensitivity'] *= ucfg['sensitivity']
     cfg['scrollSensitivity'] *= ucfg['scrollSensitivity']
     cfg['startDist'] = ucfg['startDist']
     cfg['startAngle'] = ucfg['startAngle']
     cfg['fovMultMinMaxDist'] = ucfg['fovMultMinMaxDist']
     cfg['sniperModeByShift'] = ucfg['sniperModeByShift']
     enableShift = dataSec.readBool('shift', False)
     if enableShift:
         movementMappings = dict()
         movementMappings[Keys.KEY_A] = Math.Vector3(-1, 0, 0)
         movementMappings[Keys.KEY_D] = Math.Vector3(1, 0, 0)
         movementMappings[Keys.KEY_Q] = Math.Vector3(0, 1, 0)
         movementMappings[Keys.KEY_E] = Math.Vector3(0, -1, 0)
         movementMappings[Keys.KEY_W] = Math.Vector3(0, 0, 1)
         movementMappings[Keys.KEY_S] = Math.Vector3(0, 0, -1)
         shiftSensitivity = dataSec.readFloat('shiftSensitivity', 0.5)
         self.__shiftKeySensor = KeySensor(movementMappings, shiftSensitivity)
         self.__shiftKeySensor.reset(Math.Vector3())
     dynamicsSection = dataSec['dynamics']
     self.__impulseOscillator = createOscillatorFromSection(dynamicsSection['impulseOscillator'], False)
     self.__movementOscillator = createOscillatorFromSection(dynamicsSection['movementOscillator'], False)
     self.__movementOscillator = CompoundOscillator(self.__movementOscillator, Oscillator(1.0, Vector3(50), Vector3(20), Vector3(0.01, 0.0, 0.01)))
     self.__noiseOscillator = createOscillatorFromSection(dynamicsSection['randomNoiseOscillatorSpherical'])
     self.__dynamicCfg.readImpulsesConfig(dynamicsSection)
     self.__dynamicCfg['accelerationSensitivity'] = readFloat(dynamicsSection, 'accelerationSensitivity', -1000, 1000, 0.1)
     self.__dynamicCfg['frontImpulseToPitchRatio'] = math.radians(readFloat(dynamicsSection, 'frontImpulseToPitchRatio', -1000, 1000, 0.1))
     self.__dynamicCfg['sideImpulseToRollRatio'] = math.radians(readFloat(dynamicsSection, 'sideImpulseToRollRatio', -1000, 1000, 0.1))
     self.__dynamicCfg['sideImpulseToYawRatio'] = math.radians(readFloat(dynamicsSection, 'sideImpulseToYawRatio', -1000, 1000, 0.1))
     accelerationThreshold = readFloat(dynamicsSection, 'accelerationThreshold', 0.0, 1000.0, 0.1)
     self.__dynamicCfg['accelerationThreshold'] = accelerationThreshold
     self.__dynamicCfg['accelerationMax'] = readFloat(dynamicsSection, 'accelerationMax', 0.0, 1000.0, 0.1)
     self.__dynamicCfg['maxShotImpulseDistance'] = readFloat(dynamicsSection, 'maxShotImpulseDistance', 0.0, 1000.0, 10.0)
     self.__dynamicCfg['maxExplosionImpulseDistance'] = readFloat(dynamicsSection, 'maxExplosionImpulseDistance', 0.0, 1000.0, 10.0)
     self.__dynamicCfg['zoomExposure'] = readFloat(dynamicsSection, 'zoomExposure', 0.0, 1000.0, 0.25)
     accelerationFilter = mathUtils.RangeFilter(self.__dynamicCfg['accelerationThreshold'], self.__dynamicCfg['accelerationMax'], 100, mathUtils.SMAFilter(ArcadeCamera._FILTER_LENGTH))
     maxAccelerationDuration = readFloat(dynamicsSection, 'maxAccelerationDuration', 0.0, 10000.0, ArcadeCamera._DEFAULT_MAX_ACCELERATION_DURATION)
     self.__accelerationSmoother = AccelerationSmoother(accelerationFilter, maxAccelerationDuration)
     self.__inputInertia = _InputInertia(self.__cfg['fovMultMinMaxDist'], 0.0)
     advancedCollision = dataSec['advancedCollision']
     if advancedCollision is None:
         LOG_ERROR('<advancedCollision> dataSection is not found!')
     else:
         BigWorld.setAdvancedColliderConstants(AdvancedColliderConstants.fromSection(advancedCollision), cfg['distRange'][0])
     return
Exemple #5
0
 def __readCfg(self, dataSec):
     if not dataSec:
         LOG_WARNING('Invalid section <sniperMode/camera> in avatar_input_handler.xml')
     self.__baseCfg = dict()
     bcfg = self.__baseCfg
     bcfg['keySensitivity'] = readFloat(dataSec, 'keySensitivity', 0, 10, 0.005)
     bcfg['sensitivity'] = readFloat(dataSec, 'sensitivity', 0, 10, 0.005)
     bcfg['scrollSensitivity'] = readFloat(dataSec, 'scrollSensitivity', 0, 10, 0.005)
     zooms = readVec3(dataSec, 'zooms', (0, 0, 0), (10, 10, 10), (2, 4, 8))
     bcfg['zooms'] = [zooms.x, zooms.y, zooms.z]
     ds = Settings.g_instance.userPrefs[Settings.KEY_CONTROL_MODE]
     if ds is not None:
         ds = ds['sniperMode/camera']
     self.__userCfg = dict()
     ucfg = self.__userCfg
     from account_helpers.settings_core.SettingsCore import g_settingsCore
     ucfg['horzInvert'] = g_settingsCore.getSetting('mouseHorzInvert')
     ucfg['vertInvert'] = g_settingsCore.getSetting('mouseVertInvert')
     ucfg['keySensitivity'] = readFloat(ds, 'keySensitivity', 0.0, 10.0, 1.0)
     ucfg['sensitivity'] = readFloat(ds, 'sensitivity', 0.0, 10.0, 1.0)
     ucfg['scrollSensitivity'] = readFloat(ds, 'scrollSensitivity', 0.0, 10.0, 1.0)
     ucfg['zoom'] = readFloat(ds, 'zoom', 0.0, 10.0, bcfg['zooms'][0])
     self.__cfg = dict()
     cfg = self.__cfg
     cfg['keySensitivity'] = bcfg['keySensitivity']
     cfg['sensitivity'] = bcfg['sensitivity']
     cfg['scrollSensitivity'] = bcfg['scrollSensitivity']
     cfg['zooms'] = bcfg['zooms']
     cfg['keySensitivity'] *= ucfg['keySensitivity']
     cfg['sensitivity'] *= ucfg['sensitivity']
     cfg['scrollSensitivity'] *= ucfg['scrollSensitivity']
     cfg['horzInvert'] = ucfg['horzInvert']
     cfg['vertInvert'] = ucfg['vertInvert']
     cfg['zoom'] = ucfg['zoom']
     dynamicsSection = dataSec['dynamics']
     self.__impulseOscillator = createOscillatorFromSection(dynamicsSection['impulseOscillator'])
     self.__movementOscillator = createOscillatorFromSection(dynamicsSection['movementOscillator'])
     self.__noiseOscillator = createOscillatorFromSection(dynamicsSection['randomNoiseOscillatorSpherical'])
     self.__dynamicCfg.readImpulsesConfig(dynamicsSection)
     self.__dynamicCfg['accelerationSensitivity'] = readVec3(dynamicsSection, 'accelerationSensitivity', (-1000, -1000, -1000), (1000, 1000, 1000), (0.5, 0.5, 0.5))
     accelerationThreshold = readFloat(dynamicsSection, 'accelerationThreshold', 0.0, 1000.0, 0.1)
     self.__dynamicCfg['accelerationThreshold'] = accelerationThreshold
     self.__dynamicCfg['accelerationMax'] = readFloat(dynamicsSection, 'accelerationMax', 0.0, 1000.0, 0.1)
     self.__dynamicCfg['maxShotImpulseDistance'] = readFloat(dynamicsSection, 'maxShotImpulseDistance', 0.0, 1000.0, 10.0)
     self.__dynamicCfg['maxExplosionImpulseDistance'] = readFloat(dynamicsSection, 'maxExplosionImpulseDistance', 0.0, 1000.0, 10.0)
     self.__dynamicCfg['impulsePartToRoll'] = readFloat(dynamicsSection, 'impulsePartToRoll', 0.0, 1000.0, 0.3)
     self.__dynamicCfg['pivotShift'] = Vector3(0, readFloat(dynamicsSection, 'pivotShift', -1000, 1000, -0.5), 0)
     self.__dynamicCfg['aimMarkerDistance'] = readFloat(dynamicsSection, 'aimMarkerDistance', -1000, 1000, 1.0)
     self.__dynamicCfg['zoomExposure'] = readVec3(dynamicsSection, 'zoomExposure', (0.1, 0.1, 0.1), (10, 10, 10), (0.5, 0.5, 0.5))
     accelerationFilter = mathUtils.RangeFilter(self.__dynamicCfg['accelerationThreshold'], self.__dynamicCfg['accelerationMax'], 100, mathUtils.SMAFilter(SniperCamera._FILTER_LENGTH))
     maxAccelerationDuration = readFloat(dynamicsSection, 'maxAccelerationDuration', 0.0, 10000.0, SniperCamera._DEFAULT_MAX_ACCELERATION_DURATION)
     self.__accelerationSmoother = AccelerationSmoother(accelerationFilter, maxAccelerationDuration)
     return
 def __readCfg(self, dataSec):
     if dataSec is None:
         LOG_WARNING(
             'Invalid section <arcadeMode/camera> in avatar_input_handler.xml'
         )
     self.__baseCfg = dict()
     bcfg = self.__baseCfg
     bcfg['keySensitivity'] = readFloat(dataSec, 'keySensitivity', 0, 10,
                                        0.01)
     bcfg['sensitivity'] = readFloat(dataSec, 'sensitivity', 0, 10, 0.01)
     bcfg['scrollSensitivity'] = readFloat(dataSec, 'scrollSensitivity', 0,
                                           10, 0.01)
     bcfg['angleRange'] = readVec2(dataSec, 'angleRange', (0, 0),
                                   (180, 180), (10, 110))
     distRangeVec = readVec2(dataSec, 'distRange', (1, 1), (100, 100),
                             (2, 20))
     bcfg['distRange'] = MinMax(distRangeVec.x, distRangeVec.y)
     bcfg['minStartDist'] = readFloat(dataSec, 'minStartDist',
                                      bcfg['distRange'][0],
                                      bcfg['distRange'][1],
                                      bcfg['distRange'][0])
     bcfg['optimalStartDist'] = readFloat(dataSec, 'optimalStartDist',
                                          bcfg['distRange'][0],
                                          bcfg['distRange'][1],
                                          bcfg['distRange'][0])
     bcfg['angleRange'][0] = math.radians(
         bcfg['angleRange'][0]) - math.pi * 0.5
     bcfg['angleRange'][1] = math.radians(
         bcfg['angleRange'][1]) - math.pi * 0.5
     bcfg['fovMultMinMaxDist'] = MinMax(
         readFloat(dataSec, 'fovMultMinDist', 0.1, 100, 1.0),
         readFloat(dataSec, 'fovMultMaxDist', 0.1, 100, 1.0))
     ds = Settings.g_instance.userPrefs[Settings.KEY_CONTROL_MODE]
     if ds is not None:
         ds = ds['arcadeMode/camera']
     self.__userCfg = dict()
     ucfg = self.__userCfg
     from account_helpers.settings_core.SettingsCore import g_settingsCore
     ucfg['horzInvert'] = g_settingsCore.getSetting('mouseHorzInvert')
     ucfg['vertInvert'] = g_settingsCore.getSetting('mouseVertInvert')
     ucfg['sniperModeByShift'] = g_settingsCore.getSetting(
         'sniperModeByShift')
     ucfg['keySensitivity'] = readFloat(ds, 'keySensitivity', 0.0, 10.0,
                                        1.0)
     ucfg['sensitivity'] = readFloat(ds, 'sensitivity', 0.0, 10.0, 1.0)
     ucfg['scrollSensitivity'] = readFloat(ds, 'scrollSensitivity', 0.0,
                                           10.0, 1.0)
     ucfg['startDist'] = readFloat(ds, 'startDist', bcfg['distRange'][0],
                                   500, bcfg['optimalStartDist'])
     if ucfg['startDist'] < bcfg['minStartDist']:
         ucfg['startDist'] = bcfg['optimalStartDist']
     ucfg['startAngle'] = readFloat(ds, 'startAngle', 5, 180, 60)
     ucfg['startAngle'] = math.radians(ucfg['startAngle']) - math.pi * 0.5
     ucfg['fovMultMinMaxDist'] = MinMax(
         readFloat(ds, 'fovMultMinDist', 0.1, 100,
                   bcfg['fovMultMinMaxDist'].min),
         readFloat(ds, 'fovMultMaxDist', 0.1, 100,
                   bcfg['fovMultMinMaxDist'].max))
     self.__cfg = dict()
     cfg = self.__cfg
     cfg['keySensitivity'] = bcfg['keySensitivity']
     cfg['sensitivity'] = bcfg['sensitivity']
     cfg['scrollSensitivity'] = bcfg['scrollSensitivity']
     cfg['angleRange'] = bcfg['angleRange']
     cfg['distRange'] = bcfg['distRange']
     cfg['minStartDist'] = bcfg['minStartDist']
     cfg['horzInvert'] = ucfg['horzInvert']
     cfg['vertInvert'] = ucfg['vertInvert']
     cfg['keySensitivity'] *= ucfg['keySensitivity']
     cfg['sensitivity'] *= ucfg['sensitivity']
     cfg['scrollSensitivity'] *= ucfg['scrollSensitivity']
     cfg['startDist'] = ucfg['startDist']
     cfg['startAngle'] = ucfg['startAngle']
     cfg['fovMultMinMaxDist'] = ucfg['fovMultMinMaxDist']
     cfg['sniperModeByShift'] = ucfg['sniperModeByShift']
     enableShift = dataSec.readBool('shift', False)
     if enableShift:
         movementMappings = dict()
         movementMappings[Keys.KEY_A] = Math.Vector3(-1, 0, 0)
         movementMappings[Keys.KEY_D] = Math.Vector3(1, 0, 0)
         movementMappings[Keys.KEY_Q] = Math.Vector3(0, 1, 0)
         movementMappings[Keys.KEY_E] = Math.Vector3(0, -1, 0)
         movementMappings[Keys.KEY_W] = Math.Vector3(0, 0, 1)
         movementMappings[Keys.KEY_S] = Math.Vector3(0, 0, -1)
         shiftSensitivity = dataSec.readFloat('shiftSensitivity', 0.5)
         self.__shiftKeySensor = KeySensor(movementMappings,
                                           shiftSensitivity)
         self.__shiftKeySensor.reset(Math.Vector3())
     dynamicsSection = dataSec['dynamics']
     self.__impulseOscillator = createOscillatorFromSection(
         dynamicsSection['impulseOscillator'], False)
     self.__movementOscillator = createOscillatorFromSection(
         dynamicsSection['movementOscillator'], False)
     self.__movementOscillator = CompoundOscillator(
         self.__movementOscillator,
         Oscillator(1.0, Vector3(50), Vector3(20), Vector3(0.01, 0.0,
                                                           0.01)))
     self.__noiseOscillator = createOscillatorFromSection(
         dynamicsSection['randomNoiseOscillatorSpherical'])
     self.__dynamicCfg.readImpulsesConfig(dynamicsSection)
     self.__dynamicCfg['accelerationSensitivity'] = readFloat(
         dynamicsSection, 'accelerationSensitivity', -1000, 1000, 0.1)
     self.__dynamicCfg['frontImpulseToPitchRatio'] = math.radians(
         readFloat(dynamicsSection, 'frontImpulseToPitchRatio', -1000, 1000,
                   0.1))
     self.__dynamicCfg['sideImpulseToRollRatio'] = math.radians(
         readFloat(dynamicsSection, 'sideImpulseToRollRatio', -1000, 1000,
                   0.1))
     self.__dynamicCfg['sideImpulseToYawRatio'] = math.radians(
         readFloat(dynamicsSection, 'sideImpulseToYawRatio', -1000, 1000,
                   0.1))
     accelerationThreshold = readFloat(dynamicsSection,
                                       'accelerationThreshold', 0.0, 1000.0,
                                       0.1)
     self.__dynamicCfg['accelerationThreshold'] = accelerationThreshold
     self.__dynamicCfg['accelerationMax'] = readFloat(
         dynamicsSection, 'accelerationMax', 0.0, 1000.0, 0.1)
     self.__dynamicCfg['maxShotImpulseDistance'] = readFloat(
         dynamicsSection, 'maxShotImpulseDistance', 0.0, 1000.0, 10.0)
     self.__dynamicCfg['maxExplosionImpulseDistance'] = readFloat(
         dynamicsSection, 'maxExplosionImpulseDistance', 0.0, 1000.0, 10.0)
     self.__dynamicCfg['zoomExposure'] = readFloat(dynamicsSection,
                                                   'zoomExposure', 0.0,
                                                   1000.0, 0.25)
     accelerationFilter = mathUtils.RangeFilter(
         self.__dynamicCfg['accelerationThreshold'],
         self.__dynamicCfg['accelerationMax'], 100,
         mathUtils.SMAFilter(ArcadeCamera._FILTER_LENGTH))
     maxAccelerationDuration = readFloat(
         dynamicsSection, 'maxAccelerationDuration', 0.0, 10000.0,
         ArcadeCamera._DEFAULT_MAX_ACCELERATION_DURATION)
     self.__accelerationSmoother = AccelerationSmoother(
         accelerationFilter, maxAccelerationDuration)
     self.__inputInertia = _InputInertia(self.__cfg['fovMultMinMaxDist'],
                                         0.0)
     advancedCollision = dataSec['advancedCollision']
     if advancedCollision is None:
         LOG_ERROR('<advancedCollision> dataSection is not found!')
     else:
         BigWorld.setAdvancedColliderConstants(
             AdvancedColliderConstants.fromSection(advancedCollision),
             cfg['distRange'][0])
     return
Exemple #7
0
def __getRandomNoiseOscillatorFlatParams(oscillatorSection):
    return [
        readFloat(oscillatorSection, 'mass', 1e-05, 9000, 3.5),
        readFloat(oscillatorSection, 'stiffness', 1e-05, 9000, 3.5),
        readFloat(oscillatorSection, 'drag', 1e-05, 9000, 3.5)
    ]
Exemple #8
0
 def _readBaseCfg(self, dataSec):
     bcfg = self._baseCfg
     bcfg['keySensitivity'] = readFloat(dataSec, 'keySensitivity', 0.005,
                                        10.0, 0.025)
     bcfg['sensitivity'] = readFloat(dataSec, 'sensitivity', 0.005, 10.0,
                                     0.025)
     bcfg['scrollSensitivity'] = readFloat(dataSec, 'scrollSensitivity',
                                           0.005, 10.0, 0.025)
     bcfg['angularSpeed'] = readFloat(dataSec, 'angularSpeed', pi / 720.0,
                                      pi / 0.5, pi / 360.0)
     bcfg['distRange'] = readVec2(dataSec, 'distRange', (1.0, 1.0),
                                  (10000.0, 10000.0), (2.0, 30.0))
     bcfg['transitionDist'] = readFloat(dataSec, 'transitionDist', 1.0,
                                        10000.0, 60.0)
     bcfg['minimalPitch'] = readFloat(dataSec, 'minimalPitch', pi / 36.0,
                                      pi / 3.0, pi / 18.0)
     bcfg['maximalPitch'] = readFloat(dataSec, 'maximalPitch', pi / 6.0,
                                      pi / 3.0, pi / 3.5)
     bcfg['interpolationSpeed'] = readFloat(dataSec, 'interpolationSpeed',
                                            0.0, 100.0, 5.0)
     bcfg['distInterpolationSpeed'] = readFloat(dataSec,
                                                'distInterpolationSpeed',
                                                0.0, 10.0, 5.0)
     bcfg['highPitchThreshold'] = readFloat(dataSec, 'highPitchThreshold',
                                            0.1, 10.0, 3.0)
     bcfg['hTimeThreshold'] = readFloat(dataSec, 'hysteresis/timeThreshold',
                                        0.0, 10.0, 0.5)
     bcfg['hPositionThreshold'] = readFloat(dataSec,
                                            'hysteresis/positionThreshold',
                                            0.0, 100.0, 7.0)
     bcfg['scrollSmoothingTime'] = readFloat(dataSec, 'scrollSmoothingTime',
                                             0.0, 1.0, 0.3)
 def _readCfg(self, dataSec):
     if not dataSec:
         LOG_WARNING('Invalid section <sniperMode/camera> in avatar_input_handler.xml')
     self._baseCfg = dict()
     bcfg = self._baseCfg
     bcfg['keySensitivity'] = readFloat(dataSec, 'keySensitivity', 0, 10, 0.005)
     bcfg['sensitivity'] = readFloat(dataSec, 'sensitivity', 0, 10, 0.005)
     bcfg['scrollSensitivity'] = readFloat(dataSec, 'scrollSensitivity', 0, 10, 0.005)
     zooms = dataSec.readString('zooms', '2 4 8 16 25')
     bcfg['zooms'] = [ float(x) for x in zooms.split() ]
     ds = Settings.g_instance.userPrefs[Settings.KEY_CONTROL_MODE]
     if ds is not None:
         ds = ds['sniperMode/camera']
     self._userCfg = dict()
     ucfg = self._userCfg
     ucfg['horzInvert'] = False
     ucfg['vertInvert'] = False
     ucfg['increasedZoom'] = False
     ucfg['sniperModeByShift'] = False
     maxZoom = bcfg['zooms'][-1] if ucfg['increasedZoom'] else bcfg['zooms'][:3][-1]
     ucfg['zoom'] = readFloat(ds, 'zoom', 0.0, maxZoom, bcfg['zooms'][0])
     ucfg['keySensitivity'] = readFloat(ds, 'keySensitivity', 0.0, 10.0, 1.0)
     ucfg['sensitivity'] = readFloat(ds, 'sensitivity', 0.0, 10.0, 1.0)
     ucfg['scrollSensitivity'] = readFloat(ds, 'scrollSensitivity', 0.0, 10.0, 1.0)
     self._cfg = dict()
     cfg = self._cfg
     cfg['keySensitivity'] = bcfg['keySensitivity']
     cfg['sensitivity'] = bcfg['sensitivity']
     cfg['scrollSensitivity'] = bcfg['scrollSensitivity']
     cfg['zooms'] = bcfg['zooms']
     cfg['keySensitivity'] *= ucfg['keySensitivity']
     cfg['sensitivity'] *= ucfg['sensitivity']
     cfg['scrollSensitivity'] *= ucfg['scrollSensitivity']
     cfg['horzInvert'] = ucfg['horzInvert']
     cfg['vertInvert'] = ucfg['vertInvert']
     cfg['zoom'] = ucfg['zoom']
     cfg['increasedZoom'] = ucfg['increasedZoom']
     cfg['sniperModeByShift'] = ucfg['sniperModeByShift']
     dynamicsSection = dataSec['dynamics']
     self.__impulseOscillator = createOscillatorFromSection(dynamicsSection['impulseOscillator'])
     self.__movementOscillator = createOscillatorFromSection(dynamicsSection['movementOscillator'])
     self.__noiseOscillator = createOscillatorFromSection(dynamicsSection['randomNoiseOscillatorSpherical'])
     self.__dynamicCfg.readImpulsesConfig(dynamicsSection)
     self.__dynamicCfg['accelerationSensitivity'] = readVec3(dynamicsSection, 'accelerationSensitivity', (-1000, -1000, -1000), (1000, 1000, 1000), (0.5, 0.5, 0.5))
     accelerationThreshold = readFloat(dynamicsSection, 'accelerationThreshold', 0.0, 1000.0, 0.1)
     self.__dynamicCfg['accelerationThreshold'] = accelerationThreshold
     self.__dynamicCfg['accelerationMax'] = readFloat(dynamicsSection, 'accelerationMax', 0.0, 1000.0, 0.1)
     self.__dynamicCfg['maxShotImpulseDistance'] = readFloat(dynamicsSection, 'maxShotImpulseDistance', 0.0, 1000.0, 10.0)
     self.__dynamicCfg['maxExplosionImpulseDistance'] = readFloat(dynamicsSection, 'maxExplosionImpulseDistance', 0.0, 1000.0, 10.0)
     self.__dynamicCfg['impulsePartToRoll'] = readFloat(dynamicsSection, 'impulsePartToRoll', 0.0, 1000.0, 0.3)
     self.__dynamicCfg['pivotShift'] = Vector3(0, readFloat(dynamicsSection, 'pivotShift', -1000, 1000, -0.5), 0)
     self.__dynamicCfg['aimMarkerDistance'] = readFloat(dynamicsSection, 'aimMarkerDistance', -1000, 1000, 1.0)
     rawZoomExposure = dynamicsSection.readString('zoomExposure', '0.6 0.5 0.4 0.3 0.2')
     self.__dynamicCfg['zoomExposure'] = [ float(x) for x in rawZoomExposure.split() ]
     accelerationFilter = math_utils.RangeFilter(self.__dynamicCfg['accelerationThreshold'], self.__dynamicCfg['accelerationMax'], 100, math_utils.SMAFilter(SniperCamera._FILTER_LENGTH))
     maxAccelerationDuration = readFloat(dynamicsSection, 'maxAccelerationDuration', 0.0, 10000.0, SniperCamera._DEFAULT_MAX_ACCELERATION_DURATION)
     self.__accelerationSmoother = AccelerationSmoother(accelerationFilter, maxAccelerationDuration)
     return
Exemple #10
0
 def __readCfg(self, dataSec):
     if not dataSec:
         LOG_WARNING(
             'Invalid section <sniperMode/camera> in avatar_input_handler.xml'
         )
     self.__baseCfg = dict()
     bcfg = self.__baseCfg
     bcfg['keySensitivity'] = readFloat(dataSec, 'keySensitivity', 0, 10,
                                        0.005)
     bcfg['sensitivity'] = readFloat(dataSec, 'sensitivity', 0, 10, 0.005)
     bcfg['scrollSensitivity'] = readFloat(dataSec, 'scrollSensitivity', 0,
                                           10, 0.005)
     zooms = readVec3(dataSec, 'zooms', (0, 0, 0), (10, 10, 10), (2, 4, 8))
     bcfg['zooms'] = [zooms.x, zooms.y, zooms.z]
     ds = Settings.g_instance.userPrefs[Settings.KEY_CONTROL_MODE]
     if ds is not None:
         ds = ds['sniperMode/camera']
     self.__userCfg = dict()
     ucfg = self.__userCfg
     from account_helpers.settings_core.SettingsCore import g_settingsCore
     ucfg['horzInvert'] = g_settingsCore.getSetting('mouseHorzInvert')
     ucfg['vertInvert'] = g_settingsCore.getSetting('mouseVertInvert')
     ucfg['keySensitivity'] = readFloat(ds, 'keySensitivity', 0.0, 10.0,
                                        1.0)
     ucfg['sensitivity'] = readFloat(ds, 'sensitivity', 0.0, 10.0, 1.0)
     ucfg['scrollSensitivity'] = readFloat(ds, 'scrollSensitivity', 0.0,
                                           10.0, 1.0)
     ucfg['zoom'] = readFloat(ds, 'zoom', 0.0, 10.0, bcfg['zooms'][0])
     self.__cfg = dict()
     cfg = self.__cfg
     cfg['keySensitivity'] = bcfg['keySensitivity']
     cfg['sensitivity'] = bcfg['sensitivity']
     cfg['scrollSensitivity'] = bcfg['scrollSensitivity']
     cfg['zooms'] = bcfg['zooms']
     cfg['keySensitivity'] *= ucfg['keySensitivity']
     cfg['sensitivity'] *= ucfg['sensitivity']
     cfg['scrollSensitivity'] *= ucfg['scrollSensitivity']
     cfg['horzInvert'] = ucfg['horzInvert']
     cfg['vertInvert'] = ucfg['vertInvert']
     cfg['zoom'] = ucfg['zoom']
     dynamicsSection = dataSec['dynamics']
     self.__impulseOscillator = createOscillatorFromSection(
         dynamicsSection['impulseOscillator'])
     self.__movementOscillator = createOscillatorFromSection(
         dynamicsSection['movementOscillator'])
     self.__noiseOscillator = createOscillatorFromSection(
         dynamicsSection['randomNoiseOscillatorSpherical'])
     self.__dynamicCfg.readImpulsesConfig(dynamicsSection)
     self.__dynamicCfg['accelerationSensitivity'] = readVec3(
         dynamicsSection, 'accelerationSensitivity', (-1000, -1000, -1000),
         (1000, 1000, 1000), (0.5, 0.5, 0.5))
     accelerationThreshold = readFloat(dynamicsSection,
                                       'accelerationThreshold', 0.0, 1000.0,
                                       0.1)
     self.__dynamicCfg['accelerationThreshold'] = accelerationThreshold
     self.__dynamicCfg['accelerationMax'] = readFloat(
         dynamicsSection, 'accelerationMax', 0.0, 1000.0, 0.1)
     self.__dynamicCfg['maxShotImpulseDistance'] = readFloat(
         dynamicsSection, 'maxShotImpulseDistance', 0.0, 1000.0, 10.0)
     self.__dynamicCfg['maxExplosionImpulseDistance'] = readFloat(
         dynamicsSection, 'maxExplosionImpulseDistance', 0.0, 1000.0, 10.0)
     self.__dynamicCfg['impulsePartToRoll'] = readFloat(
         dynamicsSection, 'impulsePartToRoll', 0.0, 1000.0, 0.3)
     self.__dynamicCfg['pivotShift'] = Vector3(
         0, readFloat(dynamicsSection, 'pivotShift', -1000, 1000, -0.5), 0)
     self.__dynamicCfg['aimMarkerDistance'] = readFloat(
         dynamicsSection, 'aimMarkerDistance', -1000, 1000, 1.0)
     self.__dynamicCfg['zoomExposure'] = readVec3(dynamicsSection,
                                                  'zoomExposure',
                                                  (0.1, 0.1, 0.1),
                                                  (10, 10, 10),
                                                  (0.5, 0.5, 0.5))
     accelerationFilter = mathUtils.RangeFilter(
         self.__dynamicCfg['accelerationThreshold'],
         self.__dynamicCfg['accelerationMax'], 100,
         mathUtils.SMAFilter(SniperCamera._FILTER_LENGTH))
     maxAccelerationDuration = readFloat(
         dynamicsSection, 'maxAccelerationDuration', 0.0, 10000.0,
         SniperCamera._DEFAULT_MAX_ACCELERATION_DURATION)
     self.__accelerationSmoother = AccelerationSmoother(
         accelerationFilter, maxAccelerationDuration)
 def __readCfg(self, dataSec):
     if not dataSec:
         LOG_WARNING(
             'Invalid section <artyMode/camera> in avatar_input_handler.xml'
         )
     self._baseCfg = dict()
     bcfg = self._baseCfg
     bcfg['keySensitivity'] = readFloat(dataSec, 'keySensitivity', 0.005,
                                        10.0, 0.025)
     bcfg['sensitivity'] = readFloat(dataSec, 'sensitivity', 0.005, 10.0,
                                     0.025)
     bcfg['scrollSensitivity'] = readFloat(dataSec, 'scrollSensitivity',
                                           0.005, 10.0, 0.025)
     bcfg['angularSpeed'] = readFloat(dataSec, 'angularSpeed', pi / 720.0,
                                      pi / 0.5, pi / 360.0)
     bcfg['distRange'] = readVec2(dataSec, 'distRange', (1.0, 1.0),
                                  (10000.0, 10000.0), (2.0, 30.0))
     bcfg['minimalPitch'] = readFloat(dataSec, 'minimalPitch', pi / 36.0,
                                      pi / 3.0, pi / 18.0)
     bcfg['maximalPitch'] = readFloat(dataSec, 'maximalPitch', pi / 6.0,
                                      pi / 3.0, pi / 3.5)
     bcfg['interpolationSpeed'] = readFloat(dataSec, 'interpolationSpeed',
                                            0.0, 10.0, 5.0)
     bcfg['highPitchThreshold'] = readFloat(dataSec, 'highPitchThreshold',
                                            0.1, 10.0, 3.0)
     bcfg['hTimeThreshold'] = readFloat(dataSec, 'hysteresis/timeThreshold',
                                        0.0, 10.0, 0.5)
     bcfg['hPositionThreshold'] = readFloat(dataSec,
                                            'hysteresis/positionThreshold',
                                            0.0, 100.0, 7.0)
     ds = Settings.g_instance.userPrefs[Settings.KEY_CONTROL_MODE]
     if ds is not None:
         ds = ds['artyMode/camera']
     self._userCfg = dict()
     ucfg = self._userCfg
     ucfg['horzInvert'] = False
     ucfg['vertInvert'] = False
     ucfg['keySensitivity'] = readFloat(ds, 'keySensitivity', 0.0, 10.0,
                                        1.0)
     ucfg['sensitivity'] = readFloat(ds, 'sensitivity', 0.0, 10.0, 1.0)
     ucfg['scrollSensitivity'] = readFloat(ds, 'scrollSensitivity', 0.0,
                                           10.0, 1.0)
     ucfg['camDist'] = readFloat(ds, 'camDist', 0.0, 60.0, 0.0)
     self._cfg = dict()
     cfg = self._cfg
     cfg['keySensitivity'] = bcfg['keySensitivity']
     cfg['sensitivity'] = bcfg['sensitivity']
     cfg['scrollSensitivity'] = bcfg['scrollSensitivity']
     cfg['distRange'] = bcfg['distRange']
     cfg['angularSpeed'] = bcfg['angularSpeed']
     cfg['minimalPitch'] = bcfg['minimalPitch']
     cfg['maximalPitch'] = bcfg['maximalPitch']
     cfg['interpolationSpeed'] = bcfg['interpolationSpeed']
     cfg['highPitchThresholdSq'] = bcfg['highPitchThreshold'] * bcfg[
         'highPitchThreshold']
     cfg['hTimeThreshold'] = bcfg['hTimeThreshold']
     cfg['hPositionThresholdSq'] = bcfg['hPositionThreshold'] * bcfg[
         'hPositionThreshold']
     cfg['keySensitivity'] *= ucfg['keySensitivity']
     cfg['sensitivity'] *= ucfg['sensitivity']
     cfg['scrollSensitivity'] *= ucfg['scrollSensitivity']
     cfg['camDist'] = ucfg['camDist']
     cfg['horzInvert'] = ucfg['horzInvert']
     cfg['vertInvert'] = ucfg['vertInvert']
     dynamicSection = dataSec['dynamics']
     self.__dynamicCfg.readImpulsesConfig(dynamicSection)
     self.__positionOscillator = createOscillatorFromSection(
         dynamicSection['oscillator'], False)
     self.__positionNoiseOscillator = createOscillatorFromSection(
         dynamicSection['randomNoiseOscillatorFlat'])
     return
Exemple #12
0
def __getNoiseOscillatorParams(oscillatorSection):
    return [readFloat(oscillatorSection, 'mass', 1e-05, 9000, 3.5), readVec3(oscillatorSection, 'stiffness', (1e-05, 1e-05, 1e-05), (9000, 9000, 9000), 60.0), readVec3(oscillatorSection, 'drag', (1e-05, 1e-05, 1e-05), (9000, 9000, 9000), 9.0)]
def __getRandomNoiseOscillatorFlatParams(oscillatorSection):
    return [readFloat(oscillatorSection, 'mass', 1e-05, 9000, 3.5), readFloat(oscillatorSection, 'stiffness', 1e-05, 9000, 3.5), readFloat(oscillatorSection, 'drag', 1e-05, 9000, 3.5)]
def __getNoiseOscillatorParams(oscillatorSection):
    return [readFloat(oscillatorSection, 'mass', 1e-05, 9000, 3.5), readVec3(oscillatorSection, 'stiffness', (1e-05, 1e-05, 1e-05), (9000, 9000, 9000), 60.0), readVec3(oscillatorSection, 'drag', (1e-05, 1e-05, 1e-05), (9000, 9000, 9000), 9.0)]
Exemple #15
0
def __getOscillator1dParams(oscillatorSection):
    return {'mass': readFloat(oscillatorSection, 'mass', 1e-05, 9000, 3.5),
     'stiffness': readFloat(oscillatorSection, 'stiffness', 1e-05, 9000, 3.5),
     'drag': readFloat(oscillatorSection, 'drag', 1e-05, 9000, 3.5)}
Exemple #16
0
def __getOscillator3dParams(oscillatorSection):
    return {'mass': readFloat(oscillatorSection, 'mass', 1e-05, 9000, 3.5),
     'stiffness': readVec3(oscillatorSection, 'stiffness', (1e-05, 1e-05, 1e-05), (9000, 9000, 9000), 60.0),
     'drag': readVec3(oscillatorSection, 'drag', (1e-05, 1e-05, 1e-05), (9000, 9000, 9000), 9.0)}