capitalHangarCamera.py (2978B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\camera\capitalHangarCamera.py 2 import math 3 from eve.client.script.ui.camera.baseSpaceCamera import BaseSpaceCamera 4 import evecamera 5 import evetypes 6 from inventorycommon.const import groupSupercarrier 7 import geo2 8 from carbonui.uicore import uicore 9 TITAN_CAMERA_POSITION = (9995.4853515625, -2001.05224609375, 10192.3359375) 10 SUPER_CAPITAL_CAMERA_DIRECTION = (-0.2522106051445007, 0.3255149364471436, 0.8546369075775146) 11 12 class CapitalHangarCamera(BaseSpaceCamera): 13 cameraID = evecamera.CAM_CAPITALHANGAR 14 isBobbingCamera = True 15 name = 'HangarCamera' 16 kMinPitch = math.pi / 4 17 kMaxPitch = math.pi / 2 18 19 def AnimEnterHangar(self, model, startPos, endPos, duration = 5.0): 20 self._PlaceCamera() 21 22 def AnimSwitchShips(self, model, startPos, endPos, duration = 5.0): 23 self._PlaceCamera() 24 25 def SetShip(self, model, typeID): 26 self.typeID = typeID 27 self.model = model 28 self.SetMaxZoom(self.model.GetBoundingSphereRadius() * 1.2) 29 30 def PlaceShip(self, pos): 31 self._PlaceCamera(animate=False) 32 33 def _PlaceCamera(self, animate = True): 34 duration = 5.0 35 if self.IsSuperCarrier(): 36 self.MoveToSuperCapitalCameraPosition() 37 if animate: 38 self.AnimEntrySuperCarrier(duration) 39 else: 40 self.MoveToTitanCameraPosition() 41 if animate: 42 self.AnimEntryTitan(duration) 43 44 def AnimEntryTitan(self, duration): 45 uicore.animations.MorphScalar(self, 'pitch', self.kMaxPitch - math.pi / 15, self.kMaxPitch - math.pi / 20, duration=duration) 46 uicore.animations.MorphScalar(self, 'zoom', self.zoom, 0.97 * self.zoom, duration=duration) 47 48 def AnimEntrySuperCarrier(self, duration): 49 uicore.animations.MorphScalar(self, 'pitch', self.kMaxPitch - math.pi / 15, self.kMaxPitch - math.pi / 20, duration=duration) 50 uicore.animations.MorphScalar(self, 'zoom', self.zoom * 1.03, self.zoom, duration=duration) 51 52 def IsSuperCarrier(self): 53 return evetypes.GetGroupID(self.typeID) == groupSupercarrier 54 55 def MoveToTitanCameraPosition(self): 56 self.atPosition = self.model.translationCurve.value 57 self.eyePosition = TITAN_CAMERA_POSITION 58 self.SetMinZoom(geo2.Vec3Distance(self.atPosition, self.eyePosition)) 59 60 def MoveToSuperCapitalCameraPosition(self): 61 self.atPosition = self.model.translationCurve.value 62 optimalZoom = min(self.minZoom, max(self.maxZoom, 2.5 * self.model.GetBoundingSphereRadius())) 63 diff = geo2.Vec3Scale(SUPER_CAPITAL_CAMERA_DIRECTION, optimalZoom) 64 newEyePos = geo2.Vec3Add(diff, self.atPosition) 65 self.eyePosition = newEyePos 66 self.SetMinZoom(13000) 67 68 def OnDeactivated(self): 69 BaseSpaceCamera.OnDeactivated(self) 70 self.model = None 71 72 def Orbit(self, dx, dy): 73 BaseSpaceCamera.Orbit(self, 0, dy)