SuperDex Physics C++ API
Loading...
Searching...
No Matches
mesh_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 "mesh_data.h" // Reverse include for intellisense
19
20namespace superdex {
21
24
27
30
33
38 skinning(src.skinning ? std::make_optional(SkinningDataView{*src.skinning}) : std::nullopt) {}
39
44 skinning(src.skinning ? std::make_optional(SkinningData{*src.skinning}) : std::nullopt) {}
45
50
51inline int MeshData::GetNumElements() const {
52 return (!connectivity.empty() && (nodesPerElement > 0)) ? isize(connectivity) / nodesPerElement
53 : 0;
54}
55
56inline bool MeshData::IsEmpty() const {
57 return GetNumNodes() == 0;
58}
59
64
65inline int MeshDataView::GetNumElements() const {
66 return (!connectivity.empty() && (nodesPerElement > 0)) ? isize(connectivity) / nodesPerElement
67 : 0;
68}
69
70inline bool MeshDataView::IsEmpty() const {
71 return GetNumNodes() == 0;
72}
73
74} // namespace superdex
#define MOCHI_ASSERT_VERBOSE(condition_without_side_effects,...)
Definition debug.h:102
constexpr int kMeshDataSpaceDim
Spatial dimensionality of mesh data.
Definition mesh_data.h:37
constexpr int isize(T const &a)
A non-owning view of the data blending data for one source shape within a soft skinned mesh.
Definition mesh_data.h:76
Span< int const > indices
Indices for blending. Size = numNodes * 2.
Definition mesh_data.h:87
Span< real const > weights
Weights for blending Size = numNodes * 2.
Definition mesh_data.h:88
std::string_view sourceShape
Name of the soft source shape.
Definition mesh_data.h:86
Blending data for one source shape within a soft skinned mesh.
Definition mesh_data.h:44
DynamicString sourceShape
Name of the soft source shape.
Definition mesh_data.h:54
BlendingData()=default
Default constructor.
DynamicArray< int > indices
Indices for blending. Size = numNodes * 2.
Definition mesh_data.h:55
DynamicArray< real > weights
Weights for blending Size = numNodes * 2.
Definition mesh_data.h:56
A non-owning view of the mesh data for a Mochi actor or model file.
Definition mesh_data.h:218
Span< int const > connectivity
Flat array of node indices forming the elements.
Definition mesh_data.h:247
int GetNumElements() const
Return the number of elements.
int GetNumNodes() const
Return the number of nodes.
int nodesPerElement
Number of nodes (vertices) per element.
Definition mesh_data.h:233
bool IsEmpty() const
Return true if the mesh is empty.
std::optional< SkinningDataView > skinning
Optional skinning.
Definition mesh_data.h:250
Span< real const > coordinates
Flat array of node coordinate values [m].
Definition mesh_data.h:240
Mesh data for a Mochi actor or model file.
Definition mesh_data.h:157
int GetNumNodes() const
Return the number of nodes.
bool IsEmpty() const
Return true if the mesh is empty.
int nodesPerElement
Number of nodes (vertices) per element.
Definition mesh_data.h:172
DynamicArray< real > coordinates
Flat array of node coordinate values [m].
Definition mesh_data.h:179
MeshData()=default
Default constructor.
DynamicArray< int > connectivity
Flat array of node indices forming the elements.
Definition mesh_data.h:186
int GetNumElements() const
Return the number of elements.
std::optional< SkinningData > skinning
Optional skinning.
Definition mesh_data.h:189
A non-owning view of the skinning data for a Mochi mesh.
Definition mesh_data.h:132
int weightsPerNode
Number of weights and indices per node being skinned.
Definition mesh_data.h:142
Span< int const > indices
Indices for each node. Size = numNodes * weightsPerNode.
Definition mesh_data.h:143
Span< real const > weights
Weights for each node. Size = numNodes * weightsPerNode.
Definition mesh_data.h:144
Skinning data for a Mochi mesh.
Definition mesh_data.h:101
int weightsPerNode
Number of weights and indices per node being skinned.
Definition mesh_data.h:111
DynamicArray< real > weights
Weights for each node. Size = numNodes * weightsPerNode.
Definition mesh_data.h:113
SkinningData()=default
Default constructor.
DynamicArray< int > indices
Indices for each node. Size = numNodes * weightsPerNode.
Definition mesh_data.h:112