Skip to content
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

feat: support rotations for z-up assets #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ async function loadUsdFile(directory, filename, path, isRootFile = true) {
endTimeCode = stage.GetEndTimeCode();
timeout = 1000 / stage.GetTimeCodesPerSecond();
}

// if up axis is z, rotate, otherwise make sure rotation is 0, in case we rotated in the past and need to undo it
window.usdRoot.rotation.x = String.fromCharCode(stage.GetUpAxis()) === 'z' ? -Math.PI / 2 : 0;

fitCameraToSelection(window.camera, window._controls, [window.usdRoot]);
console.log("Loading done. Scene: ", window.usdRoot);
ready = true;
Expand Down
8 changes: 4 additions & 4 deletions usd-wasm/src/bindings/emHdBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var getUsdModule = ((args) => {
// module overrides can be supplied here
locateFile: (path, prefix) => {
if (!prefix && _scriptDir) prefix = _scriptDir.substr(0, _scriptDir.lastIndexOf('/') + 1);
return prefix + path;
return prefix + path;
},
...args
}) {
Expand Down Expand Up @@ -10163,8 +10163,8 @@ var getUsdModule = ((args) => {
(_asyncify_start_rewind = wasmExports["Ug"])(a0);
var _asyncify_stop_rewind = () =>
(_asyncify_stop_rewind = wasmExports["Vg"])();
var ___start_em_js = (Module["___start_em_js"] = 3895468);
var ___stop_em_js = (Module["___stop_em_js"] = 3896792);
var ___start_em_js = (Module["___start_em_js"] = 3892124);
var ___stop_em_js = (Module["___stop_em_js"] = 3893448);
function invoke_iii(index, a1, a2) {
var sp = stackSave();
try {
Expand Down Expand Up @@ -12019,4 +12019,4 @@ if (typeof exports === "object" && typeof module === "object")
else if (typeof define === "function" && define["amd"])
define([], () => getUsdModule);

globalThis["NEEDLE:USD:GET"] = getUsdModule;
globalThis["NEEDLE:USD:GET"] = getUsdModule;
Binary file modified usd-wasm/src/bindings/emHdBindings.wasm
Binary file not shown.