示例#1
0
 def __setupTrackAssembler(self, entity):
     modelNames = getPartModelsFromDesc(self.__vehicleDesc, 'destroyed')
     compoundAssembler = BigWorld.CompoundAssembler()
     compoundAssembler.addRootPart(modelNames.chassis, TankPartNames.CHASSIS, [('Tank', ''), ('V', 'Tank')], entity.matrix)
     compoundAssembler.assemblerName = TankPartNames.CHASSIS
     compoundAssembler.spaceID = entity.spaceID
     return compoundAssembler
def _loadLootForeground(loot, spaceID, desc):
    loaders = {}
    if hasattr(desc, 'model'):
        modelName = desc.model.name
        offset = getattr(desc.model, 'overTerrainHeight', 0.0)
        if modelName is not None:
            modelAssembler = BigWorld.CompoundAssembler('model', spaceID)
            modelAssembler.addRootPart(modelName, 'root')
            borderName = getattr(desc.model, 'border', None)
            if borderName is not None:
                borderMatrix = Math.Matrix()
                modelAssembler.addPart(borderName, 'root', 'border',
                                       borderMatrix)
            loaders['model'] = Loader(modelAssembler, offset=offset)
    loadComponentSystem(loot.markingSmoke,
                        loot.appendPiece,
                        _getSequenceResourceMapping(desc, 'effect', spaceID),
                        forceForegroundLoad=True)
    loadComponentSystem(loot.pickupEffect,
                        loot.appendPiece,
                        _getSequenceResourceMapping(desc, 'pickupEffect',
                                                    spaceID),
                        forceForegroundLoad=True)
    loadComponentSystem(loot,
                        loot.appendPiece,
                        loaders,
                        forceForegroundLoad=True)
    _logger.info('[Loot] Loading of loot type %d done', loot.lootTypeID)
    return
示例#3
0
 def __dropCrate(self):
     airDropConfig = self.__dynamicObjectsCache.getConfig(
         self.__sessionProvider.arenaVisitor.getArenaGuiType()).getAirDrop(
         )
     spaceId = BigWorld.player().spaceID
     compoundName = 'crateModel'
     modelAssembler = BigWorld.CompoundAssembler(compoundName, spaceId)
     modelAssembler.addRootPart(airDropConfig.model, 'root')
     animationPath = airDropConfig.dropAnimation
     animationBuilder = AnimationSequence.Loader(animationPath, spaceId)
     dropPoint = self.deliveryPosition + Math.Vector3(
         0, self.DROP_ALTITUDE, 0)
     crateYaw = 0
     if self.plane is not None:
         crateYaw = self.plane.flightYaw
     self.inactiveCargo = parachuteCargo = ParachuteCargo(
         crateYaw, dropPoint, self.deliveryPosition, self.DESCEND_TIME)
     loadComponentSystem(
         parachuteCargo, self.__onCargoLoad, {
             'model': Loader(modelAssembler),
             'landingAnimation': Loader(animationBuilder)
         })
     self.delayCallback(
         self.deliveryTime - BigWorld.time() +
         self.POST_DELIVERY_CARGO_LIFETIME, self.__killCargo)
     return
def prepareCompoundAssembler(vehicleDesc,
                             modelsSetParams,
                             spaceID,
                             isTurretDetached=False):
    if constants.IS_DEVELOPMENT and modelsSetParams.state not in VehicleDamageState.MODEL_STATE_NAMES:
        raise SoftException(
            'Invalid modelStateName %s, must be in %s' %
            (modelsSetParams.state, VehicleDamageState.MODEL_STATE_NAMES))
    if spaceID is None:
        spaceID = BigWorld.player().spaceID
    partModels = getPartModelsFromDesc(vehicleDesc, modelsSetParams)
    chassis, hull, turret, gun = partModels
    assembler = BigWorld.CompoundAssembler()
    assembler.addRootPart(chassis, TankPartNames.CHASSIS)
    assembler.emplacePart(hull, 'V', TankPartNames.HULL)
    turretJointName = vehicleDesc.hull.turretHardPoints[0]
    assembler.addNodeAlias(turretJointName, TankNodeNames.TURRET_JOINT)
    if not isTurretDetached:
        assembler.addPart(turret, turretJointName, TankPartNames.TURRET)
        assembler.addPart(gun, TankNodeNames.GUN_JOINT, TankPartNames.GUN)
    cornerPoint = vehicleDesc.chassis.topRightCarryingPoint
    assembler.addNode(
        TankNodeNames.TRACK_LEFT_MID, TankPartNames.CHASSIS,
        mathUtils.createTranslationMatrix((-cornerPoint[0], 0, 0)))
    assembler.addNode(
        TankNodeNames.TRACK_RIGHT_MID, TankPartNames.CHASSIS,
        mathUtils.createTranslationMatrix((cornerPoint[0], 0, 0)))
    assembler.addNode(TankNodeNames.CHASSIS_MID_TRAIL, TankPartNames.CHASSIS)
    assembler.name = vehicleDesc.name
    assembler.spaceID = spaceID
    return assembler
示例#5
0
 def __init__(self, deliveryPoint, dropAltitude, dropTime):
     CallbackDelayer.__init__(self)
     angle = random.random() * 2 * math.pi
     self.__flightYaw = angle
     rotationMatrix = math_utils.createRotationMatrix((angle, 0, 0))
     dropPoint = deliveryPoint + Math.Vector3(0, dropAltitude, 0)
     beginPosition = dropPoint - rotationMatrix.applyVector(
         self.ARRIVAL_TRAJECTORY_INCLINATION)
     flatFlyVelocity = rotationMatrix.applyToAxis(2) * self.FLIGHT_SPEED
     beginPointDesc = CurveControlPoint(
         beginPosition, flatFlyVelocity,
         dropTime - self.FLY_TIME_BEFORE_DROP)
     dropPointDesc = CurveControlPoint(dropPoint, flatFlyVelocity, dropTime)
     dropPlaneConfig = self.__dynamicObjectsCache.getConfig(
         self.__sessionProvider.arenaVisitor.getArenaGuiType(
         )).getDropPlane()
     spaceId = BigWorld.player().spaceID
     compoundName = 'dropPlaneModel'
     modelAssembler = BigWorld.CompoundAssembler(compoundName, spaceId)
     modelAssembler.addRootPart(dropPlaneConfig.model, 'root')
     animationBuilder = AnimationSequence.Loader(
         dropPlaneConfig.flyAnimation, spaceId)
     planeDesc = BomberDesc(modelAssembler, dropPlaneConfig.sound,
                            beginPointDesc, dropPointDesc, animationBuilder)
     self.dropPlane = CompoundBomber(planeDesc)
     endPosition = dropPoint + rotationMatrix.applyVector(
         self.DEPARTURE_TRAJECTORY_INCLINATION)
     self.dropPlane.addControlPoint(endPosition, flatFlyVelocity,
                                    dropTime + self.FLY_TIME_AFTER_DROP)
     delayTime = dropTime - BigWorld.time() - self.FLY_TIME_BEFORE_DROP
     self.delayCallback(delayTime, self.__openCargo)
     self.delayCallback(delayTime + self.UNLOAD_ANIMATION_TIME,
                        self.__closeCargo)
     self.prevTime = BigWorld.time()
示例#6
0
    def __prepareModelAssembler(self):
        LOG_DEBUG('__prepareModelAssembler', self.__vehDescr.name,
                  self.spaceID)
        assembler = BigWorld.CompoundAssembler(self.__vehDescr.name,
                                               self.spaceID)
        turretModel, gunModel = self.__getModels()
        assembler.addRootPart(turretModel, TankPartNames.TURRET)
        assembler.emplacePart(gunModel, TankNodeNames.GUN_JOINT,
                              TankPartNames.GUN)
        parts = {
            TankPartNames.TURRET: self.__vehDescr.turret,
            TankPartNames.GUN: self.__vehDescr.gun
        }
        bspModels = ()
        for partName, part in parts.iteritems():
            partID = TankPartNames.getIdx(partName)
            crashedHT = part.hitTesterManager.crashedModelHitTester
            modelHT = part.hitTesterManager.modelHitTester
            hitTester = crashedHT if crashedHT is not None else modelHT
            bspModel = (partID, hitTester.bspModelName)
            bspModels = bspModels + (bspModel, )

        collisionAssembler = BigWorld.CollisionAssembler(
            bspModels, self.spaceID)
        return [assembler, collisionAssembler]
 def __orderLootCache(self, lootType, lootDescr):
     if lootDescr is not None:
         spaceID = self.spaceID
         if hasattr(lootDescr, 'model'):
             modelName = lootDescr.model.name
             offset = getattr(lootDescr.model, 'overTerrainHeight', 0.0)
             loaders = {}
             if modelName is not None:
                 modelAssembler = BigWorld.CompoundAssembler(
                     'model', spaceID)
                 modelAssembler.addRootPart(modelName, 'root')
                 borderName = getattr(lootDescr.model, 'border', None)
                 if borderName is not None:
                     borderMatrix = Math.Matrix()
                     modelAssembler.addPart(borderName, 'root', 'border',
                                            borderMatrix)
                 loaders = {'model': Loader(modelAssembler, offset=offset)}
             mapping = _getSequenceResourceMapping(lootDescr, 'effect',
                                                   spaceID, True)
             effectsPaths = []
             if mapping:
                 loaders['effect'] = mapping['sequence']
                 effectsPaths.append(mapping['path'])
             mapping = _getSequenceResourceMapping(lootDescr,
                                                   'pickupEffect', spaceID,
                                                   True)
             if mapping:
                 loaders['pickupEffect'] = mapping['sequence']
                 effectsPaths.append(mapping['path'])
             loadResourceMapping(loaders, self.__cacheResourceList,
                                 lootType, effectsPaths)
     return
示例#8
0
 def __prepareModelAssembler(self):
     assembler = BigWorld.CompoundAssembler(self.__vehDescr.name, self.spaceID)
     skeleton = tankStructure.CRASHED_SKELETON
     turretModel = self.__vehDescr.turret['models']['exploded']
     gunModel = self.__vehDescr.gun['models']['exploded']
     assembler.addRootPart(turretModel, TankPartNames.TURRET, skeleton.turret, mathUtils.createIdentityMatrix())
     assembler.addPart(gunModel, TankNodeNames.GUN_JOINT, TankPartNames.GUN, skeleton.gun, mathUtils.createIdentityMatrix())
     return assembler
示例#9
0
 def __prepareModelAssembler(self):
     assembler = BigWorld.CompoundAssembler(self.__vehDescr.name,
                                            self.spaceID)
     turretModel = self.__vehDescr.turret.models.exploded
     gunModel = self.__vehDescr.gun.models.exploded
     assembler.addRootPart(turretModel, TankPartNames.TURRET)
     assembler.emplacePart(gunModel, TankNodeNames.GUN_JOINT,
                           TankPartNames.GUN)
     return assembler
示例#10
0
 def prerequisites(self):
     prereqs = super(ClientSelectableEasterEgg, self).prerequisites()
     if not prereqs:
         return []
     if self.outlineModelName:
         assembler = BigWorld.CompoundAssembler('outline_model',
                                                self.spaceID)
         assembler.addRootPart(self.outlineModelName, 'root')
         prereqs.append(assembler)
     return prereqs
示例#11
0
 def __setupTrackAssembler(self, entity):
     modelNames = getPartModelsFromDesc(self.__vehicleDesc,
                                        ModelsSetParams(None, 'destroyed'))
     compoundAssembler = BigWorld.CompoundAssembler()
     compoundAssembler.addRootPart(modelNames.chassis,
                                   TankPartNames.CHASSIS,
                                   entity.filter.groundPlacingMatrix)
     compoundAssembler.assemblerName = TankPartNames.CHASSIS
     compoundAssembler.spaceID = entity.spaceID
     return compoundAssembler
 def prerequisites(self):
     stepRepairPointComponent = BigWorld.player().arena.componentSystem.stepRepairPointComponent
     if stepRepairPointComponent is not None:
         stepRepairPointComponent.addStepRepairPoint(self)
     assembler = BigWorld.CompoundAssembler(_g_stepRepairPointSettings.flagModel, self.spaceID)
     assembler.addRootPart(_g_stepRepairPointSettings.flagModel, 'root')
     rv = [assembler, _g_stepRepairPointSettings.radiusModel]
     if _g_stepRepairPointSettings.flagAnim is not None:
         loader = AnimationSequence.Loader(_g_stepRepairPointSettings.flagAnim, self.spaceID)
         rv.append(loader)
     mProv = Matrix()
     mProv.translation = self.position
     self.__stepRepairPointSoundObject = SoundGroups.g_instance.WWgetSoundObject('stepRepairPoint_' + str(self), mProv)
     self.__stepRepairPointSoundObject.play(_g_stepRepairPointSettings.attachedSoundEventName)
     return rv
 def __prepareModelAssembler(self):
     assembler = BigWorld.CompoundAssembler(self.__vehDescr.name,
                                            self.spaceID)
     turretModel = self.__vehDescr.turret.models.exploded
     gunModel = self.__vehDescr.gun.models.exploded
     assembler.addRootPart(turretModel, TankPartNames.TURRET)
     assembler.emplacePart(gunModel, TankNodeNames.GUN_JOINT,
                           TankPartNames.GUN)
     bspModels = ((TankPartNames.getIdx(TankPartNames.TURRET),
                   self.__vehDescr.turret.hitTester.bspModelName),
                  (TankPartNames.getIdx(TankPartNames.GUN),
                   self.__vehDescr.gun.hitTester.bspModelName))
     collisionAssembler = BigWorld.CollisionAssembler(
         bspModels,
         BigWorld.player().spaceID)
     return [assembler, collisionAssembler]
def getWholeVehModels(vDesc):
    nationID, vehicleTypeID = vehicles.g_list.getIDsByName(vDesc.name)
    vType = vehicles.g_cache.vehicle(nationID, vehicleTypeID)
    prereqs = set(vDesc.prerequisites())
    models = set()
    bspModels = set()
    index = 0
    for chassie in vType.chassis:
        models.add(chassie.models.undamaged)
        splinePairs = chassie.splineDesc.trackPairs if chassie.splineDesc else {}
        for splinePairDesc in splinePairs.itervalues():
            if splinePairDesc is not None:
                models.add(splinePairDesc.segmentModelLeft())
                models.add(splinePairDesc.segmentModelRight())
                models.add(splinePairDesc.segment2ModelLeft())
                models.add(splinePairDesc.segment2ModelRight())

        bspModels.add((index, chassie.hitTester.bspModelName))
        index += 1

    for hull in vType.hulls:
        prereqs.add(hull.models.undamaged)
        bspModels.add((index, hull.hitTester.bspModelName))
        index += 1

    for turrets in vType.turrets:
        for turret in turrets:
            models.add(turret.models.undamaged)
            bspModels.add((index, turret.hitTester.bspModelName))
            index += 1
            for gun in turret.guns:
                models.add(gun.models.undamaged)
                bspModels.add((index, gun.hitTester.bspModelName))
                index += 1

    result = list(prereqs)
    for model in models:
        if not model:
            continue
        compoundAssembler = BigWorld.CompoundAssembler()
        compoundAssembler.addRootPart(model, 'root')
        compoundAssembler.name = model
        compoundAssembler.spaceID = BigWorld.player().spaceID
        result.append(compoundAssembler)

    result.append(BigWorld.CollisionAssembler(tuple(bspModels), BigWorld.player().spaceID))
    return result
    def prereqs(self, spaceId):
        visualModel = BigWorld.CompoundAssembler(
            self.__stateName + ASSEMBLER_NAME_SUFFIXES.VISUAL, spaceId)
        bspModels = []
        for componentIdx, (componentId, component) in enumerate(
                self.__stateProperties.components.iteritems()):
            if componentIdx == 0:
                visualModel.addRootPart(component.visualModel, 'root')
            else:
                visualModel.emplacePart(component.visualModel, 'root',
                                        componentId)
            bspModels.append((componentIdx, component.physicsModel))

        collisionAssembler = BigWorld.CollisionAssembler(
            tuple(bspModels), self.spaceID)
        collisionAssembler.name = self.__stateName + ASSEMBLER_NAME_SUFFIXES.PHYSICS
        return [visualModel, collisionAssembler]
def prepareCompoundAssembler(vehicleDesc, modelsSetParams, spaceID, isTurretDetached=False, lodIdx=_DEFAULT_LOD_INDEX, skipMaterials=False, renderState=None):
    if IS_DEVELOPMENT and modelsSetParams.state not in VehicleDamageState.MODEL_STATE_NAMES:
        raise SoftException('Invalid modelStateName %s, must be in %s' % (modelsSetParams.state, VehicleDamageState.MODEL_STATE_NAMES))
    if spaceID is None:
        spaceID = BigWorld.player().spaceID
    assembler = BigWorld.CompoundAssembler()
    attachModels(assembler, vehicleDesc, modelsSetParams, isTurretDetached, renderState)
    if renderState == RenderStates.OVERLAY_COLLISION:
        attachModels(assembler, vehicleDesc, modelsSetParams, isTurretDetached, RenderStates.SERVER_COLLISION, True)
    cornerPoint = vehicleDesc.chassis.topRightCarryingPoint
    assembler.addNode(TankNodeNames.TRACK_LEFT_MID, TankPartNames.CHASSIS, math_utils.createTranslationMatrix((-cornerPoint[0], 0, 0)))
    assembler.addNode(TankNodeNames.TRACK_RIGHT_MID, TankPartNames.CHASSIS, math_utils.createTranslationMatrix((cornerPoint[0], 0, 0)))
    assembler.addNode(TankNodeNames.CHASSIS_MID_TRAIL, TankPartNames.CHASSIS)
    assembler.name = vehicleDesc.name
    assembler.spaceID = spaceID
    assembler.lodIdx = lodIdx
    assembler.skipMaterials = skipMaterials
    return assembler
示例#17
0
 def prerequisites(self):
     self.capturePercentage = float(self.pointsPercentage) / 100
     self.__isCapturedOnStart = self.isCaptured
     sectorBaseComponent = BigWorld.player().arena.componentSystem.sectorBaseComponent
     if sectorBaseComponent is not None:
         sectorBaseComponent.addSectorBase(self)
     assembler = BigWorld.CompoundAssembler(_g_sectorBaseSettings.flagStaffModelName, self.spaceID)
     assembler.addRootPart(_g_sectorBaseSettings.flagStaffModelName, 'root')
     scaleMatrix = Matrix()
     scaleMatrix.setScale(_g_sectorBaseSettings.flagScale)
     assembler.addPart(_g_sectorBaseSettings.flagModelName, _g_sectorBaseSettings.flagStaffFlagHP, _g_sectorBaseSettings.flagNodeAliasName, scaleMatrix)
     rv = [assembler, _g_sectorBaseSettings.radiusModel]
     if _g_sectorBaseSettings.flagAnim is not None:
         loader = AnimationSequence.Loader(_g_sectorBaseSettings.flagAnim, self.spaceID)
         rv.append(loader)
     mProv = Matrix()
     mProv.translation = self.position
     self.__baseCaptureSoundObject = SoundGroups.g_instance.WWgetSoundObject('base_' + str(self.baseID), mProv)
     self.__baseCaptureSoundObject.play(_g_sectorBaseSettings.baseAttachedSoundEventName)
     return rv
def _loadLoot(typeID, radius, callback, desc):
    loot = LootObject(radius, typeID)
    loaders = {}
    loot.prepareCompositeLoader(callback)
    spaceID = BigWorld.player().spaceID
    if hasattr(desc, 'model'):
        modelName = desc.model.name
        offset = getattr(desc.model, 'overTerrainHeight', 0.0)
        if modelName is None:
            _logger.warning('Model for loot %s not set', typeID)
        else:
            modelAssembler = BigWorld.CompoundAssembler('model', spaceID)
            modelAssembler.addRootPart(modelName, 'root')
            borderName = getattr(desc.model, 'border', None)
            if borderName is not None:
                borderMatrix = Math.Matrix()
                modelAssembler.addPart(borderName, 'root', 'border', borderMatrix)
            loaders['model'] = Loader(modelAssembler, offset=offset)
    loadComponentSystem(loot.markingSmoke, loot.appendPiece, __getSequenceResourceMapping(desc, 'effect', spaceID))
    loadComponentSystem(loot.pickupEffect, loot.appendPiece, __getSequenceResourceMapping(desc, 'pickupEffect', spaceID))
    loadComponentSystem(loot, loot.appendPiece, loaders)
    return loot
示例#19
0
def _loadLoot(typeID, radius, callback, desc):
    loot = LootObject(radius, typeID)
    loaders = {}
    if hasattr(desc, 'model'):
        modelName = desc.model.name
        offset = getattr(desc.model, 'overTerrainHeight', 0.0)
        if modelName is None:
            _logger.warning('Model for loot %s not set', typeID)
        else:
            modelAssembler = BigWorld.CompoundAssembler(
                'model',
                BigWorld.player().spaceID)
            modelAssembler.addRootPart(modelName, 'root')
            borderName = getattr(desc.model, 'border', None)
            if borderName is not None:
                borderMatrix = Math.Matrix()
                modelAssembler.addPart(borderName, 'root', 'border',
                                       borderMatrix)
            loaders['model'] = Loader(modelAssembler, offset=offset)
    if hasattr(desc, 'effect'):
        if isRendererPipelineDeferred():
            effectPath = desc.effect.path
        else:
            effectPath = desc.effect.path_fwd
        loaders['markingSmoke'] = Loader(
            AnimationSequence.Loader(effectPath,
                                     BigWorld.player().spaceID))
    if hasattr(desc, 'pickupEffect'):
        if isRendererPipelineDeferred():
            effectPath = desc.pickupEffect.path
        else:
            effectPath = desc.pickupEffect.path_fwd
        loaders['pickupEffect'] = Loader(
            AnimationSequence.Loader(effectPath,
                                     BigWorld.player().spaceID))
    loadComponentSystem(loot, callback, loaders)
    return loot
示例#20
0
def prepareCompoundAssembler(vehicleDesc,
                             modelStateName,
                             spaceID,
                             isTurretDetached=False):
    if constants.IS_DEVELOPMENT and modelStateName not in VehicleDamageState.MODEL_STATE_NAMES:
        raise Exception('Invalid modelStateName %s, must be in %s' %
                        (modelStateName, VehicleDamageState.MODEL_STATE_NAMES))
    if spaceID is None:
        spaceID = BigWorld.player().spaceID
    partModels = getPartModelsFromDesc(vehicleDesc, modelStateName)
    chassis, hull, turret, gun = partModels
    assembler = BigWorld.CompoundAssembler()
    skeleton = getSkeleton(vehicleDesc, modelStateName)
    assembler.addRootPart(chassis, TankPartNames.CHASSIS, skeleton.chassis,
                          mathUtils.createIdentityMatrix())
    assembler.emplacePart(hull, 'V', TankPartNames.HULL, skeleton.hull)
    turretJointName = vehicleDesc.hull['turretHardPoints'][0]
    assembler.renameNode(turretJointName, TankNodeNames.TURRET_JOINT)
    if not isTurretDetached:
        assembler.addPart(turret, TankNodeNames.TURRET_JOINT,
                          TankPartNames.TURRET, skeleton.turret,
                          mathUtils.createIdentityMatrix())
        assembler.addPart(gun, TankNodeNames.GUN_JOINT, TankPartNames.GUN,
                          skeleton.gun, mathUtils.createIdentityMatrix())
    cornerPoint = vehicleDesc.chassis['topRightCarryingPoint']
    assembler.addDummyNode(
        TankPartNames.CHASSIS, TankNodeNames.TRACK_LEFT_MID,
        mathUtils.createTranslationMatrix((-cornerPoint[0], 0, 0)))
    assembler.addDummyNode(
        TankPartNames.CHASSIS, TankNodeNames.TRACK_RIGHT_MID,
        mathUtils.createTranslationMatrix((cornerPoint[0], 0, 0)))
    assembler.addDummyNode(TankPartNames.CHASSIS,
                           TankNodeNames.CHASSIS_MID_TRAIL)
    assembler.assemblerName = vehicleDesc.name
    assembler.spaceID = spaceID
    return assembler