import React, { Suspense, useState, useEffect } from "react"; import { Canvas } from "@react-three/fiber"; import { OrbitControls, Environment } from "@react-three/drei"; import AvatarModel from "./AvatarModel"; import Loader from "./Loader"; // Vérification de la disponibilité WebGL function checkWebGLSupport() { try { const canvas = document.createElement('canvas'); return !!( window.WebGLRenderingContext && (canvas.getContext('webgl') || canvas.getContext('experimental-webgl')) ); } catch (e) { return false; } } export default function Avatar3D({ audioUrl }) { // Accepte audioUrl comme prop optionnelle const [webGLAvailable, setWebGLAvailable] = useState(true); const [loading, setLoading] = useState(true); useEffect(() => { setWebGLAvailable(checkWebGLSupport()); }, []); if (!webGLAvailable) { return (

WebGL non supporté

Votre navigateur ne supporte pas WebGL, nécessaire pour afficher l'avatar 3D. Veuillez utiliser un navigateur moderne comme Chrome, Firefox ou Edge.

Prévisualisation non disponible
); } return (
setLoading(false)} > {/* Éclairage amélioré */} {/* Environnement */} {/* Avatar */} {/* Contrôles */} {loading && (

Chargement de l'avatar...

)}
); }