<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>*drawlogic &#187; CODE</title>
	<atom:link href="http://drawlogic.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://drawlogic.com</link>
	<description>interactive and game development technologies for the web - flash, flex, unity3d, silverlight, javascript</description>
	<lastBuildDate>Thu, 22 Dec 2011 21:55:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>WebGL Announced, Javascript Controlled OpenGL Standard, is Now Official at Khronos Group, Who Runs OpenGL, OpenVG, OpenGL ES</title>
		<link>http://drawlogic.com/2009/08/08/webgl-announced-javascript-controlled-opengl-standard-is-now-official-at-khronos-group-who-runs-opengl-openvg-opengl-es/</link>
		<comments>http://drawlogic.com/2009/08/08/webgl-announced-javascript-controlled-opengl-standard-is-now-official-at-khronos-group-who-runs-opengl-openvg-opengl-es/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 21:55:11 +0000</pubDate>
		<dc:creator>drawk</dc:creator>
				<category><![CDATA[3d]]></category>
		<category><![CDATA[3D ENGINES]]></category>
		<category><![CDATA[AWAY3D]]></category>
		<category><![CDATA[CODE]]></category>
		<category><![CDATA[COMPANIES]]></category>
		<category><![CDATA[CONFERENCE]]></category>
		<category><![CDATA[EFFECTS]]></category>
		<category><![CDATA[ENGINE]]></category>
		<category><![CDATA[GAMEDEV]]></category>
		<category><![CDATA[GAMES]]></category>
		<category><![CDATA[HAXE]]></category>
		<category><![CDATA[JAVASCRIPT]]></category>
		<category><![CDATA[LIBRARIES]]></category>
		<category><![CDATA[NEWS]]></category>
		<category><![CDATA[OPEN SOURCE]]></category>
		<category><![CDATA[OPENGL]]></category>
		<category><![CDATA[PROGRAMMING]]></category>
		<category><![CDATA[RENDERING]]></category>
		<category><![CDATA[STANDARDS]]></category>
		<category><![CDATA[TECHNOLOGY]]></category>
		<category><![CDATA[TORQUE 3D]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[unity3d]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[group]]></category>
		<category><![CDATA[khronos]]></category>
		<category><![CDATA[opengles]]></category>
		<category><![CDATA[standard]]></category>
		<category><![CDATA[webgl]]></category>

		<guid isPermaLink="false">http://drawlogic.com/?p=622</guid>
		<description><![CDATA[So many cool and useful technologies are unveiled at SIGGRAPH every year, this year at SIGGRAPH 2009 was no different.  Khronos Group, behind the new guidance of OpenGL, OpenGL ES, OpenCL, OpenVG, COLLADA etc, came another big announcement about hardware rendering within the browser.  WebGL is now an official standard being developed at Khronos Group [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" title="OpenGL" src="http://i81.photobucket.com/albums/j223/drawkbox/opengl-logo-1-1.png" alt="" width="239" height="123" />So many cool and useful technologies are unveiled at SIGGRAPH every year, this year at SIGGRAPH 2009 was no different.  Khronos Group, behind the new guidance of OpenGL, OpenGL ES, OpenCL, OpenVG, COLLADA etc, came another big announcement about hardware rendering within the browser.  <a href="http://www.khronos.org/news/press/releases/khronos-webgl-initiative-hardware-accelerated-3d-graphics-internet/" target="_blank">WebGL is now an official standard being developed</a> at Khronos Group to bring javascript control of OpenGL to browsers&#8230; Wow!</p>
<p>Ok so this was officially announced at the GDC in March but limited information, but now it has been slated for an <strong>official public standard </strong><strong>in early 2010</strong>. Shortly after the announcement at the GDC we saw <a href="http://code.google.com/apis/o3d/" target="_blank">Google o3D</a> appear doing exactly that, controlling OpenGL through Javascript in the browser <a href="http://o3d.blogspot.com/2009/07/improving-o3ds-hardware-compatibility.html" target="_blank">but it was still largely software/harward hybrid rendered</a>. Google, Mozilla, Opera are part of the companies supporting WebGL which is great for browser support, also NVIDIA, AMD and Ericsson are in on it.</p>
<blockquote>
<h3><img class="alignright" title="Khronos Group" src="http://i81.photobucket.com/albums/j223/drawkbox/khronos_logo.gif" alt="" width="195" height="57" />Khronos Details WebGL Initiative to Bring Hardware-Accelerated 3D Graphics to the Internet</h3>
<p><em>JavaScript Binding to OpenGL ES 2.0 for Rich 3D Web Graphics without Browser Plugins; Wide industry Support from Major Browser Vendors including Google, Mozilla and Opera; Specification will be Available Royalty-free to all Developers</em></p>
<p><strong>4th August, 2009 – New Orleans, SIGGRAPH 2009 – The Khronos™ Group, today announced more details on its new WebGL™ working group</strong> for enabling hardware-accelerated 3D graphics in Web pages without the need for browser plug-ins.  First announced at the Game Developers Conference in March of 2009, the WebGL working group includes many industry leaders such as <strong>AMD, Ericsson, Google, Mozilla, NVIDIA and Opera</strong>.  The WebGL working group is defining a JavaScript binding to OpenGL® ES 2.0 to enable rich 3D graphics within a browser on any platform supporting the OpenGL or OpenGL ES graphics standards.  The working group is developing the specification to provide content portability across diverse browsers and platforms, including the capability of portable, secure shader programs.  <strong>WebGL will be a royalty-free standard developed under the proven Khronos development process, with the target of a first public release in first half of 2010.</strong> Khronos warmly welcomes any interested company to become a member and participate in the development of the WebGL specification.</p></blockquote>
<p><a href="http://drawlogic.com/2009/04/21/google-releases-o3d-plugin-for-3d-in-browser-controlled-with-javascript/" target="_blank">Google released O3D</a> this year and there are great strides in 3d within the browser from game engine wrapper technologies such as <a href="http://technology.instantaction.com/" target="_blank">instant action technology</a>, gaim theory engine (now owned by id Software and runs <a href="http://www.quakelive.com/" target="_blank">Quake  Live</a>, hardware rendered <a href="http://unity3d.com/" target="_blank">Unity 3D</a> (and <a href="http://www.garagegames.com/products/torque-3d" target="_blank">Torque 3D</a> coming soon), and Flash software rendered  3d engines <a href="http://blog.papervision3d.org/" target="_blank">Papervision 3D</a>, <a href="http://away3d.com/" target="_blank">Away 3D</a>, <a href="http://www.flashsandy.org/" target="_blank">Sandy </a>(<a href="http://drawlogic.com/2009/07/16/haxe-sandy-able-to-generate-a-3d-javascript-engine-port-of-sandy-for-canvas/" target="_blank">Sandy also released a haXe version that exports a javascript version</a>) and others.  But it looks like the movement is to bring OpenGL to the web as a standard under the name WebGL, this would be great!  There would still be lots of times where plugins are better now and in the near future but the path is a good one. Having a software/hardware rendering hybrid like Google O3D for broad video card support (some of the painful older intel cards), or using a plugin like Unity3D, Torque 3D or wrapper technology for bigger engines is a good idea for the time being. But the future is grand in this area.</p>
<p>I think that Google O3D and OpenGL ES success on iPhone games probably combined to get this in motion.  OpenGL and very basic video cards are now standard in most machines out there.  <a href="http://unity3d.com/webplayer/hwstats/" target="_blank">Unity3D actually published hardware statistics on casual gamers</a> (web-based games) ever so kindly and shows that even though there are some older Intel cards out there, for the most part machines nowadays have a video card capable of supporting at least low-poly 3d and hardware supported 2d rendering in real-time for games, user interfaces and more.</p>
<p>This is exciting news, it appears the movement of the web gaming market is getting much more capable and is accelerating the innovation of hardware accelerating the web.</p>
]]></content:encoded>
			<wfw:commentRss>http://drawlogic.com/2009/08/08/webgl-announced-javascript-controlled-opengl-standard-is-now-official-at-khronos-group-who-runs-opengl-openvg-opengl-es/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>AS3 Flash Efficient Code Techniques, Vectors in Flash 10, Faster JPEG Encoding, Other Optimization Notes</title>
		<link>http://drawlogic.com/2009/05/22/as3-flash-efficient-code-techniques-vectors-in-flash-10-faster-jpeg-encoding-other-optimization-notes/</link>
		<comments>http://drawlogic.com/2009/05/22/as3-flash-efficient-code-techniques-vectors-in-flash-10-faster-jpeg-encoding-other-optimization-notes/#comments</comments>
		<pubDate>Fri, 22 May 2009 09:21:42 +0000</pubDate>
		<dc:creator>drawk</dc:creator>
				<category><![CDATA[ACTIONSCRIPT]]></category>
		<category><![CDATA[ACTIONSCRIPT3]]></category>
		<category><![CDATA[APPLICATIONS]]></category>
		<category><![CDATA[ARCHITECT]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[CODE]]></category>
		<category><![CDATA[DEVELOPMENT]]></category>
		<category><![CDATA[FLASH]]></category>
		<category><![CDATA[FLEX]]></category>
		<category><![CDATA[PERFORMANCE]]></category>
		<category><![CDATA[PROGRAMMING]]></category>
		<category><![CDATA[TECHNOLOGY]]></category>
		<category><![CDATA[VECTOR]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[efficient]]></category>
		<category><![CDATA[optmization]]></category>

		<guid isPermaLink="false">http://drawlogic.com/?p=558</guid>
		<description><![CDATA[Flash 10 will be ready for mainstream hopefully by the end of this year, or early &#8217;10 when the penetration numbers will be up in or around the 90% range via zeh fernando based on previous trajectories.   With that, Flash 10 has many great new things such as the Vector structure that allows a collection of [...]]]></description>
			<content:encoded><![CDATA[<p>Flash 10 will be ready for mainstream hopefully by the end of this year, or early &#8217;10 when the <a href="http://spreadsheets.google.com/pub?key=pjaKnZUqwo-1XaUCJLlBQeA&amp;gid=1">penetration numbers will be up in or around the 90% range</a> via <a href="http://zehfernando.com/2009/flash-penetration-stats-for-march-2009-now-live-graphs-updated/">zeh fernando based on previous trajectories</a>.  </p>
<p>With that, <strong>Flash 10 has many great new things such as the </strong><a href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/Vector.html" target="_blank"><strong>Vector</strong></a><strong> structure that allows a collection of a certain type, which results in a faster collection because of the known type.</strong>  So anywhere where Arrays are used, that is a possible candidate for a performance increase within some code because you are asking the virtual machine to do less work on each loop (not having to dynamically find out the type).</p>
<p><a href="http://www.bytearray.org/?p=775" target="_blank">ByteArray</a> (Thibault Imbert) has demonstrated that for the JPEG encoding in corelib it is <a href="http://www.bytearray.org/?p=775" target="_blank">up to 2.5 times faster using Vectors than Arrays</a>.  Your mileage may vary heavily but it is almost a guaranteed speed boost due to less work.  This obviously has great possibilities for speeding up code that uses lots of arrays.  </p>
<p>Due to the performance boost the Vector does have some constraints in the typical give and take of coder flexibility with compiler and virtual machine overhead.  Vectors are more explicit and strongly typed which is why they are fast, but this is also limiting.</p>
<blockquote><p><strong>In addition to the data type restriction, the Vector class has other restrictions that distinguish it from the Array class:</strong></p>
<ul>
<li>A Vector is a dense array. Unlike an Array, which may have values in indices 0 and 7 even if there are no values in positions 1 through 6,<strong> a Vector must have a value (or </strong><code><strong>null</strong></code><strong>) in each index.</strong></li>
<li><strong>A Vector can optionally be fixed-length, </strong><strong>meaning the number of elements it contains can&#8217;t change</strong>.</li>
<li>Access to a Vector&#8217;s elements is bounds-checked. You can never read a value from an index greater than the final element (<code>length - 1</code>). You can never set a value with an index more than one beyond the current final index (in other words, you can only set a value at an existing index or at index <code>[length]</code>).</li>
</ul>
</blockquote>
<p> [ <a href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/Vector.html" target="_blank">Vector docs</a>  ]</p>
<p><a href="http://www.bytearray.org/?p=775" target="_blank">ByteArray not only used Vectors heavily but did other optimizations</a> that are always good to do, even though optimization is evil when you are working with precious client side resources ensuring an optimized base starting point can be a good thing.</p>
<blockquote><p>So what did I do ?</p>
<ul>
<li>I used bitwise operators as much as possible.</li>
<li><strong>I replaced all Arrays with fixed length Vectors.</strong></li>
<li>I used pre-incrementation rather than post-incrementation (thanks <a title="Joa's wiki" href="http://wiki.joa-ebert.com/" target="_blank">Joa</a> for this one <img src='http://drawlogic.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ).</li>
<li>I casted to int all my Vector indices access.</li>
<li>Other minor stuff you always do to optimize your code </li>
</ul>
</blockquote>
<p><strong>Other sources as well for even more optimization or shall I say efficient AS3:</strong></p>
<ul>
<li><a href="http://lab.polygonal.de/2008/06/18/using-object-pools/" target="_blank">Polygonal Labs Using Object Pools</a></li>
<li><a href="http://blog.joa-ebert.com/2008/05/07/tweening-and-object-pools/" target="_blank">Joa Ebert Tweening and Object Pools</a></li>
<li><a href="http://wiki.joa-ebert.com/index.php/Category:Code_Optimization" target="_blank">Joa Ebert Optmization Wiki</a></li>
<li><a href="http://www.insideria.com/2009/04/51-actionscript-30-and-flex-op.html" target="_blank">Sean Moore Efficient AS3 roundup (great list of resources for more at the bottom)</a></li>
<li><a href="http://www.lostinactionscript.com/blog/index.php/2008/09/28/tips-on-how-to-write-efficient-as3/" target="_blank">Lost in Actionscript Efficient AS3 Tips</a></li>
<li><a href="http://www.bigspaceship.com/blog/labs/as3-optimization-tip" target="_blank">Big SpaceShip Mouse Leave Tip</a> (flash can hog resources so when it isn&#8217;t in focus then let is stop tasking the processor)</li>
<li><a href="http://www.gskinner.com/blog/archives/2009/05/idle_cpu_usage.html" target="_blank">Grant Skinner Idle CPU in AIR FPS Tip</a> (set fps to a lower amount when it is out of focus)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://drawlogic.com/2009/05/22/as3-flash-efficient-code-techniques-vectors-in-flash-10-faster-jpeg-encoding-other-optimization-notes/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>JavaScript Standard ECMAScript Fifth Edition (ES5) Published</title>
		<link>http://drawlogic.com/2009/04/09/javascript-standard-ecmascript-fifth-edition-es5-published/</link>
		<comments>http://drawlogic.com/2009/04/09/javascript-standard-ecmascript-fifth-edition-es5-published/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 00:06:00 +0000</pubDate>
		<dc:creator>drawk</dc:creator>
				<category><![CDATA[ACTIONSCRIPT]]></category>
		<category><![CDATA[ACTIONSCRIPT3]]></category>
		<category><![CDATA[ADOBE]]></category>
		<category><![CDATA[ARCHITECT]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[CODE]]></category>
		<category><![CDATA[FLASH]]></category>
		<category><![CDATA[JAVASCRIPT]]></category>
		<category><![CDATA[JAVASCRIPT2]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[MICROSOFT]]></category>
		<category><![CDATA[NEWS]]></category>
		<category><![CDATA[PROGRAMMING]]></category>
		<category><![CDATA[TECHNOLOGY]]></category>
		<category><![CDATA[ECMAScript]]></category>
		<category><![CDATA[Edition]]></category>
		<category><![CDATA[es4]]></category>
		<category><![CDATA[es5]]></category>
		<category><![CDATA[Fifth]]></category>
		<category><![CDATA[standard]]></category>
		<category><![CDATA[STANDARDS]]></category>

		<guid isPermaLink="false">http://drawlogic.com/?p=518</guid>
		<description><![CDATA[Well it appears ES4 path is dead officially and a new standard has been published replacing it, the ECMAScript Fifth Edition announced in Geneva, Switzerland and will be in place as fully tested and approved by all involved by the end of 2009. ES5 was previously known as ECMAScript 3.1 or an iteration of the [...]]]></description>
			<content:encoded><![CDATA[<p>Well it appears ES4 path is dead officially and a new standard has been published replacing it, <a href="http://www.ecma-international.org/news/PressReleases/PR_Ecma_finalises_major_revision_of_ECMAScript.htm" target="_blank">the ECMAScript Fifth Edition</a> announced in Geneva, Switzerland and will be in place as fully tested and approved by all involved by the end of 2009. ES5 was previously known as ECMAScript 3.1 or an iteration of the ES3 standard that is what most JavaScript is based on in all browsers, and was previously competing with the ES4 newer standard that changed Javascript quite a bit but in many areas much better, in some areas it was bloated.</p>
<blockquote><p>This revision of <a style="font-family: Verdana; font-style: normal; font-variant: normal; font-weight: normal; font-size: 1em; line-height: normal; font-size-adjust: none; font-stretch: normal; height: auto; letter-spacing: normal; text-align: left; text-decoration: underline; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; width: auto; word-spacing: normal; color: #999999;" href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMA-262</a> will be known as ECMAScript, Fifth Edition. It was previously developed under the working name ECMAScript 3.1, which will no longer be used. ECMAScript is the scripting language that is used to create web pages with dynamic behavior. ECMAScript, which is more commonly known by the name JavaScript™, is an essential component of every web browser and the ECMAScript standard is one of the core standards that enable the existence of interoperable web applications on the World Wide Web.</p></blockquote>
<p>ECMAScript Fifth Edition (ES5) was <a href="http://blogs.msdn.com/jscript/archive/2009/04/09/a-major-milestone-in-javascript-standardization.aspx" target="_blank">strongly guided by Crockford and Microsoft</a>, which is different than the push for ES4 which is what ActionScript 3 is based on and was supported by Adobe and Mozilla.</p>
<p>However it seems everyone is happy and everyone is supporting this version to get things moving if you go by the ECMA Org quotes:</p>
<blockquote>
<p class="PR-Heading3" style="font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 1.22em; font-weight: bold; color: #333333;">Industry Reaction</p>
<p>Brendan Eich, Mozilla CTO and creator of the JavaScript language, said “The Fifth Edition of ECMAScript makes real improvements based on browser innovation and collaboration in Ecma, which provides a solid foundation for further work in future editions.” Microsoft’s ECMAScript architect, Allen Wirfs-Brock, commented “We expect the Fifth Edition to benefit all web developers by helping improve browser interoperability and making enhanced scripting features broadly available.”</p></blockquote>
<p>Peace.</p>
<p>I still have to read further into the <a href="http://www.ecma-international.org/publications/files/drafts/tc39-2009-025.pdf" target="_blank">ECMAScript 5 specification which was published</a>, but there are some new interesting things.</p>
<p>One nice feature is the <a href="http://blogs.msdn.com/ie/archive/2008/09/10/native-json-in-ie8.aspx" target="_blank">JSON object</a>.  Right now you have to eval to use JSON in javascript in a browser but they now have JSON.parse(object) and JSON.stringify(object) which is standard and conveniently already wired into IE8 this way. This is based on the <a href="http://www.json.org/json2.js" target="_blank">JSON2.js library</a> by <a href="http://www.crockford.com/" target="_blank">Douglas Crockford</a> of Yahoo.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> jsObjString <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;{<span style="color: #000099; font-weight: bold;">\&quot;</span>memberNull<span style="color: #000099; font-weight: bold;">\&quot;</span> : null, <span style="color: #000099; font-weight: bold;">\&quot;</span>memberNum<span style="color: #000099; font-weight: bold;">\&quot;</span> : 3, <span style="color: #000099; font-weight: bold;">\&quot;</span>memberStr<span style="color: #000099; font-weight: bold;">\&quot;</span> : <span style="color: #000099; font-weight: bold;">\&quot;</span>StringJSON<span style="color: #000099; font-weight: bold;">\&quot;</span>, <span style="color: #000099; font-weight: bold;">\&quot;</span>memberBool<span style="color: #000099; font-weight: bold;">\&quot;</span> : true , <span style="color: #000099; font-weight: bold;">\&quot;</span>memberObj<span style="color: #000099; font-weight: bold;">\&quot;</span> : { <span style="color: #000099; font-weight: bold;">\&quot;</span>mnum<span style="color: #000099; font-weight: bold;">\&quot;</span> : 1, <span style="color: #000099; font-weight: bold;">\&quot;</span>mbool<span style="color: #000099; font-weight: bold;">\&quot;</span> : false}, <span style="color: #000099; font-weight: bold;">\&quot;</span>memberX<span style="color: #000099; font-weight: bold;">\&quot;</span> : {}, <span style="color: #000099; font-weight: bold;">\&quot;</span>memberArray<span style="color: #000099; font-weight: bold;">\&quot;</span> : [33, <span style="color: #000099; font-weight: bold;">\&quot;</span>StringTst<span style="color: #000099; font-weight: bold;">\&quot;</span>,null,{}]&quot;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> jsObjStringParsed <span style="color: #339933;">=</span> JSON.<span style="color: #660066;">parse</span><span style="color: #009900;">&#40;</span>jsObjString<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> jsObjStringBack <span style="color: #339933;">=</span> JSON.<span style="color: #660066;">stringify</span><span style="color: #009900;">&#40;</span>jsObjStringParsed<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Another feature is <a href="http://blogs.msdn.com/ie/archive/2009/01/13/responding-to-change-updated-getter-setter-syntax-in-ie8-rc-1.aspx" target="_blank">DOM prototypes</a> which are useful and cool, which allow you to extend dom objects.</p>
<ul>
<li><a style="text-decoration: none; color: #0066aa;" href="http://msdn.microsoft.com/en-us/library/dd282900(VS.85).aspx">Document Object Model Prototypes, Part 1: Introduction</a></li>
<li><a style="text-decoration: none; color: #0066aa;" href="http://msdn.microsoft.com/en-us/library/dd229916(VS.85).aspx">Document Object Model Prototypes, Part 2: Accessor (getter/setter) Support</a></li>
</ul>
<p>If you use javascript or are an actionscripter, not sure if Adobe will have ActionScript 4 go this way or if Alchemy has changed the flash player into a multi language VM now.  It will be fun to watch things progress but also if you are into javascript it seems this standard, ES5, will be it by the end of the year.  And probably since IE8 already supports it, in all new browser by then as well.  It will probably take 1-2 years before browser saturation makes this usable but if you are using standards that mimic this then there will be no change then, such as the JSON2.js library.</p>
]]></content:encoded>
			<wfw:commentRss>http://drawlogic.com/2009/04/09/javascript-standard-ecmascript-fifth-edition-es5-published/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>AS3 Version of OpenCV for Facial Detection, Web Cam Object Detection, Head Tracking, 3D Library Integration and more with Open Computer Vision Library for Flash</title>
		<link>http://drawlogic.com/2009/03/16/as3-version-of-opencv-for-facial-detection-web-cam-object-detection-head-tracking-3d-library-integration-and-more-with-open-computer-vision-library/</link>
		<comments>http://drawlogic.com/2009/03/16/as3-version-of-opencv-for-facial-detection-web-cam-object-detection-head-tracking-3d-library-integration-and-more-with-open-computer-vision-library/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 21:47:32 +0000</pubDate>
		<dc:creator>drawk</dc:creator>
				<category><![CDATA[3d]]></category>
		<category><![CDATA[3D ENGINES]]></category>
		<category><![CDATA[ACTIONSCRIPT]]></category>
		<category><![CDATA[ACTIONSCRIPT3]]></category>
		<category><![CDATA[ADOBE]]></category>
		<category><![CDATA[ALCHEMY]]></category>
		<category><![CDATA[APPLICATIONS]]></category>
		<category><![CDATA[ARCHITECT]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[BEST OF]]></category>
		<category><![CDATA[CODE]]></category>
		<category><![CDATA[ENGINE]]></category>
		<category><![CDATA[FLASH]]></category>
		<category><![CDATA[FLEX]]></category>
		<category><![CDATA[GAMEDEV]]></category>
		<category><![CDATA[GAMES]]></category>
		<category><![CDATA[LIBRARIES]]></category>
		<category><![CDATA[MOTION]]></category>
		<category><![CDATA[OPEN SOURCE]]></category>
		<category><![CDATA[PAPERVISION]]></category>
		<category><![CDATA[PERFORMANCE]]></category>
		<category><![CDATA[PROGRAMMING]]></category>
		<category><![CDATA[RENDERING]]></category>
		<category><![CDATA[TECHNOLOGY]]></category>
		<category><![CDATA[TOOLS]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[detection]]></category>
		<category><![CDATA[face]]></category>
		<category><![CDATA[flash 10]]></category>
		<category><![CDATA[head]]></category>
		<category><![CDATA[libspark]]></category>
		<category><![CDATA[marilena]]></category>
		<category><![CDATA[opencv]]></category>
		<category><![CDATA[recognition]]></category>
		<category><![CDATA[tracking]]></category>
		<category><![CDATA[visual]]></category>

		<guid isPermaLink="false">http://drawlogic.com/?p=425</guid>
		<description><![CDATA[Libspark from Japan is a treasure trove of great flash advancements, they seem to realize the great things that can come from porting in existing solid libraries from C/C++ etc into flash and have been scoring lately including augmented reality in flash porting the ARToolkit to FLARToolkit.  Recently a port of openCV for as3 called [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.libspark.org/" target="_blank">Libspark</a> from Japan is a treasure trove of great flash advancements, they seem to realize the great things that can come from porting in existing solid libraries from C/C++ etc into flash and have been scoring lately including augmented reality in flash porting the <a href="http://www.hitl.washington.edu/artoolkit/" target="_blank">ARToolkit</a> to FLARToolkit.  Recently a port of <a href="http://www.libspark.org/wiki/mash/Marilena" target="_blank">openCV for as3 called Marilena</a> was found and it is for object detection and decent facial recognition (it is a computer vision library from intel) considering the processing power needed to do this.</p>
<p><strong>Face Detection:</strong> Here is the <a href="http://maaash.jp/lab/Marilena_sample/" target="_blank">sample included with Marilena</a> showing facial detection on an image.</p>
<p><a href="http://maaash.jp/lab/Marilena_sample/" target="_blank"><img class="alignnone size-full wp-image-436" title="marilena1" src="http://drawlogic.com/wp-content/uploads/2009/03/marilena1.jpg" alt="marilena1" width="520" height="163" /></a></p>
<p>Lots of recent action has blown up on this front from <a href="http://mrdoob.com/blog/post/643" target="_blank">Mr doob</a>, <a href="http://www.quasimondo.com/" target="_blank">quasimondo </a>(optimizing the <a href="http://www.libspark.org/wiki/mash/Marilena" target="_blank">Marilena</a> classes for better performance) and <a href="http://www.boffswana.com/news/?p=498" target="_blank">Boffwswana</a>. Also there is a kit called <a href="http://code.google.com/p/deface/" target="_blank">deface</a> by sshipman that is the first foray into this a year ago doing similar things but it was just a bit before it&#8217;s time and a bit slow in previous versions of flash,<a href="http://suckatmath.com/personal/facedetect/facedetect.html" target="_blank"> it performs decent now in this sample</a>. Flash 10 performance of the AVM2 and future directions with Alchemy will lead to more interesting stuff just like this.</p>
<p><strong><a href="http://mrdoob.com/blog/post/643" target="_blank">Mr. doob</a> head tracking sample, be sure to check <a href="http://mrdoob.com/blog/post/643" target="_blank">lots of other examples there</a><br />
</strong></p>
<p><strong><a href="http://mrdoob.com/blog/post/643" target="_blank"><img class="alignnone size-full wp-image-428" title="mrdoob_facedriven3d" src="http://drawlogic.com/wp-content/uploads/2009/03/mrdoob_facedriven3d.png" alt="mrdoob_facedriven3d" width="350" height="222" /></a><br />
</strong></p>
<p><strong><a href="http://www.boffswana.com/news/?p=498" target="_blank">Boffswana </a>example of head tracking <a href="http://www.youtube.com/watch?v=Jd3-eiid-Uw" target="_blank">Johnny Lee Wii style</a> </strong>with only a webcam and flash, no wiimote needed since it uses facial detection to check where you are and how close you are in the screen and then moves accordingly.</p>
<p><a href="http://www.boffswana.com/news/?p=498" target="_blank"><img class="alignnone size-full wp-image-427" title="bofswana" src="http://drawlogic.com/wp-content/uploads/2009/03/bofswana.jpg" alt="bofswana" width="505" height="379" /></a></p>
<p><a href="http://mrdoob.com/blog/post/643" target="_blank"></a></p>
<p>This is stemming from the recent explosion of the <a href="http://www.libspark.org/wiki/saqoosha/FLARToolKit/en" target="_blank">FLARToolkit </a>and <a href="http://drawlogic.com/2008/11/17/as3-augmented-reality-in-flash-and-papervision-3d-flartoolkit/" target="_blank">augmented reality in flash</a> as well as the gimmicks used by Nintendo with the <a href="http://www.youtube.com/watch?v=Jd3-eiid-Uw" target="_blank">wii and Johnny Lee&#8217;s great head tracking advancements</a>. Porting great libraries to flash seems to be the phase we are entering now judging by the recent excitement around Adobe Alchemy and the LLVM along with the lead from the libspark.org contributors. We have also seen this heavily last year in ports of Box2D for 2d physics and other toolkits using established working code and porting that to flash now that is is mostly capable of handling the performance.</p>
<p><a href="http://sourceforge.net/projects/opencv/" target="_blank">OpenCV</a> (Open Computer Vision Library by Intel) is quite a powerful platform that allows you to do all this and now it is available in flash. There are other great libraries for nearly all platforms now. I have done some previous work with <a href="http://code.google.com/p/aforge/" target="_blank">Aforge which is also a port of OpenCV</a> mainly for<a href="http://drawlogic.com/2007/10/17/motion-detection-in-flash-as2-and-as3-and-c/" target="_blank"> motion detection</a>. This was always around but not until the recent performance updates and the innovation that has come with Alchemy and the thinking that goes along with that (porting in libraries to flash from C/C++ etc), has allowed this to flourish in flash and thus the web.</p>
<p>The amazing new things we can do with flash by porting in existing libraries is only going to get more intense as alchemy and flash 10 are even more mainstream.  It is almost as if Flash will eventually just become a web renderer and simplified front end to many great toolkits that exist in more native environments like C/C++ but with the speed and distribution access of the web with Flash.  Exciting times ahead.</p>
]]></content:encoded>
			<wfw:commentRss>http://drawlogic.com/2009/03/16/as3-version-of-opencv-for-facial-detection-web-cam-object-detection-head-tracking-3d-library-integration-and-more-with-open-computer-vision-library/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>UnityDevelop, Port of the Best Flash IDE, FlashDevelop for Unity Scripts (Javascript)</title>
		<link>http://drawlogic.com/2009/02/19/unitydevelop-port-of-the-best-flash-ide-flashdevelop-for-unity-scripts-javascript/</link>
		<comments>http://drawlogic.com/2009/02/19/unitydevelop-port-of-the-best-flash-ide-flashdevelop-for-unity-scripts-javascript/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 04:48:14 +0000</pubDate>
		<dc:creator>drawk</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[APPLICATIONS]]></category>
		<category><![CDATA[ARCHITECT]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[CODE]]></category>
		<category><![CDATA[DESKTOP]]></category>
		<category><![CDATA[DEVELOPMENT]]></category>
		<category><![CDATA[GAMEDEV]]></category>
		<category><![CDATA[GAMES]]></category>
		<category><![CDATA[JAVASCRIPT]]></category>
		<category><![CDATA[OPEN SOURCE]]></category>
		<category><![CDATA[PROGRAMMING]]></category>
		<category><![CDATA[TECHNOLOGY]]></category>
		<category><![CDATA[TOOLS]]></category>
		<category><![CDATA[autocomplete]]></category>
		<category><![CDATA[blurst]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[flashbang]]></category>
		<category><![CDATA[flashdevelop]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[intellisense]]></category>
		<category><![CDATA[unity]]></category>
		<category><![CDATA[unity3d]]></category>
		<category><![CDATA[unityscript]]></category>

		<guid isPermaLink="false">http://drawlogic.com/?p=407</guid>
		<description><![CDATA[The guys over at Flashbang Studios, a web game development studio in phoenix, az, and some of the most visible developers in the Unity3d space with Blurst, released something that may interest both FlashDevelop users and Unity3d developers. UnityDevelop was released by Flashbang Studios recently and it is a modded version of FlashDevelop (originally from [...]]]></description>
			<content:encoded><![CDATA[<p>The guys over at <a href="http://www.flashbangstudios.com/" target="_blank">Flashbang Studios</a>, a web game development studio in phoenix, az, and some of the most visible developers in the Unity3d space with <a href="http://blurst.com/" target="_blank">Blurst</a>, released something that may interest both <a href="http://www.flashdevelop.org/community/viewforum.php?f=11&amp;sid=f082b8fa607ed787daf1e3338d3e6d07" target="_blank">FlashDevelop </a>users and <a href="http://unity3d.com/" target="_blank">Unity3d</a> developers.</p>
<p><strong><a href="http://technology.blurst.com/unitydevelop-javascript-editor/" target="_blank">UnityDevelop was released by Flashbang Studios recently</a></strong> and it is a modded version of FlashDevelop (originally from <a href="http://www.icsharpcode.net/OpenSource/SD/Download/" target="_blank">SharpDevelop </a>a really nice open source .NET and mono IDE) and it supports intellisense for Javascript or Unity3d&#8217;s use of Javascript which is called UnityScript much like ActionScript.  UnityScript can be a little more strict and has access to all of Unity3d&#8217;s API calls just like C# and Boo in the mono based virtual machine that Unity3d uses.</p>
<p>FlashDevelop, is by far the best Flash / Flex /haXe IDE in my opinion so it is really great to release this for Unity.  I hope one day I or someone has the time to port to Mono so it can be used on Macs <a href="http://technology.blurst.com/unitydevelop-javascript-editor/#comment-56" target="_blank">even with the 140 pinvokes</a>, it would be a good spread mechanism for mono.</p>
<p>With <a href="http://drawlogic.com/2009/01/21/unity3d-25-coming-soon-about-to-blow-up-with-windows-ide-support/" target="_blank">Unity3d coming to windows soon</a>, UnityDevelop could be a good go to IDE for unity if you aren&#8217;t using solely C# with VS.NET. Currently this is based on FlashDevelop2 source code.</p>
<p><strong>Video Overview of UnityDevelop</strong><br />
<!--start_raw--><br />
<object width="640" height="360" data="http://vimeo.com/moogaloop.swf?clip_id=3076296&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=3076296&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /></object><br />
<a href="http://vimeo.com/3076296">UnityDevelop Walkthrough</a> from <a href="http://vimeo.com/blurst">Flashbang Studios</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p><strong>Downloads</strong></p>
<ul>
<li><a href="http://technology.blurst.com/examples/UnityDevelop.zip">Download UnityDevelop</a> (2.9 MB)</li>
<li><a href="http://technology.blurst.com/examples/UnityDevelop_dev.zip">Source Code</a></li>
</ul>
<p>Thanks flashbang!</p>
]]></content:encoded>
			<wfw:commentRss>http://drawlogic.com/2009/02/19/unitydevelop-port-of-the-best-flash-ide-flashdevelop-for-unity-scripts-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mini Javascript Version of Papervision3D-like Engine with Canvas (Pseudo 3d with 2d)</title>
		<link>http://drawlogic.com/2009/02/18/mini-javascript-version-of-papervision3d-with-canvas-pseudo-3d-with-2d/</link>
		<comments>http://drawlogic.com/2009/02/18/mini-javascript-version-of-papervision3d-with-canvas-pseudo-3d-with-2d/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 21:32:59 +0000</pubDate>
		<dc:creator>drawk</dc:creator>
				<category><![CDATA[3d]]></category>
		<category><![CDATA[3D ENGINES]]></category>
		<category><![CDATA[CODE]]></category>
		<category><![CDATA[DEVELOPMENT]]></category>
		<category><![CDATA[ENGINE]]></category>
		<category><![CDATA[GAMEDEV]]></category>
		<category><![CDATA[GAMES]]></category>
		<category><![CDATA[JAVASCRIPT]]></category>
		<category><![CDATA[LIBRARIES]]></category>
		<category><![CDATA[OPEN SOURCE]]></category>
		<category><![CDATA[PAPERVISION]]></category>
		<category><![CDATA[RENDERING]]></category>
		<category><![CDATA[TECHNOLOGY]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[FLASH]]></category>
		<category><![CDATA[japan]]></category>
		<category><![CDATA[papervision3d]]></category>
		<category><![CDATA[pseudo]]></category>

		<guid isPermaLink="false">http://drawlogic.com/?p=389</guid>
		<description><![CDATA[Looks like it is a javascript day here at *drawlogic.  Here is an interesting example with some demos of a javascript and canvas based pseudo 3d engine. Anything this cool you know it has to be from Japan. Also of note, it has been rumored that Silverlight 3 will have fully hardware accelerated 3d and [...]]]></description>
			<content:encoded><![CDATA[<p>Looks like it is a javascript day here at *drawlogic.  Here is an interesting example with some<a href="http://gyu.que.jp/jscloth/touch.html" target="_blank"> demos of a javascript and canvas based pseudo 3d engine</a>. Anything this cool you know it has to be from Japan.<br />
Also of note, it has been rumored that Silverlight 3 will have fully hardware accelerated 3d and canvas and javascript engines are getting much faster with great demos like this.  Adobe needs to leap into hardware acceleration for flash on a broader scale soon.</p>
<p>But I digress, this demo it appears, was inspired by Papervision3D due to the naming and the javascript reference of &#8220;<a href="http://gyu.que.jp/jscloth/parpevision.js" target="_blank">parpevision.js</a>&#8220;.  I wasn&#8217;t able to find much more information about this but it is very well done and this example even shows some environment mapping. It is not close to flash pseudo-3d engines like Papervision3D yet but at the rate of javascript engine development lately this could rival flash AVM2 in the next couple of years.</p>
<p><a href="http://gyu.que.jp/jscloth/touch.html" target="_blank"><img class="alignnone" title="papervision in javascript" src="http://i81.photobucket.com/albums/j223/drawkbox/js-environment-mapping.png" alt="" width="479" height="375" /></a></p>
<h3>Demos</h3>
<ul>
<li><a href="http://gyu.que.jp/jscloth/" target="_blank">Cloth</a></li>
<li><a href="http://gyu.que.jp/jscloth/miku.html" target="_blank">Miku Character</a></li>
<li><a href="http://gyu.que.jp/jscloth/touch.html" target="_blank">Enviroment Mapping</a></li>
</ul>
<h3>Code</h3>
<ul>
<li>Sample iPod iTouch Mesh data (<a href="http://gyu.que.jp/jscloth/touchdat/meshdata.js" target="_blank">meshdata.js</a>) &#8211; contains models</li>
<li>Code from the main engine (<a href="http://gyu.que.jp/jscloth/parpevision.js" target="_blank">parpevision.js</a>)</li>
<li>Sample Viewport and main app (<a href="http://gyu.que.jp/jscloth/touch.js" target="_blank">touch.js</a> from demo 3)</li>
</ul>
<p>Here is the code for the parpevision.js file and the mini engine, it is an MIT license.<span id="more-389"></span></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/* MIT-LICENSE */</span>
<span style="color: #006600; font-style: italic;">/*
Copyright (c) 2009 Satoshi Ueyama
&nbsp;
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
&quot;Software&quot;), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
&nbsp;
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
&nbsp;
THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/</span>
&nbsp;
window.<span style="color: #660066;">P3D</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
	texture<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span>
	g<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
P3D.<span style="color: #660066;">clear</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>f<span style="color: #339933;">,</span> w<span style="color: #339933;">,</span> h<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> g <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">g</span><span style="color: #339933;">;</span>
	g.<span style="color: #660066;">beginPath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	g.<span style="color: #660066;">fillStyle</span> <span style="color: #339933;">=</span> f<span style="color: #339933;">;</span>
	g.<span style="color: #660066;">fillRect</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> w<span style="color: #339933;">,</span> h<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
P3D.<span style="color: #660066;">num_cmp</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span>b<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">return</span> a<span style="color: #339933;">-</span>b<span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
&nbsp;
P3D.<span style="color: #660066;">drawTriangle</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>poss<span style="color: #339933;">,</span> uvs<span style="color: #339933;">,</span> shade_clr<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> w <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">texture</span>.<span style="color: #660066;">width</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> h <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">texture</span>.<span style="color: #660066;">height</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> g <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">g</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> vAd <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">-</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">-</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> vBd <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">-</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">-</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> vA <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span> uvs<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">u</span> <span style="color: #339933;">-</span> uvs<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">u</span> <span style="color: #339933;">,</span> uvs<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">v</span> <span style="color: #339933;">-</span> uvs<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">v</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> vB <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span> uvs<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">u</span> <span style="color: #339933;">-</span> uvs<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">u</span> <span style="color: #339933;">,</span> uvs<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">v</span> <span style="color: #339933;">-</span> uvs<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">v</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	vA<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">*=</span> w<span style="color: #339933;">;</span>
	vA<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">*=</span> h<span style="color: #339933;">;</span>
&nbsp;
	vB<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">*=</span> w<span style="color: #339933;">;</span>
	vB<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">*=</span> h<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> m <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> M22<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	m._11 <span style="color: #339933;">=</span> vA<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	m._12 <span style="color: #339933;">=</span> vA<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	m._21 <span style="color: #339933;">=</span> vB<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	m._22 <span style="color: #339933;">=</span> vB<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> im <span style="color: #339933;">=</span> m.<span style="color: #660066;">getInvert</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>im<span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> im._11 <span style="color: #339933;">*</span> vAd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> im._12 <span style="color: #339933;">*</span> vBd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> b <span style="color: #339933;">=</span> im._21 <span style="color: #339933;">*</span> vAd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> im._22 <span style="color: #339933;">*</span> vBd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> c <span style="color: #339933;">=</span> im._11 <span style="color: #339933;">*</span> vAd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> im._12 <span style="color: #339933;">*</span> vBd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> d <span style="color: #339933;">=</span> im._21 <span style="color: #339933;">*</span> vAd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> im._22 <span style="color: #339933;">*</span> vBd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> wu <span style="color: #339933;">=</span> uvs<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">u</span> <span style="color: #339933;">*</span> w<span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> hv <span style="color: #339933;">=</span> uvs<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">v</span> <span style="color: #339933;">*</span> h<span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> du <span style="color: #339933;">=</span> wu <span style="color: #339933;">*</span> a <span style="color: #339933;">+</span> hv <span style="color: #339933;">*</span> b<span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> dv <span style="color: #339933;">=</span> wu <span style="color: #339933;">*</span> c <span style="color: #339933;">+</span> hv <span style="color: #339933;">*</span> d<span style="color: #339933;">;</span>
&nbsp;
	g.<span style="color: #660066;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	g.<span style="color: #660066;">beginPath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	g.<span style="color: #660066;">moveTo</span><span style="color: #009900;">&#40;</span>poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	g.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	g.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	g.<span style="color: #660066;">clip</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	g.<span style="color: #660066;">transform</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> c<span style="color: #339933;">,</span> b<span style="color: #339933;">,</span> d<span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">-</span> du<span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">-</span> dv<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">// bounds</span>
	<span style="color: #003366; font-weight: bold;">var</span> bx <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>wu<span style="color: #339933;">,</span> wu<span style="color: #339933;">+</span>vA<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> wu<span style="color: #339933;">+</span>vB<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> by <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>hv<span style="color: #339933;">,</span> hv<span style="color: #339933;">+</span>vA<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> hv<span style="color: #339933;">+</span>vB<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	bx.<span style="color: #660066;">sort</span><span style="color: #009900;">&#40;</span>P3D.<span style="color: #660066;">num_cmp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	by.<span style="color: #660066;">sort</span><span style="color: #009900;">&#40;</span>P3D.<span style="color: #660066;">num_cmp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> bw <span style="color: #339933;">=</span> bx<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">-</span> bx<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> bh <span style="color: #339933;">=</span> by<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">-</span> by<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>bx<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span>bw<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;=</span> <span style="color: #009900;">&#40;</span>w<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> bw<span style="color: #339933;">++;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>by<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span>bh<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;=</span> <span style="color: #009900;">&#40;</span>h<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> bh<span style="color: #339933;">++;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>bx<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;=</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>bx<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">--;</span> bw<span style="color: #339933;">++;</span><span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>by<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;=</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>by<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">--;</span> bh<span style="color: #339933;">++;</span><span style="color: #009900;">&#125;</span>
&nbsp;
	g.<span style="color: #660066;">drawImage</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">texture</span><span style="color: #339933;">,</span> bx<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> by<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> bw<span style="color: #339933;">,</span> bh<span style="color: #339933;">,</span> bx<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> by<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> bw<span style="color: #339933;">,</span> bh<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>shade_clr<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		g.<span style="color: #660066;">fillStyle</span> <span style="color: #339933;">=</span> shade_clr<span style="color: #339933;">;</span>
		g.<span style="color: #660066;">fillRect</span><span style="color: #009900;">&#40;</span>bx<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> by<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> bw<span style="color: #339933;">,</span> bh<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	g.<span style="color: #660066;">restore</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
P3D.<span style="color: #660066;">drawTestByIndexBuffer</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>pos_buf<span style="color: #339933;">,</span> ix_buf<span style="color: #339933;">,</span> culling<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> g <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">g</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>ix_buf.<span style="color: #660066;">length</span><span style="color: #339933;">%</span>3<span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span>
		<span style="color: #000066; font-weight: bold;">throw</span> <span style="color: #3366CC;">&quot;invalid index buffer length!&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> len <span style="color: #339933;">=</span> ix_buf.<span style="color: #660066;">length</span><span style="color: #339933;">/</span><span style="color: #CC0000;">3</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">,</span> ibase<span style="color: #339933;">,</span> vbase<span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> poss <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	g.<span style="color: #660066;">strokeWidth</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> ibase <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>i <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> len<span style="color: #339933;">;++</span>i<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		vbase <span style="color: #339933;">=</span> ix_buf<span style="color: #009900;">&#91;</span>ibase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span>
		poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> pos_buf<span style="color: #009900;">&#91;</span>vbase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> pos_buf<span style="color: #009900;">&#91;</span>vbase  <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		vbase <span style="color: #339933;">=</span> ix_buf<span style="color: #009900;">&#91;</span>ibase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span>
		poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> pos_buf<span style="color: #009900;">&#91;</span>vbase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> pos_buf<span style="color: #009900;">&#91;</span>vbase  <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		vbase <span style="color: #339933;">=</span> ix_buf<span style="color: #009900;">&#91;</span>ibase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span>
		poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> pos_buf<span style="color: #009900;">&#91;</span>vbase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> pos_buf<span style="color: #009900;">&#91;</span>vbase  <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// z component of cross product &amp;lt; 0 ?</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> Ax <span style="color: #339933;">=</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">-</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> Ay <span style="color: #339933;">=</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">-</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> Cx <span style="color: #339933;">=</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">-</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> Cy <span style="color: #339933;">=</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">-</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> cull <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>Ax <span style="color: #339933;">*</span> Cy<span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>Ay <span style="color: #339933;">*</span> Cx<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>culling<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		g.<span style="color: #660066;">beginPath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		g.<span style="color: #660066;">strokeStyle</span> <span style="color: #339933;">=</span> cull <span style="color: #339933;">?</span> <span style="color: #3366CC;">&quot;#592&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;#0f0&quot;</span><span style="color: #339933;">;</span>
		g.<span style="color: #660066;">moveTo</span><span style="color: #009900;">&#40;</span>poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		g.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		g.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		g.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		g.<span style="color: #660066;">stroke</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
P3D.<span style="color: #660066;">drawByIndexBuffer</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>pos_buf<span style="color: #339933;">,</span> ix_buf<span style="color: #339933;">,</span> tx_buf<span style="color: #339933;">,</span> culling<span style="color: #339933;">,</span> z_clip<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> w<span style="color: #339933;">,</span> h<span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> color_polygon <span style="color: #339933;">=</span> <span style="color: #339933;">!</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">texture</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">texture</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		w <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">texture</span>.<span style="color: #660066;">width</span><span style="color: #339933;">;</span>
		h <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">texture</span>.<span style="color: #660066;">height</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> g <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">g</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> m <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> M22<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>culling<span style="color: #009900;">&#41;</span> culling <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>ix_buf.<span style="color: #660066;">length</span><span style="color: #339933;">%</span>3<span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span>
		<span style="color: #000066; font-weight: bold;">throw</span> <span style="color: #3366CC;">&quot;invalid index buffer length!&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">,</span> ibase<span style="color: #339933;">,</span> vbase<span style="color: #339933;">,</span> tbase<span style="color: #339933;">,</span> poss <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> len <span style="color: #339933;">=</span> ix_buf.<span style="color: #660066;">length</span><span style="color: #339933;">/</span><span style="color: #CC0000;">3</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> uv_0u<span style="color: #339933;">,</span> uv_0v<span style="color: #339933;">,</span> uv_1u<span style="color: #339933;">,</span> uv_1v<span style="color: #339933;">,</span> uv_2u<span style="color: #339933;">,</span> uv_2v<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> ibase <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>i <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> len<span style="color: #339933;">;++</span>i<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		tbase <span style="color: #339933;">=</span> ix_buf<span style="color: #009900;">&#91;</span>ibase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #CC0000;">1</span>
		vbase <span style="color: #339933;">=</span> tbase <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
		poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> pos_buf<span style="color: #009900;">&#91;</span>vbase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> uv_0u <span style="color: #339933;">=</span> tx_buf<span style="color: #009900;">&#91;</span>tbase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> pos_buf<span style="color: #009900;">&#91;</span>vbase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> uv_0v <span style="color: #339933;">=</span> tx_buf<span style="color: #009900;">&#91;</span>tbase<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>z_clip <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #009900;">&#40;</span>pos_buf<span style="color: #009900;">&#91;</span>vbase<span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #CC0000;">0</span> <span style="color: #339933;">||</span> pos_buf<span style="color: #009900;">&#91;</span>vbase<span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>ibase <span style="color: #339933;">+=</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span> <span style="color: #000066; font-weight: bold;">continue</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
&nbsp;
		tbase <span style="color: #339933;">=</span> ix_buf<span style="color: #009900;">&#91;</span>ibase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #CC0000;">1</span>
		vbase <span style="color: #339933;">=</span> tbase <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
		poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> pos_buf<span style="color: #009900;">&#91;</span>vbase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> uv_1u <span style="color: #339933;">=</span> tx_buf<span style="color: #009900;">&#91;</span>tbase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> pos_buf<span style="color: #009900;">&#91;</span>vbase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> uv_1v <span style="color: #339933;">=</span> tx_buf<span style="color: #009900;">&#91;</span>tbase<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>z_clip <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #009900;">&#40;</span>pos_buf<span style="color: #009900;">&#91;</span>vbase<span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #CC0000;">0</span> <span style="color: #339933;">||</span> pos_buf<span style="color: #009900;">&#91;</span>vbase<span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #339933;">++</span>ibase<span style="color: #339933;">;</span> <span style="color: #000066; font-weight: bold;">continue</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
&nbsp;
		tbase <span style="color: #339933;">=</span> ix_buf<span style="color: #009900;">&#91;</span>ibase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #CC0000;">1</span>
		vbase <span style="color: #339933;">=</span> tbase <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
		poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> pos_buf<span style="color: #009900;">&#91;</span>vbase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> uv_2u <span style="color: #339933;">=</span> tx_buf<span style="color: #009900;">&#91;</span>tbase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> pos_buf<span style="color: #009900;">&#91;</span>vbase<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> uv_2v <span style="color: #339933;">=</span> tx_buf<span style="color: #009900;">&#91;</span>tbase<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>z_clip <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #009900;">&#40;</span>pos_buf<span style="color: #009900;">&#91;</span>vbase<span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #CC0000;">0</span> <span style="color: #339933;">||</span> pos_buf<span style="color: #009900;">&#91;</span>vbase<span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">continue</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> vAd <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">-</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">-</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> vBd <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">-</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">-</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> vCd <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">-</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">-</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// z component of cross product &amp;lt; 0 ?</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>vAd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">*</span> vCd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>vAd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">*</span> vCd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span>culling<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span>
			<span style="color: #000066; font-weight: bold;">continue</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>color_polygon<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			g.<span style="color: #660066;">fillStyle</span> <span style="color: #339933;">=</span> uv_0u<span style="color: #339933;">;</span>
&nbsp;
			g.<span style="color: #660066;">beginPath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			g.<span style="color: #660066;">moveTo</span><span style="color: #009900;">&#40;</span>poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			g.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			g.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			g.<span style="color: #660066;">fill</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">continue</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> vA <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span> uv_1u <span style="color: #339933;">-</span> uv_0u <span style="color: #339933;">,</span> uv_1v <span style="color: #339933;">-</span> uv_0v <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> vB <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span> uv_2u <span style="color: #339933;">-</span> uv_0u <span style="color: #339933;">,</span> uv_2v <span style="color: #339933;">-</span> uv_0v <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		vA<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">*=</span> w<span style="color: #339933;">;</span>
		vA<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">*=</span> h<span style="color: #339933;">;</span>
&nbsp;
		vB<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">*=</span> w<span style="color: #339933;">;</span>
		vB<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">*=</span> h<span style="color: #339933;">;</span>
&nbsp;
		m._11 <span style="color: #339933;">=</span> vA<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		m._12 <span style="color: #339933;">=</span> vA<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		m._21 <span style="color: #339933;">=</span> vB<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		m._22 <span style="color: #339933;">=</span> vB<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> im <span style="color: #339933;">=</span> m.<span style="color: #660066;">getInvert</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>im<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">continue</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> im._11 <span style="color: #339933;">*</span> vAd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> im._12 <span style="color: #339933;">*</span> vBd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> b <span style="color: #339933;">=</span> im._21 <span style="color: #339933;">*</span> vAd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> im._22 <span style="color: #339933;">*</span> vBd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> c <span style="color: #339933;">=</span> im._11 <span style="color: #339933;">*</span> vAd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> im._12 <span style="color: #339933;">*</span> vBd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> d <span style="color: #339933;">=</span> im._21 <span style="color: #339933;">*</span> vAd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> im._22 <span style="color: #339933;">*</span> vBd<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> wu <span style="color: #339933;">=</span> uv_0u <span style="color: #339933;">*</span> w<span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> hv <span style="color: #339933;">=</span> uv_0v <span style="color: #339933;">*</span> h<span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> du <span style="color: #339933;">=</span> wu <span style="color: #339933;">*</span> a <span style="color: #339933;">+</span> hv <span style="color: #339933;">*</span> b<span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> dv <span style="color: #339933;">=</span> wu <span style="color: #339933;">*</span> c <span style="color: #339933;">+</span> hv <span style="color: #339933;">*</span> d<span style="color: #339933;">;</span>
&nbsp;
		g.<span style="color: #660066;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		g.<span style="color: #660066;">beginPath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		g.<span style="color: #660066;">moveTo</span><span style="color: #009900;">&#40;</span>poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		g.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		g.<span style="color: #660066;">lineTo</span><span style="color: #009900;">&#40;</span>poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		g.<span style="color: #660066;">clip</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		g.<span style="color: #660066;">transform</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> c<span style="color: #339933;">,</span> b<span style="color: #339933;">,</span> d<span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">-</span> du<span style="color: #339933;">,</span> poss<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">-</span> dv<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #006600; font-style: italic;">// bounds</span>
		<span style="color: #003366; font-weight: bold;">var</span> bx <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>wu<span style="color: #339933;">,</span> wu<span style="color: #339933;">+</span>vA<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> wu<span style="color: #339933;">+</span>vB<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> by <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>hv<span style="color: #339933;">,</span> hv<span style="color: #339933;">+</span>vA<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> hv<span style="color: #339933;">+</span>vB<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		bx.<span style="color: #660066;">sort</span><span style="color: #009900;">&#40;</span>P3D.<span style="color: #660066;">num_cmp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		by.<span style="color: #660066;">sort</span><span style="color: #009900;">&#40;</span>P3D.<span style="color: #660066;">num_cmp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> bw <span style="color: #339933;">=</span> bx<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">-</span> bx<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> bh <span style="color: #339933;">=</span> by<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">-</span> by<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>bx<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span>bw<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;=</span> <span style="color: #009900;">&#40;</span>w<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> bw<span style="color: #339933;">++;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>by<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span>bh<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;=</span> <span style="color: #009900;">&#40;</span>h<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> bh<span style="color: #339933;">++;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>bx<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;=</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>bx<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">--;</span> bw<span style="color: #339933;">++;</span><span style="color: #009900;">&#125;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>by<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;=</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>by<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">--;</span> bh<span style="color: #339933;">++;</span><span style="color: #009900;">&#125;</span>
&nbsp;
		g.<span style="color: #660066;">drawImage</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">texture</span><span style="color: #339933;">,</span> bx<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> by<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> bw<span style="color: #339933;">,</span> bh<span style="color: #339933;">,</span> bx<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> by<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> bw<span style="color: #339933;">,</span> bh<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">/*
		if (shade_clr) {
			g.fillStyle = shade_clr;
			g.fillRect(bx[0], by[0], bw, bh);
		}
*/</span>
		g.<span style="color: #660066;">restore</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> Vec3<span style="color: #009900;">&#40;</span>_x<span style="color: #339933;">,</span> _y<span style="color: #339933;">,</span> _z<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> _x <span style="color: #339933;">||</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> _y <span style="color: #339933;">||</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">z</span> <span style="color: #339933;">=</span> _z <span style="color: #339933;">||</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
Vec3.<span style="color: #660066;">prototype</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
	zero<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">z</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	sub<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">-=</span> v.<span style="color: #660066;">x</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">-=</span> v.<span style="color: #660066;">y</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">z</span> <span style="color: #339933;">-=</span> v.<span style="color: #660066;">z</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	add<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">+=</span> v.<span style="color: #660066;">x</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">+=</span> v.<span style="color: #660066;">y</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">z</span> <span style="color: #339933;">+=</span> v.<span style="color: #660066;">z</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	copyFrom<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>v<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> v.<span style="color: #660066;">x</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> v.<span style="color: #660066;">y</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">z</span> <span style="color: #339933;">=</span> v.<span style="color: #660066;">z</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	norm<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> Math.<span style="color: #660066;">sqrt</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">x</span><span style="color: #339933;">*</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">y</span><span style="color: #339933;">*</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">z</span><span style="color: #339933;">*</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">z</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	normalize<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> nrm <span style="color: #339933;">=</span> Math.<span style="color: #660066;">sqrt</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">x</span><span style="color: #339933;">*</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">y</span><span style="color: #339933;">*</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">z</span><span style="color: #339933;">*</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">z</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>nrm <span style="color: #339933;">!=</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">/=</span> nrm<span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">/=</span> nrm<span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">z</span> <span style="color: #339933;">/=</span> nrm<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	smul<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>k<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">*=</span> k<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">*=</span> k<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">z</span> <span style="color: #339933;">*=</span> k<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	dpWith<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>v<span style="color: #009900;">&#41;</span>	<span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">x</span><span style="color: #339933;">*</span>v.<span style="color: #660066;">x</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">y</span><span style="color: #339933;">*</span>v.<span style="color: #660066;">y</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">z</span><span style="color: #339933;">*</span>v.<span style="color: #660066;">z</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	cp<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>v<span style="color: #339933;">,</span> w<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>w.<span style="color: #660066;">y</span> <span style="color: #339933;">*</span> v.<span style="color: #660066;">z</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>w.<span style="color: #660066;">z</span> <span style="color: #339933;">*</span> v.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>w.<span style="color: #660066;">z</span> <span style="color: #339933;">*</span> v.<span style="color: #660066;">x</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>w.<span style="color: #660066;">x</span> <span style="color: #339933;">*</span> v.<span style="color: #660066;">z</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">z</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>w.<span style="color: #660066;">x</span> <span style="color: #339933;">*</span> v.<span style="color: #660066;">y</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #009900;">&#40;</span>w.<span style="color: #660066;">y</span> <span style="color: #339933;">*</span> v.<span style="color: #660066;">x</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	toString<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">x</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;, &quot;</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">y</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;,&quot;</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">z</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> M44<span style="color: #009900;">&#40;</span>cpy<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>cpy<span style="color: #009900;">&#41;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">copyFrom</span><span style="color: #009900;">&#40;</span>cpy<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">ident</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
M44.<span style="color: #660066;">prototype</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
	ident<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			  <span style="color: #000066; font-weight: bold;">this</span>._12 <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._13 <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._14 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._21 <span style="color: #339933;">=</span>       <span style="color: #000066; font-weight: bold;">this</span>._23 <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._24 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._31 <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._32 <span style="color: #339933;">=</span>       <span style="color: #000066; font-weight: bold;">this</span>._34 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._41 <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._42 <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._43 <span style="color: #339933;">=</span>       <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._11 <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._22 <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._33 <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._44 <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	copyFrom<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>m<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._11 <span style="color: #339933;">=</span> m._11<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._12 <span style="color: #339933;">=</span> m._12<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._13 <span style="color: #339933;">=</span> m._13<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._14 <span style="color: #339933;">=</span> m._14<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._21 <span style="color: #339933;">=</span> m._21<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._22 <span style="color: #339933;">=</span> m._22<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._23 <span style="color: #339933;">=</span> m._23<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._24 <span style="color: #339933;">=</span> m._24<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._31 <span style="color: #339933;">=</span> m._31<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._32 <span style="color: #339933;">=</span> m._32<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._33 <span style="color: #339933;">=</span> m._33<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._34 <span style="color: #339933;">=</span> m._34<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._41 <span style="color: #339933;">=</span> m._41<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._42 <span style="color: #339933;">=</span> m._42<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._43 <span style="color: #339933;">=</span> m._43<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._44 <span style="color: #339933;">=</span> m._44<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	transVec3<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>out<span style="color: #339933;">,</span> x<span style="color: #339933;">,</span> y<span style="color: #339933;">,</span> z<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		out<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> x <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._11 <span style="color: #339933;">+</span> y <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._21 <span style="color: #339933;">+</span> z <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._31 <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>._41<span style="color: #339933;">;</span>
		out<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> x <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._12 <span style="color: #339933;">+</span> y <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._22 <span style="color: #339933;">+</span> z <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._32 <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>._42<span style="color: #339933;">;</span>
		out<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> x <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._13 <span style="color: #339933;">+</span> y <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._23 <span style="color: #339933;">+</span> z <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._33 <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>._43<span style="color: #339933;">;</span>
		out<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">3</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> x <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._14 <span style="color: #339933;">+</span> y <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._24 <span style="color: #339933;">+</span> z <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._34 <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>._44<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	transVec3Rot<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>out<span style="color: #339933;">,</span> x<span style="color: #339933;">,</span> y<span style="color: #339933;">,</span> z<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		out<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> x <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._11 <span style="color: #339933;">+</span> y <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._21 <span style="color: #339933;">+</span> z <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._31<span style="color: #339933;">;</span>
		out<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> x <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._12 <span style="color: #339933;">+</span> y <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._22 <span style="color: #339933;">+</span> z <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._32<span style="color: #339933;">;</span>
		out<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> x <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._13 <span style="color: #339933;">+</span> y <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._23 <span style="color: #339933;">+</span> z <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._33<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	perspectiveLH<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>vw<span style="color: #339933;">,</span> vh<span style="color: #339933;">,</span> z_near<span style="color: #339933;">,</span> z_far<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._11 <span style="color: #339933;">=</span> <span style="color: #CC0000;">2.0</span><span style="color: #339933;">*</span>z_near<span style="color: #339933;">/</span>vw<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._12 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._13 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._14 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._21 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._22 <span style="color: #339933;">=</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">*</span>z_near<span style="color: #339933;">/</span>vh<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._23 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._24 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._31 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._32 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._33 <span style="color: #339933;">=</span> z_far<span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span>z_far<span style="color: #339933;">-</span>z_near<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._34 <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._41 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._42 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._43 <span style="color: #339933;">=</span> z_near<span style="color: #339933;">*</span>z_far<span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span>z_near<span style="color: #339933;">-</span>z_far<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._44 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	lookAtLH<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>aUp<span style="color: #339933;">,</span> aFrom<span style="color: #339933;">,</span> aAt<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> aX <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Vec3<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> aY <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Vec3<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> aZ <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Vec3<span style="color: #009900;">&#40;</span>aAt.<span style="color: #660066;">x</span><span style="color: #339933;">,</span> aAt.<span style="color: #660066;">y</span><span style="color: #339933;">,</span> aAt.<span style="color: #660066;">z</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		aZ.<span style="color: #660066;">sub</span><span style="color: #009900;">&#40;</span>aFrom<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">normalize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		aX.<span style="color: #660066;">cp</span><span style="color: #009900;">&#40;</span>aUp<span style="color: #339933;">,</span> aZ<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">normalize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		aY.<span style="color: #660066;">cp</span><span style="color: #009900;">&#40;</span>aZ<span style="color: #339933;">,</span> aX<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._11 <span style="color: #339933;">=</span> aX.<span style="color: #660066;">x</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._12 <span style="color: #339933;">=</span> aY.<span style="color: #660066;">x</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._13 <span style="color: #339933;">=</span> aZ.<span style="color: #660066;">x</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._14 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._21 <span style="color: #339933;">=</span> aX.<span style="color: #660066;">y</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._22 <span style="color: #339933;">=</span> aY.<span style="color: #660066;">y</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._23 <span style="color: #339933;">=</span> aZ.<span style="color: #660066;">y</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._24 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._31 <span style="color: #339933;">=</span> aX.<span style="color: #660066;">z</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._32 <span style="color: #339933;">=</span> aY.<span style="color: #660066;">z</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._33 <span style="color: #339933;">=</span> aZ.<span style="color: #660066;">z</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._34 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._41 <span style="color: #339933;">=</span> <span style="color: #339933;">-</span>aFrom.<span style="color: #660066;">dpWith</span><span style="color: #009900;">&#40;</span>aX<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._42 <span style="color: #339933;">=</span> <span style="color: #339933;">-</span>aFrom.<span style="color: #660066;">dpWith</span><span style="color: #009900;">&#40;</span>aY<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._43 <span style="color: #339933;">=</span> <span style="color: #339933;">-</span>aFrom.<span style="color: #660066;">dpWith</span><span style="color: #009900;">&#40;</span>aZ<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._44 <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
&nbsp;
	    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	mul<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>A<span style="color: #339933;">,</span> B<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._11 <span style="color: #339933;">=</span> A._11<span style="color: #339933;">*</span>B._11  <span style="color: #339933;">+</span>  A._12<span style="color: #339933;">*</span>B._21  <span style="color: #339933;">+</span>  A._13<span style="color: #339933;">*</span>B._31  <span style="color: #339933;">+</span>  A._14<span style="color: #339933;">*</span>B._41<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._12 <span style="color: #339933;">=</span> A._11<span style="color: #339933;">*</span>B._12  <span style="color: #339933;">+</span>  A._12<span style="color: #339933;">*</span>B._22  <span style="color: #339933;">+</span>  A._13<span style="color: #339933;">*</span>B._32  <span style="color: #339933;">+</span>  A._14<span style="color: #339933;">*</span>B._42<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._13 <span style="color: #339933;">=</span> A._11<span style="color: #339933;">*</span>B._13  <span style="color: #339933;">+</span>  A._12<span style="color: #339933;">*</span>B._23  <span style="color: #339933;">+</span>  A._13<span style="color: #339933;">*</span>B._33  <span style="color: #339933;">+</span>  A._14<span style="color: #339933;">*</span>B._43<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._14 <span style="color: #339933;">=</span> A._11<span style="color: #339933;">*</span>B._14  <span style="color: #339933;">+</span>  A._12<span style="color: #339933;">*</span>B._24  <span style="color: #339933;">+</span>  A._13<span style="color: #339933;">*</span>B._34  <span style="color: #339933;">+</span>  A._14<span style="color: #339933;">*</span>B._44<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._21 <span style="color: #339933;">=</span> A._21<span style="color: #339933;">*</span>B._11  <span style="color: #339933;">+</span>  A._22<span style="color: #339933;">*</span>B._21  <span style="color: #339933;">+</span>  A._23<span style="color: #339933;">*</span>B._31  <span style="color: #339933;">+</span>  A._24<span style="color: #339933;">*</span>B._41<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._22 <span style="color: #339933;">=</span> A._21<span style="color: #339933;">*</span>B._12  <span style="color: #339933;">+</span>  A._22<span style="color: #339933;">*</span>B._22  <span style="color: #339933;">+</span>  A._23<span style="color: #339933;">*</span>B._32  <span style="color: #339933;">+</span>  A._24<span style="color: #339933;">*</span>B._42<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._23 <span style="color: #339933;">=</span> A._21<span style="color: #339933;">*</span>B._13  <span style="color: #339933;">+</span>  A._22<span style="color: #339933;">*</span>B._23  <span style="color: #339933;">+</span>  A._23<span style="color: #339933;">*</span>B._33  <span style="color: #339933;">+</span>  A._24<span style="color: #339933;">*</span>B._43<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._24 <span style="color: #339933;">=</span> A._21<span style="color: #339933;">*</span>B._14  <span style="color: #339933;">+</span>  A._22<span style="color: #339933;">*</span>B._24  <span style="color: #339933;">+</span>  A._23<span style="color: #339933;">*</span>B._34  <span style="color: #339933;">+</span>  A._24<span style="color: #339933;">*</span>B._44<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._31 <span style="color: #339933;">=</span> A._31<span style="color: #339933;">*</span>B._11  <span style="color: #339933;">+</span>  A._32<span style="color: #339933;">*</span>B._21  <span style="color: #339933;">+</span>  A._33<span style="color: #339933;">*</span>B._31  <span style="color: #339933;">+</span>  A._34<span style="color: #339933;">*</span>B._41<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._32 <span style="color: #339933;">=</span> A._31<span style="color: #339933;">*</span>B._12  <span style="color: #339933;">+</span>  A._32<span style="color: #339933;">*</span>B._22  <span style="color: #339933;">+</span>  A._33<span style="color: #339933;">*</span>B._32  <span style="color: #339933;">+</span>  A._34<span style="color: #339933;">*</span>B._42<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._33 <span style="color: #339933;">=</span> A._31<span style="color: #339933;">*</span>B._13  <span style="color: #339933;">+</span>  A._32<span style="color: #339933;">*</span>B._23  <span style="color: #339933;">+</span>  A._33<span style="color: #339933;">*</span>B._33  <span style="color: #339933;">+</span>  A._34<span style="color: #339933;">*</span>B._43<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._34 <span style="color: #339933;">=</span> A._31<span style="color: #339933;">*</span>B._14  <span style="color: #339933;">+</span>  A._32<span style="color: #339933;">*</span>B._24  <span style="color: #339933;">+</span>  A._33<span style="color: #339933;">*</span>B._34  <span style="color: #339933;">+</span>  A._34<span style="color: #339933;">*</span>B._44<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._41 <span style="color: #339933;">=</span> A._41<span style="color: #339933;">*</span>B._11  <span style="color: #339933;">+</span>  A._42<span style="color: #339933;">*</span>B._21  <span style="color: #339933;">+</span>  A._43<span style="color: #339933;">*</span>B._31  <span style="color: #339933;">+</span>  A._44<span style="color: #339933;">*</span>B._41<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._42 <span style="color: #339933;">=</span> A._41<span style="color: #339933;">*</span>B._12  <span style="color: #339933;">+</span>  A._42<span style="color: #339933;">*</span>B._22  <span style="color: #339933;">+</span>  A._43<span style="color: #339933;">*</span>B._32  <span style="color: #339933;">+</span>  A._44<span style="color: #339933;">*</span>B._42<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._43 <span style="color: #339933;">=</span> A._41<span style="color: #339933;">*</span>B._13  <span style="color: #339933;">+</span>  A._42<span style="color: #339933;">*</span>B._23  <span style="color: #339933;">+</span>  A._43<span style="color: #339933;">*</span>B._33  <span style="color: #339933;">+</span>  A._44<span style="color: #339933;">*</span>B._43<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._44 <span style="color: #339933;">=</span> A._41<span style="color: #339933;">*</span>B._14  <span style="color: #339933;">+</span>  A._42<span style="color: #339933;">*</span>B._24  <span style="color: #339933;">+</span>  A._43<span style="color: #339933;">*</span>B._34  <span style="color: #339933;">+</span>  A._44<span style="color: #339933;">*</span>B._44<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	translate<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>x<span style="color: #339933;">,</span> y<span style="color: #339933;">,</span> z<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._11 <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._12 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._13 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._14 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._21 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._22 <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._23 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._24 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._31 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._32 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._33 <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._34 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._41 <span style="color: #339933;">=</span> x<span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._42 <span style="color: #339933;">=</span> y<span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._43 <span style="color: #339933;">=</span> z<span style="color: #339933;">;</span>  <span style="color: #000066; font-weight: bold;">this</span>._44 <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	transpose33<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> t<span style="color: #339933;">;</span>
&nbsp;
		t <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._12<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._12 <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._21<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._21 <span style="color: #339933;">=</span> t<span style="color: #339933;">;</span>
&nbsp;
		t <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._13<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._13 <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._31<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._31 <span style="color: #339933;">=</span> t<span style="color: #339933;">;</span>
&nbsp;
		t <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._23<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._23 <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._32<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._32 <span style="color: #339933;">=</span> t<span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #006600; font-style: italic;">// OpenGL style rotation</span>
	glRotate<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>angle<span style="color: #339933;">,</span> x<span style="color: #339933;">,</span> y<span style="color: #339933;">,</span> z<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> s <span style="color: #339933;">=</span> Math.<span style="color: #660066;">sin</span><span style="color: #009900;">&#40;</span> angle <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> c <span style="color: #339933;">=</span> Math.<span style="color: #660066;">cos</span><span style="color: #009900;">&#40;</span> angle <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003366; font-weight: bold;">var</span> xx <span style="color: #339933;">=</span> x <span style="color: #339933;">*</span> x<span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> yy <span style="color: #339933;">=</span> y <span style="color: #339933;">*</span> y<span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> zz <span style="color: #339933;">=</span> z <span style="color: #339933;">*</span> z<span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> xy <span style="color: #339933;">=</span> x <span style="color: #339933;">*</span> y<span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> yz <span style="color: #339933;">=</span> y <span style="color: #339933;">*</span> z<span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> zx <span style="color: #339933;">=</span> z <span style="color: #339933;">*</span> x<span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> xs <span style="color: #339933;">=</span> x <span style="color: #339933;">*</span> s<span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> ys <span style="color: #339933;">=</span> y <span style="color: #339933;">*</span> s<span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> zs <span style="color: #339933;">=</span> z <span style="color: #339933;">*</span> s<span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> one_c <span style="color: #339933;">=</span> <span style="color: #CC0000;">1.0</span> <span style="color: #339933;">-</span> c<span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">/*
		this._11 = (one_c * xx) + c;
		this._21 = (one_c * xy) - zs;
		this._31 = (one_c * zx) + ys;
		this._41 = 0;
&nbsp;
		this._12 = (one_c * xy) + zs;
		this._22 = (one_c * yy) + c;
		this._32 = (one_c * yz) - xs;
		this._42 = 0;
&nbsp;
		this._13 = (one_c * zx) - ys;
		this._23 = (one_c * yz) + xs;
		this._33 = (one_c * zz) + c;
		this._43 = 0;
&nbsp;
		this._14 = 0;
		this._24 = 0;
		this._34 = 0;
		this._44 = 1;
*/</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._11 <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>one_c <span style="color: #339933;">*</span> xx<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> c<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._12 <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>one_c <span style="color: #339933;">*</span> xy<span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> zs<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._13 <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>one_c <span style="color: #339933;">*</span> zx<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> ys<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._14 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._21 <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>one_c <span style="color: #339933;">*</span> xy<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> zs<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._22 <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>one_c <span style="color: #339933;">*</span> yy<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> c<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._23 <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>one_c <span style="color: #339933;">*</span> yz<span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> xs<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._24 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._31 <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>one_c <span style="color: #339933;">*</span> zx<span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> ys<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._32 <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>one_c <span style="color: #339933;">*</span> yz<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> xs<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._33 <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>one_c <span style="color: #339933;">*</span> zz<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> c<span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._34 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">this</span>._41 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._42 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._43 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">this</span>._44 <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// matrix 2x2</span>
<span style="color: #003366; font-weight: bold;">function</span> M22<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">this</span>._11 <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">this</span>._12 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">this</span>._21 <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">this</span>._22 <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
M22.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">getInvert</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> out <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> M22<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> det <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._11 <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._22 <span style="color: #339933;">-</span> <span style="color: #000066; font-weight: bold;">this</span>._12 <span style="color: #339933;">*</span> <span style="color: #000066; font-weight: bold;">this</span>._21<span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>det <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">0.0001</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> det <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #CC0000;">0.0001</span><span style="color: #009900;">&#41;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span>
&nbsp;
	out._11 <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._22 <span style="color: #339933;">/</span> det<span style="color: #339933;">;</span>
	out._22 <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>._11 <span style="color: #339933;">/</span> det<span style="color: #339933;">;</span>
&nbsp;
	out._12 <span style="color: #339933;">=</span> <span style="color: #339933;">-</span><span style="color: #000066; font-weight: bold;">this</span>._12 <span style="color: #339933;">/</span> det<span style="color: #339933;">;</span>
	out._21 <span style="color: #339933;">=</span> <span style="color: #339933;">-</span><span style="color: #000066; font-weight: bold;">this</span>._21 <span style="color: #339933;">/</span> det<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">return</span> out<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://drawlogic.com/2009/02/18/mini-javascript-version-of-papervision3d-with-canvas-pseudo-3d-with-2d/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AS3 CASALib Useful Library of Common Functions and Tools for Flash</title>
		<link>http://drawlogic.com/2008/12/04/as3-casalib-useful-library-of-common-functions-and-tools-for-flash/</link>
		<comments>http://drawlogic.com/2008/12/04/as3-casalib-useful-library-of-common-functions-and-tools-for-flash/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 02:42:39 +0000</pubDate>
		<dc:creator>drawk</dc:creator>
				<category><![CDATA[ACTIONSCRIPT]]></category>
		<category><![CDATA[ACTIONSCRIPT3]]></category>
		<category><![CDATA[ARCHITECT]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[CODE]]></category>
		<category><![CDATA[DEVELOPMENT]]></category>
		<category><![CDATA[FLASH]]></category>
		<category><![CDATA[FLEX]]></category>
		<category><![CDATA[GAMEDEV]]></category>
		<category><![CDATA[LIBRARIES]]></category>
		<category><![CDATA[OPEN SOURCE]]></category>
		<category><![CDATA[PROGRAMMING]]></category>
		<category><![CDATA[TECHNOLOGY]]></category>
		<category><![CDATA[TOOLS]]></category>
		<category><![CDATA[casalib]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://drawlogic.com/?p=292</guid>
		<description><![CDATA[When you do lots of any language you build up libraries over time that are time savers that are repetitive and tedious if you do not consoildate into a library.  Taking a look at the CASALib, an as3 library of common functions for flash that was released I have many of the same things in [...]]]></description>
			<content:encoded><![CDATA[<p>When you do lots of any language you build up libraries over time that are time savers that are repetitive and tedious if you do not consoildate into a library.  <a href="http://casalib.org/" target="_blank">Taking a look at the CASALib</a>, an <a href="http://casalib.org/blog/finally-an-as3-version/" target="_blank">as3 library of common functions for flash</a><a href="http://casalib.org/blog/finally-an-as3-version/" target="_blank"> that was released</a> I have many of the same things in my libraries but CASALib <a href="http://as3.casalib.org/docs/org_casalib_time_Inactivity.html" target="_blank">just </a><a href="http://as3.casalib.org/docs/index.html?http://as3.casalib.org/docs/package-org_casalib_load.html" target="_blank">has</a> <a href="http://as3.casalib.org/docs/index.html?http://as3.casalib.org/docs/package-org_casalib_load.html" target="_blank">lots</a> <a href="http://as3.casalib.org/docs/index.html?http://as3.casalib.org/docs/package-org_casalib_load.html" target="_blank">of</a> <a href="http://as3.casalib.org/docs/index.html?http://as3.casalib.org/docs/package-org_casalib_load.html" target="_blank">extras</a> that go a bit deeper than some libraries, is very clean and is <a href="http://as3.casalib.org/docs/index.html?http://as3.casalib.org/docs/package-org_casalib_load.html" target="_blank">organized pretty well</a>.</p>
<p>One cool thing about it is the <a href="http://as3.casalib.org/docs/index.html?http://as3.casalib.org/docs/package-org_casalib_load.html" target="_blank">IDestroyable </a>interface and the <a href="http://as3.casalib.org/docs/index.html?http://as3.casalib.org/docs/package-org_casalib_load.html" target="_blank">CasaMovieClip</a>, <a href="http://as3.casalib.org/docs/index.html?http://as3.casalib.org/docs/package-org_casalib_load.html" target="_blank">CasaSprite</a>, <a href="http://as3.casalib.org/docs/index.html?http://as3.casalib.org/docs/package-org_casalib_load.html" target="_blank">CasaTextField </a>, etcthat all have a destroy() method that cleans up all events, removed instances and even removes it from the parent display object. Gets me thinking why this isn&#8217;t just part of DisplayObject in the first place.</p>
<p>From the <a href="http://casalib.org/blog/finally-an-as3-version/" target="_blank">release</a>:</p>
<blockquote><p>Here are a <em>few</em> of our favorite things in CASA Lib <acronym title="ActionScript 3.0">AS3</acronym>:</p>
<ul>
<li>Standardized external load <acronym title="Application Programming Interface">API</acronym></li>
<li>Easily remove listeners with IRemovableEventDispatcher</li>
<li><code>destroy</code> methods make garbage collection easy</li>
<li>Large group of utility classes for common manipulations</li>
</ul>
<p>We will be elaborating further the power of CASA Lib in future blog posts.</p>
<p>As with any new release there will be bugs that emerge, but with your help we promise to release updates often to keep CASA Lib as stable as possible.</p>
<h3>1.0.0 Downloads &amp; Documentation</h3>
<p>ZIP: <a href="http://as3.casalib.org/releases/1.0.0/1.0.0.zip">http://as3.casalib.org/releases/1.0.0/1.0.0.zip</a><br />
SVN: <a href="http://svn.as3.casalib.org/releases/1.0.0/">http://svn.as3.casalib.org/releases/1.0.0/</a><br />
Documentation: <a href="http://as3.casalib.org/releases/1.0.0/docs/">http://as3.casalib.org/releases/1.0.0/docs/</a></p>
<p>[<a href="http://casalib.org/blog/finally-an-as3-version/" target="_blank">source</a>]</p>
<p><span id="more-292"></span></p></blockquote>
<div class="list">
<div class="listGroup">
<ul>
<li id="org_casalib_util_AlignUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_AlignUtil.html"><span class="className">AlignUtil</span></a>
<ul class="summary">
<li>Provides utility functions aligning DisplayObjects.</li>
</ul>
</li>
<li id="org_casalib_errors_ArguementTypeError"><a href="http://as3.casalib.org/docs/org_casalib_errors_ArguementTypeError.html"><span class="className">ArguementTypeError</span></a></li>
<li id="org_casalib_errors_ArrayContentsError"><a href="http://as3.casalib.org/docs/org_casalib_errors_ArrayContentsError.html"><span class="className">ArrayContentsError</span></a></li>
<li id="org_casalib_util_ArrayUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_ArrayUtil.html"><span class="className">ArrayUtil</span></a>
<ul class="summary">
<li>Utilities for sorting, searching and manipulating Arrays.</li>
</ul>
</li>
<li id="org_casalib_load_AudioLoad"><a href="http://as3.casalib.org/docs/org_casalib_load_AudioLoad.html"><span class="className">AudioLoad</span></a>
<ul class="summary">
<li>Provides an easy and standardized way to load audio files.</li>
</ul>
</li>
<li id="org_casalib_load_BaseLoadItem"><a href="http://as3.casalib.org/docs/org_casalib_load_BaseLoadItem.html"><span class="className">BaseLoadItem</span></a>
<ul class="summary">
<li>Base class used by load classes.</li>
</ul>
</li>
<li id="org_casalib_display_CasaBitmap"><a href="http://as3.casalib.org/docs/org_casalib_display_CasaBitmap.html"><span class="className">CasaBitmap</span></a>
<ul class="summary">
<li>A base Bitmap that implements <a class="className" href="http://as3.casalib.org/docs/org_casalib_events_IRemovableEventDispatcher.html">IRemovableEventDispatcher</a> and <a class="className" href="http://as3.casalib.org/docs/org_casalib_core_IDestroyable.html">IDestroyable</a>.</li>
</ul>
</li>
<li id="org_casalib"><a href="http://as3.casalib.org/docs/org_casalib.html"><span class="className">casalib</span></a>
<ul class="summary">
<li>Creates an easy way to determine what version/release of CASA is being used.</li>
</ul>
</li>
<li id="org_casalib_display_CasaMovieClip"><a href="http://as3.casalib.org/docs/org_casalib_display_CasaMovieClip.html"><span class="className">CasaMovieClip</span></a>
<ul class="summary">
<li>A base MovieClip that implements <a class="className" href="http://as3.casalib.org/docs/org_casalib_events_IRemovableEventDispatcher.html">IRemovableEventDispatcher</a> and <a class="className" href="http://as3.casalib.org/docs/org_casalib_core_IDestroyable.html">IDestroyable</a>.</li>
</ul>
</li>
<li id="org_casalib_display_CasaSprite"><a href="http://as3.casalib.org/docs/org_casalib_display_CasaSprite.html"><span class="className">CasaSprite</span></a>
<ul class="summary">
<li>A base Sprite that implements <a class="className" href="http://as3.casalib.org/docs/org_casalib_events_IRemovableEventDispatcher.html">IRemovableEventDispatcher</a> and <a class="className" href="http://as3.casalib.org/docs/org_casalib_core_IDestroyable.html">IDestroyable</a>.</li>
</ul>
</li>
<li id="org_casalib_display_CasaTextField"><a href="http://as3.casalib.org/docs/org_casalib_display_CasaTextField.html"><span class="className">CasaTextField</span></a>
<ul class="summary">
<li>A base TextField that implements <a class="className" href="http://as3.casalib.org/docs/org_casalib_events_IRemovableEventDispatcher.html">IRemovableEventDispatcher</a> and <a class="className" href="http://as3.casalib.org/docs/org_casalib_core_IDestroyable.html">IDestroyable</a>.</li>
</ul>
</li>
<li id="org_casalib_util_ColorUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_ColorUtil.html"><span class="className">ColorUtil</span></a>
<ul class="summary">
<li>Provides utility functions for dealing with color.</li>
</ul>
</li>
<li id="org_casalib_util_ConversionUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_ConversionUtil.html"><span class="className">ConversionUtil</span></a>
<ul class="summary">
<li>Utilities for converting units.</li>
</ul>
</li>
<li id="org_casalib_load_DataLoad"><a href="http://as3.casalib.org/docs/org_casalib_load_DataLoad.html"><span class="className">DataLoad</span></a>
<ul class="summary">
<li>Provides an easy and standardized way to load data.</li>
</ul>
</li>
<li id="org_casalib_util_DateUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_DateUtil.html"><span class="className">DateUtil</span></a>
<ul class="summary">
<li>Provides utility functions for formatting and manipulating <code>Date</code> objects.</li>
</ul>
</li>
<li id="org_casalib_core_Destroyable"><a href="http://as3.casalib.org/docs/org_casalib_core_Destroyable.html"><span class="className">Destroyable</span></a>
<ul class="summary">
<li>Base class for objects that are destroyable.</li>
</ul>
</li>
<li id="org_casalib_layout_Distribution"><a href="http://as3.casalib.org/docs/org_casalib_layout_Distribution.html"><span class="className">Distribution</span></a>
<ul class="summary">
<li>Creates the mechanism to distribute DisplayObjects to a vertical or horzontal grid of columns and rows.</li>
</ul>
</li>
<li id="org_casalib_util_DrawUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_DrawUtil.html"><span class="className">DrawUtil</span></a>
<ul class="summary">
<li>Utilities for drawing shapes.</li>
</ul>
</li>
<li id="org_casalib_math_geom_Ellipse"><a href="http://as3.casalib.org/docs/org_casalib_math_geom_Ellipse.html"><span class="className">Ellipse</span></a>
<ul class="summary">
<li>Stores position and size of an ellipse (circle or oval).</li>
</ul>
</li>
<li id="org_casalib_time_EnterFrame"><a href="http://as3.casalib.org/docs/org_casalib_time_EnterFrame.html"><span class="className">EnterFrame</span></a>
<ul class="summary">
<li>Creates a centralized <code>enterFrame</code> event.</li>
</ul>
</li>
<li id="org_casalib_util_FlashVarUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_FlashVarUtil.html"><span class="className">FlashVarUtil</span></a>
<ul class="summary">
<li>Utility for providing easy access to HTML embeded FlashVars.</li>
</ul>
</li>
<li id="org_casalib_time_FrameDelay"><a href="http://as3.casalib.org/docs/org_casalib_time_FrameDelay.html"><span class="className">FrameDelay</span></a>
<ul class="summary">
<li>Creates a callback after one or more frames.</li>
</ul>
</li>
<li id="org_casalib_time_FrameTime"><a href="http://as3.casalib.org/docs/org_casalib_time_FrameTime.html"><span class="className">FrameTime</span></a>
<ul class="summary">
<li>Creates a common time which isn&#8217;t affected by delays caused by code execution; the time is only updated every frame.</li>
</ul>
</li>
<li id="org_casalib_time_FrameTimeStopwatch"><a href="http://as3.casalib.org/docs/org_casalib_time_FrameTimeStopwatch.html"><span class="className">FrameTimeStopwatch</span></a>
<ul class="summary">
<li>Functions exactly like <a class="className" href="http://as3.casalib.org/docs/org_casalib_time_Stopwatch.html">Stopwatch</a> but uses <a class="className" href="http://as3.casalib.org/docs/org_casalib_time_FrameTime.html">FrameTime</a> as the timing mechanism.</li>
</ul>
</li>
<li id="org_casalib_util_FrameUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_FrameUtil.html"><span class="className">FrameUtil</span></a>
<ul class="summary">
<li>Utilities for determining label positions and adding and removing frame scripts.</li>
</ul>
</li>
<li id="org_casalib_util_GeomUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_GeomUtil.html"><span class="className">GeomUtil</span></a>
<ul class="summary">
<li>Utilities for positioning, calculating and manipulating geometeric shapes.</li>
</ul>
</li>
<li id="org_casalib_load_GraphicLoad"><a href="http://as3.casalib.org/docs/org_casalib_load_GraphicLoad.html"><span class="className">GraphicLoad</span></a>
<ul class="summary">
<li>Provides an easy and standardized way to load images or SWF files.</li>
</ul>
</li>
<li id="org_casalib_load_GroupLoad"><a href="http://as3.casalib.org/docs/org_casalib_load_GroupLoad.html"><span class="className">GroupLoad</span></a>
<ul class="summary">
<li>Allows multiple loads to be grouped and treated as one larger load.</li>
</ul>
</li>
<li id="org_casalib_core_IDestroyable" class="interface"><a href="http://as3.casalib.org/docs/org_casalib_core_IDestroyable.html"><span class="className">IDestroyable</span> <span class="attribute">public interface</span></a></li>
<li id="org_casalib_collection_IList" class="interface"><a href="http://as3.casalib.org/docs/org_casalib_collection_IList.html"><span class="className">IList</span> <span class="attribute">public interface</span></a>
<ul class="summary">
<li>Interface for list collections.</li>
</ul>
</li>
<li id="org_casalib_time_Inactivity"><a href="http://as3.casalib.org/docs/org_casalib_time_Inactivity.html"><span class="className">Inactivity</span></a>
<ul class="summary">
<li>Detects user inactivity by checking for a void in mouse movement and key presses.</li>
</ul>
</li>
<li id="org_casalib_events_InactivityEvent"><a href="http://as3.casalib.org/docs/org_casalib_events_InactivityEvent.html"><span class="className">InactivityEvent</span></a>
<ul class="summary">
<li>An event dispatched from <a class="className" href="http://as3.casalib.org/docs/org_casalib_time_Inactivity.html">Inactivity</a>.</li>
</ul>
</li>
<li id="org_casalib_time_Interval"><a href="http://as3.casalib.org/docs/org_casalib_time_Interval.html"><span class="className">Interval</span></a>
<ul class="summary">
<li>To be used instead of <code>flash.utils.setInterval</code> and <code>flash.utils.setTimeout</code> functions.</li>
</ul>
</li>
<li id="org_casalib_events_IRemovableEventDispatcher" class="interface"><a href="http://as3.casalib.org/docs/org_casalib_events_IRemovableEventDispatcher.html"><span class="className">IRemovableEventDispatcher</span> <span class="attribute">public interface</span></a></li>
<li id="org_casalib_control_IResumable" class="interface"><a href="http://as3.casalib.org/docs/org_casalib_control_IResumable.html"><span class="className">IResumable</span> <span class="attribute">public interface</span></a></li>
<li id="org_casalib_control_IRunnable" class="interface"><a href="http://as3.casalib.org/docs/org_casalib_control_IRunnable.html"><span class="className">IRunnable</span> <span class="attribute">public interface</span></a></li>
<li id="org_casalib_ui_Key"><a href="http://as3.casalib.org/docs/org_casalib_ui_Key.html"><span class="className">Key</span></a>
<ul class="summary">
<li>Key class that simplifies listening to global key strokes and adds additional keyboard events.</li>
</ul>
</li>
<li id="org_casalib_ui_KeyCombo"><a href="http://as3.casalib.org/docs/org_casalib_ui_KeyCombo.html"><span class="className">KeyCombo</span></a>
<ul class="summary">
<li>Class for storing keyboard key code combinations.</li>
</ul>
</li>
<li id="org_casalib_events_KeyComboEvent"><a href="http://as3.casalib.org/docs/org_casalib_events_KeyComboEvent.html"><span class="className">KeyComboEvent</span></a>
<ul class="summary">
<li>An event dispatched in response to a user <a href="http://as3.casalib.org/docs/org_casalib_events_KeyComboEvent.html#DOWN">holding</a>, <a href="http://as3.casalib.org/docs/org_casalib_events_KeyComboEvent.html#RELEASE">releasing</a> or <a href="http://as3.casalib.org/docs/org_casalib_events_KeyComboEvent.html#SEQUENCE">typing</a> a combination of keys.</li>
</ul>
</li>
<li id="org_casalib_collection_List"><a href="http://as3.casalib.org/docs/org_casalib_collection_List.html"><span class="className">List</span></a>
<ul class="summary">
<li>An ordered or sequence collection that can contain duplicates.</li>
</ul>
</li>
<li id="org_casalib_events_ListenerManager"><a href="http://as3.casalib.org/docs/org_casalib_events_ListenerManager.html"><span class="className">ListenerManager</span></a>
<ul class="summary">
<li>Creates an easy way to implement <a class="className" href="http://as3.casalib.org/docs/org_casalib_events_IRemovableEventDispatcher.html">IRemovableEventDispatcher</a> when you cannot extend directly from <a class="className" href="http://as3.casalib.org/docs/org_casalib_events_RemovableEventDispatcher.html">RemovableEventDispatcher</a>.</li>
</ul>
</li>
<li id="org_casalib_events_LoadEvent"><a href="http://as3.casalib.org/docs/org_casalib_events_LoadEvent.html"><span class="className">LoadEvent</span></a>
<ul class="summary">
<li>An event dispatched during loading.</li>
</ul>
</li>
<li id="org_casalib_load_LoadItem"><a href="http://as3.casalib.org/docs/org_casalib_load_LoadItem.html"><span class="className">LoadItem</span></a>
<ul class="summary">
<li>Base class used by load classes.</li>
</ul>
</li>
<li id="org_casalib_util_LoadUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_LoadUtil.html"><span class="className">LoadUtil</span></a>
<ul class="summary">
<li>Utilities for calculating a load&#8217;s speed and progress.</li>
</ul>
</li>
<li id="org_casalib_util_LocationUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_LocationUtil.html"><span class="className">LocationUtil</span></a>
<ul class="summary">
<li> Utilities for determining the location of the SWF and the type of runtime environment.</li>
</ul>
</li>
<li id="org_casalib_util_NavigateUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_NavigateUtil.html"><span class="className">NavigateUtil</span></a>
<ul class="summary">
<li>Simplifies <code>navigateToURL</code> and <code>window.open</code> requests.</li>
</ul>
</li>
<li id="org_casalib_util_NumberUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_NumberUtil.html"><span class="className">NumberUtil</span></a>
<ul class="summary">
<li>Provides utility functions for manipulating numbers.</li>
</ul>
</li>
<li id="org_casalib_util_ObjectUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_ObjectUtil.html"><span class="className">ObjectUtil</span></a>
<ul class="summary">
<li>Utilities for working with Objects.</li>
</ul>
</li>
<li id="org_casalib_math_Percent"><a href="http://as3.casalib.org/docs/org_casalib_math_Percent.html"><span class="className">Percent</span></a>
<ul class="summary">
<li>Creates a standardized way of describing and storing percentages.</li>
</ul>
</li>
<li id="org_casalib_math_geom_Point3d"><a href="http://as3.casalib.org/docs/org_casalib_math_geom_Point3d.html"><span class="className">Point3d</span></a>
<ul class="summary">
<li>Stores location of a point in a three-dimensional coordinate system, where x represents the horizontal axis, y represents the vertical axis, z represents the axis that is vertically perpendicular to the x/y axis or depth.</li>
</ul>
</li>
<li id="org_casalib_process_Process"><a href="http://as3.casalib.org/docs/org_casalib_process_Process.html"><span class="className">Process</span></a>
<ul class="summary">
<li>Base process class.</li>
</ul>
</li>
<li id="org_casalib_events_ProcessEvent"><a href="http://as3.casalib.org/docs/org_casalib_events_ProcessEvent.html"><span class="className">ProcessEvent</span></a>
<ul class="summary">
<li>An event dispatched during a <a class="className" href="http://as3.casalib.org/docs/org_casalib_process_Process.html">Process</a>.</li>
</ul>
</li>
<li id="org_casalib_process_ProcessGroup"><a href="http://as3.casalib.org/docs/org_casalib_process_ProcessGroup.html"><span class="className">ProcessGroup</span></a>
<ul class="summary">
<li>Manages and threads <a class="className" href="http://as3.casalib.org/docs/org_casalib_process_Process.html">processes</a>.</li>
</ul>
</li>
<li id="org_casalib_util_PropertySetter"><a href="http://as3.casalib.org/docs/org_casalib_util_PropertySetter.html"><span class="className">PropertySetter</span></a>
<ul class="summary">
<li>Creates a setter function for properties.</li>
</ul>
</li>
<li id="org_casalib_transitions_PropertyTween"><a href="http://as3.casalib.org/docs/org_casalib_transitions_PropertyTween.html"><span class="className">PropertyTween</span></a>
<ul class="summary">
<li>A simple property tween class that extends <a class="className" href="http://as3.casalib.org/docs/org_casalib_transitions_Tween.html">Tween</a>.</li>
</ul>
</li>
<li id="org_casalib_util_QueryStringUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_QueryStringUtil.html"><span class="className">QueryStringUtil</span></a>
<ul class="summary">
<li>Utility for providing easy access to the browser query string.</li>
</ul>
</li>
<li id="org_casalib_math_Range"><a href="http://as3.casalib.org/docs/org_casalib_math_Range.html"><span class="className">Range</span></a>
<ul class="summary">
<li>Creates a standardized way of describing and storing an extent of variation/a value range.</li>
</ul>
</li>
<li id="org_casalib_util_RatioUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_RatioUtil.html"><span class="className">RatioUtil</span></a>
<ul class="summary">
<li>Provides utility functions for ratio scaling.</li>
</ul>
</li>
<li id="org_casalib_events_RemovableEventDispatcher"><a href="http://as3.casalib.org/docs/org_casalib_events_RemovableEventDispatcher.html"><span class="className">RemovableEventDispatcher</span></a>
<ul class="summary">
<li>Extends <code>EventDispatcher</code> to allow for simple and quick removal of event listeners.</li>
</ul>
</li>
<li id="org_casalib_events_RetryEvent"><a href="http://as3.casalib.org/docs/org_casalib_events_RetryEvent.html"><span class="className">RetryEvent</span></a>
<ul class="summary">
<li>An event dispatched when a load request is retried after previously failing.</li>
</ul>
</li>
<li id="org_casalib_display_ReversibleMovieClip"><a href="http://as3.casalib.org/docs/org_casalib_display_ReversibleMovieClip.html"><span class="className">ReversibleMovieClip</span></a>
<ul class="summary">
<li>Provides additional timeline controlling functions: <a href="http://as3.casalib.org/docs/org_casalib_display_ReversibleMovieClip.html#reverse">reverse</a> and <a href="http://as3.casalib.org/docs/org_casalib_display_ReversibleMovieClip.html#gotoAndReverse">gotoAndReverse</a>.</li>
</ul>
</li>
<li id="org_casalib_time_Sequence"><a href="http://as3.casalib.org/docs/org_casalib_time_Sequence.html"><span class="className">Sequence</span></a>
<ul class="summary">
<li>Creates a sequence of methods calls that wait for a specified event and/or delay.</li>
</ul>
</li>
<li id="org_casalib_events_SequenceEvent"><a href="http://as3.casalib.org/docs/org_casalib_events_SequenceEvent.html"><span class="className">SequenceEvent</span></a>
<ul class="summary">
<li>An event dispatched from <a class="className" href="http://as3.casalib.org/docs/org_casalib_time_Sequence.html">Sequence</a>.</li>
</ul>
</li>
<li id="org_casalib_util_StageReference"><a href="http://as3.casalib.org/docs/org_casalib_util_StageReference.html"><span class="className">StageReference</span></a>
<ul class="summary">
<li>Stores a reference to Stage for classes that cannot easily access it.</li>
</ul>
</li>
<li id="org_casalib_time_Stopwatch"><a href="http://as3.casalib.org/docs/org_casalib_time_Stopwatch.html"><span class="className">Stopwatch</span></a>
<ul class="summary">
<li>Simple stopwatch class that records elapsed time in milliseconds.</li>
</ul>
</li>
<li id="org_casalib_util_StringUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_StringUtil.html"><span class="className">StringUtil</span></a>
<ul class="summary">
<li>Utilities for manipulating and searching Strings.</li>
</ul>
</li>
<li id="org_casalib_util_TextFieldUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_TextFieldUtil.html"><span class="className">TextFieldUtil</span></a>
<ul class="summary">
<li>Utilities for working with TextFields.</li>
</ul>
</li>
<li id="org_casalib_transitions_Tween"><a href="http://as3.casalib.org/docs/org_casalib_transitions_Tween.html"><span class="className">Tween</span></a>
<ul class="summary">
<li>Simple and easily extendable tween/transition class.</li>
</ul>
</li>
<li id="org_casalib_events_TweenEvent"><a href="http://as3.casalib.org/docs/org_casalib_events_TweenEvent.html"><span class="className">TweenEvent</span></a>
<ul class="summary">
<li>An event dispatched from <a class="className" href="http://as3.casalib.org/docs/org_casalib_transitions_Tween.html">Tween</a>.</li>
</ul>
</li>
<li id="org_casalib_collection_UniqueList"><a href="http://as3.casalib.org/docs/org_casalib_collection_UniqueList.html"><span class="className">UniqueList</span></a>
<ul class="summary">
<li>An ordered or sequence collection that contains no duplicates.</li>
</ul>
</li>
<li id="org_casalib_util_ValidationUtil"><a href="http://as3.casalib.org/docs/org_casalib_util_ValidationUtil.html"><span class="className">ValidationUtil</span></a>
<ul class="summary">
<li>Utilities for validating common string formats.</li>
</ul>
</li>
<li id="org_casalib_events_VideoInfoEvent"><a href="http://as3.casalib.org/docs/org_casalib_events_VideoInfoEvent.html"><span class="className">VideoInfoEvent</span></a>
<ul class="summary">
<li>An event dispatched when meta data, or cue point is received from the <a class="className" href="http://as3.casalib.org/docs/org_casalib_load_VideoLoad.html">VideoLoad</a>.</li>
</ul>
</li>
<li id="org_casalib_load_VideoLoad"><a href="http://as3.casalib.org/docs/org_casalib_load_VideoLoad.html"><span class="className">VideoLoad</span></a>
<ul class="summary">
<li>Provides an easy and standardized way to load video files.</li>
</ul>
</li>
<li id="org_casalib_events_VideoLoadEvent"><a href="http://as3.casalib.org/docs/org_casalib_events_VideoLoadEvent.html"><span class="className">VideoLoadEvent</span></a>
<ul class="summary">
<li>An event dispatched from <a class="className" href="http://as3.casalib.org/docs/org_casalib_load_VideoLoad.html">VideoLoad</a>.</li>
</ul>
</li>
</ul>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://drawlogic.com/2008/12/04/as3-casalib-useful-library-of-common-functions-and-tools-for-flash/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>as3Query &#8211; Actionscript Port of jQuery</title>
		<link>http://drawlogic.com/2008/04/24/as3query-actionscript-port-of-jquery/</link>
		<comments>http://drawlogic.com/2008/04/24/as3query-actionscript-port-of-jquery/#comments</comments>
		<pubDate>Fri, 25 Apr 2008 01:11:56 +0000</pubDate>
		<dc:creator>drawk</dc:creator>
				<category><![CDATA[ACTIONSCRIPT]]></category>
		<category><![CDATA[ACTIONSCRIPT3]]></category>
		<category><![CDATA[ALGORITHM]]></category>
		<category><![CDATA[APPLICATIONS]]></category>
		<category><![CDATA[ARCHITECT]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[BEST OF]]></category>
		<category><![CDATA[CODE]]></category>
		<category><![CDATA[DEVELOPMENT]]></category>
		<category><![CDATA[FLASH]]></category>
		<category><![CDATA[FLEX]]></category>
		<category><![CDATA[FUNCTIONAL]]></category>
		<category><![CDATA[OPEN SOURCE]]></category>
		<category><![CDATA[PROGRAMMING]]></category>
		<category><![CDATA[TECHNOLOGY]]></category>
		<category><![CDATA[cool]]></category>
		<category><![CDATA[generators]]></category>
		<category><![CDATA[iteration]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[lambda]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://drawk.wordpress.com/?p=201</guid>
		<description><![CDATA[This is older, from january, somehow I missed it but&#8230; nitoyon has created an AS3 port of jQuery. jQuery is my favorite javascript tool besides javascript itself. Mootools, prototype, and others like mochikit are all great but jQuery was the first to do lambda chain decorating and others followed suit. But having this power in [...]]]></description>
			<content:encoded><![CDATA[<p>This is older, from january, somehow I missed it but&#8230; <a href="http://tech.nitoyon.com/blog/2008/01/as3query_alpha.html" target="_blank">nitoyon </a>has created an <a href="http://tech.nitoyon.com/blog/2008/01/as3query_alpha.html" target="_blank">AS3 port of jQuery</a>.  <a href="http://jquery.com/" target="_blank">jQuery</a> is my favorite javascript tool besides javascript itself. Mootools, prototype, and others like mochikit are all great but jQuery was the first to do <a href="http://www.learningjquery.com/2006/09/sacrificial-lambda" target="_blank">lambda chain decorating </a>and others followed suit.</p>
<p><strong>But<a href="http://tech.nitoyon.com/blog/2008/01/as3query_alpha.html" target="_blank"> having this power in as3</a> is a great thing! </strong><a href="http://www.libspark.org/svn/as3/as3Query/src/com/nitoyon/as3query/$.as" target="_blank">$ selectors</a>, common access methods to properties, methods, etc.  All good stuff. Again this shows the fun in as3 or ES4 based languages like Actionscript because people are porting all sorts of libraries to it. If this performs I may just start using it daily TODAY!</p>
<p>For instance setting the stage align for use in full screen:</p>

<div class="wp_syntax"><div class="code"><pre class="jscript" style="font-family:monospace;">$(stage).attr({scaleMode: &quot;noScale&quot;, align: &quot;TL&quot;});</pre></div></div>

<p>That is too fun&#8230; The only thing not cool about this is all the spam at <a href="http://tech.nitoyon.com/blog/2008/01/as3query_alpha.html" target="_blank">nitoyon</a>&#8216;s blog : )</p>
<p>How about a functional Tweener call:</p>

<div class="wp_syntax"><div class="code"><pre class="jscript" style="font-family:monospace;">function animate(f:Boolean):void {
				// Select 'RoundRect' elements using CSS selector
				$(&quot;RoundRect:&quot; + (f ? &quot;odd&quot; : &quot;even&quot;))
					.addTween({
						rotation: 90,
						scaleX: 0.5,
						scaleY: 0.5,
						time: 0.6,
						delay: 0.3,
						transition: &quot;easeOutCubic&quot;
					})
					.addTween({
						scaleX: 1,
						scaleY: 1,
						time: 0.5,
						delay: 0.9,
						transition: &quot;easeOutElastic&quot;,
						onComplete: function():void {
							// restore the rotation and call again.
							this.rotation = 0;
							animate(!f);
						}
					});
			}
			animate(false);</pre></div></div>

<p><strong>Stuff to see and try</strong></p>
<ul>
<li>CSS Selector Demo <a href="http://snippets.libspark.org/trac/browser/as3/as3Query/samples/CssSelectorDemo.as">Source code</a> <a href="http://snippets.libspark.org/svn/as3/as3Query/samples/CssSelectorDemo.as">plain text</a></li>
<li>25 boxes and Tweener <a href="http://snippets.libspark.org/trac/browser/as3/as3Query/samples/Box25withTweener.as">Source code</a> <a href="http://snippets.libspark.org/svn/as3/as3Query/samples/Box25withTweener.as">plain text</a></li>
<li>SVN: <a href="http://snippets.libspark.org/svn/as3/as3Query/">http://snippets.libspark.org/svn/as3/as3Query/</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://drawlogic.com/2008/04/24/as3query-actionscript-port-of-jquery/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>TweenMax Bezier Tweening Released for AS2 and AS3 by Jack at GreenSock &#8211; And List of Animation Kits</title>
		<link>http://drawlogic.com/2008/04/06/tweenmax-bezier-tweening-released-for-as2-and-as3-by-jack-at-greensock-and-list-of-animation-kits/</link>
		<comments>http://drawlogic.com/2008/04/06/tweenmax-bezier-tweening-released-for-as2-and-as3-by-jack-at-greensock-and-list-of-animation-kits/#comments</comments>
		<pubDate>Sun, 06 Apr 2008 09:40:45 +0000</pubDate>
		<dc:creator>drawk</dc:creator>
				<category><![CDATA[ACTIONSCRIPT]]></category>
		<category><![CDATA[ACTIONSCRIPT3]]></category>
		<category><![CDATA[ANIMATION]]></category>
		<category><![CDATA[ARCHITECT]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[CODE]]></category>
		<category><![CDATA[FLASH]]></category>
		<category><![CDATA[FLEX]]></category>
		<category><![CDATA[GAMEDEV]]></category>
		<category><![CDATA[INTERFACE]]></category>
		<category><![CDATA[MARKET]]></category>
		<category><![CDATA[MOTION]]></category>
		<category><![CDATA[OPEN SOURCE]]></category>
		<category><![CDATA[PERFORMANCE]]></category>
		<category><![CDATA[PROGRAMMING]]></category>
		<category><![CDATA[RENDERING]]></category>
		<category><![CDATA[TECHNOLOGY]]></category>
		<category><![CDATA[VISUALIZATION]]></category>
		<category><![CDATA[animation kit]]></category>
		<category><![CDATA[AS2]]></category>
		<category><![CDATA[kits]]></category>
		<category><![CDATA[tween]]></category>
		<category><![CDATA[tweening]]></category>
		<category><![CDATA[tweens]]></category>

		<guid isPermaLink="false">http://drawk.wordpress.com/?p=179</guid>
		<description><![CDATA[TweenMax (Speed Test) has been released that adds a main feature missing from GreenSock&#8217;s offerings in tween animation libraries and kits over Tweener. That is the bezier curve tween. Tweener is very popular for use in PV3d and AS3 due to the bezier curve and Zeh&#8217;s great example that is really the base of a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.greensock.com/tweenmaxas3/" target="_blank">TweenMax</a> (<a href="http://blog.greensock.com/bezier-speed-test/" target="_blank">Speed Test</a>) has been released that adds a main feature missing from GreenSock&#8217;s offerings in tween animation libraries and kits over <a href="http://code.google.com/p/tweener/" target="_blank">Tweener</a>.  <strong>That is the bezier curve tween.</strong> Tweener is very popular for use in PV3d and AS3 due to the <a href="http://labs.zeh.com.br/blog/?p=104" target="_blank">bezier curve and  Zeh&#8217;s great example </a>that is really the base of a possible 3d editor. TweenMax now adds this and bezier tween capability for the GreenSock animation libraries.</p>
<p><a href="http://code.google.com/p/tweener/" target="_blank">Tweener </a>and <a href="http://blog.greensock.com/tweenliteas3/" target="_blank">TweenLite </a>have become the micro animation kits as well as micro kits you can make with <a href="http://www.goasap.org/developers.html" target="_blank">Go base kits</a>. TweenLite, <a href="http://blog.greensock.com/tweenfilterliteas3/" target="_blank">TweenFilterLite</a> and TweenMax divided up into different kits allows it to be embedded for banners or small assets easier if you don&#8217;t need the filters or other advanced tweens (this comes into play heavily with large games and asset collections when the compiled SWF each need the library).  Tweener packs all features into one kit for simplicity. GreenSock kits are divided up for need.  The comparison together is about the same but for basic tweens TweenLite is only 2k.</p>
<p><a href="http://blog.greensock.com/bezier-speed-test/" target="_blank">Performance is one area that the kits from GreenSock have really shined</a> and since the addition of the <a href="http://blog.greensock.com/tweening-speed-test/" target="_blank">speed tests and benchmarks</a> it has become a great focus on showing how the open source kits are much better than bloated included animation calls in Flash and Flex defaults. I think all the kits have niches that they fit and Tweener and TweenLite are just very simple to use which adds alot to an animation kit success.</p>
<p><strong>List of Animation Kits for AS3 (some for AS2 as well)</strong></p>
<ul>
<li><a href="http://code.google.com/p/tweener/" target="_blank">Tweener</a></li>
<li>GreenSock
<ul>
<li><a href="http://blog.greensock.com/tweenliteas3/" target="_blank">TweenLite</a></li>
<li><a href="http://blog.greensock.com/tweenfilterliteas3/" target="_blank">TweenFilterLite</a></li>
<li><a href="http://blog.greensock.com/tweenmaxas3/" target="_blank">TweenMax</a> (<a href="http://blog.greensock.com/bezier-speed-test/" target="_blank">Speed Test</a>)</li>
</ul>
</li>
<li><a href="http://www.goasap.org/developers.html" target="_blank">Go Base</a></li>
<li><a href="http://play.visualcondition.com/twease/" target="_blank">Twease</a></li>
<li><a href="http://www.uza.lt/codex/as3-easing/" target="_blank">AS3Easing</a></li>
<li><a href="http://www.alex-uhlmann.de/flash/animationpackage/" target="_blank">Animation Package</a></li>
<li><a href="http://www.boostworthy.com/blog/?p=170" target="_blank">Animation System</a></li>
</ul>
<p>If you are using the Flex of Flash default animation classes, I am sorry&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://drawlogic.com/2008/04/06/tweenmax-bezier-tweening-released-for-as2-and-as3-by-jack-at-greensock-and-list-of-animation-kits/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3 Cryptography and Hashing Libraries for Encryption and Security (crypto)</title>
		<link>http://drawlogic.com/2008/02/18/as3-cryptography-libraries/</link>
		<comments>http://drawlogic.com/2008/02/18/as3-cryptography-libraries/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 08:59:22 +0000</pubDate>
		<dc:creator>drawk</dc:creator>
				<category><![CDATA[ACTIONSCRIPT]]></category>
		<category><![CDATA[ACTIONSCRIPT3]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[ALGORITHM]]></category>
		<category><![CDATA[APPLICATIONS]]></category>
		<category><![CDATA[ARCHITECT]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[BENCHMARK]]></category>
		<category><![CDATA[BEST OF]]></category>
		<category><![CDATA[CODE]]></category>
		<category><![CDATA[CRYPTO]]></category>
		<category><![CDATA[DATA]]></category>
		<category><![CDATA[DEVELOPMENT]]></category>
		<category><![CDATA[FLASH]]></category>
		<category><![CDATA[FLEX]]></category>
		<category><![CDATA[LIBRARIES]]></category>
		<category><![CDATA[OPEN SOURCE]]></category>
		<category><![CDATA[PROGRAMMING]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[SECURITY]]></category>
		<category><![CDATA[TECHNOLOGY]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[cool]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[hashing]]></category>

		<guid isPermaLink="false">http://drawk.wordpress.com/?p=160</guid>
		<description><![CDATA[AS3 libraries for crypto are pretty robust from the new RAW POWER in the AVM2 virtual machine that runs flash9/as3, cryptography, like compression, is very processor intensive and needs a fair amount of power to be worth the time (usually a balancing mechanism). I am working on a few security apps in AIR and Flash9 [...]]]></description>
			<content:encoded><![CDATA[<p>AS3 libraries for crypto are pretty robust from the new RAW POWER in the AVM2 virtual machine that runs flash9/as3, cryptography, like compression, is very processor intensive and needs a fair amount of power to be worth the time (usually a balancing mechanism). I am working on a few security apps in AIR and Flash9 for a project and a product so this is the best of what I have found to share. I will be sure to post here when these projects are complete.</p>
<p>There are two that are pretty good as3 kits that have decent support for crypto and hashing, actually as3crypto is quite broad in their support or most common crypto algorithms, even hashing support up to SHA-256 and ciphers 3DES, AES, RC4.</p>
<p>This is not really a comparison just some kits that have tools you might need.  as3crypto is definitely the way to go for more heavy ecryption with common ciphers, but if you are just hashing some text as3corelib might work for your project. as3corelib is a more broad toolkit that is made or sponsored by Adobe that has JSON, RSS, support and other tools.  It is a great core lib, but not as deep in the encryption area.  I am actually using both in the stuff I am working on, as3corelib for some other uses (JSON,RSS) and as3crypto for all encryption and hashing.</p>
<p><b> The two are:</b></p>
<ul>
<li><a href="http://code.google.com/p/as3corelib/" target="_blank">as3corelib </a>
<ul>
<li>Open source</li>
<li>Support for hashing algorithms only.</li>
<li><a href="http://as3corelib.googlecode.com/svn/trunk/src/com/adobe/" target="_blank">Browse source</a></li>
</ul>
</li>
</ul>
<ul>
<li><a href="http://crypto.hurlant.com/" target="_blank">as3crypto </a>
<ul>
<li>Robust, broad encryption and security support</li>
<li>Open source</li>
<li><a href="http://crypto.hurlant.com/demo/srcview/" target="_blank">Demo</a></li>
<li><a href="http://crypto.hurlant.com/demo/srcview/" target="_blank">Browse source</a></li>
<li> Broad support of algorithms
<ul>
<li>
<div class="level2">
<ul>
<li class="level1">
<div class="li"> TLS 1.0 support, exposed through TLSSocket and TLSEngine classes</div>
</li>
<li class="level1">
<div class="li"> X.509 Certificate support, including parsing, and validation</div>
</li>
<li class="level1">
<div class="li"> built-in list of common root Certificate Authorities</div>
</li>
<li class="level1">
<div class="li"> symmetric ciphers: AES, Blowfish, DES, 3DES, XTEA, RC4</div>
</li>
<li class="level1">
<div class="li"> confidentiality modes: CTR, CBC, CFB, CFB-8, OFB, ECB</div>
</li>
<li class="level1">
<div class="li"> public key crypto: RSA (encryption, decryption, signing, verifying and key generation)</div>
</li>
<li class="level1">
<div class="li"> padding: PKCS#1 (type 1 and 2), PKCS#5</div>
</li>
<li class="level1">
<div class="li"> BigInteger <span class="search_hit">library</span></div>
</li>
<li class="level1">
<div class="li"> hashing function: SHA-256, SHA-224, SHA-1, MD5, MD2</div>
</li>
<li class="level1">
<div class="li"> HMAC support</div>
</li>
<li class="level1">
<div class="li"> prng: TLSPRF and stream-cypher-based PRNG.</div>
</li>
<li class="level1">
<div class="li"> minimal ASN-1/DER support for PEM key parsing and X-509 cert parsing</div>
</li>
<li class="level1">
<div class="li"> Crypto &#8211; Shortcut class to access many classes above.</div>
</li>
<li class="level1">
<div class="li"> Hex, Base64 &#8211; Static methods to convert binary data to and from text formats</div>
</li>
</ul>
</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="level1">
<blockquote><p>  As3 Crypto is a cryptography <span class="search_hit">library</span> written in Actionscript 3 that provides several common algorithms, as well as TLS 1.0 support. The <span class="search_hit">library</span> is offered under the BSD license, and include several derivative works from Java, C and javascript sources.</p></blockquote>
<ul>
<li>
<ul>
<li class="level1">
<div class="li"> <a href="http://crypto.hurlant.com/" class="urlextern" title="http://crypto.hurlant.com/" rel="nofollow">AS3 Crypto <span class="search_hit">Library</span> Page</a></div>
</li>
<li class="level1">
<div class="li"> <a href="http://crypto.hurlant.com/demo/" class="urlextern" title="http://crypto.hurlant.com/demo/" rel="nofollow">Actionscript Cryptography Demo Page </a></div>
</li>
</ul>
</li>
</ul>
</div>
<blockquote><p>Here&#8217;s some numbers from as3Crypto home page that show the speed, note it has not been optimized just yet (since most of this is client side and only one user would be using it this is not an issue &#8211; server side is where this can have scale problems from parallel execution but flash is rarely server side if it is too slow, but it is quite fast)</p>
<pre>The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
md2                  1.01k        3.64k       15.08k       53.89k      171.76k
md5                221.85k      447.32k      739.54k      893.72k      905.82k
sha1                82.28k      184.78k      286.76k      336.03k      345.41k
sha224              60.84k      125.67k      200.27k      234.28k      247.58k
sha256              60.52k      126.30k      199.19k      234.04k      246.01k
hmac-md5            48.37k      159.37k      282.87k      295.15k      341.21k
hmac-sha1           18.29k       64.82k      165.72k      277.60k      342.52k
hmac-sha224          5.75k       24.84k      125.71k      204.35k      256.36k
hmac-sha256         15.10k       49.33k      123.71k      206.17k      249.08k
rc4                117.24k      381.34k      878.93k     1315.01k     1539.44k
xtea-cbc             2.49k        6.48k       12.80k       33.00k       44.48k
aes128-cbc           1.61k        4.01k       22.97k       78.55k      205.01k
aes192-cbc           1.34k        5.13k       20.91k       69.45k      172.43k
aes256-cbc           1.48k        5.63k       18.87k       63.45k      150.39k
blowfish-cbc         2.77k       10.81k       42.28k      140.27k      343.05k
des-cbc              2.53k        9.73k       35.20k      124.84k      624.88k
3des-cbc             2.50k        9.72k       35.61k      115.21k      253.42k</pre>
<p>The library has not been optimized for speed, and those numbers could probably be improved.</p></blockquote>
<p>They both have minimal or none ASN.1 support which I will need but I can port much of this from my favorite Java/C# crypto kit from the <a href="http://www.bouncycastle.org/" target="_blank">legion of the bouncy castle</a> of which I was happy to find was a substantial base for this kit.</p>
<p>Whatever you do don&#8217;t send any type of message from your crypto kits with aes 256 cipher and sha-256 hashing to Iran from the US.  <img src='http://drawlogic.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://drawlogic.com/2008/02/18/as3-cryptography-libraries/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

