mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
expand PfmFile::merge() to support other than 3 channels, and not to fuss about NaN's in the result
This commit is contained in:
parent
78ab82b88e
commit
fb6637ddac
@ -1449,17 +1449,20 @@ apply_1d_lut(int channel, const PfmFile &lut, PN_float32 x_scale) {
|
|||||||
void PfmFile::
|
void PfmFile::
|
||||||
merge(const PfmFile &other) {
|
merge(const PfmFile &other) {
|
||||||
nassertv(is_valid() && other.is_valid());
|
nassertv(is_valid() && other.is_valid());
|
||||||
nassertv(other._x_size == _x_size && other._y_size == _y_size);
|
nassertv(other._x_size == _x_size && other._y_size == _y_size && other._num_channels == _num_channels);
|
||||||
|
|
||||||
if (!_has_no_data_value) {
|
if (!_has_no_data_value) {
|
||||||
// Trivial no-op.
|
// Trivial no-op.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int yi = 0; yi < _y_size; ++yi) {
|
size_t point_size = _num_channels * sizeof(PN_float32);
|
||||||
for (int xi = 0; xi < _x_size; ++xi) {
|
for (int y = 0; y < _y_size; ++y) {
|
||||||
if (!has_point(xi, yi) && other.has_point(xi, yi)) {
|
for (int x = 0; x < _x_size; ++x) {
|
||||||
set_point(xi, yi, other.get_point(xi, yi));
|
if (!has_point(x, y) && other.has_point(x, y)) {
|
||||||
|
memcpy(&_table[(y * _x_size + x) * _num_channels],
|
||||||
|
&other._table[(y * _x_size + x) * _num_channels],
|
||||||
|
point_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user