Skip to content

Commit

Permalink
Make lighting sticky until AR placement. Fix annotation button bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjcope committed Sep 1, 2023
1 parent e2f3212 commit 2a11eca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion source/client/components/CVARManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export default class CVARManager extends Component
protected annotationsAtLaunch: boolean = false;
protected scaleDisplay: HTMLElement = null;
protected updateScale: boolean = false;
protected placementRotation: Quaternion = new Quaternion();

update()
{
Expand Down Expand Up @@ -536,7 +537,7 @@ export default class CVARManager extends Component
position.copy(camera.position)
.add(cameraDirection.multiplyScalar(radius));

this.sceneRotateHelper();
this.shadow.setRotation(scene.rotation.y);

scene.updateMatrix();
scene.updateMatrixWorld();
Expand Down Expand Up @@ -827,6 +828,8 @@ export default class CVARManager extends Component
hitPlane.visible = false;
scene.add(hitPlane);

this.placementRotation.copy(scene.quaternion);

// add selection visualization
const roundedRectShape = new Shape();
const cutOut = new Shape();
Expand Down Expand Up @@ -977,6 +980,10 @@ export default class CVARManager extends Component
// undo rotation on lights
_quat.copy(scene.quaternion);
_quat.invert();

// account for initial light placement orientation
_quat.multiply(this.placementRotation);

this.lightTransform.object3D.rotation.setFromQuaternion(_quat);
this.lightTransform.object3D.updateMatrix();

Expand Down
9 changes: 8 additions & 1 deletion source/client/ui/explorer/ARMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import CVDocument from "../../components/CVDocument";
import CVARManager from "../../components/CVARManager";

import DocumentView, { customElement, html } from "./DocumentView";
import CVAnnotationView from "client/components/CVAnnotationView";
import CVScene from "client/components/CVScene";

////////////////////////////////////////////////////////////////////////////////

Expand All @@ -37,6 +39,9 @@ export default class ARMenu extends DocumentView
protected get arManager() {
return this.system.getMainComponent(CVARManager);
}
protected get sceneNode() {
return this.system.getComponent(CVScene);
}

protected firstConnected()
{
Expand Down Expand Up @@ -65,8 +70,10 @@ export default class ARMenu extends DocumentView
const outs = arManager.outs;

const setup = document.setup;
const scene = this.sceneNode;

const annotationsButtonVisible = true;
const views = scene.getGraphComponents(CVAnnotationView);
const annotationsButtonVisible = views.some(view => {return view.hasAnnotations;});
const annotationsActive = setup.viewer.ins.annotationsVisible.value;

const narrationButtonVisible = setup.audio.outs.narrationEnabled.value;
Expand Down

0 comments on commit 2a11eca

Please sign in to comment.