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

Update to engine v1.71.0 #94

Merged
merged 2 commits into from
May 21, 2024
Merged
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
572 changes: 275 additions & 297 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "supersplat",
"version": "0.16.0",
"version": "0.17.0",
"author": "PlayCanvas<[email protected]>",
"homepage": "https://playcanvas.com/supersplat/editor",
"description": "3D Gaussian Splat Editor",
Expand Down Expand Up @@ -60,18 +60,18 @@
"@rollup/plugin-strip": "^3.0.4",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.10.0",
"concurrently": "^8.2.2",
"cors": "^2.8.5",
"cross-env": "^7.0.3",
"eslint": "^8.56.0",
"jest": "^29.7.0",
"playcanvas": "^1.70.0",
"rollup": "^4.16.1",
"playcanvas": "^1.71.0",
"rollup": "^4.17.2",
"rollup-plugin-sass": "^1.12.22",
"rollup-plugin-visualizer": "^5.12.0",
"serve": "^14.2.2",
"serve": "^14.2.3",
"tslib": "^2.6.2"
}
}
2 changes: 1 addition & 1 deletion rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const BUILD_TYPE = process.env.BUILD_TYPE || 'release';
const ENGINE_DIR = process.env.ENGINE_PATH || './node_modules/playcanvas';
const PCUI_DIR = path.resolve(process.env.PCUI_PATH || 'node_modules/@playcanvas/pcui');

const ENGINE_NAME = BUILD_TYPE === 'debug' ? 'playcanvas.dbg.mjs' : 'playcanvas.mjs';
const ENGINE_NAME = BUILD_TYPE === 'debug' ? 'playcanvas.dbg/src/index.js' : 'playcanvas/src/index.js';
const ENGINE_PATH = path.resolve(ENGINE_DIR, 'build', ENGINE_NAME);

const aliasEntries = {
Expand Down
6 changes: 5 additions & 1 deletion src/asset-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ class AssetLoader {
filename: loadRequest.filename,
contents: loadRequest.contents
},
{ elementFilter: this.loadAllData ? (() => true) : null }
{
elementFilter: this.loadAllData ? (() => true) : null,
// decompress data on load
decompress: true
}
);
asset.on('load', () => {
stopSpinner();
Expand Down
2 changes: 1 addition & 1 deletion src/scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ class Scene {
local.getMax(),
Color.BLUE,
true,
null, // this.app.scene.defaultDrawLayer,
undefined,
splat.root.getWorldTransform());

const world = splat.worldBound;
Expand Down
2 changes: 1 addition & 1 deletion src/splat-convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const convertPly = (splatData: GSplatData, modelMat: Mat4) => {
}

const internalProps = ['state'];
const props = splatData.vertexElement.properties.filter((p: any) => p.storage && !internalProps.includes(p.name));
const props = splatData.getElement('vertex').properties.filter((p: any) => p.storage && !internalProps.includes(p.name));
const header = (new TextEncoder()).encode(`ply\nformat binary_little_endian 1.0\nelement vertex ${numSplats}\n` + props.map((p: any) => `property float ${p.name}`).join('\n') + `\nend_header\n`);
const result = new Uint8Array(header.byteLength + numSplats * props.length * 4);

Expand Down
39 changes: 6 additions & 33 deletions src/splat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ void main(void)

gl_Position = evalSplat(centerWorld);

vertexState = uint(texelFetch(splatState, dataUV, 0).r * 255.0);
vertexState = uint(texelFetch(splatState, splatUV, 0).r * 255.0);

#ifdef PICK_PASS
vertexId = vertex_id;
vertexId = splatId;
#endif
}
`;
Expand Down Expand Up @@ -208,40 +208,13 @@ class Splat extends Element {
// remains centered on the splat but doesn't move in world space.
recalcBound() {
// it's faster to calculate bound of splat centers
const x = this.splatData.getProp('x');
const y = this.splatData.getProp('y');
const z = this.splatData.getProp('z');
const state = this.splatData.getProp('state') as Uint8Array;
let first = true;
let minx = -0.5, maxx = 0.5, miny = -0.5, maxy = 0.5, minz = -0.5, maxz = 0.5;

for (let i = 0; i < this.splatData.numSplats; ++i) {
if ((state[i] & State.deleted) !== 0) {
continue;
}

const xv = x[i];
const yv = y[i];
const zv = z[i];

if (first) {
minx = maxx = xv;
miny = maxy = yv;
minz = maxz = zv;
first = false;
} else {
minx = Math.min(minx, xv);
maxx = Math.max(maxx, xv);
miny = Math.min(miny, yv);
maxy = Math.max(maxy, yv);
minz = Math.min(minz, zv);
maxz = Math.max(maxz, zv);
}
}

const localBound = this.localBound;
localBound.center.set((minx + maxx) * 0.5, (miny + maxy) * 0.5, (minz + maxz) * 0.5);
localBound.halfExtents.set((maxx - minx) * 0.5, (maxy - miny) * 0.5, (maxz - minz) * 0.5);
if (!this.splatData.calcAabb(localBound, (i: number) => (state[i] & State.deleted) === 0)) {
localBound.center.set(0, 0, 0);
localBound.halfExtents.set(0.5, 0.5, 0.5);
}

// calculate meshinstance aabb (transformed local bound)
const meshInstance = this.root.gsplat.instance.meshInstance;
Expand Down
2 changes: 1 addition & 1 deletion src/tools/transform-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TransformTool {
patchGizmoMaterials(this.gizmo);

this.gizmo.coordSpace = events.invoke('tool.coordSpace');
this.gizmo.size = 1.5;
this.gizmo.size = 0.9;

this.gizmo.on('render:update', () => {
scene.forceRender = true;
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"resolveJsonModule": true,
"baseUrl": ".",
"paths": {
"playcanvas": ["node_modules/playcanvas/build/playcanvas.mjs"],
"playcanvas": ["node_modules/playcanvas/build/playcanvas"],
"pcui": ["node_modules/@playcanvas/pcui"]
}
},
Expand Down