Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class SparkGaussianSplatLoader extends BaseLoader {
async load(url: string, options?: SparkGaussianSplatLoaderOptions): Promise<Object3D> {
const resolvedUrl = this.resolveUrl(url);
const packedSplats = await this.getPackedSplats(resolvedUrl, options);
const mesh = new SplatMesh({ packedSplats });
const mesh = new SplatMesh({ packedSplats, editable: true });
await mesh.initialized;

mesh.userData.type = 'GaussianSplat';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,23 @@

import * as THREE from "three";

class VolumePointLightHelper extends THREE.PointLightHelper {
class VolumePointLightHelper extends THREE.LineSegments {
constructor(light, sphereSize, color) {
super(light, sphereSize, color);
const helperGeometry = new THREE.EdgesGeometry(
new THREE.SphereGeometry( sphereSize, 4, 2 ),
);
const helperMaterial = new THREE.LineBasicMaterial({
fog: false,
toneMapped: false,
});

super(helperGeometry, helperMaterial);

this.light = light;
this.color = color;
this.type = "PointLightHelper";
this.matrix = this.light.matrixWorld;
this.matrixAutoUpdate = false;

var geometry = new THREE.SphereGeometry(2, 4, 2);
var material = new THREE.MeshBasicMaterial({
Expand All @@ -20,6 +34,8 @@ class VolumePointLightHelper extends THREE.PointLightHelper {
this.picker = new THREE.Mesh(geometry, material);
this.picker.name = "picker";
this.add(this.picker);

this.update();
}

raycast(raycaster, intersects) {
Expand All @@ -40,7 +56,18 @@ class VolumePointLightHelper extends THREE.PointLightHelper {
}
delete this.picker;

super.dispose();
this.geometry.dispose();
this.material.dispose();
}

update() {
this.light.updateWorldMatrix(true, false);

if (this.color !== undefined) {
this.material.color.set(this.color);
} else {
this.material.color.copy(this.light.color);
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions client/packages/editor-oss/src/render/EffectRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {patchPassNode} from "./postprocessing/patchPassNode";
import {patchShadowNode} from "./postprocessing/patchShadowNode";
import {outline} from "./postprocessing/SharedDepthOutlineNode";
import {disposeSparkComposite, ensureSparkComposite} from "./SparkCompositeBridge";
import {createSparkSceneLightingBridge} from "./SparkLightingBridge";
// TODO(@stem/editor-oss migration): these subsystems still live in
// @web-shared. They will move into editor-oss in a follow-up sub-step; the
// @web-shared alias is allowed during the migration window.
Expand Down Expand Up @@ -171,6 +172,7 @@ class EffectRenderer extends BaseRenderer {
this.height = 0;
this.pixelRatio = 1;
this.sparkComposite = null;
this.sparkLighting = null;
}

/**
Expand Down Expand Up @@ -209,6 +211,8 @@ class EffectRenderer extends BaseRenderer {
// Initialize cached canvas size synchronously before the first render
const canvas = this.renderer && this.renderer.domElement ? this.renderer.domElement : renderer?.domElement;
this.sparkComposite = ensureSparkComposite(scene, renderer, helperRoot || scene);
this.sparkLighting?.dispose();
this.sparkLighting = createSparkSceneLightingBridge(scene);
Comment thread
querielo marked this conversation as resolved.
try {
const splatSettings = this.scene?.userData?.rendering?.splat || {};
if (typeof this.sparkComposite?.setSparkOptions === "function") {
Expand Down Expand Up @@ -1449,6 +1453,8 @@ class EffectRenderer extends BaseRenderer {
* Render
*/
render() {
this.sparkLighting?.update();

if (!this.ready || !this.renderPipeline) {
// If background is set, we need to clear buffers manually
Comment thread
querielo marked this conversation as resolved.
if (this.scene.background) {
Expand Down Expand Up @@ -1652,6 +1658,8 @@ class EffectRenderer extends BaseRenderer {

this.scene = null;
this.camera = null;
this.sparkLighting?.dispose();
this.sparkLighting = null;
disposeSparkComposite(this.sparkComposite);
this.sparkComposite = null;
this.renderer = null;
Expand Down
Loading
Loading