Panda3D
|
00001 // Filename: oSphereLens.h 00002 // Created by: drose (25Feb11) 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 OSPHERELENS_H 00016 #define OSPHERELENS_H 00017 00018 #include "pandabase.h" 00019 00020 #include "lens.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : OSphereLens 00024 // Description : A OSphereLens is a special nonlinear lens that 00025 // doesn't correspond to any real physical lenses. It's 00026 // primarily useful for generating 360-degree wraparound 00027 // images while avoiding the distortion associated with 00028 // fisheye images. 00029 // 00030 // A OSphereLens is similar to a Cylindrical lens and 00031 // PSphereLens, except that it is orthographic in the 00032 // vertical direction. 00033 //////////////////////////////////////////////////////////////////// 00034 class EXPCL_PANDAFX OSphereLens : public Lens { 00035 PUBLISHED: 00036 INLINE OSphereLens(); 00037 00038 public: 00039 INLINE OSphereLens(const OSphereLens ©); 00040 INLINE void operator = (const OSphereLens ©); 00041 00042 public: 00043 virtual PT(Lens) make_copy() const; 00044 00045 protected: 00046 virtual bool do_extrude(const Lens::CData *lens_cdata, const LPoint3 &point2d, 00047 LPoint3 &near_point, LPoint3 &far_point) const; 00048 virtual bool do_project(const Lens::CData *lens_cdata, 00049 const LPoint3 &point3d, LPoint3 &point2d) const; 00050 00051 virtual PN_stdfloat fov_to_film(PN_stdfloat fov, PN_stdfloat focal_length, bool horiz) const; 00052 virtual PN_stdfloat fov_to_focal_length(PN_stdfloat fov, PN_stdfloat film_size, bool horiz) const; 00053 virtual PN_stdfloat film_to_fov(PN_stdfloat film_size, PN_stdfloat focal_length, bool horiz) const; 00054 00055 public: 00056 virtual TypeHandle get_type() const { 00057 return get_class_type(); 00058 } 00059 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00060 static TypeHandle get_class_type() { 00061 return _type_handle; 00062 } 00063 static void init_type() { 00064 Lens::init_type(); 00065 register_type(_type_handle, "OSphereLens", 00066 Lens::get_class_type()); 00067 } 00068 00069 private: 00070 static TypeHandle _type_handle; 00071 }; 00072 00073 #include "oSphereLens.I" 00074 00075 #endif