Panda3D
oSphereLens.h
1 // Filename: oSphereLens.h
2 // Created by: drose (25Feb11)
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 OSPHERELENS_H
16 #define OSPHERELENS_H
17 
18 #include "pandabase.h"
19 
20 #include "lens.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : OSphereLens
24 // Description : A OSphereLens 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 OSphereLens is similar to a Cylindrical lens and
31 // PSphereLens, except that it is orthographic in the
32 // vertical direction.
33 ////////////////////////////////////////////////////////////////////
34 class EXPCL_PANDAFX OSphereLens : public Lens {
35 PUBLISHED:
36  INLINE OSphereLens();
37 
38 public:
39  INLINE OSphereLens(const OSphereLens &copy);
40  INLINE void operator = (const OSphereLens &copy);
41 
42 public:
43  virtual PT(Lens) make_copy() const;
44 
45 protected:
46  virtual bool do_extrude(const Lens::CData *lens_cdata, const LPoint3 &point2d,
47  LPoint3 &near_point, LPoint3 &far_point) const;
48  virtual bool do_project(const Lens::CData *lens_cdata,
49  const LPoint3 &point3d, LPoint3 &point2d) const;
50 
51  virtual PN_stdfloat fov_to_film(PN_stdfloat fov, PN_stdfloat focal_length, bool horiz) const;
52  virtual PN_stdfloat fov_to_focal_length(PN_stdfloat fov, PN_stdfloat film_size, bool horiz) const;
53  virtual PN_stdfloat film_to_fov(PN_stdfloat film_size, PN_stdfloat focal_length, bool horiz) const;
54 
55 public:
56  virtual TypeHandle get_type() const {
57  return get_class_type();
58  }
59  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
60  static TypeHandle get_class_type() {
61  return _type_handle;
62  }
63  static void init_type() {
64  Lens::init_type();
65  register_type(_type_handle, "OSphereLens",
66  Lens::get_class_type());
67  }
68 
69 private:
70  static TypeHandle _type_handle;
71 };
72 
73 #include "oSphereLens.I"
74 
75 #endif
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
A OSphereLens is a special nonlinear lens that doesn't correspond to any real physical lenses...
Definition: oSphereLens.h:34
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85