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

163
Views
ThreeJS solo carga una pequeña cantidad de imágenes en cola para cargar con TextureLoader?

Tengo una escena con varios objetos de grupo. Cada objeto de grupo tiene alrededor de 20 o menos objetos secundarios. Estuvo bien durante bastante tiempo. Luego moví los activos a un depósito de AWS S3, con acceso público y una buena política de CORS. Luego agregué alrededor de 10 nuevos activos al mundo. Ahora la mayoría de las imágenes no son cargadas por el cargador de texto. Sé que la política de CORS funciona porque, como dije, funcionó bien antes. Además, si la política de CORS fuera incorrecta, ninguno de los activos se cargaría y, como puede ver, un pequeño porcentaje se carga correctamente. Además, intenté borrar la memoria caché de mi navegador.

Revisé la consola de Chrome DevTools y no recibo ningún error de las funciones de error que tengo en mi llamada THREE.TextLoader().load(). ¿Qué puedo hacer para arreglar esto?

Aquí está mi código de cargador:

 function createMaterialFromImage(srcUrl, bIsRepeated=false) { const errPrefix = `(createMaterialFromImage) `; if (misc_shared_lib.isEmptySafeString(srcUrl)) throw new Error(errPrefix + `The srcUrl parameter is empty.`); // Make sure an attempt to load a GIF file is not made with // this function. if (srcUrl.toLowerCase().endsWith('.gif')) throw new Error(errPrefix + `The srcUrl parameter is a GIF file: ${srcUrl}.`); if (typeof bIsRepeated !== 'boolean') throw new Error(errPrefix + `The value in the bIsRepeated parameter is not boolean.`); const threeJsMaterial = new THREE.MeshBasicMaterial(); const loader = new THREE.TextureLoader().load( // resource URL srcUrl, // This function fires when the resource is loaded. function ( theTexture ) { // If the image is to be repeated, set the wrap // properties to THREE.RepeatWrapping, otherwise // use the default wrapping which is THREE.ClampToEdgeWrapping. theTexture.wrapS = bIsRepeated ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping; theTexture.wrapT = bIsRepeated ? THREE.RepeatWrapping : THREE.ClampToEdgeWrapping; // Assign the texture value to the material map when the texture is loaded. threeJsMaterial.map = theTexture; }, // This function will be called as the download of an // image progresses. function ( xhr ) { const pctLoaded = xhr.loaded / xhr.total * 100; console.info(`${errPrefix}${pctLoaded}}% loaded. Resource: ${srcUrl}.`); }, // This function will be called in the event of an error. function ( xhr ) { console.error( `${errPrefix} Download failed for resource: ${srcUrl}.`); } ); // Return the threeJsMaterial we created the desired image. return threeJsMaterial; }

Aquí hay una captura de pantalla anterior que muestra un objeto de grupo cargado correctamente:

Imagen antigua de la escena ThreeJS que es correcta

Así es como se ve ahora con el problema de carga:

Nueva imagen de la escena ThreeJS con activos de imagen faltantes

about 4 years ago · Juan Pablo Isaza
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!