Panda3D
 All Classes Functions Variables Enumerations
pSphereLens.h
1 // Filename: pSphereLens.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 PSPHERELENS_H
16 #define PSPHERELENS_H
17 
18 #include "pandabase.h"
19 
20 #include "lens.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : PSphereLens
24 // Description : A PSphereLens is a special nonlinear lens that
25 // doesn't correspond to any real physical lenses. It's
26 // primarily useful for generating 360-degree wraparound
27 // images while avoiding the distortion associated with
28 // fisheye images.
29 //
30 // A PSphereLens is similar to a cylindrical lens,
31 // except it is also curved in the vertical direction.
32 // This allows it to extend to both poles in the
33 // vertical direction. The mapping is similar to what
34 // many modeling packages call a sphere mapping: the x
35 // coordinate is proportional to azimuth, while the y
36 // coordinate is proportional to altitude.
37 ////////////////////////////////////////////////////////////////////
38 class EXPCL_PANDAFX PSphereLens : public Lens {
39 PUBLISHED:
40  INLINE PSphereLens();
41 
42 public:
43  INLINE PSphereLens(const PSphereLens &copy);
44  INLINE void operator = (const PSphereLens &copy);
45 
46 public:
47  virtual PT(Lens) make_copy() const;
48 
49 protected:
50  virtual bool do_extrude(const Lens::CData *lens_cdata, const LPoint3 &point2d,
51  LPoint3 &near_point, LPoint3 &far_point) const;
52  virtual bool do_project(const Lens::CData *lens_cdata,
53  const LPoint3 &point3d, LPoint3 &point2d) const;
54 
55  virtual PN_stdfloat fov_to_film(PN_stdfloat fov, PN_stdfloat focal_length, bool horiz) const;
56  virtual PN_stdfloat fov_to_focal_length(PN_stdfloat fov, PN_stdfloat film_size, bool horiz) const;
57  virtual PN_stdfloat film_to_fov(PN_stdfloat film_size, PN_stdfloat focal_length, bool horiz) const;
58 
59 public:
60  virtual TypeHandle get_type() const {
61  return get_class_type();
62  }
63  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
64  static TypeHandle get_class_type() {
65  return _type_handle;
66  }
67  static void init_type() {
68  Lens::init_type();
69  register_type(_type_handle, "PSphereLens",
70  Lens::get_class_type());
71  }
72 
73 private:
74  static TypeHandle _type_handle;
75 };
76 
77 #include "pSphereLens.I"
78 
79 #endif
A PSphereLens is a special nonlinear lens that doesn't correspond to any real physical lenses...
Definition: pSphereLens.h:38
A base class for any number of different kinds of lenses, linear and otherwise.
Definition: lens.h:45
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85