@@ -12,8 +12,6 @@ import { shaderChunks } from './program-lib/chunks/chunks.js';
12
12
import { RenderTarget } from './render-target.js' ;
13
13
import { Texture } from './texture.js' ;
14
14
15
- import { Application } from '../framework/application.js' ;
16
-
17
15
function syncToCpu ( device , targ , face ) {
18
16
var tex = targ . _colorBuffer ;
19
17
if ( tex . format != PIXELFORMAT_R8_G8_B8_A8 ) return ;
@@ -41,7 +39,9 @@ function prefilterCubemap(options) {
41
39
var cpuSync = options . cpuSync ;
42
40
43
41
if ( cpuSync && ! sourceCubemap . _levels [ 0 ] ) {
42
+ // #ifdef DEBUG
44
43
console . error ( "ERROR: prefilter: cubemap must have _levels" ) ;
44
+ // #endif
45
45
return ;
46
46
}
47
47
@@ -306,24 +306,27 @@ function texelCoordSolidAngle(u, v, size) {
306
306
return solidAngle ;
307
307
}
308
308
309
- function shFromCubemap ( source , dontFlipX ) {
309
+ function shFromCubemap ( device , source , dontFlipX ) {
310
310
var face ;
311
311
var cubeSize = source . width ;
312
312
var x , y ;
313
313
314
- if ( source . format != PIXELFORMAT_R8_G8_B8_A8 ) {
314
+ if ( source . format !== PIXELFORMAT_R8_G8_B8_A8 ) {
315
+ // #ifdef DEBUG
315
316
console . error ( "ERROR: SH: cubemap must be RGBA8" ) ;
317
+ // #endif
316
318
return ;
317
319
}
318
320
if ( ! source . _levels [ 0 ] ) {
321
+ // #ifdef DEBUG
319
322
console . error ( "ERROR: SH: cubemap must be synced to CPU" ) ;
323
+ // #endif
320
324
return ;
321
325
}
322
326
if ( ! source . _levels [ 0 ] [ 0 ] . length ) {
323
327
// Cubemap is not composed of arrays
324
328
if ( source . _levels [ 0 ] [ 0 ] instanceof HTMLImageElement ) {
325
329
// Cubemap is made of imgs - convert to arrays
326
- var device = Application . getApplication ( ) . graphicsDevice ;
327
330
var gl = device . gl ;
328
331
var shader = createShaderFromCode ( device ,
329
332
shaderChunks . fullscreenQuadVS ,
@@ -368,7 +371,9 @@ function shFromCubemap(source, dontFlipX) {
368
371
source . _levels [ 0 ] [ face ] = pixels ;
369
372
}
370
373
} else {
374
+ // #ifdef DEBUG
371
375
console . error ( "ERROR: SH: cubemap must be composed of arrays or images" ) ;
376
+ // #endif
372
377
return ;
373
378
}
374
379
}
0 commit comments