Beispiel #1
0
 public override void UpdateCamera(int diffX, int diffY)
 {
     if (DerefChain.VerifyChains(m_hor, m_vert))
     {
         m_camera.HorY = IPCUtils.ReadFloat(m_ipc, (uint)m_hor.Value);
         m_camera.HorX = IPCUtils.ReadFloat(m_ipc, (uint)(m_hor.Value + 4));
         m_camera.Vert = IPCUtils.ReadFloat(m_ipc, (uint)m_vert.Value);
         m_camera.Update(diffX * SensModifier, -diffY * SensModifier);
         IPCUtils.WriteFloat(m_ipc, (uint)m_hor.Value, m_camera.HorY);
         IPCUtils.WriteFloat(m_ipc, (uint)(m_hor.Value + 4), m_camera.HorX);
         IPCUtils.WriteFloat(m_ipc, (uint)m_vert.Value, m_camera.Vert);
     }
 }
Beispiel #2
0
        public override void UpdateCamera(int diffX, int diffY)
        {
            if (DerefChain.VerifyChains(m_hor, m_vert))
            {
                // the values are in degrees, so they need a deg -> rad conversion
                m_camera.Hor  = (float)(IPCUtils.ReadFloat(m_ipc, (uint)m_hor.Value) * (Math.PI / 180));
                m_camera.Vert = (float)(IPCUtils.ReadFloat(m_ipc, (uint)m_vert.Value) * (Math.PI / 180));

                // the vertical value needs to be clamped, these values seemed reasonable
                m_camera.Update(-diffX * SensModifier, diffY * SensModifier);
                m_camera.Vert = (float)Math.Clamp(m_camera.Vert, -60f * (Math.PI / 180), 75f * (Math.PI / 180));

                // the new values are in radians, so they need a rad -> deg conversion
                IPCUtils.WriteFloat(m_ipc, (uint)m_hor.Value, (float)(m_camera.Hor * (180 / Math.PI)));
                IPCUtils.WriteFloat(m_ipc, (uint)m_vert.Value, (float)(m_camera.Vert * (180 / Math.PI)));
            }
        }