@luma.gl/engine 8.5.13 → 8.5.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.js +5882 -5979
- package/dist/dist.min.js +1 -1
- package/dist/es5/animation/key-frames.js.map +1 -1
- package/dist/es5/animation/timeline.js +1 -1
- package/dist/es5/animation/timeline.js.map +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/geometries/cone-geometry.js +6 -4
- package/dist/es5/geometries/cone-geometry.js.map +1 -1
- package/dist/es5/geometries/cube-geometry.js +6 -4
- package/dist/es5/geometries/cube-geometry.js.map +1 -1
- package/dist/es5/geometries/cylinder-geometry.js +6 -4
- package/dist/es5/geometries/cylinder-geometry.js.map +1 -1
- package/dist/es5/geometries/ico-sphere-geometry.js +6 -4
- package/dist/es5/geometries/ico-sphere-geometry.js.map +1 -1
- package/dist/es5/geometries/index.js.map +1 -1
- package/dist/es5/geometries/plane-geometry.js +6 -4
- package/dist/es5/geometries/plane-geometry.js.map +1 -1
- package/dist/es5/geometries/sphere-geometry.js +6 -4
- package/dist/es5/geometries/sphere-geometry.js.map +1 -1
- package/dist/es5/geometries/truncated-cone-geometry.js +6 -4
- package/dist/es5/geometries/truncated-cone-geometry.js.map +1 -1
- package/dist/es5/geometry/geometry-utils.js.map +1 -1
- package/dist/es5/geometry/geometry.js +10 -12
- package/dist/es5/geometry/geometry.js.map +1 -1
- package/dist/es5/index.js +24 -24
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/animation-loop.d.ts +1 -1
- package/dist/es5/lib/animation-loop.js +2 -2
- package/dist/es5/lib/animation-loop.js.map +1 -1
- package/dist/es5/lib/model-utils.js +2 -2
- package/dist/es5/lib/model-utils.js.map +1 -1
- package/dist/es5/lib/model.js +1 -1
- package/dist/es5/lib/model.js.map +1 -1
- package/dist/es5/lib/program-manager.js +8 -10
- package/dist/es5/lib/program-manager.js.map +1 -1
- package/dist/es5/transform/buffer-transform.js +1 -1
- package/dist/es5/transform/buffer-transform.js.map +1 -1
- package/dist/es5/transform/texture-transform.js.map +1 -1
- package/dist/es5/transform/transform-shader-utils.js +1 -1
- package/dist/es5/transform/transform-shader-utils.js.map +1 -1
- package/dist/es5/transform/transform.js +6 -8
- package/dist/es5/transform/transform.js.map +1 -1
- package/dist/es5/utils/clip-space.js +4 -2
- package/dist/es5/utils/clip-space.js.map +1 -1
- package/dist/esm/animation/key-frames.js.map +1 -1
- package/dist/esm/animation/timeline.js.map +1 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/geometries/cone-geometry.js +2 -1
- package/dist/esm/geometries/cone-geometry.js.map +1 -1
- package/dist/esm/geometries/cube-geometry.js +2 -1
- package/dist/esm/geometries/cube-geometry.js.map +1 -1
- package/dist/esm/geometries/cylinder-geometry.js +2 -1
- package/dist/esm/geometries/cylinder-geometry.js.map +1 -1
- package/dist/esm/geometries/ico-sphere-geometry.js +3 -2
- package/dist/esm/geometries/ico-sphere-geometry.js.map +1 -1
- package/dist/esm/geometries/index.js.map +1 -1
- package/dist/esm/geometries/plane-geometry.js +6 -5
- package/dist/esm/geometries/plane-geometry.js.map +1 -1
- package/dist/esm/geometries/sphere-geometry.js +2 -1
- package/dist/esm/geometries/sphere-geometry.js.map +1 -1
- package/dist/esm/geometries/truncated-cone-geometry.js +2 -1
- package/dist/esm/geometries/truncated-cone-geometry.js.map +1 -1
- package/dist/esm/geometry/geometry-utils.js.map +1 -1
- package/dist/esm/geometry/geometry.js +4 -3
- package/dist/esm/geometry/geometry.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/animation-loop.d.ts +1 -1
- package/dist/esm/lib/animation-loop.js +19 -15
- package/dist/esm/lib/animation-loop.js.map +1 -1
- package/dist/esm/lib/model-utils.js +1 -1
- package/dist/esm/lib/model-utils.js.map +1 -1
- package/dist/esm/lib/model.js +23 -13
- package/dist/esm/lib/model.js.map +1 -1
- package/dist/esm/lib/program-manager.js +5 -3
- package/dist/esm/lib/program-manager.js.map +1 -1
- package/dist/esm/transform/buffer-transform.js +20 -10
- package/dist/esm/transform/buffer-transform.js.map +1 -1
- package/dist/esm/transform/texture-transform.js +21 -11
- package/dist/esm/transform/texture-transform.js.map +1 -1
- package/dist/esm/transform/transform-shader-utils.js +23 -25
- package/dist/esm/transform/transform-shader-utils.js.map +1 -1
- package/dist/esm/transform/transform.js +13 -6
- package/dist/esm/transform/transform.js.map +1 -1
- package/dist/esm/utils/clip-space.js +1 -16
- package/dist/esm/utils/clip-space.js.map +1 -1
- package/package.json +8 -7
- package/src/lib/animation-loop.d.ts +1 -1
- package/src/lib/model.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"truncated-cone-geometry.js","names":["INDEX_OFFSETS","x","y","z","TruncatedConeGeometry","props","id","uid","tesselateTruncatedCone","indices","attributes","Geometry","bottomRadius","topRadius","height","nradial","nvertical","verticalAxis","topCap","bottomCap","extra","numVertices","slant","Math","atan2","msin","sin","mcos","cos","mpi","PI","cosSlant","sinSlant","start","end","vertsAroundEdge","Uint16Array","indexOffset","positions","Float32Array","normals","texCoords","i3","i2","i","v","ringRadius","j","index","POSITION","size","value","NORMAL","TEXCOORD_0"],"sources":["../../../src/geometries/truncated-cone-geometry.js"],"sourcesContent":["import Geometry from '../geometry/geometry';\nimport {uid} from '@luma.gl/webgl';\n\nconst INDEX_OFFSETS = {\n x: [2, 0, 1],\n y: [0, 1, 2],\n z: [1, 2, 0]\n};\n\nexport default class TruncatedConeGeometry extends Geometry {\n constructor(props = {}) {\n const {id = uid('truncated-code-geometry')} = props;\n const {indices, attributes} = tesselateTruncatedCone(props);\n super({\n ...props,\n id,\n indices,\n attributes: {...attributes, ...props.attributes}\n });\n }\n}\n\n// Primitives inspired by TDL http://code.google.com/p/webglsamples/,\n// copyright 2011 Google Inc. new BSD License\n// (http://www.opensource.org/licenses/bsd-license.php).\n/* eslint-disable max-statements, complexity */\nfunction tesselateTruncatedCone(props) {\n const {\n bottomRadius = 0,\n topRadius = 0,\n height = 1,\n nradial = 10,\n nvertical = 10,\n verticalAxis = 'y',\n topCap = false,\n bottomCap = false\n } = props;\n\n const extra = (topCap ? 2 : 0) + (bottomCap ? 2 : 0);\n const numVertices = (nradial + 1) * (nvertical + 1 + extra);\n\n const slant = Math.atan2(bottomRadius - topRadius, height);\n const msin = Math.sin;\n const mcos = Math.cos;\n const mpi = Math.PI;\n const cosSlant = mcos(slant);\n const sinSlant = msin(slant);\n const start = topCap ? -2 : 0;\n const end = nvertical + (bottomCap ? 2 : 0);\n const vertsAroundEdge = nradial + 1;\n\n const indices = new Uint16Array(nradial * (nvertical + extra) * 6);\n const indexOffset = INDEX_OFFSETS[verticalAxis];\n\n const positions = new Float32Array(numVertices * 3);\n const normals = new Float32Array(numVertices * 3);\n const texCoords = new Float32Array(numVertices * 2);\n\n let i3 = 0;\n let i2 = 0;\n for (let i = start; i <= end; i++) {\n let v = i / nvertical;\n let y = height * v;\n let ringRadius;\n\n if (i < 0) {\n y = 0;\n v = 1;\n ringRadius = bottomRadius;\n } else if (i > nvertical) {\n y = height;\n v = 1;\n ringRadius = topRadius;\n } else {\n ringRadius = bottomRadius + (topRadius - bottomRadius) * (i / nvertical);\n }\n if (i === -2 || i === nvertical + 2) {\n ringRadius = 0;\n v = 0;\n }\n y -= height / 2;\n for (let j = 0; j < vertsAroundEdge; j++) {\n const sin = msin((j * mpi * 2) / nradial);\n const cos = mcos((j * mpi * 2) / nradial);\n\n positions[i3 + indexOffset[0]] = sin * ringRadius;\n positions[i3 + indexOffset[1]] = y;\n positions[i3 + indexOffset[2]] = cos * ringRadius;\n\n normals[i3 + indexOffset[0]] = i < 0 || i > nvertical ? 0 : sin * cosSlant;\n normals[i3 + indexOffset[1]] = i < 0 ? -1 : i > nvertical ? 1 : sinSlant;\n normals[i3 + indexOffset[2]] = i < 0 || i > nvertical ? 0 : cos * cosSlant;\n\n texCoords[i2 + 0] = j / nradial;\n texCoords[i2 + 1] = v;\n\n i2 += 2;\n i3 += 3;\n }\n }\n\n for (let i = 0; i < nvertical + extra; i++) {\n for (let j = 0; j < nradial; j++) {\n const index = (i * nradial + j) * 6;\n indices[index + 0] = vertsAroundEdge * (i + 0) + 0 + j;\n indices[index + 1] = vertsAroundEdge * (i + 0) + 1 + j;\n indices[index + 2] = vertsAroundEdge * (i + 1) + 1 + j;\n indices[index + 3] = vertsAroundEdge * (i + 0) + 0 + j;\n indices[index + 4] = vertsAroundEdge * (i + 1) + 1 + j;\n indices[index + 5] = vertsAroundEdge * (i + 1) + 0 + j;\n }\n }\n\n return {\n indices,\n attributes: {\n POSITION: {size: 3, value: positions},\n NORMAL: {size: 3, value: normals},\n TEXCOORD_0: {size: 2, value: texCoords}\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;;;;;;;;;AAEA,IAAMA,aAAa,GAAG;EACpBC,CAAC,EAAE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CADiB;EAEpBC,CAAC,EAAE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAFiB;EAGpBC,CAAC,EAAE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP;AAHiB,CAAtB;;IAMqBC,qB;;;;;EACnB,iCAAwB;IAAA,IAAZC,KAAY,uEAAJ,EAAI;IAAA;IACtB,gBAA8CA,KAA9C,CAAOC,EAAP;IAAA,IAAOA,EAAP,0BAAY,IAAAC,UAAA,EAAI,yBAAJ,CAAZ;;IACA,4BAA8BC,sBAAsB,CAACH,KAAD,CAApD;IAAA,IAAOI,OAAP,yBAAOA,OAAP;IAAA,IAAgBC,UAAhB,yBAAgBA,UAAhB;;IAFsB,yDAIjBL,KAJiB;MAKpBC,EAAE,EAAFA,EALoB;MAMpBG,OAAO,EAAPA,OANoB;MAOpBC,UAAU,kCAAMA,UAAN,GAAqBL,KAAK,CAACK,UAA3B;IAPU;EASvB;;;EAVgDC,iB;;;;AAiBnD,SA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AAK,EAAEX;MAAjB,CAFE;MAGVa,UAAU,EAAE;QAACH,IAAI,EAAE,CAAP;QAAUC,KAAK,EAAEV;MAAjB;IAHF;EAFP,CAAP;AAQD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"geometry-utils.js","names":["unpackIndexedGeometry","geometry","indices","attributes","vertexCount","value","length","unpackedAttributes","attributeName","attribute","constant","size","unpackedValue","constructor","x","index","i","Object","assign"],"sources":["../../../src/geometry/geometry-utils.js"],"sourcesContent":["export function unpackIndexedGeometry(geometry) {\n const {indices, attributes} = geometry;\n if (!indices) {\n return geometry;\n }\n\n const vertexCount = indices.value.length;\n const unpackedAttributes = {};\n\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n const {constant, value, size} = attribute;\n if (constant || !size) {\n continue; // eslint-disable-line\n }\n const unpackedValue = new value.constructor(vertexCount * size);\n for (let x = 0; x < vertexCount; ++x) {\n const index = indices.value[x];\n for (let i = 0; i < size; i++) {\n unpackedValue[x * size + i] = value[index * size + i];\n }\n }\n unpackedAttributes[attributeName] = {size, value: unpackedValue};\n }\n\n return {\n attributes: Object.assign({}, attributes, unpackedAttributes)\n };\n}\n"],"mappings":";;;;;;;AAAO,SAASA,qBAAT,CAA+BC,QAA/B,EAAyC;EAC9C,IAAOC,OAAP,GAA8BD,QAA9B,CAAOC,OAAP;EAAA,IAAgBC,UAAhB,GAA8BF,QAA9B,CAAgBE,UAAhB;;EACA,IAAI,CAACD,OAAL,EAAc;IACZ,OAAOD,QAAP;EACD;;EAED,IAAMG,WAAW,GAAGF,OAAO,CAACG,KAAR,CAAcC,MAAlC;EACA,IAAMC,kBAAkB,GAAG,EAA3B;;EAEA,KAAK,IAAMC,aAAX,IAA4BL,UAA5B,EAAwC;IACtC,IAAMM,SAAS,GAAGN,UAAU,CAACK,aAAD,CAA5B;IACA,IAAOE,QAAP,GAAgCD,SAAhC,CAAOC,QAAP;IAAA,IAAiBL,KAAjB,GAAgCI,SAAhC,CAAiBJ,KAAjB;IAAA,IAAwBM,IAAxB,GAAgCF,SAAhC,CAAwBE,IAAxB;;IACA,IAAID,QAAQ,IAAI,CAACC,IAAjB,EAAuB;MACrB;IACD;;IACD,IAAMC,aAAa,GAAG,IAAIP,KAAK,CAACQ,WAAV,CAAsBT,WAAW,GAAGO,IAApC,CAAtB;;IACA,KAAK,IAAIG,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGV,WAApB,EAAiC,EAAEU,CAAnC,EAAsC;MACpC,IAAMC,KAAK,GAAGb,OAAO,CAACG,KAAR,CAAcS,CAAd,CAAd;;MACA,KAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGL,IAApB,EAA0BK,CAAC,EAA3B,EAA+B;QAC7BJ,aAAa,CAACE,CAAC,GAAGH,IAAJ,GAAWK,CAAZ,CAAb,GAA8BX,KAAK,CAACU,KAAK,GAAGJ,IAAR,GAAeK,CAAhB,CAAnC;MACD;IACF;;IACDT,kBAAkB,CAACC,aAAD,CAAlB,GAAoC;MAACG,IAAI,EAAJA,IAAD;MAAON,KAAK,EAAEO;IAAd,CAApC;EACD;;EAED,OAAO;IACLT,UAAU,EAAEc,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBf,UAAlB,EAA8BI,kBAA9B;EADP,CAAP;AAGD"}
|
|
@@ -15,9 +15,9 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
15
15
|
|
|
16
16
|
var _webgl = require("@luma.gl/webgl");
|
|
17
17
|
|
|
18
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
19
|
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
21
|
|
|
22
22
|
var DRAW_MODE = {
|
|
23
23
|
POINTS: 0x0000,
|
|
@@ -31,13 +31,6 @@ var DRAW_MODE = {
|
|
|
31
31
|
exports.DRAW_MODE = DRAW_MODE;
|
|
32
32
|
|
|
33
33
|
var Geometry = function () {
|
|
34
|
-
(0, _createClass2.default)(Geometry, null, [{
|
|
35
|
-
key: "DRAW_MODE",
|
|
36
|
-
get: function get() {
|
|
37
|
-
return DRAW_MODE;
|
|
38
|
-
}
|
|
39
|
-
}]);
|
|
40
|
-
|
|
41
34
|
function Geometry() {
|
|
42
35
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
43
36
|
(0, _classCallCheck2.default)(this, Geometry);
|
|
@@ -62,6 +55,11 @@ var Geometry = function () {
|
|
|
62
55
|
}
|
|
63
56
|
|
|
64
57
|
(0, _createClass2.default)(Geometry, [{
|
|
58
|
+
key: "mode",
|
|
59
|
+
get: function get() {
|
|
60
|
+
return this.drawMode;
|
|
61
|
+
}
|
|
62
|
+
}, {
|
|
65
63
|
key: "getVertexCount",
|
|
66
64
|
value: function getVertexCount() {
|
|
67
65
|
return this.vertexCount;
|
|
@@ -137,10 +135,10 @@ var Geometry = function () {
|
|
|
137
135
|
(0, _webgl.assert)(Number.isFinite(vertexCount));
|
|
138
136
|
return vertexCount;
|
|
139
137
|
}
|
|
140
|
-
}, {
|
|
141
|
-
key: "
|
|
138
|
+
}], [{
|
|
139
|
+
key: "DRAW_MODE",
|
|
142
140
|
get: function get() {
|
|
143
|
-
return
|
|
141
|
+
return DRAW_MODE;
|
|
144
142
|
}
|
|
145
143
|
}]);
|
|
146
144
|
return Geometry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"geometry.js","names":["DRAW_MODE","POINTS","LINES","LINE_LOOP","LINE_STRIP","TRIANGLES","TRIANGLE_STRIP","TRIANGLE_FAN","Geometry","props","id","uid","drawMode","attributes","indices","vertexCount","userData","_setAttributes","_calculateVertexCount","attributeName","ArrayBuffer","isView","value","size","attribute","assert","_print","isIndexed","undefined","Object","assign","length","Infinity","constant","Math","min","Number","isFinite"],"sources":["../../../src/geometry/geometry.js"],"sourcesContent":["import {uid, assert} from '@luma.gl/webgl';\n\n// Rendering primitives - specify how to extract primitives from vertices.\n// NOTE: These are numerically identical to the corresponding WebGL/OpenGL constants\nexport const DRAW_MODE = {\n POINTS: 0x0000, // draw single points.\n LINES: 0x0001, // draw lines. Each vertex connects to the one after it.\n LINE_LOOP: 0x0002, // draw lines. Each set of two vertices is treated as a separate line segment.\n LINE_STRIP: 0x0003, // draw a connected group of line segments from the first vertex to the last\n TRIANGLES: 0x0004, // draw triangles. Each set of three vertices creates a separate triangle.\n TRIANGLE_STRIP: 0x0005, // draw a connected group of triangles.\n TRIANGLE_FAN: 0x0006 // draw a connected group of triangles.\n // Each vertex connects to the previous and the first vertex in the fan.\n};\n\nexport default class Geometry {\n static get DRAW_MODE() {\n return DRAW_MODE;\n }\n\n constructor(props = {}) {\n const {\n id = uid('geometry'),\n drawMode = DRAW_MODE.TRIANGLES,\n attributes = {},\n indices = null,\n vertexCount = null\n } = props;\n\n this.id = id;\n this.drawMode = drawMode | 0;\n this.attributes = {};\n this.userData = {};\n\n this._setAttributes(attributes, indices);\n\n this.vertexCount = vertexCount || this._calculateVertexCount(this.attributes, this.indices);\n\n // stubRemovedMethods(this, [\n // 'setNeedsRedraw', 'needsRedraw', 'setAttributes'\n // ], 'Immutable');\n\n // stubRemovedMethods(this, [\n // 'hasAttribute', 'getAttribute', 'getArray'\n // ], 'Use geometry.attributes and geometry.indices');\n\n // deprecateMethods(this, ['getAttributes'])\n }\n\n get mode() {\n return this.drawMode;\n }\n\n getVertexCount() {\n return this.vertexCount;\n }\n\n // Return an object with all attributes plus indices added as a field.\n getAttributes() {\n return this.indices ? {indices: this.indices, ...this.attributes} : this.attributes;\n }\n\n // PRIVATE\n\n _print(attributeName) {\n return `Geometry ${this.id} attribute ${attributeName}`;\n }\n\n // Attribute\n // value: typed array\n // type: indices, vertices, uvs\n // size: elements per vertex\n // target: WebGL buffer type (string or constant)\n _setAttributes(attributes, indices) {\n if (indices) {\n this.indices = ArrayBuffer.isView(indices) ? {value: indices, size: 1} : indices;\n }\n\n for (const attributeName in attributes) {\n let attribute = attributes[attributeName];\n\n // Wrap \"unwrapped\" arrays and try to autodetect their type\n attribute = ArrayBuffer.isView(attribute) ? {value: attribute} : attribute;\n\n assert(\n ArrayBuffer.isView(attribute.value),\n `${this._print(attributeName)}: must be typed array or object with value as typed array`\n );\n\n if ((attributeName === 'POSITION' || attributeName === 'positions') && !attribute.size) {\n attribute.size = 3;\n }\n\n // Move indices to separate field\n if (attributeName === 'indices') {\n assert(!this.indices);\n this.indices = attribute;\n } else {\n this.attributes[attributeName] = attribute;\n }\n }\n\n if (this.indices && this.indices.isIndexed !== undefined) {\n this.indices = Object.assign({}, this.indices);\n delete this.indices.isIndexed;\n }\n\n return this;\n }\n\n _calculateVertexCount(attributes, indices) {\n if (indices) {\n return indices.value.length;\n }\n let vertexCount = Infinity;\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n const {value, size, constant} = attribute;\n if (!constant && value && size >= 1) {\n vertexCount = Math.min(vertexCount, value.length / size);\n }\n }\n\n assert(Number.isFinite(vertexCount));\n return vertexCount;\n }\n}\n"],"mappings":";;;;;;;;;;;;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QACX,OAAOA,OAAO,CAACQ,KAAR,CAAcS,MAArB;MACD;;MACD,IAAIhB,WAAW,GAAGiB,QAAlB;;MACA,KAAK,IAAMb,aAAX,IAA4BN,UAA5B,EAAwC;QACtC,IAAMW,SAAS,GAAGX,UAAU,CAACM,aAAD,CAA5B;QACA,IAAOG,KAAP,GAAgCE,SAAhC,CAAOF,KAAP;QAAA,IAAcC,IAAd,GAAgCC,SAAhC,CAAcD,IAAd;QAAA,IAAoBU,QAApB,GAAgCT,SAAhC,CAAoBS,QAApB;;QACA,IAAI,CAACA,QAAD,IAAaX,KAAb,IAAsBC,IAAI,IAAI,CAAlC,EAAqC;UACnCR,WAAW,GAAGmB,IAAI,CAACC,GAAL,CAASpB,WAAT,EAAsBO,KAAK,CAACS,MAAN,GAAeR,IAArC,CAAd;QACD;MACF;;MAED,IAAAE,aAAA,EAAOW,MAAM,CAACC,QAAP,CAAgBtB,WAAhB,CAAP;MACA,OAAOA,WAAP;IACD;;;SA7GD,eAAuB;MACrB,OAAOf,SAAP;IACD"}
|
package/dist/es5/index.js
CHANGED
|
@@ -11,52 +11,52 @@ Object.defineProperty(exports, "AnimationLoop", {
|
|
|
11
11
|
return _animationLoop.default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
Object.defineProperty(exports, "
|
|
14
|
+
Object.defineProperty(exports, "ClipSpace", {
|
|
15
15
|
enumerable: true,
|
|
16
16
|
get: function get() {
|
|
17
|
-
return
|
|
17
|
+
return _clipSpace.default;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
Object.defineProperty(exports, "
|
|
20
|
+
Object.defineProperty(exports, "ConeGeometry", {
|
|
21
21
|
enumerable: true,
|
|
22
22
|
get: function get() {
|
|
23
|
-
return
|
|
23
|
+
return _coneGeometry.default;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
Object.defineProperty(exports, "
|
|
26
|
+
Object.defineProperty(exports, "CubeGeometry", {
|
|
27
27
|
enumerable: true,
|
|
28
28
|
get: function get() {
|
|
29
|
-
return
|
|
29
|
+
return _cubeGeometry.default;
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
Object.defineProperty(exports, "
|
|
32
|
+
Object.defineProperty(exports, "CylinderGeometry", {
|
|
33
33
|
enumerable: true,
|
|
34
34
|
get: function get() {
|
|
35
|
-
return
|
|
35
|
+
return _cylinderGeometry.default;
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
Object.defineProperty(exports, "
|
|
38
|
+
Object.defineProperty(exports, "Geometry", {
|
|
39
39
|
enumerable: true,
|
|
40
40
|
get: function get() {
|
|
41
|
-
return
|
|
41
|
+
return _geometry.default;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
-
Object.defineProperty(exports, "
|
|
44
|
+
Object.defineProperty(exports, "IcoSphereGeometry", {
|
|
45
45
|
enumerable: true,
|
|
46
46
|
get: function get() {
|
|
47
|
-
return
|
|
47
|
+
return _icoSphereGeometry.default;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
Object.defineProperty(exports, "
|
|
50
|
+
Object.defineProperty(exports, "KeyFrames", {
|
|
51
51
|
enumerable: true,
|
|
52
52
|
get: function get() {
|
|
53
|
-
return
|
|
53
|
+
return _keyFrames.KeyFrames;
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
-
Object.defineProperty(exports, "
|
|
56
|
+
Object.defineProperty(exports, "Model", {
|
|
57
57
|
enumerable: true,
|
|
58
58
|
get: function get() {
|
|
59
|
-
return
|
|
59
|
+
return _model.default;
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "PlaneGeometry", {
|
|
@@ -65,16 +65,16 @@ Object.defineProperty(exports, "PlaneGeometry", {
|
|
|
65
65
|
return _planeGeometry.default;
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
-
Object.defineProperty(exports, "
|
|
68
|
+
Object.defineProperty(exports, "ProgramManager", {
|
|
69
69
|
enumerable: true,
|
|
70
70
|
get: function get() {
|
|
71
|
-
return
|
|
71
|
+
return _programManager.default;
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
|
-
Object.defineProperty(exports, "
|
|
74
|
+
Object.defineProperty(exports, "SphereGeometry", {
|
|
75
75
|
enumerable: true,
|
|
76
76
|
get: function get() {
|
|
77
|
-
return
|
|
77
|
+
return _sphereGeometry.default;
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "Timeline", {
|
|
@@ -83,16 +83,16 @@ Object.defineProperty(exports, "Timeline", {
|
|
|
83
83
|
return _timeline.Timeline;
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
|
-
Object.defineProperty(exports, "
|
|
86
|
+
Object.defineProperty(exports, "Transform", {
|
|
87
87
|
enumerable: true,
|
|
88
88
|
get: function get() {
|
|
89
|
-
return
|
|
89
|
+
return _transform.default;
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
|
-
Object.defineProperty(exports, "
|
|
92
|
+
Object.defineProperty(exports, "TruncatedConeGeometry", {
|
|
93
93
|
enumerable: true,
|
|
94
94
|
get: function get() {
|
|
95
|
-
return
|
|
95
|
+
return _truncatedConeGeometry.default;
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
|
package/dist/es5/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.js"],"sourcesContent":["// CORE\nexport {default as AnimationLoop} from './lib/animation-loop';\nexport {default as Model} from './lib/model';\nexport {default as ProgramManager} from './lib/program-manager';\nexport {default as Transform} from './transform/transform';\n\n// Geometries\nexport {default as Geometry} from './geometry/geometry';\nexport {default as ConeGeometry} from './geometries/cone-geometry';\nexport {default as CubeGeometry} from './geometries/cube-geometry';\nexport {default as CylinderGeometry} from './geometries/cylinder-geometry';\nexport {default as IcoSphereGeometry} from './geometries/ico-sphere-geometry';\nexport {default as PlaneGeometry} from './geometries/plane-geometry';\nexport {default as SphereGeometry} from './geometries/sphere-geometry';\nexport {default as TruncatedConeGeometry} from './geometries/truncated-cone-geometry';\n\n// Animation\nexport {Timeline} from './animation/timeline';\nexport {KeyFrames} from './animation/key-frames';\n\n// Utils\nexport {default as ClipSpace} from './utils/clip-space';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AACA;;AAGA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// TODO - remove dependency on framebuffer (bundle size impact)
|
|
2
2
|
import {Query, Framebuffer} from '@luma.gl/webgl';
|
|
3
|
-
import { Stats } from 'probe.gl'
|
|
3
|
+
import { Stats } from '@probe.gl/stats'
|
|
4
4
|
import { Timeline } from '../animation/timeline'
|
|
5
5
|
|
|
6
6
|
import {CreateGLContextOptions} from '@luma.gl/gltools'
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
-
|
|
12
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
11
|
|
|
12
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
+
|
|
14
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
15
|
|
|
16
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/animation-loop.js"],"names":["isPage","document","statIdCounter","AnimationLoop","props","onCreateContext","opts","onAddHTML","onInitialize","onRender","onFinalize","onError","gl","glOptions","debug","createFramebuffer","autoResizeViewport","autoResizeDrawingBuffer","stats","lumaStats","get","useDevicePixels","log","deprecated","useDevicePixelRatio","needsRedraw","timeline","cpuTime","gpuTime","frameRate","_initialized","_running","_animationFrameId","_nextFramePromise","_resolveNextFrame","_cpuStartTime","setProps","start","bind","stop","_pageLoadPromise","_onMousemove","_onMouseleave","_setDisplay","reason","startPromise","_getPageLoadPromise","then","_createWebGLContext","_createFramebuffer","_startEventHandling","_initializeCallbackData","_updateCallbackData","_resizeCanvasDrawingBuffer","_resizeViewport","_gpuTimeQuery","Query","isSupported","animationProps","appContext","_addCallbackData","_startLoop","catch","isContextLost","_beginTimers","_setupFrame","_renderFrame","_clearNeedsRedraw","offScreen","commit","_endTimers","_finalizeCallbackData","_cancelAnimationFrame","setNeedsRedraw","Promise","resolve","waitForRender","canvas","toDataURL","id","defaultValue","element","getElementById","Number","value","removed","renderFrame","redraw","_requestAnimationFrame","reject","readyState","window","addEventListener","display","delete","animationLoop","animationFrameId","cancelAnimationFrame","renderFrameCallback","requestAnimationFrame","undefined","_resizeFramebuffer","framebuffer","startTime","Date","now","engineTime","tick","tock","time","_timeline","_loop","_animationLoop","_mousePosition","_getSizeAndAspect","width","height","aspect","update","Math","floor","getTime","_offScreen","Object","assign","OffscreenCanvas","Error","_createInfoDiv","wrapperDiv","createElement","body","appendChild","style","position","div","left","bottom","background","html","innerHTML","drawingBufferWidth","drawingBufferHeight","clientHeight","clientWidth","viewport","Framebuffer","resize","timeEnd","timeStart","isResultAvailable","isTimerDisjoint","addTime","getTimerMilliseconds","beginTimeElapsedQuery","end","e","offsetX","offsetY"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AAQA;;AAWA;;AAEA,IAAMA,MAAM,GAAG,yBAAe,OAAOC,QAAP,KAAoB,WAAlD;AAEA,IAAIC,aAAa,GAAG,CAApB;;IAEqBC,a;AAInB,2BAAwB;AAAA,QAAZC,KAAY,uEAAJ,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qBAAnB;AACD;;AAED,WAAK9H,OAAL,CAAayH,SAAb;AACD;;;iCAEY;AACX,WAAKzH,OAAL,CAAawH,OAAb;;AAEA,UAAI,KAAK5F,aAAT,EAAwB;AAEtB,aAAKA,aAAL,CAAmBmG,GAAnB;AACD;AACF;;;0CAIqB;AAAA,UACb7E,MADa,GACH,KAAKjE,EADF,CACbiE,MADa;;AAEpB,UAAIA,MAAJ,EAAY;AACVA,QAAAA,MAAM,CAACe,gBAAP,CAAwB,WAAxB,EAAqC,KAAKnD,YAA1C;AACAoC,QAAAA,MAAM,CAACe,gBAAP,CAAwB,YAAxB,EAAsC,KAAKlD,aAA3C;AACD;AACF;;;iCAEYiH,C,EAAG;AACd,WAAKjG,cAAL,CAAoBuD,cAApB,GAAqC,CAAC0C,CAAC,CAACC,OAAH,EAAYD,CAAC,CAACE,OAAd,CAArC;AACD;;;kCACaF,C,EAAG;AACf,WAAKjG,cAAL,CAAoBuD,cAApB,GAAqC,IAArC;AACD","sourcesContent":["import {\n isWebGL,\n createGLContext,\n instrumentGLContext,\n resizeGLContext,\n resetParameters\n} from '@luma.gl/gltools';\n\nimport {\n requestAnimationFrame,\n cancelAnimationFrame,\n Query,\n lumaStats,\n // TODO - remove dependency on framebuffer (bundle size impact)\n Framebuffer,\n log,\n assert\n} from '@luma.gl/webgl';\n\nimport {isBrowser} from '@probe.gl/env';\n\nconst isPage = isBrowser() && typeof document !== 'undefined';\n\nlet statIdCounter = 0;\n\nexport default class AnimationLoop {\n /*\n * @param {HTMLCanvasElement} canvas - if provided, width and height will be passed to context\n */\n constructor(props = {}) {\n const {\n onCreateContext = opts => createGLContext(opts),\n onAddHTML = null,\n onInitialize = () => {},\n onRender = () => {},\n onFinalize = () => {},\n onError,\n\n gl = null,\n glOptions = {},\n debug = false,\n\n createFramebuffer = false,\n\n // view parameters\n autoResizeViewport = true,\n autoResizeDrawingBuffer = true,\n stats = lumaStats.get(`animation-loop-${statIdCounter++}`)\n } = props;\n\n let {useDevicePixels = true} = props;\n\n if ('useDevicePixelRatio' in props) {\n log.deprecated('useDevicePixelRatio', 'useDevicePixels')();\n // @ts-ignore\n useDevicePixels = props.useDevicePixelRatio;\n }\n\n this.props = {\n onCreateContext,\n onAddHTML,\n onInitialize,\n onRender,\n onFinalize,\n onError,\n\n gl,\n glOptions,\n debug,\n createFramebuffer\n };\n\n // state\n this.gl = gl;\n this.needsRedraw = null;\n this.timeline = null;\n this.stats = stats;\n this.cpuTime = this.stats.get('CPU Time');\n this.gpuTime = this.stats.get('GPU Time');\n this.frameRate = this.stats.get('Frame Rate');\n\n this._initialized = false;\n this._running = false;\n this._animationFrameId = null;\n this._nextFramePromise = null;\n this._resolveNextFrame = null;\n this._cpuStartTime = 0;\n\n this.setProps({\n autoResizeViewport,\n autoResizeDrawingBuffer,\n useDevicePixels\n });\n\n // Bind methods\n this.start = this.start.bind(this);\n this.stop = this.stop.bind(this);\n\n this._pageLoadPromise = null;\n\n this._onMousemove = this._onMousemove.bind(this);\n this._onMouseleave = this._onMouseleave.bind(this);\n }\n\n delete() {\n this.stop();\n this._setDisplay(null);\n }\n\n setNeedsRedraw(reason) {\n assert(typeof reason === 'string');\n this.needsRedraw = this.needsRedraw || reason;\n return this;\n }\n\n setProps(props) {\n if ('autoResizeViewport' in props) {\n this.autoResizeViewport = props.autoResizeViewport;\n }\n if ('autoResizeDrawingBuffer' in props) {\n this.autoResizeDrawingBuffer = props.autoResizeDrawingBuffer;\n }\n if ('useDevicePixels' in props) {\n this.useDevicePixels = props.useDevicePixels;\n }\n return this;\n }\n\n // Starts a render loop if not already running\n // @param {Object} context - contains frame specific info (E.g. tick, width, height, etc)\n start(opts = {}) {\n if (this._running) {\n return this;\n }\n this._running = true;\n // console.debug(`Starting ${this.constructor.name}`);\n // Wait for start promise before rendering frame\n const startPromise = this._getPageLoadPromise()\n .then(() => {\n if (!this._running || this._initialized) {\n return null;\n }\n\n // Create the WebGL context\n this._createWebGLContext(opts);\n this._createFramebuffer();\n this._startEventHandling();\n\n // Initialize the callback data\n this._initializeCallbackData();\n this._updateCallbackData();\n\n // Default viewport setup, in case onInitialize wants to render\n this._resizeCanvasDrawingBuffer();\n this._resizeViewport();\n\n this._gpuTimeQuery = Query.isSupported(this.gl, ['timers']) ? new Query(this.gl) : null;\n\n this._initialized = true;\n\n // Note: onIntialize can return a promise (in case it needs to load resources)\n return this.onInitialize(this.animationProps);\n })\n .then(appContext => {\n if (this._running) {\n this._addCallbackData(appContext || {});\n if (appContext !== false) {\n this._startLoop();\n }\n }\n });\n\n if (this.props.onError) {\n startPromise.catch(this.props.onError);\n }\n\n return this;\n }\n\n // Redraw now\n redraw() {\n if (this.isContextLost()) {\n return this;\n }\n\n this._beginTimers();\n\n this._setupFrame();\n this._updateCallbackData();\n\n this._renderFrame(this.animationProps);\n\n // clear needsRedraw flag\n this._clearNeedsRedraw();\n\n // https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/commit\n // Chrome's offscreen canvas does not require gl.commit\n if (this.offScreen && this.gl.commit) {\n this.gl.commit();\n }\n\n if (this._resolveNextFrame) {\n this._resolveNextFrame(this);\n this._nextFramePromise = null;\n this._resolveNextFrame = null;\n }\n\n this._endTimers();\n\n return this;\n }\n\n // Stops a render loop if already running, finalizing\n stop() {\n // console.debug(`Stopping ${this.constructor.name}`);\n if (this._running) {\n this._finalizeCallbackData();\n this._cancelAnimationFrame(this._animationFrameId);\n this._nextFramePromise = null;\n this._resolveNextFrame = null;\n this._animationFrameId = null;\n this._running = false;\n }\n return this;\n }\n\n attachTimeline(timeline) {\n this.timeline = timeline;\n\n return this.timeline;\n }\n\n detachTimeline() {\n this.timeline = null;\n }\n\n waitForRender() {\n this.setNeedsRedraw('waitForRender');\n\n if (!this._nextFramePromise) {\n this._nextFramePromise = new Promise(resolve => {\n this._resolveNextFrame = resolve;\n });\n }\n return this._nextFramePromise;\n }\n\n async toDataURL() {\n this.setNeedsRedraw('toDataURL');\n\n await this.waitForRender();\n\n return this.gl.canvas.toDataURL();\n }\n\n isContextLost() {\n return this.gl.isContextLost();\n }\n\n onCreateContext(...args) {\n return this.props.onCreateContext(...args);\n }\n\n onInitialize(...args) {\n return this.props.onInitialize(...args);\n }\n\n onRender(...args) {\n return this.props.onRender(...args);\n }\n\n onFinalize(...args) {\n return this.props.onFinalize(...args);\n }\n\n // DEPRECATED/REMOVED METHODS\n\n getHTMLControlValue(id, defaultValue = 1) {\n const element = document.getElementById(id);\n // @ts-ignore Not all html elements have value\n return element ? Number(element.value) : defaultValue;\n }\n\n // Update parameters\n setViewParameters() {\n log.removed('AnimationLoop.setViewParameters', 'AnimationLoop.setProps')();\n return this;\n }\n\n // PRIVATE METHODS\n\n _startLoop() {\n const renderFrame = () => {\n if (!this._running) {\n return;\n }\n this.redraw();\n this._animationFrameId = this._requestAnimationFrame(renderFrame);\n };\n\n // cancel any pending renders to ensure only one loop can ever run\n this._cancelAnimationFrame(this._animationFrameId);\n this._animationFrameId = this._requestAnimationFrame(renderFrame);\n }\n\n // PRIVATE METHODS\n\n _getPageLoadPromise() {\n if (!this._pageLoadPromise) {\n this._pageLoadPromise = isPage\n ? new Promise((resolve, reject) => {\n if (isPage && document.readyState === 'complete') {\n resolve(document);\n return;\n }\n window.addEventListener('load', () => {\n resolve(document);\n });\n })\n : Promise.resolve({});\n }\n return this._pageLoadPromise;\n }\n\n _setDisplay(display) {\n if (this.display) {\n this.display.delete();\n this.display.animationLoop = null;\n }\n\n // store animation loop on the display\n if (display) {\n display.animationLoop = this;\n }\n\n this.display = display;\n }\n\n _cancelAnimationFrame(animationFrameId) {\n // E.g. VR display has a separate animation frame to sync with headset\n if (this.display && this.display.cancelAnimationFrame) {\n return this.display.cancelAnimationFrame(animationFrameId);\n }\n\n return cancelAnimationFrame(animationFrameId);\n }\n\n _requestAnimationFrame(renderFrameCallback) {\n if (this._running) {\n // E.g. VR display has a separate animation frame to sync with headset\n if (this.display && this.display.requestAnimationFrame) {\n return this.display.requestAnimationFrame(renderFrameCallback);\n }\n\n return requestAnimationFrame(renderFrameCallback);\n }\n return undefined;\n }\n\n // Called on each frame, can be overridden to call onRender multiple times\n // to support e.g. stereoscopic rendering\n _renderFrame(...args) {\n // Allow e.g. VR display to render multiple frames.\n if (this.display) {\n this.display._renderFrame(...args);\n return;\n }\n\n // call callback\n this.onRender(...args);\n // end callback\n }\n\n _clearNeedsRedraw() {\n this.needsRedraw = null;\n }\n\n _setupFrame() {\n this._resizeCanvasDrawingBuffer();\n this._resizeViewport();\n this._resizeFramebuffer();\n }\n\n // Initialize the object that will be passed to app callbacks\n _initializeCallbackData() {\n this.animationProps = {\n gl: this.gl,\n\n stop: this.stop,\n canvas: this.gl.canvas,\n framebuffer: this.framebuffer,\n\n // Initial values\n useDevicePixels: this.useDevicePixels,\n needsRedraw: null,\n\n // Animation props\n startTime: Date.now(),\n engineTime: 0,\n tick: 0,\n tock: 0,\n\n // Timeline time for back compatibility\n time: 0,\n\n // Experimental\n _timeline: this.timeline,\n _loop: this,\n _animationLoop: this,\n _mousePosition: null // Event props\n };\n }\n\n // Update the context object that will be passed to app callbacks\n _updateCallbackData() {\n const {width, height, aspect} = this._getSizeAndAspect();\n if (width !== this.animationProps.width || height !== this.animationProps.height) {\n this.setNeedsRedraw('drawing buffer resized');\n }\n if (aspect !== this.animationProps.aspect) {\n this.setNeedsRedraw('drawing buffer aspect changed');\n }\n\n this.animationProps.width = width;\n this.animationProps.height = height;\n this.animationProps.aspect = aspect;\n\n this.animationProps.needsRedraw = this.needsRedraw;\n\n // Update time properties\n this.animationProps.engineTime = Date.now() - this.animationProps.startTime;\n\n if (this.timeline) {\n this.timeline.update(this.animationProps.engineTime);\n }\n\n this.animationProps.tick = Math.floor((this.animationProps.time / 1000) * 60);\n this.animationProps.tock++;\n\n // For back compatibility\n this.animationProps.time = this.timeline\n ? this.timeline.getTime()\n : this.animationProps.engineTime;\n\n // experimental\n this.animationProps._offScreen = this.offScreen;\n }\n\n _finalizeCallbackData() {\n // call callback\n this.onFinalize(this.animationProps);\n // end callback\n }\n\n // Add application's data to the app context object\n _addCallbackData(appContext) {\n if (typeof appContext === 'object' && appContext !== null) {\n this.animationProps = Object.assign({}, this.animationProps, appContext);\n }\n }\n\n // Either uses supplied or existing context, or calls provided callback to create one\n _createWebGLContext(opts) {\n this.offScreen =\n opts.canvas &&\n typeof OffscreenCanvas !== 'undefined' &&\n opts.canvas instanceof OffscreenCanvas;\n\n // Create the WebGL context if necessary\n opts = Object.assign({}, opts, this.props.glOptions);\n this.gl = this.props.gl ? instrumentGLContext(this.props.gl, opts) : this.onCreateContext(opts);\n\n if (!isWebGL(this.gl)) {\n throw new Error('AnimationLoop.onCreateContext - illegal context returned');\n }\n\n // Reset the WebGL context.\n resetParameters(this.gl);\n\n this._createInfoDiv();\n }\n\n _createInfoDiv() {\n if (this.gl.canvas && this.props.onAddHTML) {\n const wrapperDiv = document.createElement('div');\n document.body.appendChild(wrapperDiv);\n wrapperDiv.style.position = 'relative';\n const div = document.createElement('div');\n div.style.position = 'absolute';\n div.style.left = '10px';\n div.style.bottom = '10px';\n div.style.width = '300px';\n div.style.background = 'white';\n wrapperDiv.appendChild(this.gl.canvas);\n wrapperDiv.appendChild(div);\n const html = this.props.onAddHTML(div);\n if (html) {\n div.innerHTML = html;\n }\n }\n }\n\n _getSizeAndAspect() {\n // https://webglfundamentals.org/webgl/lessons/webgl-resizing-the-canvas.html\n const width = this.gl.drawingBufferWidth;\n const height = this.gl.drawingBufferHeight;\n\n // https://webglfundamentals.org/webgl/lessons/webgl-anti-patterns.html\n let aspect = 1;\n const {canvas} = this.gl;\n\n if (canvas && canvas.clientHeight) {\n aspect = canvas.clientWidth / canvas.clientHeight;\n } else if (width > 0 && height > 0) {\n aspect = width / height;\n }\n\n return {width, height, aspect};\n }\n\n // Default viewport setup\n _resizeViewport() {\n if (this.autoResizeViewport) {\n this.gl.viewport(0, 0, this.gl.drawingBufferWidth, this.gl.drawingBufferHeight);\n }\n }\n\n // Resize the render buffer of the canvas to match canvas client size\n // Optionally multiplying with devicePixel ratio\n _resizeCanvasDrawingBuffer() {\n if (this.autoResizeDrawingBuffer) {\n resizeGLContext(this.gl, {useDevicePixels: this.useDevicePixels});\n }\n }\n\n // TBD - deprecated?\n _createFramebuffer() {\n // Setup default framebuffer\n if (this.props.createFramebuffer) {\n this.framebuffer = new Framebuffer(this.gl);\n }\n }\n\n _resizeFramebuffer() {\n if (this.framebuffer) {\n this.framebuffer.resize({\n width: this.gl.drawingBufferWidth,\n height: this.gl.drawingBufferHeight\n });\n }\n }\n\n _beginTimers() {\n this.frameRate.timeEnd();\n this.frameRate.timeStart();\n\n // Check if timer for last frame has completed.\n // GPU timer results are never available in the same\n // frame they are captured.\n if (\n this._gpuTimeQuery &&\n this._gpuTimeQuery.isResultAvailable() &&\n !this._gpuTimeQuery.isTimerDisjoint()\n ) {\n this.stats.get('GPU Time').addTime(this._gpuTimeQuery.getTimerMilliseconds());\n }\n\n if (this._gpuTimeQuery) {\n // GPU time query start\n this._gpuTimeQuery.beginTimeElapsedQuery();\n }\n\n this.cpuTime.timeStart();\n }\n\n _endTimers() {\n this.cpuTime.timeEnd();\n\n if (this._gpuTimeQuery) {\n // GPU time query end. Results will be available on next frame.\n this._gpuTimeQuery.end();\n }\n }\n\n // Event handling\n\n _startEventHandling() {\n const {canvas} = this.gl;\n if (canvas) {\n canvas.addEventListener('mousemove', this._onMousemove);\n canvas.addEventListener('mouseleave', this._onMouseleave);\n }\n }\n\n _onMousemove(e) {\n this.animationProps._mousePosition = [e.offsetX, e.offsetY];\n }\n _onMouseleave(e) {\n this.animationProps._mousePosition = null;\n }\n}\n"],"file":"animation-loop.js"}
|
|
1
|
+
{"version":3,"file":"animation-loop.js","names":["isPage","isBrowser","document","statIdCounter","AnimationLoop","props","onCreateContext","opts","createGLContext","onAddHTML","onInitialize","onRender","onFinalize","onError","gl","glOptions","debug","createFramebuffer","autoResizeViewport","autoResizeDrawingBuffer","stats","lumaStats","get","useDevicePixels","log","deprecated","useDevicePixelRatio","needsRedraw","timeline","cpuTime","gpuTime","frameRate","_initialized","_running","_animationFrameId","_nextFramePromise","_resolveNextFrame","_cpuStartTime","setProps","start","bind","stop","_pageLoadPromise","_onMousemove","_onMouseleave","_setDisplay","reason","assert","startPromise","_getPageLoadPromise","then","_createWebGLContext","_createFramebuffer","_startEventHandling","_initializeCallbackData","_updateCallbackData","_resizeCanvasDrawingBuffer","_resizeViewport","_gpuTimeQuery","Query","isSupported","animationProps","appContext","_addCallbackData","_startLoop","catch","isContextLost","_beginTimers","_setupFrame","_renderFrame","_clearNeedsRedraw","offScreen","commit","_endTimers","_finalizeCallbackData","_cancelAnimationFrame","setNeedsRedraw","Promise","resolve","waitForRender","canvas","toDataURL","id","defaultValue","element","getElementById","Number","value","removed","renderFrame","redraw","_requestAnimationFrame","reject","readyState","window","addEventListener","display","delete","animationLoop","animationFrameId","cancelAnimationFrame","renderFrameCallback","requestAnimationFrame","undefined","_resizeFramebuffer","framebuffer","startTime","Date","now","engineTime","tick","tock","time","_timeline","_loop","_animationLoop","_mousePosition","_getSizeAndAspect","width","height","aspect","update","Math","floor","getTime","_offScreen","Object","assign","OffscreenCanvas","instrumentGLContext","isWebGL","Error","resetParameters","_createInfoDiv","wrapperDiv","createElement","body","appendChild","style","position","div","left","bottom","background","html","innerHTML","drawingBufferWidth","drawingBufferHeight","clientHeight","clientWidth","viewport","resizeGLContext","Framebuffer","resize","timeEnd","timeStart","isResultAvailable","isTimerDisjoint","addTime","getTimerMilliseconds","beginTimeElapsedQuery","end","e","offsetX","offsetY"],"sources":["../../../src/lib/animation-loop.js"],"sourcesContent":["import {\n isWebGL,\n createGLContext,\n instrumentGLContext,\n resizeGLContext,\n resetParameters\n} from '@luma.gl/gltools';\n\nimport {\n requestAnimationFrame,\n cancelAnimationFrame,\n Query,\n lumaStats,\n // TODO - remove dependency on framebuffer (bundle size impact)\n Framebuffer,\n log,\n assert\n} from '@luma.gl/webgl';\n\nimport {isBrowser} from '@probe.gl/env';\n\nconst isPage = isBrowser() && typeof document !== 'undefined';\n\nlet statIdCounter = 0;\n\nexport default class AnimationLoop {\n /*\n * @param {HTMLCanvasElement} canvas - if provided, width and height will be passed to context\n */\n constructor(props = {}) {\n const {\n onCreateContext = opts => createGLContext(opts),\n onAddHTML = null,\n onInitialize = () => {},\n onRender = () => {},\n onFinalize = () => {},\n onError,\n\n gl = null,\n glOptions = {},\n debug = false,\n\n createFramebuffer = false,\n\n // view parameters\n autoResizeViewport = true,\n autoResizeDrawingBuffer = true,\n stats = lumaStats.get(`animation-loop-${statIdCounter++}`)\n } = props;\n\n let {useDevicePixels = true} = props;\n\n if ('useDevicePixelRatio' in props) {\n log.deprecated('useDevicePixelRatio', 'useDevicePixels')();\n // @ts-ignore\n useDevicePixels = props.useDevicePixelRatio;\n }\n\n this.props = {\n onCreateContext,\n onAddHTML,\n onInitialize,\n onRender,\n onFinalize,\n onError,\n\n gl,\n glOptions,\n debug,\n createFramebuffer\n };\n\n // state\n this.gl = gl;\n this.needsRedraw = null;\n this.timeline = null;\n this.stats = stats;\n this.cpuTime = this.stats.get('CPU Time');\n this.gpuTime = this.stats.get('GPU Time');\n this.frameRate = this.stats.get('Frame Rate');\n\n this._initialized = false;\n this._running = false;\n this._animationFrameId = null;\n this._nextFramePromise = null;\n this._resolveNextFrame = null;\n this._cpuStartTime = 0;\n\n this.setProps({\n autoResizeViewport,\n autoResizeDrawingBuffer,\n useDevicePixels\n });\n\n // Bind methods\n this.start = this.start.bind(this);\n this.stop = this.stop.bind(this);\n\n this._pageLoadPromise = null;\n\n this._onMousemove = this._onMousemove.bind(this);\n this._onMouseleave = this._onMouseleave.bind(this);\n }\n\n delete() {\n this.stop();\n this._setDisplay(null);\n }\n\n setNeedsRedraw(reason) {\n assert(typeof reason === 'string');\n this.needsRedraw = this.needsRedraw || reason;\n return this;\n }\n\n setProps(props) {\n if ('autoResizeViewport' in props) {\n this.autoResizeViewport = props.autoResizeViewport;\n }\n if ('autoResizeDrawingBuffer' in props) {\n this.autoResizeDrawingBuffer = props.autoResizeDrawingBuffer;\n }\n if ('useDevicePixels' in props) {\n this.useDevicePixels = props.useDevicePixels;\n }\n return this;\n }\n\n // Starts a render loop if not already running\n // @param {Object} context - contains frame specific info (E.g. tick, width, height, etc)\n start(opts = {}) {\n if (this._running) {\n return this;\n }\n this._running = true;\n // console.debug(`Starting ${this.constructor.name}`);\n // Wait for start promise before rendering frame\n const startPromise = this._getPageLoadPromise()\n .then(() => {\n if (!this._running || this._initialized) {\n return null;\n }\n\n // Create the WebGL context\n this._createWebGLContext(opts);\n this._createFramebuffer();\n this._startEventHandling();\n\n // Initialize the callback data\n this._initializeCallbackData();\n this._updateCallbackData();\n\n // Default viewport setup, in case onInitialize wants to render\n this._resizeCanvasDrawingBuffer();\n this._resizeViewport();\n\n this._gpuTimeQuery = Query.isSupported(this.gl, ['timers']) ? new Query(this.gl) : null;\n\n this._initialized = true;\n\n // Note: onIntialize can return a promise (in case it needs to load resources)\n return this.onInitialize(this.animationProps);\n })\n .then(appContext => {\n if (this._running) {\n this._addCallbackData(appContext || {});\n if (appContext !== false) {\n this._startLoop();\n }\n }\n });\n\n if (this.props.onError) {\n startPromise.catch(this.props.onError);\n }\n\n return this;\n }\n\n // Redraw now\n redraw() {\n if (this.isContextLost()) {\n return this;\n }\n\n this._beginTimers();\n\n this._setupFrame();\n this._updateCallbackData();\n\n this._renderFrame(this.animationProps);\n\n // clear needsRedraw flag\n this._clearNeedsRedraw();\n\n // https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/commit\n // Chrome's offscreen canvas does not require gl.commit\n if (this.offScreen && this.gl.commit) {\n this.gl.commit();\n }\n\n if (this._resolveNextFrame) {\n this._resolveNextFrame(this);\n this._nextFramePromise = null;\n this._resolveNextFrame = null;\n }\n\n this._endTimers();\n\n return this;\n }\n\n // Stops a render loop if already running, finalizing\n stop() {\n // console.debug(`Stopping ${this.constructor.name}`);\n if (this._running) {\n this._finalizeCallbackData();\n this._cancelAnimationFrame(this._animationFrameId);\n this._nextFramePromise = null;\n this._resolveNextFrame = null;\n this._animationFrameId = null;\n this._running = false;\n }\n return this;\n }\n\n attachTimeline(timeline) {\n this.timeline = timeline;\n\n return this.timeline;\n }\n\n detachTimeline() {\n this.timeline = null;\n }\n\n waitForRender() {\n this.setNeedsRedraw('waitForRender');\n\n if (!this._nextFramePromise) {\n this._nextFramePromise = new Promise(resolve => {\n this._resolveNextFrame = resolve;\n });\n }\n return this._nextFramePromise;\n }\n\n async toDataURL() {\n this.setNeedsRedraw('toDataURL');\n\n await this.waitForRender();\n\n return this.gl.canvas.toDataURL();\n }\n\n isContextLost() {\n return this.gl.isContextLost();\n }\n\n onCreateContext(...args) {\n return this.props.onCreateContext(...args);\n }\n\n onInitialize(...args) {\n return this.props.onInitialize(...args);\n }\n\n onRender(...args) {\n return this.props.onRender(...args);\n }\n\n onFinalize(...args) {\n return this.props.onFinalize(...args);\n }\n\n // DEPRECATED/REMOVED METHODS\n\n getHTMLControlValue(id, defaultValue = 1) {\n const element = document.getElementById(id);\n // @ts-ignore Not all html elements have value\n return element ? Number(element.value) : defaultValue;\n }\n\n // Update parameters\n setViewParameters() {\n log.removed('AnimationLoop.setViewParameters', 'AnimationLoop.setProps')();\n return this;\n }\n\n // PRIVATE METHODS\n\n _startLoop() {\n const renderFrame = () => {\n if (!this._running) {\n return;\n }\n this.redraw();\n this._animationFrameId = this._requestAnimationFrame(renderFrame);\n };\n\n // cancel any pending renders to ensure only one loop can ever run\n this._cancelAnimationFrame(this._animationFrameId);\n this._animationFrameId = this._requestAnimationFrame(renderFrame);\n }\n\n // PRIVATE METHODS\n\n _getPageLoadPromise() {\n if (!this._pageLoadPromise) {\n this._pageLoadPromise = isPage\n ? new Promise((resolve, reject) => {\n if (isPage && document.readyState === 'complete') {\n resolve(document);\n return;\n }\n window.addEventListener('load', () => {\n resolve(document);\n });\n })\n : Promise.resolve({});\n }\n return this._pageLoadPromise;\n }\n\n _setDisplay(display) {\n if (this.display) {\n this.display.delete();\n this.display.animationLoop = null;\n }\n\n // store animation loop on the display\n if (display) {\n display.animationLoop = this;\n }\n\n this.display = display;\n }\n\n _cancelAnimationFrame(animationFrameId) {\n // E.g. VR display has a separate animation frame to sync with headset\n if (this.display && this.display.cancelAnimationFrame) {\n return this.display.cancelAnimationFrame(animationFrameId);\n }\n\n return cancelAnimationFrame(animationFrameId);\n }\n\n _requestAnimationFrame(renderFrameCallback) {\n if (this._running) {\n // E.g. VR display has a separate animation frame to sync with headset\n if (this.display && this.display.requestAnimationFrame) {\n return this.display.requestAnimationFrame(renderFrameCallback);\n }\n\n return requestAnimationFrame(renderFrameCallback);\n }\n return undefined;\n }\n\n // Called on each frame, can be overridden to call onRender multiple times\n // to support e.g. stereoscopic rendering\n _renderFrame(...args) {\n // Allow e.g. VR display to render multiple frames.\n if (this.display) {\n this.display._renderFrame(...args);\n return;\n }\n\n // call callback\n this.onRender(...args);\n // end callback\n }\n\n _clearNeedsRedraw() {\n this.needsRedraw = null;\n }\n\n _setupFrame() {\n this._resizeCanvasDrawingBuffer();\n this._resizeViewport();\n this._resizeFramebuffer();\n }\n\n // Initialize the object that will be passed to app callbacks\n _initializeCallbackData() {\n this.animationProps = {\n gl: this.gl,\n\n stop: this.stop,\n canvas: this.gl.canvas,\n framebuffer: this.framebuffer,\n\n // Initial values\n useDevicePixels: this.useDevicePixels,\n needsRedraw: null,\n\n // Animation props\n startTime: Date.now(),\n engineTime: 0,\n tick: 0,\n tock: 0,\n\n // Timeline time for back compatibility\n time: 0,\n\n // Experimental\n _timeline: this.timeline,\n _loop: this,\n _animationLoop: this,\n _mousePosition: null // Event props\n };\n }\n\n // Update the context object that will be passed to app callbacks\n _updateCallbackData() {\n const {width, height, aspect} = this._getSizeAndAspect();\n if (width !== this.animationProps.width || height !== this.animationProps.height) {\n this.setNeedsRedraw('drawing buffer resized');\n }\n if (aspect !== this.animationProps.aspect) {\n this.setNeedsRedraw('drawing buffer aspect changed');\n }\n\n this.animationProps.width = width;\n this.animationProps.height = height;\n this.animationProps.aspect = aspect;\n\n this.animationProps.needsRedraw = this.needsRedraw;\n\n // Update time properties\n this.animationProps.engineTime = Date.now() - this.animationProps.startTime;\n\n if (this.timeline) {\n this.timeline.update(this.animationProps.engineTime);\n }\n\n this.animationProps.tick = Math.floor((this.animationProps.time / 1000) * 60);\n this.animationProps.tock++;\n\n // For back compatibility\n this.animationProps.time = this.timeline\n ? this.timeline.getTime()\n : this.animationProps.engineTime;\n\n // experimental\n this.animationProps._offScreen = this.offScreen;\n }\n\n _finalizeCallbackData() {\n // call callback\n this.onFinalize(this.animationProps);\n // end callback\n }\n\n // Add application's data to the app context object\n _addCallbackData(appContext) {\n if (typeof appContext === 'object' && appContext !== null) {\n this.animationProps = Object.assign({}, this.animationProps, appContext);\n }\n }\n\n // Either uses supplied or existing context, or calls provided callback to create one\n _createWebGLContext(opts) {\n this.offScreen =\n opts.canvas &&\n typeof OffscreenCanvas !== 'undefined' &&\n opts.canvas instanceof OffscreenCanvas;\n\n // Create the WebGL context if necessary\n opts = Object.assign({}, opts, this.props.glOptions);\n this.gl = this.props.gl ? instrumentGLContext(this.props.gl, opts) : this.onCreateContext(opts);\n\n if (!isWebGL(this.gl)) {\n throw new Error('AnimationLoop.onCreateContext - illegal context returned');\n }\n\n // Reset the WebGL context.\n resetParameters(this.gl);\n\n this._createInfoDiv();\n }\n\n _createInfoDiv() {\n if (this.gl.canvas && this.props.onAddHTML) {\n const wrapperDiv = document.createElement('div');\n document.body.appendChild(wrapperDiv);\n wrapperDiv.style.position = 'relative';\n const div = document.createElement('div');\n div.style.position = 'absolute';\n div.style.left = '10px';\n div.style.bottom = '10px';\n div.style.width = '300px';\n div.style.background = 'white';\n wrapperDiv.appendChild(this.gl.canvas);\n wrapperDiv.appendChild(div);\n const html = this.props.onAddHTML(div);\n if (html) {\n div.innerHTML = html;\n }\n }\n }\n\n _getSizeAndAspect() {\n // https://webglfundamentals.org/webgl/lessons/webgl-resizing-the-canvas.html\n const width = this.gl.drawingBufferWidth;\n const height = this.gl.drawingBufferHeight;\n\n // https://webglfundamentals.org/webgl/lessons/webgl-anti-patterns.html\n let aspect = 1;\n const {canvas} = this.gl;\n\n if (canvas && canvas.clientHeight) {\n aspect = canvas.clientWidth / canvas.clientHeight;\n } else if (width > 0 && height > 0) {\n aspect = width / height;\n }\n\n return {width, height, aspect};\n }\n\n // Default viewport setup\n _resizeViewport() {\n if (this.autoResizeViewport) {\n this.gl.viewport(0, 0, this.gl.drawingBufferWidth, this.gl.drawingBufferHeight);\n }\n }\n\n // Resize the render buffer of the canvas to match canvas client size\n // Optionally multiplying with devicePixel ratio\n _resizeCanvasDrawingBuffer() {\n if (this.autoResizeDrawingBuffer) {\n resizeGLContext(this.gl, {useDevicePixels: this.useDevicePixels});\n }\n }\n\n // TBD - deprecated?\n _createFramebuffer() {\n // Setup default framebuffer\n if (this.props.createFramebuffer) {\n this.framebuffer = new Framebuffer(this.gl);\n }\n }\n\n _resizeFramebuffer() {\n if (this.framebuffer) {\n this.framebuffer.resize({\n width: this.gl.drawingBufferWidth,\n height: this.gl.drawingBufferHeight\n });\n }\n }\n\n _beginTimers() {\n this.frameRate.timeEnd();\n this.frameRate.timeStart();\n\n // Check if timer for last frame has completed.\n // GPU timer results are never available in the same\n // frame they are captured.\n if (\n this._gpuTimeQuery &&\n this._gpuTimeQuery.isResultAvailable() &&\n !this._gpuTimeQuery.isTimerDisjoint()\n ) {\n this.stats.get('GPU Time').addTime(this._gpuTimeQuery.getTimerMilliseconds());\n }\n\n if (this._gpuTimeQuery) {\n // GPU time query start\n this._gpuTimeQuery.beginTimeElapsedQuery();\n }\n\n this.cpuTime.timeStart();\n }\n\n _endTimers() {\n this.cpuTime.timeEnd();\n\n if (this._gpuTimeQuery) {\n // GPU time query end. Results will be available on next frame.\n this._gpuTimeQuery.end();\n }\n }\n\n // Event handling\n\n _startEventHandling() {\n const {canvas} = this.gl;\n if (canvas) {\n canvas.addEventListener('mousemove', this._onMousemove);\n canvas.addEventListener('mouseleave', this._onMouseleave);\n }\n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ADA,IAEA,CAAC,KAAKlG,aAAL,CAAmBmG,eAAnB,EAHH,EAIE;QACA,KAAKzI,KAAL,CAAWE,GAAX,CAAe,UAAf,EAA2BwI,OAA3B,CAAmC,KAAKpG,aAAL,CAAmBqG,oBAAnB,EAAnC;MACD;;MAED,IAAI,KAAKrG,aAAT,EAAwB;QAEtB,KAAKA,aAAL,CAAmBsG,qBAAnB;MACD;;MAED,KAAKnI,OAAL,CAAa8H,SAAb;IACD;;;WAED,sBAAa;MACX,KAAK9H,OAAL,CAAa6H,OAAb;;MAEA,IAAI,KAAKhG,aAAT,EAAwB;QAEtB,KAAKA,aAAL,CAAmBuG,GAAnB;MACD;IACF;;;WAID,+BAAsB;MACpB,IAAOjF,MAAP,GAAiB,KAAKlE,EAAtB,CAAOkE,MAAP;;MACA,IAAIA,MAAJ,EAAY;QACVA,MAAM,CAACe,gBAAP,CAAwB,WAAxB,EAAqC,KAAKpD,YAA1C;QACAqC,MAAM,CAACe,gBAAP,CAAwB,YAAxB,EAAsC,KAAKnD,aAA3C;MACD;IACF;;;WAED,sBAAasH,CAAb,EAAgB;MACd,KAAKrG,cAAL,CAAoBuD,cAApB,GAAqC,CAAC8C,CAAC,CAACC,OAAH,EAAYD,CAAC,CAACE,OAAd,CAArC;IACD;;;WACD,uBAAcF,CAAd,EAAiB;MACf,KAAKrG,cAAL,CAAoBuD,cAApB,GAAqC,IAArC;IACD"}
|
|
@@ -12,9 +12,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
12
12
|
|
|
13
13
|
var _webgl = require("@luma.gl/webgl");
|
|
14
14
|
|
|
15
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
15
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
16
|
|
|
17
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
18
|
|
|
19
19
|
var GLTF_TO_LUMA_ATTRIBUTE_MAP = {
|
|
20
20
|
POSITION: 'positions',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"model-utils.js","names":["GLTF_TO_LUMA_ATTRIBUTE_MAP","POSITION","NORMAL","COLOR_0","TEXCOORD_0","TEXCOORD_1","TEXCOORD_2","getBuffersFromGeometry","gl","geometry","options","buffers","indices","name","attributes","attribute","remappedName","mapAttributeName","constant","value","typedArray","accessor","Buffer","inferAttributeAccessor","data","assert","Uint16Array","Uint32Array","size","isIndexed","undefined","target","attributeMap","attributeName","category","Number","isFinite"],"sources":["../../../src/lib/model-utils.js"],"sourcesContent":["import GL from '@luma.gl/constants';\nimport {Buffer, assert} from '@luma.gl/webgl';\n\n// Support for mapping new geometries with glTF attribute names to \"classic\" luma.gl shader names\nconst GLTF_TO_LUMA_ATTRIBUTE_MAP = {\n POSITION: 'positions',\n NORMAL: 'normals',\n COLOR_0: 'colors',\n TEXCOORD_0: 'texCoords',\n TEXCOORD_1: 'texCoords1',\n TEXCOORD_2: 'texCoords2'\n};\n\nexport function getBuffersFromGeometry(gl, geometry, options) {\n const buffers = {};\n let indices = geometry.indices;\n\n for (const name in geometry.attributes) {\n const attribute = geometry.attributes[name];\n const remappedName = mapAttributeName(name, options);\n\n if (name === 'indices') {\n indices = attribute;\n } else if (attribute.constant) {\n buffers[remappedName] = attribute.value;\n } else {\n const typedArray = attribute.value;\n // Create accessor by copying the attribute and removing `value``\n const accessor = {...attribute};\n delete accessor.value;\n buffers[remappedName] = [new Buffer(gl, typedArray), accessor];\n\n inferAttributeAccessor(name, accessor);\n }\n }\n\n if (indices) {\n const data = indices.value || indices;\n assert(\n data instanceof Uint16Array || data instanceof Uint32Array,\n 'attribute array for \"indices\" must be of integer type'\n );\n const accessor = {\n size: 1,\n isIndexed: indices.isIndexed === undefined ? true : indices.isIndexed\n };\n buffers.indices = [\n new Buffer(gl, {\n data,\n target: GL.ELEMENT_ARRAY_BUFFER\n }),\n accessor\n ];\n }\n\n return buffers;\n}\n\nfunction mapAttributeName(name, options) {\n const {attributeMap = GLTF_TO_LUMA_ATTRIBUTE_MAP} = options || {};\n return (attributeMap && attributeMap[name]) || name;\n}\n\n// Check for well known attribute names\n// eslint-disable-next-line complexity\nexport function inferAttributeAccessor(attributeName, attribute) {\n let category;\n switch (attributeName) {\n case 'texCoords':\n case 'texCoord1':\n case 'texCoord2':\n case 'texCoord3':\n category = 'uvs';\n break;\n case 'vertices':\n case 'positions':\n case 'normals':\n case 'pickingColors':\n category = 'vectors';\n break;\n default:\n }\n\n // Check for categorys\n switch (category) {\n case 'vectors':\n attribute.size = attribute.size || 3;\n break;\n case 'uvs':\n attribute.size = attribute.size || 2;\n break;\n default:\n }\n\n assert(Number.isFinite(attribute.size), `attribute ${attributeName} needs size`);\n}\n"],"mappings":";;;;;;;;;;;;AACA;;;;;;AAGA,IAAMA,0BAA0B,GAAG;EACjCC,QAAQ,EAAE,WADuB;EAEjCC,MAAM,EAAE,SAFyB;EAGjCC,OAAO,EAAE,QAHwB;EAIjCC,UAAU,EAAE,WAJqB;EAKjCC,UAAU,EAAE,YALqB;EAMjCC,UAAU,EAAE;AANqB,CAAnC;;AASO,SAASC,sBAAT,CAAgCC,EAAhC,EAA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