-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HdJavaScript and JavaScript API wrappers #2
base: usdjs
Are you sure you want to change the base?
Conversation
initial js render delegate improvements
cleanup and minor fixes
let filetype = undefined; | ||
if (filename.indexOf('.png') >= filename.length - 5) { | ||
filetype = 'image/png'; | ||
} else if (filename.indexOf('.jpg') >= filename.length - 5) { | ||
filetype = 'image/jpeg'; | ||
} else if (filename.indexOf('.jpeg') >= filename.length - 5) { | ||
filetype = 'image/jpeg'; | ||
} else { | ||
throw new Error('Unknown filetype'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You likely want to do something like this instead:
let filetype = undefined; | |
if (filename.indexOf('.png') >= filename.length - 5) { | |
filetype = 'image/png'; | |
} else if (filename.indexOf('.jpg') >= filename.length - 5) { | |
filetype = 'image/jpeg'; | |
} else if (filename.indexOf('.jpeg') >= filename.length - 5) { | |
filetype = 'image/jpeg'; | |
} else { | |
throw new Error('Unknown filetype'); | |
} | |
let filetype = undefined; | |
if (REGEX_JPEG.test(filename)) { | |
filetype = 'image/jpeg'; | |
} else if(REGEX_PNG.test(filename)) { | |
filetype = 'image/png'; | |
} else { | |
throw new Error('Unknown filetype'); | |
} |
Where at the top of the file you do:
const REGEX_JPEG = /\.(jpg|jpeg)$/i;
const REGEX_PNG = /\.png$/i;
|
Many thanks for your bug reports.
It doesn't have the highest priority right now for the team I am on, to be honest, because we are focusing more on CAD models :-) I'll add the two other things to our internal bug tracker. |
Understood, just want to point out that CAD models to occassionally contain skinned mesh data though :) for cables, wires, soft parts, ... |
That's actually pretty clever :-) |
Haha, let me know if you want to hear more production-proven performance optimization tips regarding bringing CAD to realtime 🚲 |
The URL pointing to the emscripten version of TBB was not valid anymore. We are updating the URL in this commit. Co-authored-by: David Koerner <[email protected]>
Is it planned to get this working on mobile? Seems in some cases the SharedArrayBuffer prevents that but in other cases the wasm instantiation never seems to complete. |
Maybe it is some timing issue depending on the network or phone. It's working for me in Chrome on Android. I can imagine that the problem is related to the hacky service worker we use to enable cross origin isolation on GitHub Pages - required for SharedArrayBuffer. It would be great if you could try setting proper http headers on Glitch: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements |
@kaischroeder https://usd-viewer.glitch.me/ now sets the headers server-side, I removed the service worker to take that out of the support equation. (Downside is that it's now not a static page anymore and thus there's a couple seconds spinup delay if the instance happened to go to sleep (after 30mins of inactivity or so)) |
@hybridherbst I have now found some more time to look into this. the github pages demo indeed stopped working for me as well. your glitch installation also unfortunately does not work for me anymore. I was now able to make it work on mobile with a local https server that sets the right CORS headers. |
@kaischroeder mind checking again? I found a glitch (haha) and fixed it. Working with binary files is a bit strange in their editor (they tend to break if you try to view them). Works for me again at least :) |
@hybridherbst Thanks. It works for me on Desktop. :-) On mobile I had to reload once - the first time I tried I got this error message: Uncaught (in promise) ReferenceError: Usd is not defined |
Cool, good to know! |
Description of Change(s)
This branch adds several experimental features as proofs of concept to the WebAssembly port of USD. Please see the main WebAssembly branch for build instructions: #1
This adds:
After building this branch and running make install, you get a folder hdEmscripten under the build folder that contains all the files needed to create an app based on this. You can for example copy them into the demo project: https://github.com/autodesk-forks/USD/tree/gh-pages/usd_for_web_demos
The only purpose of this PR today is to make the changes easily viewable and to allow people to play with this code. This is far from being in a form that can be merged.