The combination of effects is encoded bitwise as an index into the
shader cache array. The `getShader` function fetches the relevant index
if it's present, or calls `_buildShader()` to compile a new shader. The
effects are enabled by prepending lines like `#define ENABLE_whirl` at
the beginning of the vertex and fragment shader texts.
The renderer can now update any combination of a Drawable's position,
direction, scale, and effect values through a single function call. The
effect values will be adjusted according to per-effect conversion
functions to prepare the values for use inside the shader.
The current fragment chader contains non-uniform control flow for
determining the texture coordinates to use with `texture2D()`. The spec
says that this can cause undefined behavior; in my case I see a
"sparkle" of wrong pixels near primitive edges.
See:
https://www.opengl.org/wiki/Sampler_%28GLSL%29#Non-uniform_flow_control
This change introduces the Drawable class, which corresponds to a
Scratch sprite or clone. It supports setting its "skin" (corresponding
to a Scratch costume) by md5+extension, but currently only supports
bitmap skins. Drawables can be created, destroyed, and otherwise
manipulated by ID through the renderer.