def __assembleNonDamagedOnly(resourceRefs, appearance, isPlayer, lodLink,
                              lodStateLink):
     model_assembler.assembleTerrainMatKindSensor(appearance, lodStateLink)
     model_assembler.assembleRecoil(appearance, lodLink)
     model_assembler.assembleGunLinkedNodesAnimator(appearance)
     model_assembler.assembleCollisionObstaclesCollector(
         appearance, lodStateLink)
     model_assembler.assembleTessellationCollisionSensor(
         appearance, lodStateLink)
     model_assembler.assembleSuspensionIfNeed(appearance, lodStateLink)
     model_assembler.assembleLeveredSuspensionIfNeed(
         appearance, lodStateLink)
     _assembleSwinging(appearance, lodLink)
     model_assembler.assembleSuspensionSound(appearance, lodLink, isPlayer)
     model_assembler.assembleSuspensionController(appearance)
     appearance.wheelsAnimator = model_assembler.createWheelsAnimator(
         appearance.compoundModel, appearance.typeDescriptor,
         appearance.splineTracks, appearance.filter, lodStateLink)
     appearance.trackNodesAnimator = model_assembler.createTrackNodesAnimator(
         appearance.compoundModel, appearance.typeDescriptor,
         appearance.wheelsAnimator, lodStateLink)
     model_assembler.assembleVehicleTraces(appearance, appearance.filter,
                                           lodStateLink)
     model_assembler.assembleTracks(resourceRefs, appearance.typeDescriptor,
                                    appearance, appearance.splineTracks,
                                    False, lodStateLink)
 def __assembleModel(self):
     resources = self.__resources
     self.__model = resources[self.__vDesc.name]
     self.__setupEmblems(self.__vDesc)
     if not self.__isVehicleDestroyed:
         self.__fashions = VehiclePartsTuple(
             BigWorld.WGVehicleFashion(False), None, None, None)
         model_assembler.setupTracksFashion(self.__fashions.chassis,
                                            self.__vDesc,
                                            self.__isVehicleDestroyed)
         self.__model.setupFashions(self.__fashions)
         chassisFashion = self.__fashions.chassis
         model_assembler.setupSplineTracks(chassisFashion, self.__vDesc,
                                           self.__model, self.__resources)
         self.wheelsAnimator = model_assembler.createWheelsAnimator(
             self.__model, self.__vDesc, None)
         self.trackNodesAnimator = model_assembler.createTrackNodesAnimator(
             self.__model, self.__vDesc, self.wheelsAnimator)
     else:
         self.__fashions = VehiclePartsTuple(None, None, None, None)
         self.wheelsAnimator = None
         self.trackNodesAnimator = None
     self.updateCamouflage()
     yaw = self.__vDesc.gun.staticTurretYaw
     pitch = self.__vDesc.gun.staticPitch
     if yaw is None:
         yaw = 0.0
     if pitch is None:
         pitch = 0.0
     gunMatrix = mathUtils.createRTMatrix(Math.Vector3(yaw, pitch, 0.0),
                                          (0.0, 0.0, 0.0))
     self.__model.node('gun', gunMatrix)
     return self.__model
    def __assembleModel(self):
        from vehicle_systems import model_assembler
        resources = self.__resources
        self.__vEntity.model = resources[self.__vDesc.name]
        if not self.__isVehicleDestroyed:
            self.__fashions = VehiclePartsTuple(BigWorld.WGVehicleFashion(False), BigWorld.WGBaseFashion(), BigWorld.WGBaseFashion(), BigWorld.WGBaseFashion())
            model_assembler.setupTracksFashion(self.__vDesc, self.__fashions.chassis)
            self.__vEntity.model.setupFashions(self.__fashions)
            self.__initMaterialHandlers()
            model_assembler.assembleCollisionObstaclesCollector(self, None)
            model_assembler.assembleTessellationCollisionSensor(self, None)
            self.wheelsAnimator = model_assembler.createWheelsAnimator(self.__vEntity.model, self.__vDesc, None)
            self.trackNodesAnimator = model_assembler.createTrackNodesAnimator(self.__vEntity.model, self.__vDesc, self.wheelsAnimator)
            chassisFashion = self.__fashions.chassis
            splineTracksImpl = model_assembler.setupSplineTracks(chassisFashion, self.__vDesc, self.__vEntity.model, self.__resources)
            model_assembler.assembleTracks(self.__resources, self.__vDesc, self, splineTracksImpl, True)
            self.updateCustomization(self.__outfit)
            dirtEnabled = BigWorld.WG_dirtEnabled() and 'HD' in self.__vDesc.type.tags
            if dirtEnabled:
                dirtHandlers = [BigWorld.PyDirtHandler(True, self.__vEntity.model.node(TankPartNames.CHASSIS).position.y),
                 BigWorld.PyDirtHandler(False, self.__vEntity.model.node(TankPartNames.HULL).position.y),
                 BigWorld.PyDirtHandler(False, self.__vEntity.model.node(TankPartNames.TURRET).position.y),
                 BigWorld.PyDirtHandler(False, self.__vEntity.model.node(TankPartNames.GUN).position.y)]
                modelHeight, _ = self.computeVehicleHeight()
                self.dirtComponent = Vehicular.DirtComponent(dirtHandlers, modelHeight)
                for fashionIdx, _ in enumerate(TankPartNames.ALL):
                    self.__fashions[fashionIdx].addMaterialHandler(dirtHandlers[fashionIdx])

                self.dirtComponent.setBase()
        else:
            self.__fashions = VehiclePartsTuple(BigWorld.WGBaseFashion(), BigWorld.WGBaseFashion(), BigWorld.WGBaseFashion(), BigWorld.WGBaseFashion())
            self.__vEntity.model.setupFashions(self.__fashions)
            self.wheelsAnimator = None
            self.trackNodesAnimator = None
            self.dirtComponent = None
        cfg = hangarCFG()
        turretYaw = self.__vDesc.gun.staticTurretYaw
        gunPitch = self.__vDesc.gun.staticPitch
        if not ('AT-SPG' in self.__vDesc.type.tags or 'SPG' in self.__vDesc.type.tags):
            if turretYaw is None:
                turretYaw = cfg['vehicle_turret_yaw']
                turretYawLimits = self.__vDesc.gun.turretYawLimits
                if turretYawLimits is not None:
                    turretYaw = mathUtils.clamp(turretYawLimits[0], turretYawLimits[1], turretYaw)
            if gunPitch is None:
                gunPitch = cfg['vehicle_gun_pitch']
                gunPitchLimits = self.__vDesc.gun.pitchLimits['absolute']
                gunPitch = mathUtils.clamp(gunPitchLimits[0], gunPitchLimits[1], gunPitch)
        else:
            if turretYaw is None:
                turretYaw = 0.0
            if gunPitch is None:
                gunPitch = 0.0
        turretYawMatrix = mathUtils.createRotationMatrix((turretYaw, 0.0, 0.0))
        self.__vEntity.model.node(TankPartNames.TURRET, turretYawMatrix)
        gunPitchMatrix = mathUtils.createRotationMatrix((0.0, gunPitch, 0.0))
        self.__vEntity.model.node(TankPartNames.GUN, gunPitchMatrix)
        return
Example #4
0
    def __assembleNonDamagedOnly(self, resourceRefs, isPlayer, lodLink, lodStateLink):
        model_assembler.assembleTerrainMatKindSensor(self, lodStateLink, self.spaceID)
        model_assembler.assembleRecoil(self, lodLink)
        model_assembler.assembleMultiGunRecoil(self, lodLink)
        model_assembler.assembleGunLinkedNodesAnimator(self)
        model_assembler.assembleCollisionObstaclesCollector(self, lodStateLink, self.typeDescriptor)
        model_assembler.assembleTessellationCollisionSensor(self, lodStateLink)
        wheelsScroll = None
        wheelsSteering = None
        generalWheelsAnimatorConfig = self.typeDescriptor.chassis.generalWheelsAnimatorConfig
        if generalWheelsAnimatorConfig is not None:
            scrollableWheelsCount = generalWheelsAnimatorConfig.getNonTrackWheelsCount()
            wheelsScroll = []
            for _ in xrange(scrollableWheelsCount):
                retrieverGameObject = ScriptGameObject(self.spaceID)
                retriever = retrieverGameObject.createComponent(NetworkFilters.FloatFilterRetriever)
                wheelsScroll.append(DataLinks.createFloatLink(retriever, 'value'))
                self.filterRetrievers.append(retriever)
                self.filterRetrieverGameObjects.append(retrieverGameObject)

            steerableWheelsCount = generalWheelsAnimatorConfig.getSteerableWheelsCount()
            wheelsSteering = []
            for _ in xrange(steerableWheelsCount):
                retrieverGameObject = ScriptGameObject(self.spaceID)
                retriever = retrieverGameObject.createComponent(NetworkFilters.FloatFilterRetriever)
                wheelsSteering.append(DataLinks.createFloatLink(retriever, 'value'))
                self.filterRetrievers.append(retriever)
                self.filterRetrieverGameObjects.append(retrieverGameObject)

        self.wheelsAnimator = model_assembler.createWheelsAnimator(self, ColliderTypes.VEHICLE_COLLIDER, self.typeDescriptor, lambda : self.wheelsState, wheelsScroll, wheelsSteering, self.splineTracks, lodStateLink)
        if self.customEffectManager is not None:
            self.customEffectManager.setWheelsData(self)
        suspensionLodLink = lodStateLink
        if 'wheeledVehicle' in self.typeDescriptor.type.tags:
            wheeledLodCalculator = self.wheelsGameObject.createComponent(Vehicular.LodCalculator, DataLinks.linkMatrixTranslation(self.compoundModel.matrix), True, WHEELED_CHASSIS_PRIORITY_GROUP, isPlayer)
            self.allLodCalculators.append(wheeledLodCalculator)
            suspensionLodLink = wheeledLodCalculator.lodStateLink
        model_assembler.assembleSuspensionIfNeed(self, suspensionLodLink)
        model_assembler.assembleLeveredSuspensionIfNeed(self, suspensionLodLink)
        self.__assembleSwinging(lodLink)
        model_assembler.assembleBurnoutProcessor(self)
        model_assembler.assembleSuspensionSound(self, lodLink, isPlayer)
        model_assembler.assembleHullAimingController(self)
        self.trackNodesAnimator = model_assembler.createTrackNodesAnimator(self, self.typeDescriptor, lodStateLink)
        model_assembler.assembleTracks(resourceRefs, self.typeDescriptor, self, self.splineTracks, False, lodStateLink)
        model_assembler.assembleVehicleTraces(self, self.filter, lodStateLink)
        return
    def __assembleModel(self):
        from vehicle_systems import model_assembler
        resources = self.__resources
        self.__vEntity.model = resources[self.__vDesc.name]
        if not self.__isVehicleDestroyed:
            self.__fashions = VehiclePartsTuple(BigWorld.WGVehicleFashion(),
                                                BigWorld.WGBaseFashion(),
                                                BigWorld.WGBaseFashion(),
                                                BigWorld.WGBaseFashion())
            model_assembler.setupTracksFashion(self.__vDesc,
                                               self.__fashions.chassis)
            self.__vEntity.model.setupFashions(self.__fashions)
            model_assembler.assembleCollisionObstaclesCollector(
                self, None, self.__vDesc,
                BigWorld.player().spaceID)
            model_assembler.assembleTessellationCollisionSensor(self, None)
            wheelsScroll = None
            wheelsSteering = None
            if self.__vDesc.chassis.generalWheelsAnimatorConfig is not None:
                scrollableWheelsCount = self.__vDesc.chassis.generalWheelsAnimatorConfig.getWheelsCount(
                )
                wheelsScroll = [(lambda: 0.0)
                                for _ in xrange(scrollableWheelsCount)]
                steerableWheelsCount = self.__vDesc.chassis.generalWheelsAnimatorConfig.getSteerableWheelsCount(
                )
                wheelsSteering = [(lambda: 0.0)
                                  for _ in xrange(steerableWheelsCount)]
            chassisFashion = self.__fashions.chassis
            splineTracksImpl = model_assembler.setupSplineTracks(
                chassisFashion, self.__vDesc, self.__vEntity.model,
                self.__resources, self.__outfit.modelsSet)
            self.wheelsAnimator = model_assembler.createWheelsAnimator(
                self, ColliderTypes.VEHICLE_COLLIDER, self.__vDesc, lambda: 0,
                wheelsScroll, wheelsSteering, splineTracksImpl)
            self.trackNodesAnimator = model_assembler.createTrackNodesAnimator(
                self, self.__vDesc)
            model_assembler.assembleTracks(self.__resources, self.__vDesc,
                                           self, splineTracksImpl, True)
            dirtEnabled = BigWorld.WG_dirtEnabled(
            ) and 'HD' in self.__vDesc.type.tags
            if dirtEnabled:
                dirtHandlers = [
                    BigWorld.PyDirtHandler(
                        True,
                        self.__vEntity.model.node(
                            TankPartNames.CHASSIS).position.y),
                    BigWorld.PyDirtHandler(
                        False,
                        self.__vEntity.model.node(
                            TankPartNames.HULL).position.y),
                    BigWorld.PyDirtHandler(
                        False,
                        self.__vEntity.model.node(
                            TankPartNames.TURRET).position.y),
                    BigWorld.PyDirtHandler(
                        False,
                        self.__vEntity.model.node(
                            TankPartNames.GUN).position.y)
                ]
                modelHeight, _ = self.computeVehicleHeight()
                self.dirtComponent = self.createComponent(
                    Vehicular.DirtComponent, dirtHandlers, modelHeight)
                for fashionIdx, _ in enumerate(TankPartNames.ALL):
                    self.__fashions[fashionIdx].addMaterialHandler(
                        dirtHandlers[fashionIdx])

                self.dirtComponent.setBase()
            outfitData = camouflages.getOutfitData(
                self, self.__outfit, self.__vDesc,
                self.__vState != 'undamaged')
            self.c11nComponent = self.createComponent(
                Vehicular.C11nEditComponent, self.__fashions,
                self.compoundModel, outfitData)
            self.__updateDecals(self.__outfit)
            self.__updateSequences(self.__outfit)
        else:
            self.__fashions = VehiclePartsTuple(BigWorld.WGVehicleFashion(),
                                                BigWorld.WGBaseFashion(),
                                                BigWorld.WGBaseFashion(),
                                                BigWorld.WGBaseFashion())
            self.__vEntity.model.setupFashions(self.__fashions)
            self.wheelsAnimator = None
            self.trackNodesAnimator = None
            self.dirtComponent = None
            self.flagComponent = None
        self.__staticTurretYaw = self.__vDesc.gun.staticTurretYaw
        self.__staticGunPitch = self.__vDesc.gun.staticPitch
        if not ('AT-SPG' in self.__vDesc.type.tags
                or 'SPG' in self.__vDesc.type.tags):
            if self.__staticTurretYaw is None:
                self.__staticTurretYaw = self._getTurretYaw()
                turretYawLimits = self.__vDesc.gun.turretYawLimits
                if turretYawLimits is not None:
                    self.__staticTurretYaw = math_utils.clamp(
                        turretYawLimits[0], turretYawLimits[1],
                        self.__staticTurretYaw)
            if self.__staticGunPitch is None:
                self.__staticGunPitch = self._getGunPitch()
                gunPitchLimits = self.__vDesc.gun.pitchLimits['absolute']
                self.__staticGunPitch = math_utils.clamp(
                    gunPitchLimits[0], gunPitchLimits[1],
                    self.__staticGunPitch)
        else:
            if self.__staticTurretYaw is None:
                self.__staticTurretYaw = 0.0
            if self.__staticGunPitch is None:
                self.__staticGunPitch = 0.0
        turretYawMatrix = math_utils.createRotationMatrix(
            (self.__staticTurretYaw, 0.0, 0.0))
        self.__vEntity.model.node(TankPartNames.TURRET, turretYawMatrix)
        gunPitchMatrix = math_utils.createRotationMatrix(
            (0.0, self.__staticGunPitch, 0.0))
        self.__setGunMatrix(gunPitchMatrix)
        return