Added the ability to spawn a mannequin

This commit is contained in:
Brooks Palin
2024-03-12 15:26:04 -06:00
parent ffba0b940f
commit 1ef2afc685
6 changed files with 44 additions and 7 deletions
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M112 48a48 48 0 1 1 96 0 48 48 0 1 1 -96 0zm40 304V480c0 17.7-14.3 32-32 32s-32-14.3-32-32V256.9L59.4 304.5c-9.1 15.1-28.8 20-43.9 10.9s-20-28.8-10.9-43.9l58.3-97c17.4-28.9 48.6-46.6 82.3-46.6h29.7c33.7 0 64.9 17.7 82.3 46.6l58.3 97c9.1 15.1 4.2 34.8-10.9 43.9s-34.8 4.2-43.9-10.9L232 256.9V480c0 17.7-14.3 32-32 32s-32-14.3-32-32V352H152z"/></svg>

After

Width:  |  Height:  |  Size: 570 B

+2
View File
@@ -39,6 +39,7 @@ import fasChevronDown from "@fortawesome/fontawesome-pro/svgs/solid/chevron-down
import customCylinder from "../assets/icons/cylinder.svg?raw";
import customSphere from "../assets/icons/sphere.svg?raw";
import customTorus from "../assets/icons/torus.svg?raw";
import customMannequin from "../assets/icons/person.svg?raw";
import styles from "./icon.element.scss?inline";
@@ -99,6 +100,7 @@ function renderSvg(iconId: string) {
"up-down-left-right": () => farUpDownLeftRight,
"video": () => farVideo,
"xmark": () => fasXmark,
"mannequin": () => customMannequin,
_: () => null,
});
@@ -50,6 +50,15 @@ export class AddToSceneMenuElement extends LitElement {
>
Cylinder
</sts-button>
<sts-button
role="menuitem"
icon="mannequin"
@click=${() => {
studio.loadObject("Mannequin.gltf")
}}
>
Mannequin
</sts-button>
<hr />
<sts-button
role="menuitem"
+6 -6
View File
@@ -58,13 +58,13 @@ fn spawn_test_bvh(
let ent = cmd.spawn_bvh_with_transform(
&r_bvh.0,
Transform::from_scale(Vec3::splat(0.06))
.with_translation(Vec3::new(0., 1.0, 0.524)),
);
// let ent = cmd.spawn_bvh_with_transform(
// &r_bvh.0,
// Transform::from_scale(Vec3::splat(0.06))
// .with_translation(Vec3::new(0., 1.0, 0.524)),
// );
cmd.entity(ent).insert(RetargetSource);
// cmd.entity(ent).insert(RetargetSource);
}
}
}
+25
View File
@@ -596,4 +596,29 @@ declare global {
Ok(())
}
//==============================================================================
// Spawing GLTF objects
//==============================================================================
// static LOAD_GLTF : WasmMessageBuffer<String> = WasmMessageBuffer::new();
// #[wasm_bindgen(js_name = spawnGltf)]
// pub fn spawn_gltf(path : String) {
// let wrapper = LOAD_GLTF.get_or_init(|| ReentrantMutex::new(RefCell::new(Some(path.clone()))));
// let guard = wrapper.lock();
// *guard.borrow_mut() = Some(path);
// }
// pub(super) fn load_gltf_object(
// mut load_object_event: EventWriter<LoadLibraryObjectEvent>
// ) {
// let wrapper = LOAD_GLTF.get_or_init(|| ReentrantMutex::new(RefCell::new(Some(path.clone()))));
// let guard = wrapper.lock();
// if guard.borrow().is_some() {
// load_object_event.send(LoadLibraryObjectEvent(guard.take().unwrap()));
// }
// }
}
+1 -1
View File
@@ -31,4 +31,4 @@ pub(crate) fn initialize() {
let wrapper = INITIALIZED.get_or_init(|| ReentrantMutex::new(RefCell::new(false)));
let guard = wrapper.lock();
*guard.borrow_mut() = true;
}
}