HTML and CSS Reference
In-Depth Information
Step 4: Add matrix helpers to simplify matrix interaction.
For gd.core.draw() you'd normally have to write some extremely complex logic to
handle matrices for colors and shapes. Instead, you're going to use some prewritten help-
ers for modelview ( http://3dengine.org/Modelview_matrix ) , perspective ( http://mng.bz/
VitL ) , and identity matrices ( http://en.wikipedia.org/wiki/Identity_matrix ) . Append listing
9.16 to your gd.core object. Like webgl_util.js, the following chunk of code comes from
an unknown source, but you'll find that Mozilla's WebGL tutorials, Learning WebGL, and
many other online lessons make use of it.
Listing 9.16. core.js—Matrix helpers [ 4 ] , [ 5 ]
4 “Matrix multiplication,” Wikipedia, last modified April 8, 2013, http://mng.bz/yo4D .
5 “Translation (geometry),” Wikipedia, last modified Feb. 21, 2013, http://mng.bz/2dbB .
 
 
 
Search WWH ::




Custom Search