Exemplo n.º 1
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)
    ]
Exemplo n.º 2
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)
    }
Exemplo n.º 3
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
Exemplo n.º 4
0
def createOscillatorFromSection(oscillatorSection, constraintsAsAngle=True):
    constraints = readVec3(oscillatorSection, 'constraints', (0.0, 0.0, 0.0),
                           (175.0, 175.0, 175.0), 10.0)
    if constraintsAsAngle:
        constraints = Vector3(
            (math.radians(constraints.x), math.radians(constraints.y),
             math.radians(constraints.z)))
    constructorParams = {
        'oscillator': __getOscillator3dParams,
        'noiseOscillator': __getOscillator3dParams,
        'randomNoiseOscillatorFlat': __getOscillator1dParams,
        'randomNoiseOscillatorSpherical':
        __getRandomNoiseOscillatorSphericalParams
    }.get(oscillatorSection.name, __getOscillator3dParams)(oscillatorSection)
    constructor = Oscillator
    if oscillatorSection.name == 'noiseOscillator':
        constructor = NoiseOscillator
    elif oscillatorSection.name == 'randomNoiseOscillatorFlat':
        constructor = RandomNoiseOscillatorFlat
    elif oscillatorSection.name == 'randomNoiseOscillatorSpherical':
        constructor = RandomNoiseOscillatorSpherical
    else:
        constructorParams['constraints'] = constraints
    oscillator = constructor(**constructorParams)
    return oscillator
Exemplo n.º 5
0
def createOscillatorFromSection(oscillatorSection, constraintsAsAngle=True):
    constraints = readVec3(oscillatorSection, 'constraints', (0.0, 0.0, 0.0),
                           (175.0, 175.0, 175.0), 10.0)
    if constraintsAsAngle:
        constraints = Vector3(
            (math.radians(constraints.x), math.radians(constraints.y),
             math.radians(constraints.z)))
    constructorParams = {
        'oscillator': __getOscillatorParams,
        'noiseOscillator': __getNoiseOscillatorParams,
        'randomNoiseOscillatorFlat': __getRandomNoiseOscillatorFlatParams,
        'randomNoiseOscillatorSpherical':
        __getRandomNoiseOscillatorSphericalParams
    }.get(oscillatorSection.name, __getOscillatorParams)(oscillatorSection)
    oscillator = None
    if oscillatorSection.name == 'noiseOscillator':
        oscillator = Math.PyNoiseOscillator(*constructorParams)
    elif oscillatorSection.name == 'randomNoiseOscillatorFlat':
        oscillator = Math.PyRandomNoiseOscillatorFlat(*constructorParams)
    elif oscillatorSection.name == 'randomNoiseOscillatorSpherical':
        oscillator = Math.PyRandomNoiseOscillatorSpherical(*constructorParams)
    else:
        constructorParams.append(constraints)
        oscillator = Math.PyOscillator(*constructorParams)
    return oscillator
Exemplo n.º 6
0
 def reloadConfig(self, filterSec):
     if filterSec is not None:
         T_Vector = readVec3(filterSec, 'T', (0.0, 0.01, 0.01), (10.0, 10.0, 10.0), (0.0, 2.0, 1.0))
         self.__T1 = T_Vector[0]
         self.__T2 = T_Vector[1]
         self.__T3 = T_Vector[2]
     return
Exemplo n.º 7
0
 def reloadConfig(self, filterSec):
     if filterSec is not None:
         T_Vector = readVec3(filterSec, 'T', (0.0, 0.01, 0.01), (10.0, 10.0, 10.0), (0.0, 2.0, 1.0))
         self.__T1 = T_Vector[0]
         self.__T2 = T_Vector[1]
         self.__T3 = T_Vector[2]
     return
 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
 def _readConfigs(self, dataSec):
     if not dataSec:
         LOG_WARNING(
             'Invalid section <sniperMode/camera> in avatar_input_handler.xml'
         )
     super(SniperCamera, self)._readConfigs(dataSec)
     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)
Exemplo n.º 10
0
def createOscillatorFromSection(oscillatorSection, constraintsAsAngle = True):
    constraints = readVec3(oscillatorSection, 'constraints', (0.0, 0.0, 0.0), (175.0, 175.0, 175.0), 10.0)
    if constraintsAsAngle:
        constraints = Vector3((math.radians(constraints.x), math.radians(constraints.y), math.radians(constraints.z)))
    constructorParams = {'oscillator': __getOscillatorParams,
     'noiseOscillator': __getNoiseOscillatorParams,
     'randomNoiseOscillatorFlat': __getRandomNoiseOscillatorFlatParams,
     'randomNoiseOscillatorSpherical': __getRandomNoiseOscillatorSphericalParams}.get(oscillatorSection.name, __getOscillatorParams)(oscillatorSection)
    oscillator = None
    if oscillatorSection.name == 'noiseOscillator':
        oscillator = Math.PyNoiseOscillator(*constructorParams)
    elif oscillatorSection.name == 'randomNoiseOscillatorFlat':
        oscillator = Math.PyRandomNoiseOscillatorFlat(*constructorParams)
    elif oscillatorSection.name == 'randomNoiseOscillatorSpherical':
        oscillator = Math.PyRandomNoiseOscillatorSpherical(*constructorParams)
    else:
        constructorParams.append(constraints)
        oscillator = Math.PyOscillator(*constructorParams)
    return oscillator
Exemplo n.º 11
0
def createOscillatorFromSection(oscillatorSection, constraintsAsAngle = True):
    constraints = readVec3(oscillatorSection, 'constraints', (0.0, 0.0, 0.0), (175.0, 175.0, 175.0), 10.0)
    if constraintsAsAngle:
        constraints = Vector3((math.radians(constraints.x), math.radians(constraints.y), math.radians(constraints.z)))
    constructorParams = {'oscillator': __getOscillator3dParams,
     'noiseOscillator': __getOscillator3dParams,
     'randomNoiseOscillatorFlat': __getOscillator1dParams,
     'randomNoiseOscillatorSpherical': __getRandomNoiseOscillatorSphericalParams}.get(oscillatorSection.name, __getOscillator3dParams)(oscillatorSection)
    constructor = Oscillator
    if oscillatorSection.name == 'noiseOscillator':
        constructor = NoiseOscillator
    elif oscillatorSection.name == 'randomNoiseOscillatorFlat':
        constructor = RandomNoiseOscillatorFlat
    elif oscillatorSection.name == 'randomNoiseOscillatorSpherical':
        constructor = RandomNoiseOscillatorSpherical
    else:
        constructorParams['constraints'] = constraints
    oscillator = constructor(**constructorParams)
    return oscillator
Exemplo n.º 12
0
def __getRandomNoiseOscillatorSphericalParams(oscillatorSection):
    oscillatorParams = __getOscillator1dParams(oscillatorSection)
    oscillatorParams['scaleCoeff'] = readVec3(oscillatorSection, 'scaleCoeff', Vector3(0.0), Vector3(9000), Vector3(1.0))
    return oscillatorParams
Exemplo n.º 13
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)}
Exemplo n.º 14
0
def __getRandomNoiseOscillatorSphericalParams(oscillatorSection):
    oscillatorParams = __getRandomNoiseOscillatorFlatParams(oscillatorSection)
    oscillatorParams.append(readVec3(oscillatorSection, 'scaleCoeff', Vector3(0.0), Vector3(9000), Vector3(1.0)))
    return oscillatorParams
Exemplo n.º 15
0
def __getRandomNoiseOscillatorSphericalParams(oscillatorSection):
    oscillatorParams = __getRandomNoiseOscillatorFlatParams(oscillatorSection)
    oscillatorParams.append(
        readVec3(oscillatorSection, 'scaleCoeff', Vector3(0.0), Vector3(9000),
                 Vector3(1.0)))
    return oscillatorParams
Exemplo n.º 16
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)
Exemplo n.º 17
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)]
Exemplo n.º 18
0
def __getRandomNoiseOscillatorSphericalParams(oscillatorSection):
    oscillatorParams = __getOscillator1dParams(oscillatorSection)
    oscillatorParams['scaleCoeff'] = readVec3(oscillatorSection, 'scaleCoeff',
                                              Vector3(0.0), Vector3(9000),
                                              Vector3(1.0))
    return oscillatorParams