Commit Graph

43 Commits

Author SHA1 Message Date
DD Liu
5bf185262a Revert "Revert "Revert "Revert "Draw pen lines via fragment shader"""" 2020-04-22 18:16:58 -04:00
DD Liu
bf43ef363a Revert "Revert "Revert "Draw pen lines via fragment shader""" 2020-04-09 12:27:19 -04:00
DD Liu
4a521509da Merge branch 'develop' into revert-559-revert-438-pen-shader 2020-04-02 14:28:08 -04:00
DD Liu
4958bb5c69 Revert "Revert "Draw pen lines via fragment shader"" 2020-04-02 14:14:06 -04:00
DD Liu
adf6fd6dae Revert "Draw pen lines via fragment shader" 2020-02-28 10:00:40 -05:00
adroitwhiz
7d652b44d3 Move pen line bounds calculation to vertex shader 2020-02-11 17:46:12 -05:00
adroitwhiz
936afeef60 Tighten pen bounds 2020-02-07 07:11:28 -05:00
adroitwhiz
9e12f093f6 Cleanup 2020-02-05 03:18:47 -05:00
adroitwhiz
24851f28f8 Draw pen lines via fragment shader 2020-02-05 03:18:47 -05:00
adroitwhiz
b194394cfd Set PenSkin silhouette data directly 2020-01-28 21:05:33 -05:00
adroitwhiz
0cb97a202a Address review feedback 2020-01-24 05:28:20 -05:00
adroitwhiz
10a6d87eb6 Premultiplied alpha, take 2 2020-01-23 14:41:53 -05:00
Chris Willis-Ford
13b9ed7e16 Merge pull request #491 from adroitwhiz/dont-fudge-up-the-renderer
Remove u_fudge
2019-10-01 13:02:15 -07:00
Karishma Chadha
11665299bc Revert "Put Skin Alter Push Back In" 2019-09-26 09:39:05 -05:00
Karishma Chadha
2a1d215e50 Revert "Revert "Revert "Revert "Skin alter push"""" 2019-09-12 13:43:32 -04:00
Karishma Chadha
1cd9e54834 Revert "Revert "Revert "Skin alter push""" 2019-09-12 13:24:03 -04:00
Karishma Chadha
7c4393787b Revert "Revert "Skin alter push"" 2019-08-13 11:42:51 -04:00
Karishma Chadha
4a28cffcd4 Revert "Skin alter push" 2019-08-13 11:22:27 -04:00
adroitwhiz
06def05119 Remove u_fudge 2019-08-08 12:15:27 -04:00
Michael "Z" Goddard
14b01bd63c cache PenSkin's _canvasSize 2019-06-18 17:18:49 -04:00
Benjamin Wheeler
ed6c707cba Revert "Tweak scalingVector to make dots appear to be more circular" 2019-05-30 11:50:54 -04:00
Chris Willis-Ford
8b54df18af Merge pull request #423 from ktbee/more-circular-pen-dots
Tweak scalingVector to make dots appear to be more circular
2019-05-28 15:39:34 -07:00
Katie Broida
9fc82a8fc3 Tweak scalingVector to make dots appear to be more circular instead of oval 2019-05-13 13:27:08 -04:00
peabrainiac
3d373571f8 Update PenSkin.js 2019-03-03 18:40:09 +01:00
peabrainiac
9f7bd971c9 Update PenSkin.js
changed clearColor on `_setCanvasSize`
2019-03-02 00:29:21 +01:00
peabrainiac
44d2fdeba8 Update PenSkin.js 2019-02-27 08:48:45 +01:00
Christopher Willis-Ford
3ff532dbee Quick fix for line drawing gaps
This fixes 238747426 and mostly fixes 197728370 without breaking 225569460
2018-08-10 18:30:38 -07:00
Michael "Z" Goddard
4c8bc5d806 Framebuffer PenSkin (#319)
* draw pen skin lines and stamps to a framebuffer

* skip reading pixels and draw stamp to framebuffer

* update silhouette with readPixels

* draw pen canvas to buffer when its dirty

Composite lines and stamps on browser preferred side (cpu/gpu) until
the export texture is needed. Then blend the canvas with the current
buffer contents.

Updating this way invalidates useProgram optimization and the renderer
currently does not have a way to know this.

* draw lines on framebuffer through fragment shader

* optimize draw regions and pen skin matrix creation

* control draw regions

* mobile gpus need high precision floats for line drawing

* optimize cpu pen line math

* sampled pen line caps

* sampleless pen skin lines, lint, document pen skin buffer ops

* add PenSkin._canvasDirty to constructor

* remove DRAW_MODE_line

* comment PenSkin reused memory, use memory in drawRectangle

* turn draw region id's into optional method handlers

A region ID object may have an enter and exit method on it that are
used by default when entering and exiting that region.

* remove old DRAW_MODE_line precision setting

* standardize vert lines on 4 spaces

* fixup! turn draw region id's into optional method handlers

* do not draw when updating pen skin silhouette

* do not premultiply stamp colors by alpha

* fixup! do not draw when updating pen skin silhouette

* do not premultiply line color

* add a small rim around the line for aliasing

* variable pen line alias amount

* reverse offset pen line on y axis by relative alias amount

Reverse the offset to keep small line overlap to a minimum.

* fixup! reverse offset pen line on y axis by relative alias amount

* medium precision gpu floats
2018-08-08 14:30:51 -04:00
Michael "Z" Goddard
d88b2b4df4 offset pen lines of width 1 and 3 (#314) 2018-08-08 14:05:30 -04:00
Mx Corey Frang
2b8371e5af Rewrite isTouchingDrawables on CPU (#263)
* avoid gl.readPixels at all costs
2018-04-27 16:19:25 -04:00
Christopher Willis-Ford
9307e09031 Use bilinear filtering except when we shouldn't
Use bilinear filtering unless the Drawable is angled by a multiple of 90
degrees and is either a raster image (like a BitmapSkin) or is around
its native resoluion. This makes both bitmaps and vectors look better in
most cases. This is roughly the same logic that Scratch 2.0 used; we may
want to tweak it over time to see if we can make it even better.
2017-11-29 20:55:50 -08:00
Michael "Z" Goddard
a0df7153bc Add Skin.isTouching
Use Silhouette to implement Skin.isTouching in subclasses.
2017-11-15 17:41:46 -05:00
Christopher Willis-Ford
49f7b06dbe Lint fixes 2017-09-06 15:23:28 -06:00
liam4
4707349028 Fix 'draw a point' typo in drawLine doc 2017-06-05 19:56:41 -03:00
Ray Schamp
3c6511d94e Generate docs from src, publish to gh-pages
Fix any broken JSDoc syntax. Unfortunately there is no way to document tuples like `{[int, int]}` for a `[width, height]` array. We could possibly fix this and make the code more readable with `{width: number, height: number}` instead of tuples.

Remove single `@fileoverview` from Rectangle.js, since it was the only file with one and was weird to have that one module show up on the docs home page.

Add a `docs` script to `package.json`, run it from `npm test`, so invalid docs will cause tests to fail (eventually we may want to start using eslint-plugin-jsdoc to catch these errors with the linter alone).
2017-02-21 14:46:24 -05:00
griffpatch
4dba5db28d Alpha channel conversion
I wasn't so clever with this - I'm sorry. Now that I have managed to
link up my local render & vm projects I am able to fix the issue
properly. Many appologies!
2017-02-09 08:36:57 +00:00
griffpatch
6f5acfee7b Bug in alpha channel conversion
This is groundwork required by the issue:
https://github.com/LLK/scratch-vm/issues/393
2017-01-27 12:26:11 +00:00
SillyInventor
ea786aa4bd set canvas to dirty when clearing pen canvas 2017-01-24 19:44:47 -05:00
Christopher Willis-Ford
5eef82a9dc Add missing jsdoc for _setAttributes on PenSkin 2017-01-20 13:16:22 -08:00
Christopher Willis-Ford
3bdb1fff1f Small changes & fixes from VM integration
Changes include:
- Implement pen clear
- Upack pen-related location parameters
- Fix inverted vertical position on pen actions
- Remove canvas debug content
- Set `strokeStyle` instead of `fillStyle`
- Remove location parameter from stamp operation: always stamp in place
2017-01-19 11:22:32 -08:00
Christopher Willis-Ford
f7fd05cfba Use skin-relative coordinates for Pen actions 2017-01-10 15:22:33 -08:00
Christopher Willis-Ford
f29ed34ddc Implement pen point, line, and stamp
Also clean up the code around our calls to `readPixels`:
- Use `Uint8Array` instead of `Buffer` to hold the pixels
- Use `ImageData.data.set` instead of a `for` loop when copying pixels
  to a canvas
2017-01-10 11:47:45 -08:00
Christopher Willis-Ford
140c0fbf37 Merge skin classes, convert PenDrawable to PenSkin
Merge the "skin classes" work from another branch and move/convert the
pen work from `PenDrawable` to `PenSkin`.
2017-01-05 16:25:53 -08:00