Skip to content

Commit

Permalink
Rect select fix (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
slimbuck authored Jun 28, 2024
1 parent ec82236 commit f53eeef
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 151 deletions.
132 changes: 66 additions & 66 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "supersplat",
"version": "0.19.2",
"version": "0.19.3",
"author": "PlayCanvas<[email protected]>",
"homepage": "https://playcanvas.com/supersplat/editor",
"description": "3D Gaussian Splat Editor",
Expand Down Expand Up @@ -52,7 +52,7 @@
},
"devDependencies": {
"@playcanvas/eslint-config": "^1.7.1",
"@playcanvas/pcui": "^4.3.0",
"@playcanvas/pcui": "^4.4.0",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-image": "^3.0.3",
"@rollup/plugin-json": "^6.1.0",
Expand All @@ -61,18 +61,18 @@
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@types/wicg-file-system-access": "^2023.10.5",
"@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.10.0",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"concurrently": "^8.2.2",
"cors": "^2.8.5",
"cross-env": "^7.0.3",
"eslint": "^8.56.0",
"jest": "^29.7.0",
"playcanvas": "^1.71.5",
"playcanvas": "^1.72.0",
"rollup": "^4.18.0",
"rollup-plugin-sass": "^1.12.22",
"rollup-plugin-sass": "^1.13.0",
"rollup-plugin-visualizer": "^5.12.0",
"serve": "^14.2.3",
"tslib": "^2.6.2"
"tslib": "^2.6.3"
}
}
2 changes: 1 addition & 1 deletion src/camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ class Camera extends Element {
const renderTarget = this.entity.camera.renderTarget;

// resolve msaa buffer
if (renderTarget._samples > 1) {
if (renderTarget.samples > 1) {
renderTarget.resolve(true, false);
}

Expand Down
3 changes: 2 additions & 1 deletion src/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ const registerEditorEvents = (events: Events, editHistory: EditHistory, scene: S
mat.transformVec4(vec4, vec4);
vec4.x /= vec4.w;
vec4.y = -vec4.y / vec4.w;
if (vec4.x < sx || vec4.x > ex || vec4.y < sy || vec4.y > ey) {
vec4.z /= vec4.w;
if (vec4.x < sx || vec4.x > ex || vec4.y < sy || vec4.y > ey || vec4.z < -1 || vec4.z > 1) {
return false;
}
return true;
Expand Down
28 changes: 20 additions & 8 deletions src/splat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,27 @@ flat varying highp uint vertexState;
flat varying highp uint vertexId;
#endif
vec4 discardVec = vec4(0.0, 0.0, 2.0, 1.0);
void main(void)
{
// evaluate center of the splat in object space
vec3 centerLocal = evalCenter();
// evaluate the rest of the splat using world space center
vec4 centerWorld = matrix_model * vec4(centerLocal, 1.0);
gl_Position = evalSplat(centerWorld);
// calculate splat uv
if (!calcSplatUV()) {
gl_Position = discardVec;
return;
}
// read data
readData();
vec4 pos;
if (!evalSplat(pos)) {
gl_Position = discardVec;
return;
}
gl_Position = pos;
texCoord = vertex_position.xy;
color = getColor();
#ifndef DITHER_NONE
id = float(splatId);
#endif
vertexState = uint(texelFetch(splatState, splatUV, 0).r * 255.0);
Expand All @@ -47,7 +59,7 @@ void main(void)
const fragmentShader = /*glsl*/`
#ifdef PICK_PASS
flat varying highp uint vertexId;
flat varying highp uint vertexId;
#endif
flat varying highp uint vertexState;
Expand Down
Loading

0 comments on commit f53eeef

Please sign in to comment.