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