Panda3D
Loading...
Searching...
No Matches
pfmVizzer.I
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 pfmVizzer.I
10 * @author drose
11 * @date 2012-09-30
12 */
13
14/**
15 * Returns the reference to the PfmFile manipulated by this PfmVizzer.
16 */
18get_pfm() {
19 return _pfm;
20}
21
22INLINE PfmVizzer::
23~PfmVizzer() {
24}
25
26/**
27 * Returns the reference to the PfmFile manipulated by this PfmVizzer.
28 */
29INLINE const PfmFile &PfmVizzer::
30get_pfm() const {
31 return _pfm;
32}
33
34/**
35 * Sets the vis_inverse flag. When this flag is true, vis meshes and point
36 * clouds are generated with the 3-d depth value in the texture coordinates,
37 * and the 2-d index value in the vertex position. When it is false, meshes
38 * are generated normally, with the 3-d depth value in the vertex position and
39 * the 2-d index value in the texture coordinates.
40 *
41 * This may be used in lieu of the lower-level add_vis_column().
42 */
43INLINE void PfmVizzer::
44set_vis_inverse(bool vis_inverse) {
45 _vis_inverse = vis_inverse;
47}
48
49/**
50 * Returns the vis_inverse flag. See set_vis_inverse().
51 */
52INLINE bool PfmVizzer::
53get_vis_inverse() const {
54 return _vis_inverse;
55}
56
57/**
58 * If the flat_texcoord_name is specified, it is the name of an additional
59 * vertex column that will be created for the "flat" texture coordinates, i.e.
60 * the original 0..1 values that correspond to the 2-D index position of each
61 * point in the original pfm file.
62 *
63 * These are the same values that will be assigned to the default texture
64 * coordinates if the vis_inverse flag is *not* true.
65 *
66 * This may be used in lieu of the lower-level add_vis_column().
67 */
68INLINE void PfmVizzer::
69set_flat_texcoord_name(InternalName *flat_texcoord_name) {
70 _flat_texcoord_name = flat_texcoord_name;
72}
73
74/**
75 * Resets the flat_texcoord_name to empty, so that additional texture
76 * coordinates are not created.
77 *
78 * This may be used in lieu of the lower-level add_vis_column().
79 */
80INLINE void PfmVizzer::
82 _flat_texcoord_name = nullptr;
83}
84
85/**
86 * Returns the flat_texcoord_name. See set_flat_texcoord_name().
87 */
90 return _flat_texcoord_name;
91}
92
93/**
94 * Sets the vis_2d flag. When this flag is true, only the first two (x, y)
95 * value of each depth point is considered meaningful; the z component is
96 * ignored. This is only relevant for generating visualizations.
97 *
98 * This may be used in lieu of the lower-level add_vis_column().
99 */
100INLINE void PfmVizzer::
101set_vis_2d(bool vis_2d) {
102 _vis_2d = vis_2d;
104}
105
106/**
107 * Returns the vis_2d flag. See set_vis_2d().
108 */
109INLINE bool PfmVizzer::
110get_vis_2d() const {
111 return _vis_2d;
112}
113
114/**
115 * Sets the keep_beyond_lens flag. When this flag is true, points that fall
116 * outside of the normal lens range in project() or in add_vis_column() will
117 * be retained anyway; when it is false, these points will be discarded.
118 */
119INLINE void PfmVizzer::
120set_keep_beyond_lens(bool keep_beyond_lens) {
121 _keep_beyond_lens = keep_beyond_lens;
122}
123
124/**
125 * Returns the keep_beyond_lens flag. See set_keep_beyond_lens().
126 */
127INLINE bool PfmVizzer::
128get_keep_beyond_lens() const {
129 return _keep_beyond_lens;
130}
131
132/**
133 * Specifies a blending map--a grayscale image--that will be applied to the
134 * vertex color during generate_vis_mesh() and generate_vis_points(). The
135 * image size must exactly match the mesh size of the PfmVizzer.
136 *
137 * Ownership of the pointer is not kept by the PfmVizzer; it is your
138 * responsibility to ensure it does not destruct during the lifetime of the
139 * PfmVizzer (or at least not before your subsequent call to
140 * generate_vis_mesh()).
141 */
142INLINE void PfmVizzer::
143set_vis_blend(const PNMImage *vis_blend) {
144 _vis_blend = vis_blend;
145}
146
147/**
148 * Removes the blending map set by a prior call to set_vis_blend().
149 */
150INLINE void PfmVizzer::
152 _vis_blend = nullptr;
153}
154
155/**
156 * Returns the blending map set by the most recent call to set_vis_blend(), or
157 * NULL if there is no blending map in effect.
158 */
160get_vis_blend() const {
161 return _vis_blend;
162}
163
164/**
165 * Assigns an auxiliary PfmFile to this PfmVizzer. This file will be queried
166 * by column types CT_aux_vertex1/2/3, but has no other meaning to the vizzer.
167 * This size of this PfmFile should exactly match the base PfmFile. No
168 * reference count is held and no copy is made; the caller is responsible for
169 * ensuring that the auxiliary PfmFile will persist throughout the lifetime of
170 * the PfmVizzer it is assigned to.
171 */
172INLINE void PfmVizzer::
173set_aux_pfm(const PfmFile *pfm) {
174 assert(pfm == nullptr || (pfm->get_x_size() == _pfm.get_x_size() &&
175 pfm->get_y_size() == _pfm.get_y_size()));
176 _aux_pfm = pfm;
177}
178
179/**
180 * Removes the auxiliary PfmFile from this PfmVizzer.
181 */
182INLINE void PfmVizzer::
184 _aux_pfm = nullptr;
185}
186
187/**
188 * Returns the reference to the auxiliary PfmFile queried by this PfmVizzer.
189 * This contains the values that will be reflected in CT_aux_vertex3 etc. See
190 * set_aux_pfm().
191 */
192INLINE const PfmFile *PfmVizzer::
193get_aux_pfm() const {
194 return _aux_pfm;
195}
196
197/**
198 *
199 */
200INLINE PfmVizzer::VisColumn::
201VisColumn() {
202 _undist_lut = nullptr;
203}
Encodes a string name in a hash table, mapping it to a pointer.
int get_x_size() const
Returns the number of pixels in the X direction.
int get_y_size() const
Returns the number of pixels in the Y direction.
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
Definition pnmImage.h:58
Defines a pfm file, a 2-d table of floating-point numbers, either 3-component or 1-component,...
Definition pfmFile.h:31
bool get_vis_inverse() const
Returns the vis_inverse flag.
Definition pfmVizzer.I:53
void clear_aux_pfm()
Removes the auxiliary PfmFile from this PfmVizzer.
Definition pfmVizzer.I:183
void clear_vis_columns()
Removes all of the previously-added vis columns in preparation for building a new list.
void clear_flat_texcoord_name()
Resets the flat_texcoord_name to empty, so that additional texture coordinates are not created.
Definition pfmVizzer.I:81
bool get_keep_beyond_lens() const
Returns the keep_beyond_lens flag.
Definition pfmVizzer.I:128
const PfmFile * get_aux_pfm() const
Returns the reference to the auxiliary PfmFile queried by this PfmVizzer.
Definition pfmVizzer.I:193
void set_aux_pfm(const PfmFile *pfm)
Assigns an auxiliary PfmFile to this PfmVizzer.
Definition pfmVizzer.I:173
void set_vis_blend(const PNMImage *vis_blend)
Specifies a blending map–a grayscale image–that will be applied to the vertex color during generate_v...
Definition pfmVizzer.I:143
InternalName * get_flat_texcoord_name() const
Returns the flat_texcoord_name.
Definition pfmVizzer.I:89
void set_vis_2d(bool vis_2d)
Sets the vis_2d flag.
Definition pfmVizzer.I:101
void clear_vis_blend()
Removes the blending map set by a prior call to set_vis_blend().
Definition pfmVizzer.I:151
PfmFile & get_pfm()
Returns the reference to the PfmFile manipulated by this PfmVizzer.
Definition pfmVizzer.I:18
void set_keep_beyond_lens(bool keep_beyond_lens)
Sets the keep_beyond_lens flag.
Definition pfmVizzer.I:120
void set_flat_texcoord_name(InternalName *flat_texcoord_name)
If the flat_texcoord_name is specified, it is the name of an additional vertex column that will be cr...
Definition pfmVizzer.I:69
void set_vis_inverse(bool vis_inverse)
Sets the vis_inverse flag.
Definition pfmVizzer.I:44
bool get_vis_2d() const
Returns the vis_2d flag.
Definition pfmVizzer.I:110
const PNMImage * get_vis_blend() const
Returns the blending map set by the most recent call to set_vis_blend(), or NULL if there is no blend...
Definition pfmVizzer.I:160