Skip to content

Commit

Permalink
Merge branch 'master' of github.com:uber/luma.gl into 3D-texture
Browse files Browse the repository at this point in the history
  • Loading branch information
tsherif committed Mar 12, 2019
2 parents 34944f8 + 8254e17 commit 7c7bc32
Show file tree
Hide file tree
Showing 199 changed files with 2,052 additions and 2,275 deletions.
12 changes: 3 additions & 9 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
{
"require": [
"@babel/register"
],
"sourceMap": false,
"instrument": false,
"extends": "node_modules/ocular-dev-tools/templates/.nycrc",
"include": [
"modules/**/*.js"
],
"exclude": [
"test/**/*.js"
"dev-modules/**/*.js",
"modules/**/dist/es5/**/*.js"
]
}
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ addons:
- libxi-dev
node_js:
- '8.11.4'
install:
- yarn bootstrap
before_script:
- export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start
- npm run build
script:
- npm run test ci
after_success:
- cat coverage/lcov.info | coveralls
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# 7.0 Pre-releases

## v7.0.0-alpha.14 - Mar 11, 2019
- Ensure that externally created contexts are polyfilled, tracked (#954)
- Add support for mat attribute types (#959)
- Add draco glTF compression support (#957)
- Move wip code out of /src (#955)
- Stats update (#953)
- Expose glTF API as function call (#951)
- Query cleanup (#950)
- Fix WebGL 2 timer polyfills (#946)
- glTF: Handle alpha mask and blend (#945)
- Don't create no-op Promises for queries (#942)

## v7.0.0-alpha.13 - Mar 1, 2019
- new default material parameters (#940)
- Capturing canvas contents (#937)
Expand Down
63 changes: 0 additions & 63 deletions aliases.js

This file was deleted.

96 changes: 17 additions & 79 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,84 +1,22 @@
const TARGETS = {
chrome: '60',
edge: '15',
firefox: '53',
ios: '10.3',
safari: '10.1',
node: '8'
};

const CONFIG = {
default: {
presets: [
['@babel/env', {
targets: TARGETS
}]
],
plugins: [
'version-inline',
// NOTE: To debug our babel plugins, just reference the local modules
// './dev-modules/babel-plugin-inline-gl-constants',
'babel-plugin-inline-webgl-constants',
// ['./dev-modules/babel-plugin-remove-glsl-comments', {
['babel-plugin-remove-glsl-comments', {
const getBabelConfig = require('ocular-dev-tools/config/babel.config');

module.exports = api => {
const config = getBabelConfig(api);
config.plugins = config.plugins || [];

config.plugins.push(
'version-inline',
// NOTE: To debug our babel plugins, just reference the local modules
// './dev-modules/babel-plugin-inline-gl-constants',
'babel-plugin-inline-webgl-constants',
// ['./dev-modules/babel-plugin-remove-glsl-comments', {
[
'babel-plugin-remove-glsl-comments',
{
patterns: ['**/shadertools/src/modules/**/*.js']
}]
}
]
}
};

CONFIG.es6 = Object.assign({}, CONFIG.default, {
presets: [
['@babel/env', {
targets: TARGETS,
modules: false
}]
]
});

CONFIG.es6.plugins = CONFIG.es6.plugins.concat([
['@babel/plugin-transform-runtime', {useESModules: true}]
]);

CONFIG.esm = Object.assign({}, CONFIG.default, {
presets: [
['@babel/env', {
modules: false
}]
]
});

CONFIG.esm.plugins = CONFIG.esm.plugins.concat([
['@babel/plugin-transform-runtime', {useESModules: true}]
]);
);

CONFIG.es5 = Object.assign({}, CONFIG.default, {
presets: [
['@babel/env', {
forceAllTransforms: true,
modules: 'commonjs'
}]
]
});

CONFIG.es5.plugins = CONFIG.es5.plugins.concat([
['@babel/plugin-transform-runtime']
]);

CONFIG.cover = Object.assign({}, CONFIG.default);
// constant inlining seems to cause problems for nyc
CONFIG.cover.plugins = ['version-inline', 'istanbul'];

module.exports = function getConfig(api) {

// eslint-disable-next-line
var env = api.cache(() => process.env.BABEL_ENV || process.env.NODE_ENV);

const config = CONFIG[env] || CONFIG.default;
// Uncomment to debug
// eslint-disable-next-line
// console.error(env, config.plugins);
return config;
};

module.exports.config = CONFIG.es6;
38 changes: 23 additions & 15 deletions docs/api-reference/core/animation-loop-proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Returns a function `self => {...}` that sets up the message handling inside the

## Methods

### constructor
### constructor(worker: Worker, props : Object)

```js
new AnimationLoopProxy(worker, {
Expand All @@ -47,37 +47,45 @@ new AnimationLoopProxy(worker, {
```

* `worker` - a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker) instance using code created from `AnimationLoopProxy.createWorker`.
* `options`
- `onInitialize` (callback) - if supplied, will be called once after first `start()` has been called, after page load completes and a context has been created.
- `onFinalize`=`null` (callback) - Called once when animation is stopped. Can be used to delete objects or free any resources created during `onInitialize`.
- `autoResizeDrawingBuffer`=`true` - If true, checks the canvas size every frame and updates the drawing buffer size if needed.
- `useDevicePixels` - Whether to use `window.devicePixelRatio` as a multiplier, e.g. in `autoResizeDrawingBuffer` etc.

### start
* `props.onInitialize` (callback) - if supplied, will be called once after first `start()` has been called, after page load completes and a context has been created.
* `props.onFinalize`=`null` (callback) - Called once when animation is stopped. Can be used to delete objects or free any resources created during `onInitialize`.
* `props.autoResizeDrawingBuffer`=`true` - If true, checks the canvas size every frame and updates the drawing buffer size if needed.
* `props.useDevicePixels` - Whether to use `window.devicePixelRatio` as a multiplier, e.g. in `autoResizeDrawingBuffer` etc.

Restarts the animation
### start([options : Object]) : AnimationLoopProxy

Initializes and then (re)starts the animation

```js
animationLoopProxy.start(options)
```

* `options`=`{}` (object) - Options to create the canvas with.
+ `options.canvas` (string | HTMLCanvasElement) - A *string* containing the `id` of an existing HTML element or a *DOMElement* instance. If `null` or not provided, a new canvas will be created.
* `options.canvas` (string | HTMLCanvasElement) - A *string* containing the `id` of an existing HTML element or a *DOMElement* instance. If `null` or not provided, a new canvas will be created.

### stop
### stop() : AnimationLoopProxy

Stops the animation

```js
animationLoopProxy.stop();
```

### setProps
### waitForRender() : Promise

Returns a promise which resolves in the next frame after rendering has completed.

```js
animationLoopProxy.setProps({...props});
const loop = await animationLoop.waitForRender()
// can now read pixels from webgl context
loop.gl.readPixels(...)
```

* `autoResizeDrawingBuffer` - Update the drawing buffer size to match the canvas size before each call to `onRenderFrame()`
* `useDevicePixels` - Whether to use `window.devicePixelRatio` as a multiplier, e.g. in `autoResizeDrawingBuffer` etc.
### setProps(props: Object) : AnimationLoopProxy

```js
animationLoopProxy.setProps({...props});
```

* `props.autoResizeDrawingBuffer` - Update the drawing buffer size to match the canvas size before each call to `onRenderFrame()`
* `props.useDevicePixels` - Whether to use `window.devicePixelRatio` as a multiplier, e.g. in `autoResizeDrawingBuffer` etc.
58 changes: 34 additions & 24 deletions docs/api-reference/core/animation-loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {AnimationLoop} from 'luma.gl';

const animationLoop = new AnimationLoop({
onInitialize({gl}) {
// Keys in the object returned here will be available in onRenderFrame
// Keys in the object returned here will be available in onRender
return {
clipSpaceQuad: new ClipSpaceQuad({gl, fs: FRAGMENT_SHADER})
};
Expand All @@ -43,72 +43,82 @@ animationLoop.start({canvas: 'my-canvas'});

## Methods

### constructor
### constructor(props : Object)

```js
new AnimationLoop({
onCreateContext,
onInitialize,
onFinalize,
onRenderFrame,
onRender,

autoResizeViewport,
autoResizeDrawingBuffer
});
```

* `onCreateContext`=`null` (callback) - function without parameters that returns a `WebGLRenderingContext`. This callback will be called exactly once, after page load completes.
* `onInitialize` (callback) - if supplied, will be called once after first `start()` has been called, after page load completes and a context has been created.
* `onRender`=`null` (callback) - Called on every animation frame.
* `onFinalize`=`null` (callback) - Called once when animation is stopped. Can be used to delete objects or free any resources created during `onInitialize`.
* `autoResizeViewport`=`true` - If true, calls `gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight)` each frame before `onRenderFrame` is called. Set to false to control viewport size.
* `autoResizeDrawingBuffer`=`true` - If true, checks the canvas size every frame and updates the drawing buffer size if needed.
* `useDevicePixels` - Whether to use `window.devicePixelRatio` as a multiplier, e.g. in `autoResizeDrawingBuffer` etc.
* `gl`=`null` (WebGLContext) - If supplied, will render into this external context instead of creating a new one.
* `glOptions`=`{}` (object) - Options to create the WebGLContext with. See [createGLContext](/docs/api-reference/webgl/context/context.md).
* `debug`=`false` (bool) - Enable debug mode will provide more validations and error messages, but less performant.
* `createFramebuffer`=`false` (bool) - If true, will make a `framebuffer` (FrameBuffer) parameter available to `onInitialize` and `onRender` callbacks.
* `props.onCreateContext`=`null` (callback) - function without parameters that returns a `WebGLRenderingContext`. This callback will be called exactly once, after page load completes.
* `props.onInitialize` (callback) - if supplied, will be called once after first `start()` has been called, after page load completes and a context has been created.
* `props.onRender`=`null` (callback) - Called on every animation frame.
* `props.onFinalize`=`null` (callback) - Called once when animation is stopped. Can be used to delete objects or free any resources created during `onInitialize`.
* `props.autoResizeViewport`=`true` - If true, calls `gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight)` each frame before `onRender` is called. Set to false to control viewport size.
* `props.autoResizeDrawingBuffer`=`true` - If true, checks the canvas size every frame and updates the drawing buffer size if needed.
* `props.useDevicePixels` - Whether to use `window.devicePixelRatio` as a multiplier, e.g. in `autoResizeDrawingBuffer` etc.
* `props.gl`=`null` (WebGLContext) - If supplied, will render into this external context instead of creating a new one.
* `props.glOptions`=`{}` (object) - Options to create the WebGLContext with. See [createGLContext](/docs/api-reference/webgl/context/context.md).
* `props.debug`=`false` (bool) - Enable debug mode will provide more validations and error messages, but less performant.
* `props.createFramebuffer`=`false` (bool) - If true, will make a `framebuffer` (FrameBuffer) parameter available to `onInitialize` and `onRender` callbacks.


### start
### start([options : Object]) : AnimationLoop

Restarts the animation

`animationLoop.start(options)`

* `options`=`{}` (object) - Options to create the WebGLContext with. See [createGLContext](/docs/api-reference/webgl/context/context.md).

### stop
### stop() : AnimationLoop

Stops the animation

`animationLoop.stop()`

### redraw
### waitForRender() : Promise

Returns a promise which resolves in the next frame after rendering and the `onRender` callback have completed.

```js
const loop = await animationLoop.waitForRender()
// can now read pixels from webgl context
loop.gl.readPixels(...)
```

### redraw() : AnimationLoop

Immediately invokes a redraw (call `onRender` with updated animation props). Only use if the canvas must be updated synchronously.

### setNeedsRedraw
### setNeedsRedraw(reason : String) : AnimationLoop

`animationLoop.setNeedsRedraw(reason)`

* `reason` (`String`) - A human readable string giving a hint as to why redraw was needed (e.g. "geometry changed").

If set, the value will be provided as the `needsRedraw` field to the `onRenderFrame` callback.
If set, the value will be provided as the `needsRedraw` field to the `onRender` callback.

Notes:
* `onRenderFrame` will be called for each animation frame regardless of whether this flag is set, and the redraw reason is automatically cleared.
* `onRender` will be called for each animation frame regardless of whether this flag is set, and the redraw reason is automatically cleared.
* If called multiple times, the `reason` provided in the first call will be remembered.
* `AnimationLoop` automatically sets this flag if the WebGL context's drawing buffer size changes.


### setProps
### setProps(props : Object) : AnimationLoop

`animationLoop.setProps({...props})`

* `autoResizeViewport` - Call `gl.viewport` before each call to `onRenderFrame()`
* `autoResizeDrawingBuffer` - Update the drawing buffer size to match the canvas size before each call to `onRenderFrame()`
* `useDevicePixels` - Whether to use `window.devicePixelRatio` as a multiplier, e.g. in `autoResizeDrawingBuffer` etc.
* `props.autoResizeViewport` - Call `gl.viewport` before each call to `onRender()`
* `props.autoResizeDrawingBuffer` - Update the drawing buffer size to match the canvas size before each call to `onRender()`
* `props.useDevicePixels` - Whether to use `window.devicePixelRatio` as a multiplier, e.g. in `autoResizeDrawingBuffer` etc.

### toDataURL

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7c7bc32

Please sign in to comment.