Panda3D

fisheyeLens.h

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 &copy);
00036   INLINE void operator = (const FisheyeLens &copy);
00037 
00038 public:
00039   virtual PT(Lens) make_copy() const;
00040 
00041 protected:
00042   virtual bool extrude_impl(const LPoint3f &point2d,
00043                             LPoint3f &near_point, LPoint3f &far_point) const;
00044   virtual bool extrude_vec_impl(const LPoint3f &point2d, LVector3f &vec) const;
00045   virtual bool project_impl(const LPoint3f &point3d, LPoint3f &point2d) const;
00046 
00047   virtual float fov_to_film(float fov, float focal_length, bool horiz) const;
00048   virtual float fov_to_focal_length(float fov, float film_size, bool horiz) const;
00049   virtual float film_to_fov(float film_size, float focal_length, bool horiz) const;
00050 
00051 public:
00052   virtual TypeHandle get_type() const {
00053     return get_class_type();
00054   }
00055   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00056   static TypeHandle get_class_type() {
00057     return _type_handle;
00058   }
00059   static void init_type() {
00060     Lens::init_type();
00061     register_type(_type_handle, "FisheyeLens",
00062                   Lens::get_class_type());
00063   }
00064 
00065 private:
00066   static TypeHandle _type_handle;
00067 };
00068 
00069 #include "fisheyeLens.I"
00070 
00071 #endif
 All Classes Functions Variables Enumerations