@shopware-ag/dive
Version:
Shopware Spatial Framework
57 lines (44 loc) • 1.65 kB
text/typescript
import { Mesh, Object3D, PlaneGeometry, ShadowMaterial } from 'three';
import { DIVERoot } from '../root/Root';
import { type DIVERenderer } from '../../renderer/Renderer';
import { DIVEXRLightRoot } from './xrlightroot/XRLightRoot';
import { type DIVEScene } from '../Scene';
export class DIVEXRRoot extends Object3D {
private _xrLightRoot: DIVEXRLightRoot;
private _xrModelRoot: DIVERoot;
private _xrHandNode: Object3D;
public get XRModelRoot(): DIVERoot {
return this._xrModelRoot;
}
public get XRLightRoot(): DIVEXRLightRoot {
return this._xrLightRoot;
}
public get XRHandNode(): Object3D {
return this._xrHandNode;
}
private _xrShadowPlane: Mesh;
constructor(scene: DIVEScene) {
super();
this.name = 'XRRoot';
this._xrModelRoot = new DIVERoot();
this._xrModelRoot.name = 'XRModelRoot';
this.add(this._xrModelRoot);
this._xrShadowPlane = new Mesh(
new PlaneGeometry(100, 100),
new ShadowMaterial({ opacity: 1, transparent: true }),
);
this._xrModelRoot.add(this._xrShadowPlane);
this._xrLightRoot = new DIVEXRLightRoot(scene);
this._xrLightRoot.name = 'XRLightRoot';
this.add(this._xrLightRoot);
this._xrHandNode = new Object3D();
this._xrHandNode.name = 'XRHandNode';
this.add(this._xrHandNode);
}
public InitLightEstimation(renderer: DIVERenderer): void {
this._xrLightRoot.InitLightEstimation(renderer);
}
public DisposeLightEstimation(): void {
this._xrLightRoot.DisposeLightEstimation();
}
}