Panda3D
oSphereLens.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 oSphereLens.h
10  * @author drose
11  * @date 2011-02-25
12  */
13 
14 #ifndef OSPHERELENS_H
15 #define OSPHERELENS_H
16 
17 #include "pandabase.h"
18 
19 #include "lens.h"
20 
21 /**
22  * A OSphereLens is a special nonlinear lens that doesn't correspond to any
23  * real physical lenses. It's primarily useful for generating 360-degree
24  * wraparound images while avoiding the distortion associated with fisheye
25  * images.
26  *
27  * A OSphereLens is similar to a Cylindrical lens and PSphereLens, except that
28  * it is orthographic in the vertical direction.
29  */
30 class EXPCL_PANDAFX OSphereLens : public Lens {
31 PUBLISHED:
32  INLINE OSphereLens();
33 
34 public:
35  INLINE OSphereLens(const OSphereLens &copy);
36  INLINE void operator = (const OSphereLens &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_project(const Lens::CData *lens_cdata,
45  const LPoint3 &point3d, LPoint3 &point2d) const;
46 
47  virtual PN_stdfloat fov_to_film(PN_stdfloat fov, PN_stdfloat focal_length, bool horiz) const;
48  virtual PN_stdfloat fov_to_focal_length(PN_stdfloat fov, PN_stdfloat film_size, bool horiz) const;
49  virtual PN_stdfloat film_to_fov(PN_stdfloat film_size, PN_stdfloat focal_length, bool horiz) const;
50 
51 public:
52  virtual TypeHandle get_type() const {
53  return get_class_type();
54  }
55  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
56  static TypeHandle get_class_type() {
57  return _type_handle;
58  }
59  static void init_type() {
60  Lens::init_type();
61  register_type(_type_handle, "OSphereLens",
62  Lens::get_class_type());
63  }
64 
65 private:
66  static TypeHandle _type_handle;
67 };
68 
69 #include "oSphereLens.I"
70 
71 #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 OSphereLens is a special nonlinear lens that doesn't correspond to any real physical lenses.
Definition: oSphereLens.h:30
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81