Panda3D
perspectiveLens.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 perspectiveLens.h
10 * @author drose
11 * @date 1999-02-18
12 */
13
14#ifndef PERSPECTIVELENS_H
15#define PERSPECTIVELENS_H
16
17#include "pandabase.h"
18
19#include "lens.h"
20
21
22/**
23 * A perspective-type lens: a normal camera.
24 */
25class EXPCL_PANDA_GOBJ PerspectiveLens : public Lens {
26PUBLISHED:
27 INLINE PerspectiveLens();
28 INLINE explicit PerspectiveLens(PN_stdfloat hfov, PN_stdfloat vfov);
29
30public:
31 INLINE PerspectiveLens(const PerspectiveLens &copy);
32 INLINE void operator = (const PerspectiveLens &copy);
33
34public:
35 virtual PT(Lens) make_copy() const;
36 virtual bool is_linear() const;
37 virtual bool is_perspective() const;
38
39protected:
40 virtual bool do_extrude_depth(const CData *cdata, const LPoint3 &point2d,
41 LPoint3 &point3d) const;
42 virtual void do_compute_projection_mat(Lens::CData *lens_cdata);
43
44 virtual PN_stdfloat fov_to_film(PN_stdfloat fov, PN_stdfloat focal_length, bool horiz) const;
45 virtual PN_stdfloat fov_to_focal_length(PN_stdfloat fov, PN_stdfloat film_size, bool horiz) const;
46 virtual PN_stdfloat film_to_fov(PN_stdfloat film_size, PN_stdfloat focal_length, bool horiz) const;
47
48public:
49 static void register_with_read_factory();
50
51protected:
52 static TypedWritable *make_from_bam(const FactoryParams &params);
53
54public:
55 virtual TypeHandle get_type() const {
56 return get_class_type();
57 }
58 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
59 static TypeHandle get_class_type() {
60 return _type_handle;
61 }
62 static void init_type() {
63 Lens::init_type();
64 register_type(_type_handle, "PerspectiveLens",
65 Lens::get_class_type());
66 }
67
68private:
69 static TypeHandle _type_handle;
70};
71
72#include "perspectiveLens.I"
73
74#endif
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
A base class for any number of different kinds of lenses, linear and otherwise.
Definition: lens.h:41
A perspective-type lens: a normal camera.
virtual bool is_linear() const
Returns true if the lens represents a linear projection (e.g.
virtual bool is_perspective() const
Returns true if the lens represents a perspective projection (i.e.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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