mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
add optional undist_lut parameter to PfmVizzer::project()
This commit is contained in:
parent
68306f0c8f
commit
255027b18d
@ -54,7 +54,7 @@ PfmVizzer(PfmFile &pfm) : _pfm(pfm) {
|
|||||||
// texture image.
|
// texture image.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void PfmVizzer::
|
void PfmVizzer::
|
||||||
project(const Lens *lens) {
|
project(const Lens *lens, const PfmFile *undist_lut) {
|
||||||
nassertv(_pfm.is_valid());
|
nassertv(_pfm.is_valid());
|
||||||
|
|
||||||
static LMatrix4f to_uv(0.5f, 0.0f, 0.0f, 0.0f,
|
static LMatrix4f to_uv(0.5f, 0.0f, 0.0f, 0.0f,
|
||||||
@ -77,7 +77,19 @@ project(const Lens *lens) {
|
|||||||
_pfm.set_point4(xi, yi, LVecBase4f(0, 0, 0, 0));
|
_pfm.set_point4(xi, yi, LVecBase4f(0, 0, 0, 0));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p = to_uv.xform_point(LCAST(PN_float32, film));
|
// Now the lens gives us coordinates in the range [-1, 1].
|
||||||
|
// Rescale these to [0, 1].
|
||||||
|
LPoint3f uvw = film * to_uv;
|
||||||
|
|
||||||
|
if (undist_lut != NULL) {
|
||||||
|
// Apply the undistortion map, if given.
|
||||||
|
LPoint3f p2;
|
||||||
|
undist_lut->calc_bilinear_point(p2, uvw[0], 1.0 - uvw[1]);
|
||||||
|
uvw = p2;
|
||||||
|
uvw[1] = 1.0 - uvw[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
p = uvw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ PUBLISHED:
|
|||||||
INLINE PfmFile &get_pfm();
|
INLINE PfmFile &get_pfm();
|
||||||
INLINE const PfmFile &get_pfm() const;
|
INLINE const PfmFile &get_pfm() const;
|
||||||
|
|
||||||
BLOCKING void project(const Lens *lens);
|
BLOCKING void project(const Lens *lens, const PfmFile *undist_lut = NULL);
|
||||||
BLOCKING void extrude(const Lens *lens);
|
BLOCKING void extrude(const Lens *lens);
|
||||||
|
|
||||||
INLINE void set_vis_inverse(bool vis_inverse);
|
INLINE void set_vis_inverse(bool vis_inverse);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user