Comparing version 1.2.1 to 1.3.0
# Release notes | ||
## Next | ||
* Add `framebuffer.use()` method for quickly setting up framebuffer objects | ||
* `regl.clear` and `regl.read` now accept a framebuffer as a parameter | ||
## 1.2.1 | ||
@@ -4,0 +9,0 @@ |
@@ -88,3 +88,4 @@ var check = require('./util/check') | ||
next: null, | ||
dirty: false | ||
dirty: false, | ||
setFBO: null | ||
} | ||
@@ -679,2 +680,7 @@ | ||
decFBORefs(framebuffer) | ||
}, | ||
use: function (block) { | ||
framebufferState.setFBO({ | ||
framebuffer: reglFramebuffer | ||
}, block) | ||
} | ||
@@ -681,0 +687,0 @@ }) |
@@ -16,3 +16,3 @@ var check = require('./util/check') | ||
extensions) { | ||
function readPixels (input) { | ||
function readPixelsImpl (input) { | ||
var type | ||
@@ -112,3 +112,21 @@ if (framebufferState.next === null) { | ||
function readPixelsFBO (options) { | ||
var result | ||
framebufferState.setFBO({ | ||
framebuffer: options.framebuffer | ||
}, function () { | ||
result = readPixelsImpl(options) | ||
}) | ||
return result | ||
} | ||
function readPixels (options) { | ||
if (!options || !('framebuffer' in options)) { | ||
return readPixelsImpl(options) | ||
} else { | ||
return readPixelsFBO(options) | ||
} | ||
} | ||
return readPixels | ||
} |
@@ -196,4 +196,2 @@ var check = require('./util/check') | ||
stats.shaderCount++ | ||
var cache = programCache[fragId] | ||
@@ -206,2 +204,4 @@ if (!cache) { | ||
program = new REGLProgram(fragId, vertId) | ||
stats.shaderCount++ | ||
linkProgram(program, command) | ||
@@ -208,0 +208,0 @@ cache[vertId] = program |
@@ -533,4 +533,6 @@ // Error checking and parameter validation. | ||
} else if (img.data) { | ||
check(img.data.byteLength === mw * mh * | ||
Math.max(pixelSize(img.type, c), img.unpackAlignment), | ||
// check(img.data.byteLength === mw * mh * | ||
// Math.max(pixelSize(img.type, c), img.unpackAlignment), | ||
var rowSize = Math.ceil(pixelSize(img.type, c) * mw / img.unpackAlignment) * img.unpackAlignment | ||
check(img.data.byteLength === rowSize * mh, | ||
'invalid data for image, buffer size is inconsistent with image format') | ||
@@ -537,0 +539,0 @@ } else if (img.element) { |
/* globals requestAnimationFrame, cancelAnimationFrame */ | ||
if (typeof requestAnimationFrame === 'function' && | ||
typeof cancelAnimationFrame === 'function') { | ||
module.exports = { | ||
next: function (x) { return requestAnimationFrame(x) }, | ||
cancel: function (x) { return cancelAnimationFrame(x) } | ||
} | ||
} else { | ||
module.exports = { | ||
next: function (cb) { | ||
return setTimeout(cb, 16) | ||
}, | ||
cancel: clearTimeout | ||
} | ||
module.exports = { | ||
next: typeof requestAnimationFrame === 'function' | ||
? function (cb) { return requestAnimationFrame(cb) } | ||
: function (cb) { return setTimeout(cb, 16) }, | ||
cancel: typeof cancelAnimationFrame === 'function' | ||
? function (raf) { return cancelAnimationFrame(raf) } | ||
: clearTimeout | ||
} |
@@ -30,3 +30,3 @@ // Context and canvas creation helper functions | ||
w = bounds.right - bounds.left | ||
h = bounds.top - bounds.bottom | ||
h = bounds.bottom - bounds.top | ||
} | ||
@@ -33,0 +33,0 @@ canvas.width = pixelRatio * w |
{ | ||
"name": "regl", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "regl is a fast functional WebGL framework.", | ||
"main": "regl.js", | ||
"main": "dist/regl.js", | ||
"files": [ | ||
"regl.js", | ||
"lib/*", | ||
"dist/*", | ||
"browserify/*", | ||
"API.md", | ||
"CHANGES.md", | ||
"package.json", | ||
"README.md", | ||
"DEVELOPING.md" | ||
], | ||
"directories": { | ||
@@ -10,10 +21,11 @@ "example": "example" | ||
"browserify": { | ||
"transform": "./lib/transform" | ||
"transform": "./browserify/transform" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"browserify": "^13.1.1", | ||
"es2020": "^1.1.9", | ||
"angle-normals": "^1.0.0", | ||
"baboon-image": "^2.0.0", | ||
"bl": "^1.1.2", | ||
"browserify": "^13.0.0", | ||
"budo": "^8.1.0", | ||
@@ -28,3 +40,2 @@ "bunny": "^1.0.1", | ||
"disc": "^1.3.2", | ||
"es2020": "^1.1.9", | ||
"falafel": "^1.2.0", | ||
@@ -45,3 +56,2 @@ "faucet": "0.0.1", | ||
"hsv2rgb": "^1.1.0", | ||
"indexhtmlify": "^1.2.1", | ||
"install": "^0.8.1", | ||
@@ -60,2 +70,3 @@ "istanbul": "^0.4.3", | ||
"regl-stats-widget": "0.0.1", | ||
"reify": "^0.3.8", | ||
"remark": "^5.0.1", | ||
@@ -67,2 +78,7 @@ "remark-cli": "^1.0.0", | ||
"resl": "^1.0.0", | ||
"rollup": "^0.36.1", | ||
"rollup-plugin-buble": "^0.14.0", | ||
"rollup-plugin-commonjs": "^5.0.4", | ||
"rollup-plugin-json": "^2.0.2", | ||
"rollup-plugin-node-resolve": "^2.0.0", | ||
"runscript": "^1.1.0", | ||
@@ -76,3 +92,2 @@ "seedrandom": "^2.4.2", | ||
"three": "^0.79.0", | ||
"through2": "^2.0.1", | ||
"vectorize-text": "^3.0.2", | ||
@@ -82,14 +97,13 @@ "vertices-bounding-box": "^1.0.0" | ||
"scripts": { | ||
"test": "node bin/check-dependecies.js && standard | snazzy && tape test/util/index.js | faucet", | ||
"test": "standard | snazzy && tape test/util/index.js | faucet", | ||
"test-browser": "budo test/util/browser.js --open", | ||
"cover": "istanbul cover test/util/index.js", | ||
"bench-browser": "budo bench/bench.js --open", | ||
"bench-node": "node bench/bench.js", | ||
"bench-node": "node bench/bench-node.js", | ||
"bench-graph": "node bench/bench-graph.js", | ||
"bench-history": "node bench/bench-history", | ||
"build": "npm run build-script && npm run build-min && npm run build-bench && npm run build-gallery && npm run build-size && npm run build-compare", | ||
"build-size": "browserify --full-paths --transform ./bin/remove-check.js regl.js | discify > www/size.html", | ||
"build-script": "browserify regl.js --standalone createREGL > dist/regl.js", | ||
"build-min": "node bin/build-min.js", | ||
"build-bench": "browserify bench/bench.js | indexhtmlify > www/bench.html", | ||
"build": "npm run build-script && npm run build-min && npm run build-bench && npm run build-compare", | ||
"build-script": "rollup -c rollup/config.js", | ||
"build-min": "rollup -c rollup/config.unchecked.js && node bin/minify.js dist/regl.unchecked.js dist/regl.min.js", | ||
"build-bench": "rollup -c rollup/config.bench.js", | ||
"build-gallery": "node bin/build-gallery.js", | ||
@@ -126,3 +140,4 @@ "build-compare": "node bin/build-compare.js", | ||
"dist/*", | ||
"www/*" | ||
"www/*", | ||
"example/util/ammo.js" | ||
] | ||
@@ -129,0 +144,0 @@ }, |
@@ -75,3 +75,3 @@ <div align="center"> | ||
```JavaScript | ||
```js | ||
// Calling the regl module with no arguments creates a full screen canvas and | ||
@@ -164,2 +164,8 @@ // WebGL context, and then uses this context to initialize a new REGL instance | ||
If you are using npm, you may also want to try [`budo`](https://github.com/mattdesl/budo) which is a live development server. | ||
#### Run time error checking and browserify | ||
By default if you compile `regl` with `browserify` then all error messages and run time checks are removed. This is done to reduce the size of the final bundle. If you are developing an application, you should run browserify using the `--debug` flag in order to enable error messages. This will also generate source maps which make reading the source code of your application easier. | ||
### Standalone script tag | ||
@@ -212,3 +218,8 @@ | ||
In order to prevent performance regressions, `regl` is continuously benchmarked. You can run benchmarks locally using `npm run bench` or [check them out online](https://regl-project.github.io/regl/www/bench.html). The [results for the last few days can be found here.](https://regl-project.github.io/regl/www/bench-results/bench-result-5e92a749b35c37a43672) | ||
In order to prevent performance regressions, `regl` is continuously | ||
benchmarked. You can run benchmarks locally using `npm run bench` or | ||
[check them out | ||
online](https://regl-project.github.io/regl/www/bench.html). The | ||
[results for the last few days can be found | ||
here.](https://regl-project.github.io/regl/www/bench-results/bench-result-db4b76e25bd8ed6d7ed9) | ||
@@ -215,0 +226,0 @@ These measurements were taken using our custom scripts `bench-history` and |
28
regl.js
@@ -385,7 +385,7 @@ var check = require('./lib/util/check') | ||
function clear (options) { | ||
check( | ||
typeof options === 'object' && options, | ||
'regl.clear() takes an object as input') | ||
var setFBO = framebufferState.setFBO = compileProcedure({ | ||
framebuffer: dynamic.define.call(null, DYN_PROP, 'framebuffer') | ||
}) | ||
function clearImpl (_, options) { | ||
var clearFlags = 0 | ||
@@ -412,2 +412,22 @@ core.procs.poll() | ||
function clear (options) { | ||
check( | ||
typeof options === 'object' && options, | ||
'regl.clear() takes an object as input') | ||
if ('framebuffer' in options) { | ||
if (options.framebuffer && | ||
options.framebuffer_reglType === 'framebufferCube') { | ||
for (var i = 0; i < 6; ++i) { | ||
setFBO(extend({ | ||
framebuffer: options.framebuffer.faces[i] | ||
}, options), clearImpl) | ||
} | ||
} else { | ||
setFBO(options, clearImpl) | ||
} | ||
} else { | ||
clearImpl(null, options) | ||
} | ||
} | ||
function frame (cb) { | ||
@@ -414,0 +434,0 @@ check.type(cb, 'function', 'regl.frame() callback must be a function') |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
1
272
1
2
1003542
64
46
24012