mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
a few checks against bad data
This commit is contained in:
parent
b5eeced04a
commit
1c9395b311
@ -109,6 +109,7 @@ get_point(int x, int y) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE void PfmFile::
|
INLINE void PfmFile::
|
||||||
set_point(int x, int y, const LVecBase3 &point) {
|
set_point(int x, int y, const LVecBase3 &point) {
|
||||||
|
nassertv(!point.is_nan());
|
||||||
nassertv(x >= 0 && x < _x_size);
|
nassertv(x >= 0 && x < _x_size);
|
||||||
nassertv(y >= 0 && y < _y_size);
|
nassertv(y >= 0 && y < _y_size);
|
||||||
_table[y * _x_size + x] = point;
|
_table[y * _x_size + x] = point;
|
||||||
|
@ -208,8 +208,10 @@ read(istream &in) {
|
|||||||
LittleEndian value(&data, sizeof(data));
|
LittleEndian value(&data, sizeof(data));
|
||||||
PN_float32 result;
|
PN_float32 result;
|
||||||
value.store_value(&result, sizeof(result));
|
value.store_value(&result, sizeof(result));
|
||||||
|
if (!cnan(result)) {
|
||||||
point[ci] = result;
|
point[ci] = result;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
_table.push_back(point);
|
_table.push_back(point);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -221,8 +223,10 @@ read(istream &in) {
|
|||||||
BigEndian value(&data, sizeof(data));
|
BigEndian value(&data, sizeof(data));
|
||||||
PN_float32 result;
|
PN_float32 result;
|
||||||
value.store_value(&result, sizeof(result));
|
value.store_value(&result, sizeof(result));
|
||||||
|
if (!cnan(result)) {
|
||||||
point[ci] = result;
|
point[ci] = result;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
_table.push_back(point);
|
_table.push_back(point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -879,6 +883,7 @@ make_vis_mesh_geom(GeomNode *gnode, bool inverted) const {
|
|||||||
n[2] += v0[0] * v1[1] - v0[1] * v1[0];
|
n[2] += v0[0] * v1[1] - v0[1] * v1[0];
|
||||||
}
|
}
|
||||||
n.normalize();
|
n.normalize();
|
||||||
|
nassertv(!n.is_nan());
|
||||||
if (inverted) {
|
if (inverted) {
|
||||||
n = -n;
|
n = -n;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user