Skip to content

Commit

Permalink
Merge branch 'master' into tgorkin/gatsby-upgrade-1.0
Browse files Browse the repository at this point in the history
* master:
  Transform refactor (#1221)
  dev-tools: Bump to 0.0.29 (#1232)
  v7.3.0-alpha.7
  Transform: Fix update of Buffers and elementCount. (#1224)
  point docs to release branch (#1229)
  update website fonts (#1227)
  • Loading branch information
tgorkin committed Sep 11, 2019
2 parents 2ac74fb + 210151b commit ad05d1f
Show file tree
Hide file tree
Showing 40 changed files with 1,479 additions and 873 deletions.
78 changes: 78 additions & 0 deletions docs/api-reference/core/transform/buffer-transform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# BufferTransform

`BufferTransform` is an internal helper class for `Transform`, responsible for managing resources and state required for reading from and/or writing to `Buffer` objects. It auto creates `feedbackBufferes` when requested, creates `TransformFeedback` objects. Maintains all buffer bindings, when swapping is eanbled, two binding objects are created for easy switching of all WebGL resource binginds.

NOTE: In following sections 'buffer transform' is used to refer to 'reading from and/or writing to `Buffer` objects'.

## Constructor

### Transform(gl : WebGL2RenderingContext, props: Object)

* `gl` (`WebGLRenderingContext`) gl - context
* `props` (`Object`, Optional) - contains following data.
* `sourceBuffers` (`Object`, Optional) - key and value pairs, where key is the name of vertex shader attribute and value is the corresponding `Attribute`, `Buffer` or attribute descriptor object.
* `feedbackBuffers` (`Object`, Optional) - key and value pairs, where key is the name of vertex shader varying and value is the corresponding `Buffer` object or buffer params object. If a buffer params object is specified, it will contain following fields, these can be used to capture data into the buffer at particular offset and size.
* `buffer`=(Buffer) - Buffer object to be bound.
* `byteOffset`=(Number, default: 0) - Byte offset that is used to start recording the data in the buffer.
* `byteSize`=(Number, default: remaining buffer size) - Size in bytes that is used for recording the data.
* `varyings` (`Array`, Optional) - Array of vertex shader varyings names. When not provided this can be deduced from `feedbackBuffers`.

NOTE: If only reading from `Buffer` objects, above optional props doesn't have to be supplied during construction, but can be supplied using `update` method. If writing to `Buffer` objects, either `varyings` or `feedbackBuffers` must be supplied.


## Methods (Model props)

### getDrawOptions(opts: Object) : Object

Returns resources required when performing `Model.draw()` options.

* `opts` (`Object`) - Any existing `opts.attributes` will be merged with new attributes.

Returns an Object : {attributes, transformFeedback}.

### updateModelProps(props: Object) : Object

Updates input `props` object with data required for buffer transform.

* `opts` (`Object`) - If writing to `Buffer` objects, `opts.varying` will be updated.

Returns updated object.

## Methods (Resource management)

### setupResources(opts: Object)

Sets up internal resources needed writing to buffers.

* `opts` (`Object`) - contains following data.
* `model` (`Model`, Optional) - `Model` object that is used to perform draw operations.

### swap()

If `feedbackMap` is provided during construction, performs source and feedback buffers swap as per the `feedbackMap`.

### update(props: Object)

Updates buffer bindings for one or more source or feedback buffers.

* `props` (`Object`) - contains following data.
* `sourceBuffers` (`Object`, Optional) - key and value pairs, where key is the name of vertex shader attribute and value is the corresponding `Attribute`, `Buffer` or attribute descriptor object.
* `feedbackBuffers` (`Object`, Optional) - key and value pairs, where key is the name of vertex shader varying and value is the corresponding `Buffer` object or buffer params object. If a buffer params object is specified, it will contain following fields, these can be used to capture data into the buffer at particular offset and size.
* `buffer`=(Buffer) - Buffer object to be bound.
* `byteOffset`=(Number, default: 0) - Byte offset that is used to start recording the data in the buffer.
* `byteSize`=(Number, default: remaining buffer size) - Size in bytes that is used for recording the data.


## Methods (Accessors)

### getBuffer(varyingName : String) : Buffer

Returns current feedback buffer corresponding to given varying name.

* `varyingName` (`String`) - varying name.

### getData([options : Object]) : ArrayBufferView

Reads and returns data from current feedback buffer corresponding to the given varying name.

* `options.varyingName` (`String`, Optional) - when specified, first checks if there is a corresponding feedback buffer, if so reads data from this buffer and returns. When not specified, there must be target texture and data is read from this texture and returned.
67 changes: 67 additions & 0 deletions docs/api-reference/core/transform/texture-transform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# TextureTransform

`TextureTransform` is an internal helper class for `Transform`, responsible for managing resources and state required for reading from and/or writing to `Texture` objects. It auto creates `Texture` objects when requested, creates `Framebuffer` objects. Maintains all texture bindings, when swapping is eanbled, two binding objects are created for easy switching of all WebGL resource binginds.

NOTE: In following sections 'texture transform' is used to refer to 'reading from and/or writing to `Texture` objects'.

## Constructor

### Transform(gl : WebGL2RenderingContext, props: Object)

* `gl` (`WebGLRenderingContext`) gl - context
* `props` (`Object`, Optional) - contains following data.
* `sourceTextures` (`Object`, Optional) - key and value pairs, where key is the name of vertex shader attribute and value is the corresponding `Texture` object.
* `targetTexture` (`Texture`|`String`, Optional) - `Texture` object to which data to be written. When it is a `String`, it must be one of the source texture attributes name, a new texture object is cloned from it.
* `targetTextureVarying` (`String`) : varying name used in vertex shader who's data should go into target texture.
* `swapTexture` (`String`) : source texture attribute name, that is swapped with target texture every time `swap()` is called.
* `fs` (`String`, Optional) - fragment shader string, when rendering to a texture, fragments can be processed using this custom shader, when not specified, pass through fragment shader will be used.


## Methods (Model props)

### getDrawOptions(opts: Object) : Object

Returns options required when performing `Model.draw()` options.

* `opts` (`Object`) - Any existing `opts.attributes` , `opts.parameters`, and `opts.uniforms` will be merged with new values.

Returns an Object : {attributes, framebuffer, uniforms, discard, parameters}.

### updateModelProps(props: Object) : Object

Updates input `props` object used to build `Model` object, with data required for texture transform.

* `props` (`Object`) - props for building `Model` object, it will updated with required options (`{vs, fs, modules, uniforms, inject}`) for texture transform.

Returns updated object.

## Methods (Resource management)

### swap()

If `swapTexture` is provided during construction, performs source and feedback buffers swap as per the `swapTexture` mapping.

### update(props: Object)

Updates bindings for source and target texture.

* `props` (`Object`) - contains following data.
* `sourceTextures` (`Object`, Optional) - key and value pairs, where key is the name of vertex shader attribute and value is the corresponding `Texture` object.
* `targetTexture` (`Texture`|`String`, Optional) - `Texture` object to which data to be written. When it is a `String`, it must be one of the source texture attributes name, a new texture object is cloned from it.


## Methods (Accessors)

### getTargetTexture() : Texture

Returns current target texture object.

### getData([options : Object]) : ArrayBufferView

Reads and returns data from current target texture.

* `options.packed` (Boolean, Optional, Default: false) - When true, data is packed to the actual size varyings. When false return array contains 4 values (R, G, B and A) for each element. Un-used element value will be 0 for R, G and B and 1 for A channel.

### getFramebuffer() : Framebuffer

Returns current `Framebuffer` object.
6 changes: 3 additions & 3 deletions examples/core/gltf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"open-vr": "adb reverse tcp:8080 tcp:8080 && adb shell am start -a android.intent.action.VIEW -d http://localhost:8080/"
},
"dependencies": {
"@loaders.gl/core": "^1.2.0",
"@loaders.gl/draco": "^1.2.0",
"@loaders.gl/polyfills": "^1.2.0",
"@loaders.gl/core": "^1.3.0-beta.1",
"@loaders.gl/draco": "^1.3.0-beta.1",
"@loaders.gl/polyfills": "^1.3.0-beta.1",
"@luma.gl/addons": "^7.2.0-beta",
"@luma.gl/constants": "^7.2.0-beta",
"@luma.gl/core": "^7.2.0-beta",
Expand Down
2 changes: 1 addition & 1 deletion examples/core/transform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"dependencies": {
"@luma.gl/core": "^7.2.0-beta",
"probe.gl": "^3.0.1"
"probe.gl": "^3.1.0-beta.3"
},
"devDependencies": {
"html-webpack-plugin": "^3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "2.0.0",
"version": "7.3.0-alpha.6",
"version": "7.3.0-alpha.7",
"npmClient": "yarn",
"useWorkspaces": true,
"exact": true,
Expand Down
12 changes: 6 additions & 6 deletions modules/addons/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@luma.gl/addons",
"version": "7.3.0-alpha.6",
"version": "7.3.0-alpha.7",
"description": "Additional classes for luma.gl",
"license": "MIT",
"repository": {
Expand Down Expand Up @@ -30,16 +30,16 @@
"build-bundle": "webpack --display=minimal --config ../../scripts/bundle.config.js"
},
"dependencies": {
"@loaders.gl/gltf": "^1.2.0",
"@loaders.gl/images": "^1.2.0",
"@luma.gl/constants": "7.3.0-alpha.6",
"@loaders.gl/gltf": "^1.3.0-beta.1",
"@loaders.gl/images": "^1.3.0-beta.1",
"@luma.gl/constants": "7.3.0-alpha.7",
"math.gl": "^2.3.0"
},
"peerDependencies": {
"@luma.gl/core": "^7.1.0"
},
"devDependencies": {
"@loaders.gl/core": "^1.2.0",
"@loaders.gl/polyfills": "^1.2.0"
"@loaders.gl/core": "^1.3.0-beta.1",
"@loaders.gl/polyfills": "^1.3.0-beta.1"
}
}
2 changes: 1 addition & 1 deletion modules/constants/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@luma.gl/constants",
"version": "7.3.0-alpha.6",
"version": "7.3.0-alpha.7",
"description": "WebGL and WebGL2 constants",
"license": "MIT",
"repository": {
Expand Down
14 changes: 7 additions & 7 deletions modules/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@luma.gl/core",
"version": "7.3.0-alpha.6",
"version": "7.3.0-alpha.7",
"description": "WebGL2 Components for High Performance Rendering and Computation",
"license": "MIT",
"publishConfig": {
Expand Down Expand Up @@ -31,13 +31,13 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0",
"@luma.gl/constants": "7.3.0-alpha.6",
"@luma.gl/shadertools": "7.3.0-alpha.6",
"@luma.gl/webgl": "7.3.0-alpha.6",
"@luma.gl/webgl-state-tracker": "7.3.0-alpha.6",
"@luma.gl/webgl2-polyfill": "7.3.0-alpha.6",
"@luma.gl/constants": "7.3.0-alpha.7",
"@luma.gl/shadertools": "7.3.0-alpha.7",
"@luma.gl/webgl": "7.3.0-alpha.7",
"@luma.gl/webgl-state-tracker": "7.3.0-alpha.7",
"@luma.gl/webgl2-polyfill": "7.3.0-alpha.7",
"math.gl": "^2.3.0",
"probe.gl": "^3.0.2",
"probe.gl": "^3.1.0-beta.3",
"seer": "^0.2.4"
}
}
2 changes: 1 addition & 1 deletion modules/core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export {AmbientLight, DirectionalLight, PointLight} from './lighting/light-sourc
export {default as AnimationLoop} from './lib/animation-loop';
export {encodePickingColor, decodePickingColor, getNullPickingColor} from './lib/picking-colors';
export {default as Model} from './lib/model';
export {default as Transform} from './lib/transform';
export {default as Transform} from './lib/transform/transform';
export {default as ClipSpace} from './lib/clip-space';

// Resource Management
Expand Down
Loading

0 comments on commit ad05d1f

Please sign in to comment.