SuperDex Physics C++ API
Loading...
Searching...
No Matches
mochi_prefab_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#pragma once
18
20
21namespace superdex::prefab {
22
23// Convenience overloads of @ref AddToScene that delegate to the canonical overloads using default
24// @ref PrefabParams. Declared in mochi_prefab.h.
25inline AddToSceneResult AddToScene(ScenePrefab const& prefab, Scene* scene, Error& error) {
26 return AddToScene(prefab, scene, PrefabParams{}, error);
27}
28
29inline AddToSceneResult
30AddToScene(std::string_view prefabPath, std::string_view rootPath, Scene* scene, Error& error) {
31 return AddToScene(prefabPath, rootPath, scene, PrefabParams{}, error);
32}
33
34// Convenience overloads of @ref ExportScene and @ref ExportActor that use default
35// @ref ExportParams. Declared in mochi_prefab.h.
36inline void ExportScene(
37 Scene const* scene,
38 std::string_view exportName,
39 std::string_view outputDir,
40 Error& error) {
41 ExportScene(scene, exportName, outputDir, ExportParams{}, error);
42}
43
44inline void ExportActor(
45 Actor const* actor,
46 std::string_view exportName,
47 std::string_view outputDir,
48 Error& error) {
49 ExportActor(actor, exportName, outputDir, ExportParams{}, error);
50}
51
52} // namespace superdex::prefab
Represents a simulated body (actor) in a scene.
Definition mochi_actor.h:49
Represents a simulation scene.
Definition mochi_scene.h:45
AddToSceneResult AddToScene(ScenePrefab const &prefab, Scene *scene, PrefabParams const &params, Error &error)
Instantiate a ScenePrefab and add it to a Scene.
void ExportActor(Actor const *actor, std::string_view exportName, std::string_view outputDir, ExportParams const &params, Error &error)
Export a single actor to a prefab file under outputDir/exportName/<exportName>.mochi_scene.
void ExportScene(Scene const *scene, std::string_view exportName, std::string_view outputDir, ExportParams const &params, Error &error)
Export a Scene to a folder containing a prefab file and all generated mesh files.
Struct used to return all created actors and constraints from AddToScene.
Options for ExportScene and ExportActor.
Parameters for instantiating a ScenePrefab into a Scene.
Top-level prefab describing a complete or partial physics scene (possibly just one actor).