File size: 1,213 Bytes
71d12ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
THREE.GUI = {
    create: (viewer, scene) => {
        var gui = new dat.GUI();

        // Set some GUI params
        var shaderParams = gui.addFolder('Shader');
        shaderParams.add(sixDofViewer, 'displacement', 0, 7).name('Displacement');
        shaderParams.add(sixDofViewer, 'opacity', 0, 1).name('Opacity');
        shaderParams.add(sixDofViewer, 'pointSize', 0, 10).name('Point Size');
        shaderParams.add({ 'debugDepth': false }, 'debugDepth')
            .name('Debug Depth')
            .onChange(val => {
                sixDofViewer.toggleDepthDebug(val);
            });
        shaderParams.add({
            'changeStyle': () => { }
        }, 'changeStyle', {
            'Mesh': SixDOF.Style[SixDOF.Style.MESH],
            'Wireframe': SixDOF.Style[SixDOF.Style.WIRE],
            'Pointcloud': SixDOF.Style[SixDOF.Style.POINTS]
        })
            .name('Rendering Style')
            .onChange(val => {
                scene.remove(sixDofViewer);
                sixDofViewer = new SixDOF.Viewer(colorTexture, depthTexture, {
                    'style': SixDOF.Style[val]
                });
                scene.add(sixDofViewer);
            });


        return gui;
    }
}