Panda3D
|
00001 // Filename: pSphereLens.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 PSPHERELENS_H 00016 #define PSPHERELENS_H 00017 00018 #include "pandabase.h" 00019 00020 #include "lens.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : PSphereLens 00024 // Description : A PSphereLens 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 PSphereLens is similar to a cylindrical lens, 00031 // except it is also curved in the vertical direction. 00032 // This allows it to extend to both poles in the 00033 // vertical direction. The mapping is similar to what 00034 // many modeling packages call a sphere mapping: the x 00035 // coordinate is proportional to azimuth, while the y 00036 // coordinate is proportional to altitude. 00037 //////////////////////////////////////////////////////////////////// 00038 class EXPCL_PANDAFX PSphereLens : public Lens { 00039 PUBLISHED: 00040 INLINE PSphereLens(); 00041 00042 public: 00043 INLINE PSphereLens(const PSphereLens ©); 00044 INLINE void operator = (const PSphereLens ©); 00045 00046 public: 00047 virtual PT(Lens) make_copy() const; 00048 00049 protected: 00050 virtual bool extrude_impl(const LPoint3f &point2d, 00051 LPoint3f &near_point, LPoint3f &far_point) const; 00052 virtual bool project_impl(const LPoint3f &point3d, LPoint3f &point2d) const; 00053 00054 virtual float fov_to_film(float fov, float focal_length, bool horiz) const; 00055 virtual float fov_to_focal_length(float fov, float film_size, bool horiz) const; 00056 virtual float film_to_fov(float film_size, float focal_length, bool horiz) const; 00057 00058 public: 00059 virtual TypeHandle get_type() const { 00060 return get_class_type(); 00061 } 00062 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00063 static TypeHandle get_class_type() { 00064 return _type_handle; 00065 } 00066 static void init_type() { 00067 Lens::init_type(); 00068 register_type(_type_handle, "PSphereLens", 00069 Lens::get_class_type()); 00070 } 00071 00072 private: 00073 static TypeHandle _type_handle; 00074 }; 00075 00076 #include "pSphereLens.I" 00077 00078 #endif