Panda3D
 All Classes Functions Variables Enumerations
fisheyeLens.h
1 // Filename: fisheyeLens.h
2 // Created by: drose (12Dec01)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef FISHEYELENS_H
16 #define FISHEYELENS_H
17 
18 #include "pandabase.h"
19 
20 #include "lens.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : FisheyeLens
24 // Description : A fisheye lens. This nonlinear lens introduces a
25 // spherical distortion to the image, which is minimal
26 // at small angles from the lens, and increases at
27 // larger angles from the lens. The field of view may
28 // extend to 360 degrees.
29 ////////////////////////////////////////////////////////////////////
30 class EXPCL_PANDAFX FisheyeLens : public Lens {
31 PUBLISHED:
32  INLINE FisheyeLens();
33 
34 public:
35  INLINE FisheyeLens(const FisheyeLens &copy);
36  INLINE void operator = (const FisheyeLens &copy);
37 
38 public:
39  virtual PT(Lens) make_copy() const;
40 
41 protected:
42  virtual bool do_extrude(const Lens::CData *lens_cdata, const LPoint3 &point2d,
43  LPoint3 &near_point, LPoint3 &far_point) const;
44  virtual bool do_extrude_vec(const Lens::CData *lens_cdata, const LPoint3 &point2d,
45  LVector3 &vec) const;
46  virtual bool do_project(const Lens::CData *lens_cdata,
47  const LPoint3 &point3d, LPoint3 &point2d) const;
48 
49  virtual PN_stdfloat fov_to_film(PN_stdfloat fov, PN_stdfloat focal_length, bool horiz) const;
50  virtual PN_stdfloat fov_to_focal_length(PN_stdfloat fov, PN_stdfloat film_size, bool horiz) const;
51  virtual PN_stdfloat film_to_fov(PN_stdfloat film_size, PN_stdfloat focal_length, bool horiz) const;
52 
53 public:
54  virtual TypeHandle get_type() const {
55  return get_class_type();
56  }
57  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
58  static TypeHandle get_class_type() {
59  return _type_handle;
60  }
61  static void init_type() {
62  Lens::init_type();
63  register_type(_type_handle, "FisheyeLens",
64  Lens::get_class_type());
65  }
66 
67 private:
68  static TypeHandle _type_handle;
69 };
70 
71 #include "fisheyeLens.I"
72 
73 #endif
A base class for any number of different kinds of lenses, linear and otherwise.
Definition: lens.h:45
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
A fisheye lens.
Definition: fisheyeLens.h:30
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85