Files
test2/intern/cycles/test/util_boundbox_test.cpp
Sergey Sharybin 24fbd71a56 Fix #130829: Incorrect render result with light trees
The original report stumbled upon this issue with a more tricky
configuration when light linking is combined with light tress.
However, the actual contributing factor was a mesh with emission
shader which is not assigned to any triangles. This triggered a
bug in the BoundBox::transformed() which converted non-valid bounds
to bounds by performing per-corner growing.

Additionally fix incorrect handling of shared nodes which only
worked for leaf nodes. This was due to the fact how the measure
was accumulated: it is possible that add() is called with an empty
measure.

Pull Request: https://projects.blender.org/blender/blender/pulls/134699
2025-02-18 13:11:46 +01:00

31 lines
855 B
C++

/* SPDX-FileCopyrightText: 2011-2025 Blender Foundation
*
* SPDX-License-Identifier: Apache-2.0 */
#include "util/boundbox.h"
#include "testing/testing.h"
#include "util/transform.h"
CCL_NAMESPACE_BEGIN
TEST(BoundBox, transformed)
{
{
const Transform tfm = transform_translate(make_float3(1, 2, 3));
const BoundBox orig_bounds(make_float3(-2, -3, -4), make_float3(3, 4, 5));
const BoundBox transformed_bounds = orig_bounds.transformed(&tfm);
EXPECT_LE(len(transformed_bounds.min - make_float3(-1, -1, -1)), 1e-6f);
EXPECT_LE(len(transformed_bounds.max - make_float3(4, 6, 8)), 1e-6f);
}
/* Non-valid boundbox should result in non-valid after transform. */
{
const Transform tfm = transform_scale(make_float3(1, 1, 1));
EXPECT_FALSE(BoundBox(BoundBox::empty).transformed(&tfm).valid());
}
}
CCL_NAMESPACE_END