Пример #1
0
 def __init__(self):
     BaseSpaceCamera.__init__(self)
     self.lastLookAtID = None
     self.sceneCursor = (0, 0, 0)
     self.positionAnimator = PositionAnimatorDetached(self)
     self.trackBall = None
     self.trackBallMorpher = VectorLerper()
 def __init__(self):
     BaseSpaceCamera.__init__(self)
     self._speedOffsetProportion = 0.0
     self.lookAtBall = None
     self.trackBall = None
     self.orbitFreezeProp = 0.0
     self.speedDir = None
     self._zoomPropCache = None
     self._eyeOffsetChaser = Vector3Chaser()
     self._atOffsetChaser = Vector3Chaser()
     self.trackLerper = None
     self.isManualFovEnabled = False
     self._trackSpeed = 1.0
Пример #3
0
 def __init__(self):
     BaseSpaceCamera.__init__(self)
     self.lookAtBall = None
     self.trackBall = None
     self.orbitFreezeProp = 0.0
     self.speedDir = None
     self._zoomPropCache = None
     self._eyeOffsetChaser = Vector3Chaser()
     self._trackOffsetChaser = Vector3Chaser()
     self._speedOffsetLerper = VectorLerper(duration=1.0)
     self.speedOffset = (0, 0, 0)
     self.trackLerper = VectorLerper(duration=1.5)
     self.isManualFovEnabled = False
     self._trackSpeed = 1.0
     self._handleTargetKilledThread = None
Пример #4
0
 def Update(self):
     self._UpdateAnchorPosition()
     BaseSpaceCamera.Update(self)
     if not self.lookAtBall or not self.ego:
         return
     zoomProp = self.GetZoomProportion()
     self._UpdateAtOffset()
     self._UpdateEyeOffset()
     newAtPos = self.GetTrackPosition(self.lookAtBall)
     atDiff = geo2.Vec3Subtract(newAtPos, self._atPosition)
     self.SetAtPosition(newAtPos)
     if self.IsChasing():
         self.SetEyePosition(
             self.trackLerper.GetValue(self._eyePosition,
                                       self.GetChaseEyePosition()))
     elif self.IsTracking():
         self.SetEyePosition(
             self.trackLerper.GetValue(self._eyePosition,
                                       self.GetTrackingEyePosition()))
     else:
         prop = self._GetEyePosDriftProporition()
         eyeOffset = geo2.Vec3Scale(atDiff, prop)
         self.SetEyePosition(geo2.Vec3Add(self._eyePosition, eyeOffset))
     if not self.IsInTransit():
         if self.GetItemID() == self.ego or self.IsTracking(
         ) or self.IsChasing():
             self.SetZoom(zoomProp)
         self.EnforceMinZoom()
     if not self.isManualFovEnabled and IsDynamicCameraMovementEnabled():
         self.SetFovTarget(self.GetDynamicFov())
Пример #5
0
 def OnActivated(self,
                 lastCamera=None,
                 itemID=None,
                 duration=None,
                 **kwargs):
     settings.char.ui.Set('spaceCameraID', evecamera.CAM_TACTICAL)
     if lastCamera:
         distance = max(
             self.maxZoom,
             min(geo2.Vec3Length(self.eyePosition), self.minZoom))
         if lastCamera.cameraID in (evecamera.CAM_SHIPORBIT,
                                    evecamera.CAM_UNDOCK,
                                    evecamera.CAM_ENTERSPACE):
             self._ResetEyeAndAtPosition(lastCamera.eyePosition,
                                         lastCamera.atPosition, distance)
         else:
             animate = lastCamera.cameraID not in (evecamera.CAM_SHIPPOV,
                                                   evecamera.CAM_HANGAR)
             self._ResetEyeAndAtPosition(self.eyePosition, self.atPosition,
                                         distance, animate)
         self._SetLookAtBall(GetBall(lastCamera.GetItemID()))
         if lastCamera.cameraID != evecamera.CAM_SHIPPOV:
             self.fov = lastCamera.fov
         self.ResetFOV()
     else:
         if not itemID:
             itemID = self.ego
         self._SetLookAtBall(GetBall(itemID))
         self.SetEyePosition(self.default_eyePosition)
     BaseSpaceCamera.OnActivated(self, **kwargs)
Пример #6
0
 def Update(self):
     BaseSpaceCamera.Update(self)
     if IsDynamicCameraMovementEnabled():
         self.SetFovTarget(self.GetDynamicFov())
     ball = GetBall(self.ego)
     if ball:
         self.SetAtPosition(GetBallPosition(ball))
Пример #7
0
 def Orbit(self, *args):
     if self.IsTracking() and self.IsBeyondZoomDistance():
         self.StopTracking()
         self.AnimLookAtTransit(self.positionAnimator.ball,
                                self.eyePosition)
     else:
         BaseSpaceCamera.Orbit(self, *args)
Пример #8
0
 def OnActivated(self, lastCamera=None, itemID=None, **kwargs):
     BaseSpaceCamera.OnActivated(self, **kwargs)
     if lastCamera and lastCamera.cameraID in evecamera.INSPACE_CAMERAS:
         self.SetAtPosition(lastCamera.atPosition)
         self.SetEyePosition(lastCamera.eyePosition)
         self.fov = lastCamera.fov
     self.SetFovTarget(self.default_fov)
Пример #9
0
 def Orbit(self, dx=0, dy=0):
     if self.IsTransitioningToOrFromTracking(
     ) and IsDynamicCameraMovementEnabled():
         return
     BaseSpaceCamera.Orbit(self, dx, dy)
     if self.IsTracking() or self.IsChasing():
         self.Track(None)
Пример #10
0
 def Update(self):
     BaseSpaceCamera.Update(self)
     if self.model and self.model.translationCurve:
         atPos = self.model.translationCurve.value
         diff = geo2.Vec3Subtract(atPos, self._atPosition)
         self.atPosition = atPos
         self.eyePosition = geo2.Vec3Add(self.eyePosition, diff)
Пример #11
0
 def OnDeactivated(self):
     BaseSpaceCamera.OnDeactivated(self)
     self._zoomPropCache = self.GetZoomProportion()
     self.lookAtBall = None
     self._trackOffsetChaser.ResetValue()
     self.ResetAnchorPos()
     self.DisableManualFov()
     self._trackSpeed = 1.0
     self.ResetRotate()
Пример #12
0
 def Pan(self, dx=None, dy=None, dz=None):
     if not self.IsManualControlEnabled():
         return
     if self.IsActiveOrTrackingShipWarping():
         return
     self.StopTracking()
     if self.IsAttached():
         self.Detach()
     k = self.GetPanSpeed()
     BaseSpaceCamera.Pan(self, k * dx, k * dy, k * dz)
Пример #13
0
 def OnActivated(self, **kwargs):
     BaseSpaceCamera.OnActivated(self, **kwargs)
     duration = max(blue.os.desiredSimDilation, 0.2) * 1.75
     self._eyePosition = geo2.Vec3Scale(self.GetLookAtDirection(), -30.0)
     eyePos1 = geo2.Vec3Scale(self.GetLookAtDirection(), 8.0)
     uicore.animations.MorphVector3(self,
                                    '_eyePosition',
                                    self._eyePosition,
                                    eyePos1,
                                    duration=duration)
     uicore.animations.MorphScalar(self,
                                   'fov',
                                   startVal=self.fov,
                                   endVal=0.55,
                                   duration=duration)
Пример #14
0
 def Update(self):
     BaseSpaceCamera.Update(self)
     if not session.solarsystemid:
         return
     if not self.trackBall:
         self.UpdateTrackBall()
     if self.trackBall and getattr(
             self.trackBall, 'model', None) and hasattr(
                 self.trackBall.model.rotationCurve, 'value'):
         self.UpdateUpDirection()
         self.UpdateAtEyePositions()
         self.UpdateInSceneContainer()
     if self.trackBall and self.trackBall.id != self.ego:
         uthread.new(
             sm.GetService('sceneManager').SetPrimaryCamera,
             evecamera.CAM_SHIPORBIT)
Пример #15
0
 def Update(self):
     BaseSpaceCamera.Update(self)
     if not session.solarsystemid:
         return
     if self.IsActiveOrTrackingShipWarping() and not self.IsAttached():
         self.LookAt(self.ego)
     if self.positionAnimator.GetItemID():
         self.positionAnimator.Update()
         if self.IsTracking():
             atPos = self.GetTrackingAtPosition()
         else:
             atPos = self.positionAnimator.GetAtPosition()
         self.SetAtPosition(atPos)
         self.SetEyePosition(self.positionAnimator.GetEyePosition())
     if self.IsAttached():
         self._EnforceMaximumDistanceAttached()
     else:
         self._EnforceMaximumDistanceDetached()
Пример #16
0
 def OnActivated(self, itemID=None, lastCamera=None, **kwargs):
     BaseSpaceCamera.OnActivated(self, **kwargs)
     self._LerpSpeedOffset()
     settings.char.ui.Set('spaceCameraID', evecamera.CAM_SHIPORBIT)
     if lastCamera and lastCamera.cameraID in (
             evecamera.CAM_TACTICAL, evecamera.CAM_SHIPPOV,
             evecamera.CAM_JUMP, evecamera.CAM_UNDOCK,
             evecamera.CAM_ENTERSPACE):
         itemID = itemID or getattr(lastCamera, 'lastLookAtID',
                                    None) or self.ego
         self._SetLookAtBall(itemID)
         atPos1 = self.GetTrackPosition(self.lookAtBall)
         eyePos1 = geo2.Vec3Add(
             atPos1,
             geo2.Vec3Scale(lastCamera.GetLookAtDirection(),
                            self.GetInitialZoomDist(lastCamera)))
         if lastCamera.cameraID in (evecamera.CAM_TACTICAL,
                                    evecamera.CAM_JUMP,
                                    evecamera.CAM_UNDOCK,
                                    evecamera.CAM_ENTERSPACE):
             if lastCamera.cameraID == evecamera.CAM_JUMP:
                 duration = 0.1
             else:
                 duration = GetDurationByDistance(lastCamera.eyePosition,
                                                  eyePos1, 0.4, 0.6)
             self.Transit(lastCamera.atPosition,
                          lastCamera.eyePosition,
                          atPos1,
                          eyePos1,
                          duration=duration,
                          smoothing=0.0)
             currFov = self.fov
             self.fov = lastCamera.fov
             self.SetFovTarget(currFov)
         else:
             self.SetAtPosition(atPos1)
             self.SetEyePosition(eyePos1)
     elif itemID:
         self._SetLookAtBall(itemID)
     elif not self.lookAtBall:
         self._SetLookAtBall(self.ego)
Пример #17
0
 def OnDeactivated(self):
     BaseSpaceCamera.OnDeactivated(self)
     if self.trackBall:
         self.trackBall = None
     if self.inSceneContainer:
         self.inSceneContainer.Close()
Пример #18
0
 def Orbit(self, dx, dy):
     BaseSpaceCamera.Orbit(self, 0, dy)
Пример #19
0
 def __init__(self):
     BaseSpaceCamera.__init__(self)
     self.lastLookAtID = None
     self.trackBall = None
Пример #20
0
 def OnDeactivated(self):
     BaseSpaceCamera.OnDeactivated(self)
     self.model = None
Пример #21
0
 def __init__(self):
     BaseSpaceCamera.__init__(self)
     self.model = None
Пример #22
0
 def OnActivated(self, **kwargs):
     BaseSpaceCamera.OnActivated(self, **kwargs)
     self.animEntryThread = uthread.new(self._OnActivated)
Пример #23
0
 def OnDeactivated(self):
     BaseSpaceCamera.OnDeactivated(self)
     uicore.animations.StopAllAnimations(self)
     if self.animEntryThread:
         self.animEntryThread.kill()
         self.animEntryThread = None
Пример #24
0
 def OnDeactivated(self):
     BaseSpaceCamera.OnDeactivated(self)
     self._SetLookAtBall(None)
     self.StopTracking()
Пример #25
0
 def GetZoomToPoint(self):
     offset = BaseSpaceCamera.GetZoomToPoint(self)
     speedOffset = self.GetSpeedOffset()
     if speedOffset:
         offset = geo2.Vec3AddD(offset, speedOffset)
     return offset
Пример #26
0
 def FovZoom(self, dz):
     BaseSpaceCamera.FovZoom(self, dz)
     self.isManualFovEnabled = True
Пример #27
0
 def __init__(self):
     BaseSpaceCamera.__init__(self)
     self.lastCamera = None
     self.itemID = None
     self.lastLookAtID = None
     self.dist = 0.0
Пример #28
0
 def __init__(self):
     BaseSpaceCamera.__init__(self)
     self.animEntryThread = None
Пример #29
0
 def __init__(self):
     BaseSpaceCamera.__init__(self)
     self.lastLookAtID = None
     self.sceneCursor = (0, 0, 0)
     self.ballPosition = BallPositionAnimator()
Пример #30
0
 def Zoom(self, dz):
     if self.IsTracking() and self.CheckObjectTooFar(self.trackBall.id):
         return
     BaseSpaceCamera.Zoom(self, dz)
Пример #31
0
 def Orbit(self, *args):
     BaseSpaceCamera.Orbit(self, *args)
     uicore.animations.StopAnimation(self, 'yaw')
     uicore.animations.StopAnimation(self, 'pitch')
Пример #32
0
 def OnActivated(self, **kwargs):
     BaseSpaceCamera.OnActivated(self, **kwargs)
     sm.StartService('state').SetState(self.ego, states.lookingAt, True)
     settings.char.ui.Set('spaceCameraID', evecamera.CAM_SHIPPOV)
     self.UpdateTrackBall()
     uthread.new(self.ConstructInSceneContainer)
Пример #33
0
 def __init__(self):
     BaseSpaceCamera.__init__(self)
     self.lastLookAtID = None
     self.trackBall = None
     self.inSceneContainer = None
Пример #34
0
 def ResetCameraPosition(self):
     BaseSpaceCamera.ResetCameraPosition(self)
     self._SetLookAtBall(self.ego)