added initial gltf test.
This commit is contained in:
parent
d82df88296
commit
1dd192cd4d
@ -1,6 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
AbstractMesh,
|
AbstractMesh,
|
||||||
Mesh,
|
|
||||||
PhysicsMotionType,
|
PhysicsMotionType,
|
||||||
Scene,
|
Scene,
|
||||||
TransformNode,
|
TransformNode,
|
||||||
@ -144,12 +143,8 @@ export class Base {
|
|||||||
mesh && mesh.setParent(this.xrInputSource.motionController.rootMesh);
|
mesh && mesh.setParent(this.xrInputSource.motionController.rootMesh);
|
||||||
this.grabbedMesh = mesh;
|
this.grabbedMesh = mesh;
|
||||||
} else {
|
} else {
|
||||||
if (mesh?.parent?.parent?.metadata?.grabbable) {
|
if (mesh?.metadata?.grabbable) {
|
||||||
if (mesh?.parent?.parent?.parent) {
|
|
||||||
mesh = (mesh?.parent?.parent?.parent as Mesh);
|
|
||||||
this.grabbedMesh = mesh;
|
this.grabbedMesh = mesh;
|
||||||
player = true;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
const uploadImage = async (evt) => {
|
const uploadImage = async (evt) => {
|
||||||
|
|
||||||
const file = (evt.target as HTMLInputElement).files[0];
|
const file = (evt.target as HTMLInputElement).files[0];
|
||||||
|
if (!file) {
|
||||||
|
console.log('no file selected');
|
||||||
|
return;
|
||||||
|
}
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('file', file);
|
formData.append('file', file);
|
||||||
//formData.append('requireSignedURLs', 'true');
|
//formData.append('requireSignedURLs', 'true');
|
||||||
|
|||||||
@ -115,7 +115,10 @@ function Menu() {
|
|||||||
|
|
||||||
function handleDiagramListClick(evt: React.MouseEvent<HTMLAnchorElement>) {
|
function handleDiagramListClick(evt: React.MouseEvent<HTMLAnchorElement>) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
switch (evt.target.id) {
|
if (!evt.currentTarget.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (evt.currentTarget.id) {
|
||||||
case 'imageUploadLink':
|
case 'imageUploadLink':
|
||||||
const input = document.createElement('input');
|
const input = document.createElement('input');
|
||||||
input.type = 'file';
|
input.type = 'file';
|
||||||
@ -133,9 +136,7 @@ function Menu() {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<MainMenu onClick={handleDiagramListClick}/>
|
<MainMenu onClick={handleDiagramListClick}/>
|
||||||
<TutorialMenu onClick={handleDesktopTutorialClick}/>
|
|
||||||
<CreateMenu display={createState} toggleCreateMenu={handleCreateClick}/>
|
<CreateMenu display={createState} toggleCreateMenu={handleCreateClick}/>
|
||||||
<KeyboardHelp display={desktopTutorialState} onClick={handleDesktopTutorialClick}/>
|
|
||||||
<DiagramList onClick={handleCreateClick} display={diagramListState}/>
|
<DiagramList onClick={handleCreateClick} display={diagramListState}/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
29
src/vrApp.ts
29
src/vrApp.ts
@ -57,6 +57,35 @@ export class VrApp {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
addSceneInspector();
|
addSceneInspector();
|
||||||
|
|
||||||
|
/*
|
||||||
|
SceneLoader.ImportMesh(null,'https://models.deepdiagram.com/', 'Chair_textured_mesh_lowpoly_glb.glb', scene, (meshes) => {
|
||||||
|
const transform = new Mesh('chair', scene);
|
||||||
|
for(const mesh of meshes){
|
||||||
|
mesh.parent= transform;
|
||||||
|
}
|
||||||
|
let {min, max} = transform.getHierarchyBoundingVectors(true);
|
||||||
|
const parentMesh = MeshBuilder.CreateBox('boundingBox', {width: max.x - min.x, height: max.y - min.y, depth: max.z - min.z}, scene);
|
||||||
|
for(const mesh of meshes){
|
||||||
|
mesh.parent= parentMesh;
|
||||||
|
|
||||||
|
}
|
||||||
|
transform.dispose();
|
||||||
|
//parentMesh.setBoundingInfo(new BoundingInfo(min, max));
|
||||||
|
parentMesh.showBoundingBox = true;
|
||||||
|
parentMesh.scaling = new Vector3(.2,.2,.2);
|
||||||
|
//mesh.metadata = {grabbable: true};
|
||||||
|
parentMesh.position.y = .5;
|
||||||
|
parentMesh.position.z = 0;
|
||||||
|
parentMesh.metadata = {grabbable: true};
|
||||||
|
const material = new StandardMaterial('chairMaterial', scene);
|
||||||
|
material.alpha = 0;
|
||||||
|
parentMesh.material = material;
|
||||||
|
parentMesh.showBoundingBox = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
const el = document.querySelector('#download');
|
const el = document.querySelector('#download');
|
||||||
if (el) {
|
if (el) {
|
||||||
el.addEventListener('click', () => {
|
el.addEventListener('click', () => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user