未验证 提交 950d4813 编写于 作者: M Michael Klimushyn 提交者: GitHub

Clamp when overflowing z bounds (#9402)

上级 cd973f8a
......@@ -299,12 +299,18 @@ SceneUpdateContext::Frame::Frame(SceneUpdateContext& context,
color_(color),
paint_bounds_(SkRect::MakeEmpty()),
layer_(layer) {
if (depth > -1 && world_elevation > depth) {
// TODO(mklim): Deal with bounds overflow more elegantly. We'd like to be
// able to have developers specify the behavior here to alternatives besides
// clamping, like normalization on some arbitrary curve.
// Clamp the local z coordinate at our max bound. Take into account the
// parent z position here to fix clamping in cases where the child is
// overflowing because of its parents.
const float parent_elevation = world_elevation - local_elevation;
local_elevation = depth - parent_elevation;
}
if (local_elevation != 0.0) {
if (depth > -1 && world_elevation >= depth) {
// TODO(mklim): Deal with bounds overflow correctly.
FML_LOG(ERROR) << "Elevation " << world_elevation << " is outside of "
<< depth;
}
entity_node().SetTranslation(0.f, 0.f, -local_elevation);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册