(options)
| 18458 | } |
| 18459 | |
| 18460 | function createScene(options) { |
| 18461 | options = options || {} |
| 18462 | options.camera = options.camera || {} |
| 18463 | |
| 18464 | var canvas = options.canvas |
| 18465 | if(!canvas) { |
| 18466 | canvas = document.createElement('canvas') |
| 18467 | if(options.container) { |
| 18468 | var container = options.container |
| 18469 | container.appendChild(canvas) |
| 18470 | } else { |
| 18471 | document.body.appendChild(canvas) |
| 18472 | } |
| 18473 | } |
| 18474 | |
| 18475 | var gl = options.gl |
| 18476 | if(!gl) { |
| 18477 | if(options.glOptions) { |
| 18478 | isMobile = !!options.glOptions.preserveDrawingBuffer |
| 18479 | } |
| 18480 | |
| 18481 | gl = getContext(canvas, |
| 18482 | options.glOptions || { |
| 18483 | premultipliedAlpha: true, |
| 18484 | antialias: true, |
| 18485 | preserveDrawingBuffer: isMobile |
| 18486 | }) |
| 18487 | } |
| 18488 | if(!gl) { |
| 18489 | throw new Error('webgl not supported') |
| 18490 | } |
| 18491 | |
| 18492 | //Initial bounds |
| 18493 | var bounds = options.bounds || [[-10,-10,-10], [10,10,10]] |
| 18494 | |
| 18495 | //Create selection |
| 18496 | var selection = new MouseSelect() |
| 18497 | |
| 18498 | //Accumulation buffer |
| 18499 | var accumBuffer = createFBO(gl, |
| 18500 | gl.drawingBufferWidth, gl.drawingBufferHeight, { |
| 18501 | preferFloat: !isMobile |
| 18502 | }) |
| 18503 | |
| 18504 | var accumShader = createShader(gl) |
| 18505 | |
| 18506 | var isOrtho = |
| 18507 | (options.cameraObject && options.cameraObject._ortho === true) || |
| 18508 | (options.camera.projection && options.camera.projection.type === 'orthographic') || |
| 18509 | false |
| 18510 | |
| 18511 | //Create a camera |
| 18512 | var cameraOptions = { |
| 18513 | eye: options.camera.eye || [2,0,0], |
| 18514 | center: options.camera.center || [0,0,0], |
| 18515 | up: options.camera.up || [0,1,0], |
| 18516 | zoomMin: options.camera.zoomMax || 0.1, |
| 18517 | zoomMax: options.camera.zoomMin || 100, |
nothing calls this directly
no test coverage detected
searching dependent graphs…