Commit graph

162 commits

Author SHA1 Message Date
Christopher Willis-Ford
41d3d6f6ba First pass at implementing all effects
Some of the math is wrong but I believe all the structure is now in place.
2016-05-19 15:46:37 -07:00
Christopher Willis-Ford
8b461e0651 Tweak whirl, color effects for #ifdef-based shader
Also fixed a typo in effect value conversion
2016-05-19 13:25:01 -07:00
Christopher Willis-Ford
d9a89fdd06 Support setting the stage background color 2016-05-19 12:00:19 -07:00
Christopher Willis-Ford
7f020787fd Generate shader for each effect combo on demand
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.
2016-05-19 11:36:55 -07:00
Christopher Willis-Ford
798981812d Provide an interface for bulk-updating a Drawable
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.
2016-05-18 16:21:26 -07:00
Christopher Willis-Ford
db69b23a0e Support rendering SVGs 2016-05-18 12:35:08 -07:00
Christopher Willis-Ford
06f7d46613 Keep skin until new one loads 2016-05-17 15:24:14 -07:00
Christopher Willis-Ford
f30629ebba Document all methods 2016-05-17 15:12:37 -07:00
Christopher Willis-Ford
4fc42ca00a Added a TODO regarding a texturing issue
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
2016-05-17 14:10:51 -07:00
Christopher Willis-Ford
dbe3f1370b Draw a squirrel
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.
2016-05-17 13:52:37 -07:00
Christopher Willis-Ford
60931611d4 Move build products and demo.html into subdir 2016-05-13 11:42:40 -07:00
Christopher Willis-Ford
51e17c57a9 Establish initial structure, create demo.html
So far this does nothing but clear the screen to magenta, but it's a
start.
2016-05-13 11:29:51 -07:00