Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/distort/pSphereLens.h

Go to the documentation of this file.
00001 // Filename: pSphereLens.h
00002 // Created by:  drose (12Dec01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef PSPHERELENS_H
00020 #define PSPHERELENS_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "lens.h"
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : PSphereLens
00028 // Description : A PSphereLens is a special nonlinear lens that
00029 //               doesn't correspond to any real physical lenses.  It's
00030 //               primarily useful for generating 360-degree wraparound
00031 //               images while avoiding the distortion associated with
00032 //               fisheye images.
00033 //
00034 //               A PSphereLens is similar to a cylindrical lens,
00035 //               except it is also curved in the vertical direction.
00036 //               This allows it to extend to both poles in the
00037 //               vertical direction.  The mapping is similar to what
00038 //               many modeling packages call a sphere mapping: the x
00039 //               coordinate is proportional to azimuth, while the y
00040 //               coordinate is proportional to altitude.
00041 ////////////////////////////////////////////////////////////////////
00042 class EXPCL_PANDAFX PSphereLens : public Lens {
00043 PUBLISHED:
00044   INLINE PSphereLens();
00045 
00046 public:
00047   INLINE PSphereLens(const PSphereLens &copy);
00048   INLINE void operator = (const PSphereLens &copy);
00049 
00050 public:
00051   virtual PT(Lens) make_copy() const;
00052 
00053 protected:
00054   virtual bool extrude_impl(const LPoint3f &point2d,
00055                             LPoint3f &near_point, LPoint3f &far_point) const;
00056   virtual bool project_impl(const LPoint3f &point3d, LPoint3f &point2d) const;
00057 
00058   virtual float fov_to_film(float fov, float focal_length, bool horiz) const;
00059   virtual float fov_to_focal_length(float fov, float film_size, bool horiz) const;
00060   virtual float film_to_fov(float film_size, float focal_length, bool horiz) const;
00061 
00062 public:
00063   virtual TypeHandle get_type() const {
00064     return get_class_type();
00065   }
00066   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00067   static TypeHandle get_class_type() {
00068     return _type_handle;
00069   }
00070   static void init_type() {
00071     Lens::init_type();
00072     register_type(_type_handle, "PSphereLens",
00073                   Lens::get_class_type());
00074   }
00075 
00076 private:
00077   static TypeHandle _type_handle;
00078 };
00079 
00080 #include "pSphereLens.I"
00081 
00082 #endif

Generated on Fri May 2 00:36:42 2003 for Panda by doxygen1.3