• Main Page
  • Related Pages
  • Classes
  • Files
  • File List

src/CameraObject.hh

00001 /*
00002  * Copyright Staffan Gimåker 2006-2007, 2009-2010.
00003  * Copyright Anders Boberg 2006-2007.
00004  *
00005  * ---
00006  *
00007  * This file is part of peekabot.
00008  *
00009  * peekabot is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 3 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * peekabot is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00021  */
00022 
00023 #ifndef PEEKABOT_CAMERA_OBJECT_HH_INCLUDED
00024 #define PEEKABOT_CAMERA_OBJECT_HH_INCLUDED
00025 
00026 
00027 #include "Types.hh"
00028 #include "SceneObject.hh"
00029 #include "HandlerInformer.hh"
00030 
00031 #include <Eigen/Core>
00032 
00033 
00034 namespace peekabot
00035 {
00048     class CameraObject : public SceneObject
00049     {
00050     public:
00056         CameraObject();
00057 
00060         CameraObject(ScopedHandler* handler) throw();
00061 
00072         bool set_fov(float fov);
00073 
00076         float get_fov() const throw();
00077 
00084         void set_orthographic(bool enable);
00085 
00088         bool is_orthographic() const throw();
00089 
00090         virtual void accept(ObjectVisitor* visitor) throw();
00091 
00092         virtual ObjectType get_object_type() const;
00093 
00104         void set_zoom_distance(float zoom_distance) throw();
00105 
00111         float get_zoom_distance() const throw();
00112 
00113         void set_near_plane(float y_distance) throw();
00114 
00115         float get_near_plane() const throw();
00116 
00117         void set_far_plane(float y_distance) throw();
00118 
00119         float get_far_plane() const throw();
00120 
00124         inline const Eigen::Vector4f get_view_vector() const throw()
00125         {
00126             return get_transformation().matrix().col(0);
00127         }
00128 
00132         inline const Eigen::Vector4f get_up_vector() const throw()
00133         {
00134             return get_transformation().matrix().col(2);
00135         }
00136 
00139 
00140         typedef boost::signals2::signal<void ()> OrthoSetsignal;
00141 
00142         typedef boost::signals2::signal<void ()> FovSetSignal;
00143 
00144         typedef boost::signals2::signal<void ()> ZoomDistanceSetSignal;
00145 
00146         typedef boost::signals2::signal<void ()> NearPlaneSetSignal;
00147 
00148         typedef boost::signals2::signal<void ()> FarPlaneSetSignal;
00149 
00150         // ---
00151 
00152         inline OrthoSetsignal &ortho_set_signal() const
00153         {
00154             return m_ortho_set_signal;
00155         }
00156 
00157         inline FovSetSignal &fov_set_signal() const
00158         {
00159             return m_fov_set_signal;
00160         }
00161 
00162         inline ZoomDistanceSetSignal &zoom_distance_set_signal() const
00163         {
00164             return m_zoom_distance_set_signal;
00165         }
00166 
00167         inline NearPlaneSetSignal &near_plane_set_signal() const
00168         {
00169             return m_near_plane_set_signal;
00170         }
00171 
00172         inline FarPlaneSetSignal &far_plane_set_signal() const
00173         {
00174             return m_far_plane_set_signal;
00175         }
00176 
00178 
00179     protected:
00180         virtual PropMap &get_prop_adapters();
00181 
00182     private:
00183         static void create_prop_adapters(PropMap &adapters);
00184 
00187 
00190         static void start_handler(
00191             const std::string & name,
00192             XMLHandler::AttributeMap &attributes,
00193             ScopedHandler *handler) throw();
00194 
00197         void orthographic_start_handler(
00198             const std::string & name,
00199             XMLHandler::AttributeMap &attributes,
00200             ScopedHandler *handler) throw();
00201 
00204         void fov_start_handler(
00205             const std::string & name,
00206             XMLHandler::AttributeMap &attributes,
00207             ScopedHandler *handler) throw();
00208 
00209         void fov_value_start_handler(
00210             const std::string & name,
00211             XMLHandler::AttributeMap &attributes,
00212             ScopedHandler *handler,
00213             bool value_in_degrees) throw();
00214 
00217         void fov_value_cdata_handler(
00218             const std::string &cdata,
00219             ScopedHandler *handler,
00220             bool value_in_degrees) throw();
00221 
00223 
00224     private:
00227         float m_fov;
00228 
00232         bool m_is_orthographic;
00233 
00234         float m_near;
00235 
00236         float m_far;
00237 
00247         float m_zoom_distance;
00248 
00249         static HandlerInformer ms_handler_informer;
00250 
00251         mutable OrthoSetsignal m_ortho_set_signal;
00252         mutable FovSetSignal m_fov_set_signal;
00253         mutable ZoomDistanceSetSignal m_zoom_distance_set_signal;
00254         mutable NearPlaneSetSignal m_near_plane_set_signal;
00255         mutable FarPlaneSetSignal m_far_plane_set_signal;
00256     };
00257 }
00258 
00259 
00260 #endif // PEEKABOT_CAMERA_OBJECT_HH_INCLUDED

Generated on Sun Jan 30 2011 for peekabot by  doxygen 1.7.1