Note there was an inconsequential coordinate flip in the original
transformation code, which was fixed in order for the sliced bounds to
work. The change is at line 388
This change allowed TWGL to create a WebGL 2 context when available and
fall back to WebGL 1 when that's the only option. This should in theory
be harmless, but deserves more extensive testing before rolling it out.
The playground was trying to build with a now-missing entry point.
Also, I fixed some JSDoc comments, added HTML labels, etc. until IDEA
had no meaningful complaints about `playground/index.html`.
`RenderWebGL`'s constructor will now throw if TWGL init fails. There's
also a new static method to check whether or not we expect TWGL init to
succeed.
Some mobile GPUs end up dividing by "zero" with the previous epsilon
value. The larger epsilon doesn't cause any problems on systems which
didn't exhibit the bug (like my main dev machine).
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.
Use Drawable.isTouching and Skin.isTouching to implement pick and
_getConvexHullPointsForDrawable to emulate rendering the drawable's
silhouette and determining what is picked or the points for a convex
hull.
EffectTransform transforms a point based on a Drawable's effect uniform
values mimicking the texcoord0 transformation in the shader. This way a
point in the Drawable space can know if its touching its silhouette
when the Drawable has effects active.
Silhouette emulates silhouette rendering. Performing tests like
RenderWebGL.pick can use Silhouette in place of reading a silhouette
rendering from the GPU.
Silhouette.isTouching(vec) takes a texture coordinate vector and checks
if the corresponding location is opaque or not for the underlying
information.
So the issue is simple... We start by filling the detector canvas with
the color white, then layer over this the costumes we are want to detect
white colors in (but clip to the shape of the costumre we are detecting
against) then the areas that were clipped will still be white (the
background fill color). So we detect white no matter what.
`Skin._rotationCenter` is a twgl vector or said another way a
Float32Array. JavaScript casts values stored in this array as 32 bit
floats instead of JavaScript's standard 64 bit floats. Comparing the
equality, like `setRotationCenter` does, of a 64 bit float against a
value stored in a 32 bit container will virtually always be false.
Truncating the new value into a 32 bit (losing precision) will give a
more useful comparison and remove a lot of current false positives.