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