70 Commits

Author SHA1 Message Date
Ray Schamp
9f26ab17eb Publish playground to gh-pages 2016-09-24 15:26:37 -04:00
Ray Schamp
d91ddf4158 Publish to NPM 2016-09-24 15:26:37 -04:00
Ray Schamp
201ceaba77 Merge pull request #39 from rschamp/build-dist
Use path to webpack for postinstall
2016-09-20 16:48:10 -04:00
Ray Schamp
a6c8be8226 Use path to webpack for postinstall 2016-09-20 16:25:24 -04:00
Ray Schamp
89402a88c7 Merge pull request #38 from LLK/build-dist
Build module to be imported
2016-09-20 15:39:05 -04:00
Ray Schamp
278cddf04e Build module to be imported
If another package wants to import `src/index.js`, it needs to replicate the loader config in `webpack.config.js`. To avoid this, package the module in `dist.js` and set that as the module to require.

I changed `main` to point to this so that other packages can just `require('scratch-blocks')`, but it would also work for our purposes to add `"webpack": "./dist.js"` if we want to keep `src/index.js` as `main`.
2016-09-20 09:13:35 -04:00
Tim Mickel
fb3f677e2c Remove worker support (#36)
* Remove WebWorker support

* Recompile Sept. 14
2016-09-15 19:01:44 -04:00
Tim Mickel
a5fb65ebeb Recompile 3 Sept. 12 (#34) 2016-09-12 12:24:51 -04:00
Tim Mickel
2b81b791b3 Use the right skin format in playground demo (#33) 2016-09-12 12:08:56 -04:00
Tim Mickel
042f0f0353 Fix asset URL handling from #27 (#32)
* Fix URL handling of assets

* Recompile 2 Sept 12
2016-09-12 11:55:08 -04:00
Tim Mickel
69821db56f Recompile Sept 12 (#31) 2016-09-12 11:06:53 -04:00
TheBrokenRail
3277584da9 Offline Sprites (#27)
* Added Scratch Cat SVG

* Offline Scratch Cat

* Moved To SRC

* Update README.md

* Delete Travis

* Add Travis YML

* Recompile

* Add files via upload

* Recompile Part 1

* Recompile Part 1

* Recompile Part 1

* Recompile Part 1

* Recompile!

* Not Needed

* Recompile For Real

* Update README.md

* Added Stage Offline

* Less Hacky Offline

* Recompile

* Fixed Line Length
2016-09-12 11:03:57 -04:00
Andrew Sliwinski
19bb8b99c3 Build 2016-08-08 15:00:04 -04:00
Andrew Sliwinski
bf26fe41e8 Update demo worker based on feedback from @cwillisf 2016-08-08 14:59:51 -04:00
Andrew Sliwinski
92fc916b86 Synchronize with master branch 2016-08-08 14:58:35 -04:00
Andrew Sliwinski
f5cd625be8 Fix issue in worker where 'window' is undefined 2016-08-08 14:28:06 -04:00
Andrew Sliwinski
b8cc5f5245 Update documentation in README 2016-08-08 14:23:25 -04:00
Andrew Sliwinski
47b5d07497 Update gitignore 2016-08-08 14:23:01 -04:00
Andrew Sliwinski
672947ca56 Normalize build result naming to match VM conventions 2016-08-08 14:22:54 -04:00
Andrew Sliwinski
fc7db05978 Add Travis configuration 2016-08-08 14:22:21 -04:00
Andrew Sliwinski
3dca142bb9 Move “demo” into “playground” directory as to match VM and Blocks 2016-08-08 14:22:06 -04:00
Andrew Sliwinski
894ada4960 Move development dependencies into “devDependencies” in package.json 2016-08-08 14:21:21 -04:00
Andrew Sliwinski
86ae0d63e3 Remove unused test commands and clean-up Makefile 2016-08-08 14:21:01 -04:00
Andrew Sliwinski
5c75fc0112 Remove IDEA IDE specific configuration files. 2016-08-08 14:20:32 -04:00
Christopher Willis-Ford
543f05d6d4 Use babel-polyfill, plus compatibility fixes 2016-06-16 14:30:32 -07:00
Christopher Willis-Ford
ef100bf91e Make API consistent from page and worker
RenderWebGL{Local,Worker} class methods return Promise instances from
all methods returning a value. This makes the API consistent from a
Web Worker vs. the local page, and also allows the possibility of
asynchronous render queries in the future.
2016-06-16 12:59:48 -07:00
Christopher Willis-Ford
b00ec4c501 Rename WorkerRemote to RenderWebGLWorker 2016-06-15 15:36:46 -07:00
Christopher Willis-Ford
ad94df4afe Use ES6 class definitions 2016-06-15 15:21:58 -07:00
Christopher Willis-Ford
2c9e17d486 Use babel for ES6 / ES2015 support 2016-06-15 14:39:44 -07:00
Christopher Willis-Ford
f3a80c3429 Split 'index' files into 3: node, web, worker 2016-06-15 13:48:02 -07:00
Chris Willis-Ford
73ae8c205d Add missing raw-loader package 2016-06-14 18:55:38 -04:00
Christopher Willis-Ford
fc10df7e41 Allow driving the renderer from a web worker
The build generates a new output set called `render-webgl-worker`, meant
to be imported from a web worker. This exposes the `RenderWebGLRemote`
class to facilitate communication with the renderer using `postMessage`
and `onmessage`.
Only a few messages are implemented so far, but it's enough to run the
demo page.
2016-06-14 11:45:35 -07:00
Christopher Willis-Ford
f0dae7aa48 Fix GL errors when using SVG Drawable early
Drawable now creates its own temporary texture upon construction. This
1x1 transparent texture is ready immediately and is replaced once a real
skin is loaded. This slightly simplifies some of the skin loading code
but more importantly prevents GL errors caused when trying to draw a
Drawable if it hasn't yet created its "real" texture, as in the SVG load
path.
2016-06-13 10:23:54 -07:00
Christopher Willis-Ford
b74f9448f5 Simplify draw modes again
The ability to bitwise-combine draw modes turns out to not be a benefit:
it's not safe to short-circuit drawing in the way that I had intended
because it could change the results of blending. Blending could create a
color that matches a "touching color?" check without that color existing
anywhere else.
2016-06-09 16:30:26 -07:00
Christopher Willis-Ford
04cebb9eed Improve color handling in isTouchingColor
- Always take color in unsigned-byte terms.
- Moved tolerance value into a class constant.
- Use the same tolerance in JS color comparison as in the shader.
2016-06-09 15:32:23 -07:00
Christopher Willis-Ford
aeefe8e5a3 Add setDebugCanvas method
Some debug code has been moved inside conditionals instead of comments
2016-06-09 15:17:21 -07:00
Christopher Willis-Ford
1edb753ac8 Add silhouette color to Drawable's uniforms 2016-06-09 13:44:04 -07:00
Christopher Willis-Ford
91cc797c3b Refactor ShaderManager's DRAW_MODE and effect info
Draw modes are now enabled/disabled by bitmask and can be combined.
Combining silhouette mode and color mask mode will be useful for
color-touching-color, for example.

Effect converters are now one field in a larger EFFECT_INFO map, which
also contains bitmask values for each effect. Drawable no longer makes
any assumptions regarding how ShaderManager will unpack the effect bits.

The shader cache is now an array of arrays, where the outer index is the
mask of active draw modes and the inner index is the mask of active
effects (as it was before). Effects which cannot impact the shape of a
Drawable are masked out in silhouette mode in order to avoid compiling
redundant shaders.
2016-06-09 12:17:12 -07:00
Christopher Willis-Ford
bb357ba8bc Exclude build directory in IDEA
This helps with searches, "Go To Declaration", etc.
2016-06-09 12:03:10 -07:00
Christopher Willis-Ford
a21bd1aff1 Simplify coordinate system specification
The renderer now calculates the native render target size based on the
edge coordinates provided to the constructor. This native size will be
used directly for queries such as "touching color?" and will be scaled
when rendering for display.
2016-06-09 10:59:19 -07:00
Christopher Willis-Ford
1040189e27 Move shader management to new ShaderManager class 2016-06-08 13:38:49 -07:00
Christopher Willis-Ford
74deedba1b Add .editorconfig 2016-06-08 09:27:01 -07:00
Christopher Willis-Ford
9f59b42901 Implement color-touching-color
The `isTouchingColor` function now takes an optional mask parameter. If
provided, only the parts of the Drawable which match the mask color will
be used for the test. For example:
```
  isTouchingColor(4, red, blue);
```
This means "are there any parts of Drawable #4 which are blue and are
touching a red pixel on some other Drawable?"
2016-06-06 16:21:24 -07:00
Christopher Willis-Ford
6b0f3379bf Allow overriding the candidates for picking
This can be used to implement the "touching {mouse-pointer}?" block.
2016-06-03 09:21:36 -07:00
Christopher Willis-Ford
eb7e87730c Move RenderWebGL class into its own file
The `index.js` file now handles module-level exports only.
2016-06-03 08:47:50 -07:00
Christopher Willis-Ford
4d04ef5de7 Use Buffer instead of Uint8Array (lint fix)
Also suppress lint warning about unused alpha in color4ubToID since
that's intentional (for now).
2016-06-02 15:42:55 -07:00
Christopher Willis-Ford
bdf65d4284 Add isTouchingColor(drawableID, color3ub)
Also eliminate the ability to specify background alpha, since that can
affect page-level compositing in undesirable ways.
Also avoid some redundant GL state calls.
2016-06-02 15:09:02 -07:00
Christopher Willis-Ford
25d8148ec4 Add more flexibility to draw-time object filtering
The `_drawThese` call now takes both a list of Drawable IDs for positive
filtering and a filter function for negative filtering.
2016-06-01 16:17:56 -07:00
Christopher Willis-Ford
137e4a642e Skin loading improvements
Fixed timing errors related to calling `setSkin()` a second time before
the first callback chain completes.
Fixed a typo causing problems when more than one Drawable is registered.
2016-06-01 15:28:08 -07:00
Christopher Willis-Ford
e03e9a0929 Drop lightness threshold for color effect
HSL's lightness is, in this case, basically the same as half of HSV's
value, so this change halves the threshold value used by the color
effect to make it similar in appearance to the HSV implementation.
2016-06-01 14:23:13 -07:00