Panda3D
|
00001 // Filename: fisheyeLens.h 00002 // Created by: drose (12Dec01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef FISHEYELENS_H 00016 #define FISHEYELENS_H 00017 00018 #include "pandabase.h" 00019 00020 #include "lens.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : FisheyeLens 00024 // Description : A fisheye lens. This nonlinear lens introduces a 00025 // spherical distortion to the image, which is minimal 00026 // at small angles from the lens, and increases at 00027 // larger angles from the lens. The field of view may 00028 // extend to 360 degrees. 00029 //////////////////////////////////////////////////////////////////// 00030 class EXPCL_PANDAFX FisheyeLens : public Lens { 00031 PUBLISHED: 00032 INLINE FisheyeLens(); 00033 00034 public: 00035 INLINE FisheyeLens(const FisheyeLens ©); 00036 INLINE void operator = (const FisheyeLens ©); 00037 00038 public: 00039 virtual PT(Lens) make_copy() const; 00040 00041 protected: 00042 virtual bool do_extrude(const Lens::CData *lens_cdata, const LPoint3 &point2d, 00043 LPoint3 &near_point, LPoint3 &far_point) const; 00044 virtual bool do_extrude_vec(const Lens::CData *lens_cdata, const LPoint3 &point2d, 00045 LVector3 &vec) const; 00046 virtual bool do_project(const Lens::CData *lens_cdata, 00047 const LPoint3 &point3d, LPoint3 &point2d) const; 00048 00049 virtual PN_stdfloat fov_to_film(PN_stdfloat fov, PN_stdfloat focal_length, bool horiz) const; 00050 virtual PN_stdfloat fov_to_focal_length(PN_stdfloat fov, PN_stdfloat film_size, bool horiz) const; 00051 virtual PN_stdfloat film_to_fov(PN_stdfloat film_size, PN_stdfloat focal_length, bool horiz) const; 00052 00053 public: 00054 virtual TypeHandle get_type() const { 00055 return get_class_type(); 00056 } 00057 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00058 static TypeHandle get_class_type() { 00059 return _type_handle; 00060 } 00061 static void init_type() { 00062 Lens::init_type(); 00063 register_type(_type_handle, "FisheyeLens", 00064 Lens::get_class_type()); 00065 } 00066 00067 private: 00068 static TypeHandle _type_handle; 00069 }; 00070 00071 #include "fisheyeLens.I" 00072 00073 #endif