|
@@ -120,6 +120,18 @@ set_point(int x, int y, const LVecBase3f &point) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: PfmFile::set_point
|
|
|
|
|
+// Access: Published
|
|
|
|
|
+// Description: Replaces the 3-component point value at the indicated
|
|
|
|
|
+// point. In a 1-channel image, the channel value is in
|
|
|
|
|
+// the x component.
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+INLINE void PfmFile::
|
|
|
|
|
+set_point(int x, int y, const LVecBase3d &point) {
|
|
|
|
|
+ set_point(x, y, LCAST(PN_float32, point));
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: PfmFile::modify_point
|
|
// Function: PfmFile::modify_point
|
|
|
// Access: Published
|
|
// Access: Published
|
|
@@ -178,6 +190,18 @@ set_point4(int x, int y, const LVecBase4f &point) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: PfmFile::set_point4
|
|
|
|
|
+// Access: Published
|
|
|
|
|
+// Description: Replaces the 4-component point value at the indicated
|
|
|
|
|
+// point. In a 1-channel image, the channel value is in
|
|
|
|
|
+// the x component.
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+INLINE void PfmFile::
|
|
|
|
|
+set_point4(int x, int y, const LVecBase4d &point) {
|
|
|
|
|
+ set_point4(x, y, LCAST(PN_float32, point));
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: PfmFile::modify_point4
|
|
// Function: PfmFile::modify_point4
|
|
|
// Access: Published
|
|
// Access: Published
|
|
@@ -205,7 +229,24 @@ modify_point4(int x, int y) {
|
|
|
// 0, get_y_size()).
|
|
// 0, get_y_size()).
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE bool PfmFile::
|
|
INLINE bool PfmFile::
|
|
|
-calc_autocrop(LVecBase4 &range) const {
|
|
|
|
|
|
|
+calc_autocrop(LVecBase4f &range) const {
|
|
|
|
|
+ int x_begin, x_end, y_begin, y_end;
|
|
|
|
|
+ bool result = calc_autocrop(x_begin, x_end, y_begin, y_end);
|
|
|
|
|
+ range.set(x_begin, x_end, y_begin, y_end);
|
|
|
|
|
+ return result;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: PfmFile::calc_autocrop
|
|
|
|
|
+// Access: Published
|
|
|
|
|
+// Description: Computes the minimum range of x and y across the PFM
|
|
|
|
|
+// file that include all points. If there are no points
|
|
|
|
|
+// with no_data_value in the grid--that is, all points
|
|
|
|
|
+// are included--then this will return (0, get_x_size(),
|
|
|
|
|
+// 0, get_y_size()).
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+INLINE bool PfmFile::
|
|
|
|
|
+calc_autocrop(LVecBase4d &range) const {
|
|
|
int x_begin, x_end, y_begin, y_end;
|
|
int x_begin, x_end, y_begin, y_end;
|
|
|
bool result = calc_autocrop(x_begin, x_end, y_begin, y_end);
|
|
bool result = calc_autocrop(x_begin, x_end, y_begin, y_end);
|
|
|
range.set(x_begin, x_end, y_begin, y_end);
|
|
range.set(x_begin, x_end, y_begin, y_end);
|
|
@@ -252,6 +293,17 @@ set_no_data_chan4(bool chan4) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: PfmFile::set_no_data_value
|
|
|
|
|
+// Access: Published
|
|
|
|
|
+// Description: Sets the special value that means "no data" when it
|
|
|
|
|
+// appears in the pfm file.
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+INLINE void PfmFile::
|
|
|
|
|
+set_no_data_value(const LPoint4d &no_data_value) {
|
|
|
|
|
+ set_no_data_value(LCAST(PN_float32, no_data_value));
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: PfmFile::set_no_data_value
|
|
// Function: PfmFile::set_no_data_value
|
|
|
// Access: Published
|
|
// Access: Published
|
|
@@ -289,6 +341,40 @@ get_no_data_value() const {
|
|
|
return _no_data_value;
|
|
return _no_data_value;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: PfmFile::xform
|
|
|
|
|
+// Access: Published
|
|
|
|
|
+// Description: Applies the indicated transform matrix to all points
|
|
|
|
|
+// in-place.
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+INLINE void PfmFile::
|
|
|
|
|
+xform(const LMatrix4d &transform) {
|
|
|
|
|
+ xform(LCAST(PN_float32, transform));
|
|
|
|
|
+}
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: PfmFile::compute_planar_bounds
|
|
|
|
|
+// Access: Published
|
|
|
|
|
+// Description: Computes the minmax bounding volume of the points in
|
|
|
|
|
+// 3-D space, assuming the points represent a
|
|
|
|
|
+// mostly-planar surface.
|
|
|
|
|
+//
|
|
|
|
|
+// This algorithm works by sampling the (square)
|
|
|
|
|
+// sample_radius pixels at the four point_dist corners
|
|
|
|
|
+// around the center (cx - pd, cx + pd) and so on, to
|
|
|
|
|
+// approximate the plane of the surface. Then all of
|
|
|
|
|
+// the points are projected into that plane and the
|
|
|
|
|
+// bounding volume of the entire mesh within that plane
|
|
|
|
|
+// is determined. If points_only is true, the bounding
|
|
|
|
|
+// volume of only those four points is determined.
|
|
|
|
|
+//
|
|
|
|
|
+// center, point_dist and sample_radius are in UV space,
|
|
|
|
|
+// i.e. in the range 0..1.
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+INLINE PT(BoundingHexahedron) PfmFile::
|
|
|
|
|
+compute_planar_bounds(const LPoint2d ¢er, PN_float32 point_dist, PN_float32 sample_radius, bool points_only) const {
|
|
|
|
|
+ return compute_planar_bounds(LCAST(PN_float32, center), point_dist, sample_radius, points_only);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: PfmFile::set_vis_inverse
|
|
// Function: PfmFile::set_vis_inverse
|
|
|
// Access: Published
|
|
// Access: Published
|