Skip to content

Commit

Permalink
USDZExporter: Anchoring support (#22854)
Browse files Browse the repository at this point in the history
* WIP: Wall placement

* wallplacement config

* use options function and remove console.log

* tabs for spaces

* replace tabs with spaces in strings of USDZExporter

Co-authored-by: Thorsten Bux <thorsten.bux@outlook.com>
  • Loading branch information
aleneum and ThorstenBux authored Oct 28, 2022
1 parent 5fac492 commit 868aee4
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions examples/jsm/exporters/USDZExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ import * as fflate from '../libs/fflate.module.js';

class USDZExporter {

options = {
ar: { anchoring: { type: 'plane' }, planeAnchoring: { alignment: 'vertical' } }
};

setOptions( options ) {

this.options = options;

}

async parse( scene ) {

const files = {};
Expand All @@ -16,6 +26,25 @@ class USDZExporter {

let output = buildHeader();

output += `def Xform "Root"
{
def Scope "Scenes" (
kind = "sceneLibrary"
)
{
def Xform "Scene" (
customData = {
bool preliminary_collidesWithEnvironment = 0
string sceneName = "Scene"
}
sceneName = "Scene"
)
{
token preliminary:anchoring:type = "${this.options.ar.anchoring.type}"
token preliminary:planeAnchoring:alignment = "${this.options.ar.planeAnchoring.alignment}"
`;

const materials = {};
const textures = {};

Expand Down Expand Up @@ -59,6 +88,14 @@ class USDZExporter {

} );


output += `
}
}
}
`;

output += buildMaterials( materials, textures );

files[ modelFileName ] = fflate.strToU8( output );
Expand Down

0 comments on commit 868aee4

Please sign in to comment.