示例#1
0
 def SetMinMaxZoom(self, minZoom, maxZoom):
     if minZoom <= maxZoom:
         LogException(
             'Camera: Cannot set minZoom to a value smaller than maxZoom: minZoom=%s, maxZoom=%s, %s'
             % (minZoom, maxZoom, self))
     self.minZoom = minZoom
     self.maxZoom = maxZoom
示例#2
0
 def _UpdateCamera(self, camera):
     try:
         camera._Update()
     except DestinyBallInvalid as e:
         log.LogWarn('DestinyBallInvalid while updating camera')
     except Exception:
         LogException('Unexpected exception raised from UpdateCamera')
示例#3
0
 def SetMinZoom(self, value):
     if value <= self.maxZoom:
         LogException(
             'Camera: Cannot set minZoom to a value smaller than minZoom: value=%s, %s'
             % (value, self))
     else:
         self.minZoom = value
示例#4
0
 def SetTargetValue(self, value, speed=None):
     if IsNanVector3(value):
         LogException('Camera: Attempting to set an invalid value: %s' %
                      repr(value))
         return
     self._targetValue = value
     if speed is not None:
         self._speed = speed
示例#5
0
 def GetZoomDistance(self):
     dist = geo2.Vec3Distance(self._eyePosition, self.GetZoomToPoint())
     if math.isinf(dist):
         LogException('Error: Infinite camera distance:%s, %s' %
                      (repr(dist), self))
         self.ResetCameraPosition()
         return 1.0
     return dist
示例#6
0
 def UpdateProjection(self):
     aspectRatio = self.GetAspectRatio()
     fov = self._fov - self._fovOffset
     if fov <= 0.0:
         fov = 1.0
         self.ResetCameraPosition()
         LogException('Camera: FOV Set to <= 0.0')
     if self.centerOffset:
         self._UpdateProjectionOffset(aspectRatio, fov)
     else:
         self._UpdateProjectionFov(aspectRatio, fov)
示例#7
0
    def CameraMove_thread(self):
        try:
            camera = self.GetCamera()
            lastYawRad, _, _ = geo2.QuaternionRotationGetYawPitchRoll(
                camera.GetRotationQuat())
            radDelta = 0
            while self.cameraStillSpinning:
                blue.pyos.synchro.Yield()
                if self.mouseDownPos is None or camera is None:
                    self.cameraStillSpinning = False
                    return
                curYaw, pitch, roll = geo2.QuaternionRotationGetYawPitchRoll(
                    camera.GetRotationQuat())
                angleBtwYaws = mathCommon.GetLesserAngleBetweenYaws(
                    lastYawRad, curYaw)
                radDelta += angleBtwYaws
                lastYawRad = curYaw
                if abs(radDelta) > math.pi / 2:
                    sm.ScatterEvent('OnClientMouseSpinInSpace')
                    return

        except Exception as e:
            LogException(e)