Panda3D

Loading...
Searching...
No Matches
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 */
25 class EXPCL_PANDA_GOBJ PerspectiveLens : public Lens {
26PUBLISHED:
27 INLINE PerspectiveLens();
28 INLINE explicit PerspectiveLens(PN_stdfloat hfov, PN_stdfloat vfov);
29
30 public:
31 INLINE PerspectiveLens(const PerspectiveLens &copy);
32 INLINE void operator = (const PerspectiveLens &copy);
33
34 public:
35 virtual PT(Lens) make_copy() const;
36 virtual bool is_linear() const;
37 virtual bool is_perspective() const;
38
39 protected:
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
48 public:
49 static void register_with_read_factory();
50
51 protected:
52 static TypedWritable *make_from_bam(const FactoryParams &params);
53
54 public:
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
68 private:
69 static TypeHandle _type_handle;
70};
71
72#include "perspectiveLens.I"
73
74#endif
FactoryParams
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition factoryParams.h:36
Lens::is_linear
virtual bool is_linear() const
Returns true if the lens represents a linear projection (e.g.
Definition lens.cxx:540
Lens::is_perspective
virtual bool is_perspective() const
Returns true if the lens represents a perspective projection (i.e.
Definition lens.cxx:549
PerspectiveLens::make_copy
virtual PointerTo< Lens > make_copy() const
Allocates a new Lens just like this one.
Definition perspectiveLens.cxx:24
PerspectiveLens::register_with_read_factory
static void register_with_read_factory()
Tells the BamReader how to create objects of type Lens.
Definition perspectiveLens.cxx:196
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
lens.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
perspectiveLens.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
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