DebugUI Flashcards

1
Q

Qual biblioteca usamos para criar uma Debug UI com sliders e controles?

A

lil-gui

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Como iniciar o GUI após importar?

A

const gui = new GUI()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Como adicionamos um slider para mesh.position.y com limites?

A

gui.add(mesh.position, ‘y’).min(-3).max(3).step(0.01)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Como alterar o nome (label) de um controle?

A

Usando .name(‘nome’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Como mudar o valor de uma variável que não pertence a um objeto?

A

Envolvendo a variável em um objeto (ex: debugObject)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Como adicionamos uma checkbox para mostrar/ocultar um mesh?

A

gui.add(mesh, ‘visible’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Como adicionamos um controle de cor para um material?

A

gui.addColor(material, ‘color’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Por que usar um objeto como debugObject para a cor?

A

Para controlar a cor fora da instância Three.js e poder aplicar .set() no material

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Como aplicamos a nova cor ao material quando a cor no UI mudar?

A

Usando .onChange(() => { material.color.set(debugObject.color) })

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Como adicionamos um botão que executa uma função?

A

Colocamos a função como propriedade em debugObject e usamos gui.add(debugObject, ‘func’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Qual método usamos para reagir a mudanças somente após o usuário soltar o controle?

A

.onFinishChange()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Como substituímos a geometria do mesh com novos valores?

A

mesh.geometry.dispose(); mesh.geometry = new THREE.BoxGeometry(…)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Por que devemos chamar .dispose() na geometria antiga?

A

Para liberar memória da GPU e evitar vazamento

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Como agrupamos múltiplos controles em uma pasta?

A

const folder = gui.addFolder(‘nome’); folder.add(…)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Como ocultar a interface gráfica do lil-gui completamente?

A

gui.hide()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Como alternar a visibilidade da UI com uma tecla?

A

Usando window.addEventListener(‘keydown’, …) e gui.show(gui._hidden)