Panda3D
 All Classes Functions Variables Enumerations
cylindricalLens.h
1 // Filename: cylindricalLens.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 CYLINDRICALLENS_H
16 #define CYLINDRICALLENS_H
17 
18 #include "pandabase.h"
19 
20 #include "lens.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : CylindricalLens
24 // Description : A cylindrical lens. This is the kind of lens
25 // generally used for extremely wide panoramic shots.
26 // It behaves like a normal perspective lens in the
27 // vertical direction, but it is non-linear in the
28 // horizontal dimension: a point on the film corresponds
29 // to a point in space in linear proportion to its angle
30 // to the camera, not to its straight-line distance from
31 // the center.
32 //
33 // This allows up to 360 degree lenses in the horizontal
34 // dimension, with relatively little distortion. The
35 // distortion is not very apparent between two
36 // relatively nearby points on the film, but it becomes
37 // increasingly evident as you compare points widely
38 // spaced on the film.
39 ////////////////////////////////////////////////////////////////////
40 class EXPCL_PANDAFX CylindricalLens : public Lens {
41 PUBLISHED:
42  INLINE CylindricalLens();
43 
44 public:
45  INLINE CylindricalLens(const CylindricalLens &copy);
46  INLINE void operator = (const CylindricalLens &copy);
47 
48 public:
49  virtual PT(Lens) make_copy() const;
50 
51 protected:
52  virtual bool do_extrude(const Lens::CData *lens_cdata, const LPoint3 &point2d,
53  LPoint3 &near_point, LPoint3 &far_point) const;
54  virtual bool do_extrude_vec(const Lens::CData *lens_cdata, const LPoint3 &point2d,
55  LVector3 &vec) const;
56  virtual bool do_project(const Lens::CData *lens_cdata,
57  const LPoint3 &point3d, LPoint3 &point2d) const;
58 
59  virtual PN_stdfloat fov_to_film(PN_stdfloat fov, PN_stdfloat focal_length, bool horiz) const;
60  virtual PN_stdfloat fov_to_focal_length(PN_stdfloat fov, PN_stdfloat film_size, bool horiz) const;
61  virtual PN_stdfloat film_to_fov(PN_stdfloat film_size, PN_stdfloat focal_length, bool horiz) const;
62 
63 public:
64  virtual TypeHandle get_type() const {
65  return get_class_type();
66  }
67  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
68  static TypeHandle get_class_type() {
69  return _type_handle;
70  }
71  static void init_type() {
72  Lens::init_type();
73  register_type(_type_handle, "CylindricalLens",
74  Lens::get_class_type());
75  }
76 
77 private:
78  static TypeHandle _type_handle;
79 };
80 
81 #include "cylindricalLens.I"
82 
83 #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 cylindrical lens.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85