Panda3D
 All Classes Functions Variables Enumerations
perspectiveLens.h
1 // Filename: perspectiveLens.h
2 // Created by: drose (18Feb99)
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 PERSPECTIVELENS_H
16 #define PERSPECTIVELENS_H
17 
18 #include "pandabase.h"
19 
20 #include "lens.h"
21 
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : PerspectiveLens
25 // Description : A perspective-type lens: a normal camera.
26 ////////////////////////////////////////////////////////////////////
27 class EXPCL_PANDA_GOBJ PerspectiveLens : public Lens {
28 PUBLISHED:
29  INLINE PerspectiveLens();
30  INLINE PerspectiveLens(PN_stdfloat hfov, PN_stdfloat vfov);
31 
32 public:
33  INLINE PerspectiveLens(const PerspectiveLens &copy);
34  INLINE void operator = (const PerspectiveLens &copy);
35 
36 public:
37  virtual PT(Lens) make_copy() const;
38  virtual bool is_linear() const;
39  virtual bool is_perspective() const;
40 
41 protected:
42  virtual bool do_extrude_depth(const CData *cdata, const LPoint3 &point2d,
43  LPoint3 &point3d) const;
44  virtual void do_compute_projection_mat(Lens::CData *lens_cdata);
45 
46  virtual PN_stdfloat fov_to_film(PN_stdfloat fov, PN_stdfloat focal_length, bool horiz) const;
47  virtual PN_stdfloat fov_to_focal_length(PN_stdfloat fov, PN_stdfloat film_size, bool horiz) const;
48  virtual PN_stdfloat film_to_fov(PN_stdfloat film_size, PN_stdfloat focal_length, bool horiz) const;
49 
50 public:
51  static void register_with_read_factory();
52 
53 protected:
54  static TypedWritable *make_from_bam(const FactoryParams &params);
55 
56 public:
57  virtual TypeHandle get_type() const {
58  return get_class_type();
59  }
60  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
61  static TypeHandle get_class_type() {
62  return _type_handle;
63  }
64  static void init_type() {
65  Lens::init_type();
66  register_type(_type_handle, "PerspectiveLens",
67  Lens::get_class_type());
68  }
69 
70 private:
71  static TypeHandle _type_handle;
72 };
73 
74 #include "perspectiveLens.I"
75 
76 #endif
A base class for any number of different kinds of lenses, linear and otherwise.
Definition: lens.h:45
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
virtual bool is_perspective() const
Returns true if the lens represents a perspective projection (i.e.
Definition: lens.cxx:627
virtual bool is_linear() const
Returns true if the lens represents a linear projection (e.g.
Definition: lens.cxx:615
A perspective-type lens: a normal camera.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85