* Checks the capabilities of the current WebGL environment to see if the * settings supplied by the user are capable of being fulfilled. If they * are not, warnings will be logged and the settings will be changed to * something close that can be fulfilled. * * @private
()
| 351 | * @private |
| 352 | */ |
| 353 | _checkIfFormatsAvailable() { |
| 354 | const gl = this.gl; |
| 355 | |
| 356 | if ( |
| 357 | this.useDepth && |
| 358 | this.renderer.webglVersion === constants.WEBGL && |
| 359 | !gl.getExtension('WEBGL_depth_texture') |
| 360 | ) { |
| 361 | console.warn( |
| 362 | 'Unable to create depth textures in this environment. Falling back ' + |
| 363 | 'to a framebuffer without depth.' |
| 364 | ); |
| 365 | this.useDepth = false; |
| 366 | } |
| 367 | |
| 368 | if ( |
| 369 | this.useDepth && |
| 370 | this.renderer.webglVersion === constants.WEBGL && |
| 371 | this.depthFormat === constants.FLOAT |
| 372 | ) { |
| 373 | console.warn( |
| 374 | 'FLOAT depth format is unavailable in WebGL 1. ' + |
| 375 | 'Defaulting to UNSIGNED_INT.' |
| 376 | ); |
| 377 | this.depthFormat = constants.UNSIGNED_INT; |
| 378 | } |
| 379 | |
| 380 | if (![ |
| 381 | constants.UNSIGNED_BYTE, |
| 382 | constants.FLOAT, |
| 383 | constants.HALF_FLOAT |
| 384 | ].includes(this.format)) { |
| 385 | console.warn( |
| 386 | 'Unknown Framebuffer format. ' + |
| 387 | 'Please use UNSIGNED_BYTE, FLOAT, or HALF_FLOAT. ' + |
| 388 | 'Defaulting to UNSIGNED_BYTE.' |
| 389 | ); |
| 390 | this.format = constants.UNSIGNED_BYTE; |
| 391 | } |
| 392 | if (this.useDepth && ![ |
| 393 | constants.UNSIGNED_INT, |
| 394 | constants.FLOAT |
| 395 | ].includes(this.depthFormat)) { |
| 396 | console.warn( |
| 397 | 'Unknown Framebuffer depth format. ' + |
| 398 | 'Please use UNSIGNED_INT or FLOAT. Defaulting to FLOAT.' |
| 399 | ); |
| 400 | this.depthFormat = constants.FLOAT; |
| 401 | } |
| 402 | |
| 403 | const support = checkWebGLCapabilities(this.renderer); |
| 404 | if (!support.float && this.format === constants.FLOAT) { |
| 405 | console.warn( |
| 406 | 'This environment does not support FLOAT textures. ' + |
| 407 | 'Falling back to UNSIGNED_BYTE.' |
| 408 | ); |
| 409 | this.format = constants.UNSIGNED_BYTE; |
| 410 | } |
nothing calls this directly
no test coverage detected