Lagrange
Loading...
Searching...
No Matches
check_simple_scenes_equal.h
1/*
2 * Copyright 2026 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12
13#pragma once
14
15#include <lagrange/scene/SimpleScene.h>
16#include <lagrange/testing/check_meshes_equal.h>
17
18// clang-format off
19#include <lagrange/utils/warnoff.h>
20#include <catch2/catch_test_macros.hpp>
21#include <lagrange/utils/warnon.h>
22// clang-format on
23
24namespace lagrange::testing {
25
40template <typename Scalar, typename Index, size_t Dimension>
41void check_simple_scenes_equal(
42 const scene::SimpleScene<Scalar, Index, Dimension>& a,
43 const scene::SimpleScene<Scalar, Index, Dimension>& b)
44{
45 REQUIRE(a.get_num_meshes() == b.get_num_meshes());
46
47 for (Index i = 0; i < a.get_num_meshes(); ++i) {
48 check_meshes_equal(a.get_mesh(i), b.get_mesh(i));
49 REQUIRE(a.get_num_instances(i) == b.get_num_instances(i));
50
51 for (Index j = 0; j < a.get_num_instances(i); ++j) {
52 const auto& inst_a = a.get_instance(i, j);
53 const auto& inst_b = b.get_instance(i, j);
54 REQUIRE(inst_a.mesh_index == inst_b.mesh_index);
55 REQUIRE(inst_a.transform.matrix().isApprox(inst_b.transform.matrix(), Scalar(0)));
56 }
57 }
58}
59
60} // namespace lagrange::testing
@ Scalar
Mesh attribute must have exactly 1 channel.
Definition AttributeFwd.h:56