00001 #ifndef MERCURYCAMERA_H 00002 #define MERCURYCAMERA_H 00003 00004 #include "MercuryObject.h" 00005 #include "MercuryMath.h" 00006 00007 class MercuryCamera : public MercuryObject 00008 { 00009 public: 00010 MercuryCamera(); 00011 00012 inline void SetUp(const MercuryPoint& up) { m_up = up.Normalize(); m_taintedMatrix = true; } 00013 inline void SetTarget(const MercuryPoint& target) { m_target = target; m_taintedMatrix = true; } 00014 inline void SetEye(const MercuryPoint& eye) { SetPosition(eye); m_taintedMatrix = true; } 00015 00016 inline const MercuryPoint GetDirection() const { return (m_target - GetPosition()).Normalize(); } 00017 inline const MercuryPoint& GetEye() const { return GetPosition(); } 00018 inline const MercuryPoint& GetUp() const { return m_up; } 00019 inline const MercuryPoint& GetTarget() const { return m_target; } 00020 MercuryPoint GetRight() const; 00021 00022 virtual void Prerender(); 00023 00029 // void SetAxisRecalc(bool toggle) { m_recalcAxis = toggle; } 00030 // inline bool GetAxisRecalc() const { return m_recalcAxis; } 00031 00032 // void Roll(const float degree); 00033 // void Pitch(const float degree); 00034 // void Yaw(const float degree); 00035 // inline float GetRoll() const { return m_pyr[2] * RADDEG; } 00036 // inline float GetPitch() const { return m_pyr[0] * RADDEG; } 00037 // inline float GetYaw() const { return m_pyr[1] * RADDEG; } 00038 00039 virtual void Render(); 00040 CLASS_RTTI( MercuryCamera, MercuryObject ); 00041 private: 00042 void* m_lai; 00043 // MercuryPoint m_eye; //MercuryObject m_position (this is where the eye is located) 00044 MercuryPoint m_target; 00045 00046 //direction vectors 00047 MercuryPoint m_up; //local y axis 00048 // MercuryPoint m_x; //local x axis 00049 00050 MercuryPoint m_pyr; //pitch yaw roll 00051 bool m_recalcAxis; 00052 }; 00053 00054 00055 #endif 00056 /* 00057 * (c) 2005 Anthony Varner, Josh Allen 00058 * All rights reserved. 00059 * 00060 * Permission is hereby granted, free of charge, to any person obtaining a 00061 * copy of this software and associated documentation files (the 00062 * "Software"), to deal in the Software without restriction, including 00063 * without limitation the rights to use, copy, modify, merge, publish, 00064 * distribute, and/or sell copies of the Software, and to permit persons to 00065 * whom the Software is furnished to do so, provided that the above 00066 * copyright notice(s) and this permission notice appear in all copies of 00067 * the Software and that both the above copyright notice(s) and this 00068 * permission notice appear in supporting documentation. 00069 * 00070 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00071 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00072 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00073 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00074 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00075 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00076 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00077 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00078 * PERFORMANCE OF THIS SOFTWARE. 00079 */ 00080