SuperDex Physics C++ API
Loading...
Searching...
No Matches
model_data_inl.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// PLEASE DO NOT ADD OTHER INCLUDES HERE. This header is included in the mochi_physics public API.
18#include "model_data.h" // Reverse include for intellisense
19
20namespace superdex {
21
30
39
41 : box(src.box),
42 plane(src.plane),
43 sphere(src.sphere),
45 if (src.mesh) {
46 this->mesh.emplace(MeshDataView{*src.mesh});
47 }
48 if (src.visualMesh) {
49 this->visualMesh.emplace(MeshDataView{*src.visualMesh});
50 }
51 if (src.blending) {
52 DynamicArray<BlendingDataView> blendingDataViewArray;
53 blendingDataViewArray.reserve(src.blending->size());
54 for (auto const& blendingData : *src.blending) {
55 blendingDataViewArray.emplace_back(BlendingDataView{blendingData});
56 }
57 this->blending.emplace(std::move(blendingDataViewArray));
58 }
59 if (src.constrainedNodes) {
60 this->constrainedNodes.emplace(Span<int const>{*src.constrainedNodes});
61 }
62 if (src.elementFrameAxes) {
63 this->elementFrameAxes.emplace(Span<real const>{*src.elementFrameAxes});
64 }
65 if (src.sdf) {
66 this->sdf.emplace(GridSdfDataView{*src.sdf});
67 }
68 if (src.material) {
69 this->material.emplace(PerElementSoftMaterialDataView{*src.material});
70 }
71}
72
74 : box(src.box),
75 plane(src.plane),
76 sphere(src.sphere),
78 if (src.mesh) {
79 this->mesh.emplace(MeshData{*src.mesh});
80 }
81 if (src.visualMesh) {
82 this->visualMesh.emplace(MeshData{*src.visualMesh});
83 }
84 if (src.blending) {
85 DynamicArray<BlendingData> blendingDataArray;
86 blendingDataArray.reserve(src.blending->size());
87 for (auto const& blendingData : *src.blending) {
88 blendingDataArray.emplace_back(BlendingData{blendingData});
89 }
90 this->blending.emplace(std::move(blendingDataArray));
91 }
92 if (src.constrainedNodes) {
93 this->constrainedNodes.emplace(DynamicArray<int>{*src.constrainedNodes});
94 }
95 if (src.elementFrameAxes) {
96 this->elementFrameAxes.emplace(DynamicArray<real>{*src.elementFrameAxes});
97 }
98 if (src.sdf) {
99 this->sdf.emplace(GridSdfData{*src.sdf});
100 }
101 if (src.material) {
102 this->material.emplace(PerElementSoftMaterialData{*src.material});
103 }
104}
105
106} // namespace superdex
auto MakeConstSpan(ContainerT const &container)
Definition span.h:167
A non-owning view of precomputed grid-based signed-distance-field data.
Definition model_data.h:119
Aabb negativeValueBounds
Spatial bounds of the portion of the SDF grid with negative values.
Definition model_data.h:148
Aabb bounds
Spatial bounds of the SDF grid.
Definition model_data.h:140
std::optional< Real3 > translation
Optional parent-from-grid translation [m] to apply at runtime.
Definition model_data.h:172
Span< real const > values
Signed distance values [m].
Definition model_data.h:137
std::optional< Quaternion > rotation
Optional parent-from-grid rotation to apply at runtime.
Definition model_data.h:164
std::optional< Real3 > scale
Optional parent-from-grid per-axis scale to apply at runtime.
Definition model_data.h:156
Int3 dims
Dimensions of the SDF grid in X, Y, and Z.
Definition model_data.h:130
Data for a pre-computed SDF grid.
Definition model_data.h:43
DynamicArray< real > values
Signed distance values [m].
Definition model_data.h:61
Aabb bounds
Spatial bounds of the SDF grid.
Definition model_data.h:64
std::optional< Quaternion > rotation
Optional parent-from-grid rotation to apply at runtime.
Definition model_data.h:88
Aabb negativeValueBounds
Spatial bounds of the portion of the SDF grid with negative values.
Definition model_data.h:72
Int3 dims
Dimensions of the SDF grid in X, Y, and Z.
Definition model_data.h:54
std::optional< Real3 > translation
Optional parent-from-grid translation [m] to apply at runtime.
Definition model_data.h:96
std::optional< Real3 > scale
Optional parent-from-grid per-axis scale to apply at runtime.
Definition model_data.h:80
A non-owning view of the contents of a Mochi model file.
Definition model_data.h:257
std::optional< Box > box
Definition model_data.h:286
std::optional< MeshDataView > mesh
Definition model_data.h:268
std::optional< Sphere > sphere
Definition model_data.h:288
std::optional< Plane > plane
Definition model_data.h:287
bool experimentalDataDetected
True if the loaded model contains unsupported experimental data.
Definition model_data.h:303
The contents of a Mochi model file.
Definition model_data.h:185
std::optional< Sphere > sphere
Definition model_data.h:215
bool experimentalDataDetected
True if the loaded model contains unsupported experimental data.
Definition model_data.h:230
std::optional< MeshData > mesh
Definition model_data.h:196
std::optional< Plane > plane
Definition model_data.h:214
std::optional< Box > box
Definition model_data.h:213
Per-element material parameters for a soft body in struct-of-arrays format.