Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

217
Views
Three js hdr se apaga pero nunca se vuelve a encender

Estoy tratando de encender y apagar un mapa hdr en tres js.

Así es como lo creo

 //HDRI LOADER var envmaploader = new THREE.PMREMGenerator(renderer); const loadhdri = new THREE.RGBELoader() .load("myhdr.hdr", function (texture){ texture.mapping = THREE.EquirectangularReflectionMapping; scene.background = texture; scene.environment = texture;

})

Hasta aquí todo bien.

Luego lo agrego a la interfaz gráfica de usuario:

 var gui = new dat.gui.GUI(); var params = {switch: true} const lightsFolder = gui.addFolder('Customize lights') lightsFolder.add(params, "switch").name('hdrenv').onChange(updateHdr)

Finalmente, trato de especificar la lógica de encendido/apagado, pero cuando leo los registros de la consola, siempre imprime 'falso'

 function updateHdr() { if (params2==true) { scene.environment = texture console.log("true")} else {scene.environment = null console.log ("else switch false") } }

Tenga en cuenta que el hdr se carga correctamente, se apaga correctamente cuando hago clic en el botón de cambio, pero nunca se vuelve a encender.

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Intenta escribir tu función updateHdr así:

 function updateHdr( value ) { if ( value === true ) { scene.environment = texture; console.log( 'true' ); } else { scene.environment = null; console.log( 'else switch false' ); } }
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!