<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<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/"
	>

<channel>
	<title>{ P I X E L W E L D E R S } &#187; 3D</title>
	<link>http://pixelwelders.com/blog</link>
	<description>Flash + Flex + Game Dev + Grammar?</description>
	<pubDate>Tue, 04 Nov 2008 14:18:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>FIVe3D Custom Primitive: VectorCube Class</title>
		<link>http://pixelwelders.com/blog/actionscript-3/2008/five3d-custom-primitive-vectorcube-class/</link>
		<comments>http://pixelwelders.com/blog/actionscript-3/2008/five3d-custom-primitive-vectorcube-class/#comments</comments>
		<pubDate>Thu, 17 Jul 2008 22:48:09 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[3D]]></category>

		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Featured]]></category>

		<category><![CDATA[FIVe3D]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/actionscript-3/2008/five3d-custom-primitive-vectorcube-class/</guid>
		<description><![CDATA[After a long Papervision-induced hiatus, I've come back to FIVe3D- mainly because I still think it's a great library.  Since it's still relatively new, however, there's not a lot of example code out there.  Thus, here's another chunk from your friends here at Pixelwelders.]]></description>
			<content:encoded><![CDATA[<p>After a long Papervision-induced hiatus, I&#8217;ve come back to FIVe3D- mainly because I still think it&#8217;s a great library.  Since it&#8217;s still relatively new, however, there&#8217;s not a lot of example code out there.  Thus, here&#8217;s another chunk from your friends here at Pixelwelders.  This class creates a cube out of Sprite3D planes.</p>
<h3>Fig. 1: 27 Cubes</h3>

<object	type="application/x-shockwave-flash"
			data="http://pixelwelders.com/experiments/FIVe3D_cube/RubiksCube.swf"
			width="700"
			height="450">
	<param name="movie" value="http://pixelwelders.com/experiments/FIVe3D_cube/RubiksCube.swf" />
</object>
<h3>Fig.2: The VectorCube Class</h3>

<div class="wp_syntax"><div class="code"><pre class="actionscript"><span style="color: #808080; font-style: italic;">/**
 * A vector Cube class for Mathieu Badimon's excellent FIVe3D library
 * @author Zack Jordan
 * { P I X E L W E L D E R S . C O M }
 */</span>
package com.<span style="color: #006600;">pixelwelders</span>.<span style="color: #006600;">five3d</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> five3D.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite3D</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> VectorCube <span style="color: #0066CC;">extends</span> Sprite3D
	<span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> faces		: <span style="color: #0066CC;">Array</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> VectorCube<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">size</span>:<span style="color: #0066CC;">Number</span>, colors:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">super</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">!</span>colors <span style="color: #66cc66;">&#41;</span> colors = <span style="color: #66cc66;">&#91;</span> 0xFF0000, 0xFF0000, 0xFF0000, 0xFF0000, 0xFF0000, 0xFF0000 <span style="color: #66cc66;">&#93;</span>;
			createCube<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">size</span>, colors <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">/**
		 * Creates a new cube at the size specified
		 * 
		 * @param		size			Size of the cube to be created
		 * @return					The new cube
		 */</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> createCube<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">size</span>:<span style="color: #0066CC;">Number</span>, colors:<span style="color: #0066CC;">Array</span> <span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			faces = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #000000; font-weight: bold;">var</span> xP:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span>	<span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>,	<span style="color: #cc66cc;">0</span>, -<span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> yP:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span>	<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>,	<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>,	-<span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>, <span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> zP:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span>	-<span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>	<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> xR:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span>	<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>,	<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">-90</span>, <span style="color: #cc66cc;">90</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> yR:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span>	<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">-90</span>, <span style="color: #cc66cc;">180</span>, <span style="color: #cc66cc;">90</span>,	<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> zR:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span>	<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>,	<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> <span style="color: #cc66cc;">6</span>; i++ <span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #000000; font-weight: bold;">var</span> face:Sprite3D = <span style="color: #000000; font-weight: bold;">new</span> Sprite3D<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				face.<span style="color: #006600;">graphics3D</span>.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">1</span>, 0x000000, <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span>;
				face.<span style="color: #006600;">graphics3D</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span> colors<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>;
				face.<span style="color: #006600;">graphics3D</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span> -<span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>, -<span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span>, <span style="color: #0066CC;">size</span>, <span style="color: #0066CC;">size</span> <span style="color: #66cc66;">&#41;</span>;
				face.<span style="color: #006600;">graphics3D</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				face.<span style="color: #006600;">singleSided</span> = <span style="color: #000000; font-weight: bold;">true</span>;
&nbsp;
				face.<span style="color: #006600;">x</span> = xP<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span>;
				face.<span style="color: #006600;">y</span> = yP<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span>;
				face.<span style="color: #006600;">z</span> = zP<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span>;
				face.<span style="color: #006600;">rotationX</span> = xR<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span>;
				face.<span style="color: #006600;">rotationY</span> = yR<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span>;
				face.<span style="color: #006600;">rotationZ</span> = zR<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span>;
&nbsp;
				faces<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span> = face;
				addChild<span style="color: #66cc66;">&#40;</span> face <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>So what is this good for?  Really, it&#8217;s just an easy way to create six faces and arrange them into a cube.  You don&#8217;t have to worry about depth sorting or any of that stuff because each of the faces is one-sided.  However, if you are using more than one of these in your presentation, make sure you specify that <code>container.childrenSorted = true</code>, where <code>container</code> is the Sprite3D containing your Cubes.  Otherwise you&#8217;ll get some weird results.</p>
<p>Another note: the <code>faces</code> Array is public so you can continue to draw on each face of the cube, and even add children.  So really, this is just a starting point; I&#8217;ll let you find something useful to do with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/actionscript-3/2008/five3d-custom-primitive-vectorcube-class/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Pokervision3D</title>
		<link>http://pixelwelders.com/blog/game-design/2008/pokervision3d/</link>
		<comments>http://pixelwelders.com/blog/game-design/2008/pokervision3d/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 13:34:51 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[3D]]></category>

		<category><![CDATA[Game Design]]></category>

		<category><![CDATA[Papervision3D]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/game-design/2008/pokervision3d/</guid>
		<description><![CDATA[I just spent the last three weeks a little bit out of the action, wandering Europe in a motorcoach.  On said motorcoach, there were only two things to do: play with my laptop, and play poker with the other passengers.  By the end of the trip, I ended up winning about thirty Euros [...]]]></description>
			<content:encoded><![CDATA[<p>I just spent the last three weeks a little bit out of the action, wandering Europe in a motorcoach.  On said motorcoach, there were only two things to do: play with my laptop, and play poker with the other passengers.  By the end of the trip, I ended up winning about thirty Euros from my playing partners (most of which were 17 and younger).  Obviously, I have no ethical qualms about gambling with minors.  The only thing that disturbed me about this scenario was the fact that 30 Euros is pocket money in France and practically a mortgage payment in the US.  Stupid dollar.</p>
<p>So between games, I started this little project in Papervision.  I&#8217;m not sure how far I&#8217;ll take it, but it might end up being my entry into the <a href="http://blog.papervision3d.org/2008/07/02/paperking3d-the-papervision3d-contest/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://blog.papervision3d.org/2008/07/02/paperking3d-the-papervision3d-contest/');">PaperKing3D</a> contest.  I found some great images of a Victorian-style deck of cards, and painstakingly clone-brushed a full deck out of the few cards I could find.  I then put together the actual game&#8211; which is obviously not finished.  However, it does actually deal out the cards and keep track of players- the next step is to actually make it judge hands (flush vs. full house, etc.).</p>
<p>The best part of this little demo is what happens when you mouse over your cards (the closest hand).  That is Bartek Drozdz&#8217;s <a href="http://www.everydayflash.com/blog/index.php/2008/06/16/bend-modifier-papervision3d-2/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.everydayflash.com/blog/index.php/2008/06/16/bend-modifier-papervision3d-2/');">bend modifier</a> in action.  I think it&#8217;s pretty eye-catching.</p>

<object	type="application/x-shockwave-flash"
			data="http://pixelwelders.com/games/Pokervision3D/Flex/Pokervision_UI.swf"
			width="700"
			height="550">
	<param name="movie" value="http://pixelwelders.com/games/Pokervision3D/Flex/Pokervision_UI.swf" />
</object>
<p><br/><br />
Anyway, that&#8217;s it on Pokervision for today; hopefully I&#8217;ll have the time to finish this (multiplayer 3D poker, anyone?).  In the meantime, I&#8217;ll be working on another, possibly more awesome project that I&#8217;ll be presenting at tomorrow&#8217;s <a href="http://flash.meetup.com/11/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://flash.meetup.com/11/');">Chicago Flash Meetup</a>.  I&#8217;ll post more details here later this week.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/game-design/2008/pokervision3d/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Custom Shapes in FIVe3D: The Arc</title>
		<link>http://pixelwelders.com/blog/actionscript-3/2008/custom-shapes-in-five3d-the-arc/</link>
		<comments>http://pixelwelders.com/blog/actionscript-3/2008/custom-shapes-in-five3d-the-arc/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 05:38:24 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[3D]]></category>

		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[FIVe3D]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/actionscript-3/2008/custom-shapes-in-five3d-the-arc/</guid>
		<description><![CDATA[The beauty of FIVe3D (other than its size, ease of use, and a few other things) is how easily extendable it is.  For a <a href="http://pixelwelders.com/blog/actionscript-3/2008/best-five3d-experiment-yet-seriously-its-awesome/">previous experiment</a>, I needed a way to draw an arc in 3D space.  This isn't something that FIVe3D provides, and in fact it was a little challenging to find the math I needed.  However!  Once I found it, I was able to easily use FIVe3D's drawing API to put it into action.]]></description>
			<content:encoded><![CDATA[<p>The beauty of FIVe3D (other than its size, ease of use, and a few other things) is how easily extendable it is.  For a <a href="http://pixelwelders.com/blog/actionscript-3/2008/best-five3d-experiment-yet-seriously-its-awesome/" >previous experiment</a>, I needed a way to draw an arc in 3D space.  This isn&#8217;t something that FIVe3D provides, and in fact it was a little challenging to find the math I needed.  However!  Once I found it, I was able to easily use FIVe3D&#8217;s drawing API to put it into action.  </p>
<p>The arc code, by the way, is from an ancient AS2 function called drawWedge() by Ric Ewing, which drew pizza-style wedges.  Close enough.  With a little elbow grease I managed to bend it to my will.  Here&#8217;s an example of a bunch of arcs doing their thing:</p>

<object	type="application/x-shockwave-flash"
			data="http://pixelwelders.com/experiments/FIVe3D_Arc/FIVe3D_Arc.swf"
			width="750"
			height="400">
	<param name="movie" value="http://pixelwelders.com/experiments/FIVe3D_Arc/FIVe3D_Arc.swf" />
</object>
<p>And here is the code that draws the arc, which extends FIVe3D&#8217;s Drawing class.  This could probably be cleaned up a bit, since I run through Ric&#8217;s arc code twice to create the thing; it wasn&#8217;t originally that way, but getting the fill on the <em>inside</em> of the arc proved more difficult than I originally thought.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript"><span style="color: #808080; font-style: italic;">/**
 * An extension of Mathieu Badimon's FIVe3D Drawing class.
 * This class draws an additional shape onto a FIVe3D Graphics3D instance.
 * This class includes code from by Ric Ewing.
 * 
 * @author 	Zack Jordan
 * 			{ P I X E L W E L D E R S }
 */</span>
package com.<span style="color: #006600;">pixelwelders</span>.<span style="color: #006600;">five3d</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> five3D.<span style="color: #006600;">display</span>.<span style="color: #006600;">Graphics3D</span>;
	<span style="color: #0066CC;">import</span> five3D.<span style="color: #006600;">utils</span>.<span style="color: #006600;">Drawing</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> PXWDrawing <span style="color: #0066CC;">extends</span> Drawing
	<span style="color: #66cc66;">&#123;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">/**
		 * Draws a wedge shape onto a Graphics3D instance.
		 * 
		 * @param 	graphics		a Graphics3D instance on which to draw
		 * @param 	x				x position of the center of this wedge
		 * @param	y				y position of the center of this wedge
		 * @param	startAngle		the angle of one straight line of this wedge
		 * @param	arc				the angle (in degrees) of the total arc of this wedge
		 * @param	xRadius			the external radius along the x axis
		 * @param	yRadius			the external radius along the y axis
		 * @param	innerXRadius	the internal radius along the x axis
		 * @param	innerYRadius	the internal radius along the y axis
		 * @param	color			the color of the wedge fill
		 * @param	fillAlpha		the alpha value of the wedge fill
		 * 
		 * @return					nothing
		 */</span>
		<span style="color: #0066CC;">static</span> <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> drawWedge<span style="color: #66cc66;">&#40;</span> 
			graphics:Graphics3D, 
			x:<span style="color: #0066CC;">Number</span>, 
			y:<span style="color: #0066CC;">Number</span>, 
			startAngle:<span style="color: #0066CC;">Number</span>, 
			arc:<span style="color: #0066CC;">Number</span>, 
			xRadius:<span style="color: #0066CC;">Number</span>, 
			yRadius:<span style="color: #0066CC;">Number</span>, 
			innerXRadius:<span style="color: #0066CC;">Number</span>, 
			innerYRadius:<span style="color: #0066CC;">Number</span>, 
			<span style="color: #0066CC;">color</span>:uint = 0xFF0000, 
			fillAlpha:<span style="color: #0066CC;">Number</span> = .<span style="color: #cc66cc;">5</span> 
		<span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> segAngle	: <span style="color: #0066CC;">Number</span>
			<span style="color: #000000; font-weight: bold;">var</span> theta		: <span style="color: #0066CC;">Number</span>
			<span style="color: #000000; font-weight: bold;">var</span> angle		: <span style="color: #0066CC;">Number</span>
			<span style="color: #000000; font-weight: bold;">var</span> angleMid	: <span style="color: #0066CC;">Number</span>
			<span style="color: #000000; font-weight: bold;">var</span> segs		: <span style="color: #0066CC;">Number</span>
			<span style="color: #000000; font-weight: bold;">var</span> bx		: <span style="color: #0066CC;">Number</span>
			<span style="color: #000000; font-weight: bold;">var</span> by		: <span style="color: #0066CC;">Number</span>
			<span style="color: #000000; font-weight: bold;">var</span> cx		: <span style="color: #0066CC;">Number</span>
			<span style="color: #000000; font-weight: bold;">var</span> cy		: <span style="color: #0066CC;">Number</span>;
&nbsp;
			segs = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">ceil</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">abs</span><span style="color: #66cc66;">&#40;</span> arc <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">45</span> <span style="color: #66cc66;">&#41;</span>;
			segAngle = arc <span style="color: #66cc66;">/</span> segs;
			theta = -<span style="color: #66cc66;">&#40;</span> segAngle <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span>;
			angle = -<span style="color: #66cc66;">&#40;</span> startAngle <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span>;
&nbsp;
			graphics.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">1</span>, 0x000000, <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span>;
			graphics.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">color</span>, fillAlpha <span style="color: #66cc66;">&#41;</span>;
			graphics.<span style="color: #0066CC;">moveTo</span><span style="color: #66cc66;">&#40;</span> 
				x + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> startAngle <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> innerXRadius,
				y + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span> -startAngle<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> innerYRadius 
			<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">// line 1</span>
			graphics.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span> 
				x + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> startAngle <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> xRadius,
				y + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span> -startAngle <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> yRadius 
			<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">// outer arc</span>
			<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> segs; i++ <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				angle += theta;
				angleMid = angle - <span style="color: #66cc66;">&#40;</span> theta <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span>;
				bx = x + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> angle <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> xRadius;
				by = y + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span> angle <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> yRadius;
				cx = x + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> angleMid <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span> xRadius <span style="color: #66cc66;">/</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> theta <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
				cy = y + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span> angleMid <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span> yRadius <span style="color: #66cc66;">/</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> theta <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
				graphics.<span style="color: #0066CC;">curveTo</span><span style="color: #66cc66;">&#40;</span> cx, cy, bx, by <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #808080; font-style: italic;">// line 2</span>
			graphics.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span> 
				x + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#40;</span> startAngle + arc <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> innerXRadius, 
				y + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span> -<span style="color: #66cc66;">&#40;</span> startAngle + arc <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> innerYRadius 
			<span style="color: #66cc66;">&#41;</span>;
&nbsp;
			theta = -<span style="color: #66cc66;">&#40;</span> segAngle <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span>;
			angle = -<span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#40;</span> startAngle + arc <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">180</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span>;
&nbsp;
			<span style="color: #808080; font-style: italic;">// inner arc</span>
			<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> j:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; j <span style="color: #66cc66;">&lt;</span> segs; j++ <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				angle -= theta;
				angleMid = angle + <span style="color: #66cc66;">&#40;</span> theta <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span>;
				bx = x + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> angle <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> innerXRadius;
				by = y + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span> angle <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> innerYRadius;
				cx = x + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> angleMid <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span> innerXRadius <span style="color: #66cc66;">/</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> theta <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
				cy = y + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span> angleMid <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span> innerYRadius <span style="color: #66cc66;">/</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> theta <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
				graphics.<span style="color: #0066CC;">curveTo</span><span style="color: #66cc66;">&#40;</span> cx, cy, bx, by <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>			
			graphics.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;			
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>		
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Another note on this experiment: the SWF is 16k.  Holy crap.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/actionscript-3/2008/custom-shapes-in-five3d-the-arc/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Son of Papervision! (VectorVision vs. FIVe3D)</title>
		<link>http://pixelwelders.com/blog/actionscript-3/2008/son-of-papervision-vectorvision-vs-five3d/</link>
		<comments>http://pixelwelders.com/blog/actionscript-3/2008/son-of-papervision-vectorvision-vs-five3d/#comments</comments>
		<pubDate>Sun, 01 Jun 2008 00:05:02 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[3D]]></category>

		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Actionscript]]></category>

		<category><![CDATA[FIVe3D]]></category>

		<category><![CDATA[Papervision3D]]></category>

		<category><![CDATA[VectorVision]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/actionscript-3/2008/son-of-papervision-vectorvision-vs-five3d/</guid>
		<description><![CDATA[The first thing that people do when they see FIVe3D is compare it to Papervision.  In my opinion, this is a pretty useless exercise... except that now it's not, thanks to some folks from Amsterdam...]]></description>
			<content:encoded><![CDATA[<p><strong>ASIDE:</strong> So, the original theme of this article was a head to head between PV3D/VectorVision and FIVe3D, but then I realized that an offspring metaphor was really more apt, as explained below.  Nonetheless, the following picture is too awesome not to use.</p>
<div class="captioned_image" style="float:none">
<img src="http://pixelwelders.com/blog/wp-content/themes/tma/images/latest/kingkong_470x175.jpg" alt="Papervision vs. FIVe3D" /></p>
<p>An awesome picture.</p>
</div>
<p>If you&#8217;ve been following this site for any amount of time, you&#8217;ve probably noticed that I&#8217;ve been spending quite a bit of time with Mathieu Badimon&#8217;s excellent <a href="http://five3d.mathieu-badimon.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://five3d.mathieu-badimon.com/');">FIVe3D</a> engine.  Probably too much time, in fact.  I&#8217;ve talked about the features in other posts, so I won&#8217;t go into it here.  If this is the first you&#8217;ve heard of it, go take a look at Mathieu&#8217;s examples, or click &#8216;FIVe3D&#8217; in the tag cloud to the right to see what it is and some of the things it&#8217;s capable of.</p>
<p>It seems that the first thing people do when they see this engine is compare it with Papervision3D.  I&#8217;ve resisted this for a long time; in my opinion, bitmap-based and vector-based 3D engines seem to be pretty close to the proverbial apples and oranges.  However!  As of sometime last week, Papervision and FIVe3D have been combined into some sort of (proverbial?) fruit punch, which means that inter-species comparisons make a lot more sense.  It&#8217;s called VectorVision, and the men responsible for this unholy union are <a href="http://blog.barcinski-jeanjean.com/2008/05/16/vectorsvision-vectors-in-papervision3d/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://blog.barcinski-jeanjean.com/2008/05/16/vectorsvision-vectors-in-papervision3d/');">Barcinski &#038; Jean-Jean</a>, two mad scientists from Amsterdam.</p>
<p>Based on my earlier experiments, I&#8217;ve been kicking around the idea of a 3D tag cloud for this blog.  FIVe3D, of course, seemed like the obvious man for the job due to its simplicity and the fact that Papervision hasn&#8217;t had anything in the way of quality text rendering.  However, the experiments of the aforementioned Dutchmen made me wonder how Papervision would handle the task.  So, I created a similar application using each library.  You can see the results below; each image is a separate SWF- just click one to activate it.</p>
<table>
<tr>
<th>FIVe3D</th>
<th>Papervision3D</th>
</tr>
<tr>
<td>
<span id="five3d"/>
<object	type="application/x-shockwave-flash"
			data="http://pixelwelders.com/experiments/FIVe2D_vs_PV3D/FIVe3D_vs_Papervision3D.swf"
			width="350"
			height="400">
	<param name="movie" value="http://pixelwelders.com/experiments/FIVe2D_vs_PV3D/FIVe3D_vs_Papervision3D.swf" />
</object>
		</td>
<td>
<span id="pv3d"/>
<object	type="application/x-shockwave-flash"
			data="http://pixelwelders.com/experiments/FIVe2D_vs_PV3D/FIVe3D_vs_Papervision3D_2.swf"
			width="350"
			height="400">
	<param name="movie" value="http://pixelwelders.com/experiments/FIVe2D_vs_PV3D/FIVe3D_vs_Papervision3D_2.swf" />
</object>
		</td>
</tr>
<tr>
<td>SWF size: 32k</td>
<td>SWF size: 60k</td>
</tr>
</table>
<h3>Findings</h3>
<p>As you can see, there are some differences; and of course, this is as basic as either engine gets.  But in terms of pure capability, it looks like the offspring of PV3D and FIVe3D is indeed greater than either.  Post your machine/browser and frame rates; I&#8217;d like to see what everyone else is getting.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/actionscript-3/2008/son-of-papervision-vectorvision-vs-five3d/feed/</wfw:commentRss>
		</item>
		<item>
		<title>FIVe3D Cheat Sheet: The Display Classes</title>
		<link>http://pixelwelders.com/blog/actionscript-3/2008/five3d-cheat-sheet-the-display-classes/</link>
		<comments>http://pixelwelders.com/blog/actionscript-3/2008/five3d-cheat-sheet-the-display-classes/#comments</comments>
		<pubDate>Tue, 27 May 2008 14:31:44 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[3D]]></category>

		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Actionscript]]></category>

		<category><![CDATA[cheat sheet]]></category>

		<category><![CDATA[FIVe3D]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/actionscript-3/2008/five3d-cheat-sheet-the-display-classes/</guid>
		<description><![CDATA[Here's a quick summary and comparison of the FIVe3D display classes.  Hopefully this will help tide a few people over until Mathieu releases the real documentation (which will certainly be much more exhaustive than my little effort).]]></description>
			<content:encoded><![CDATA[<p>As should be obvious, I&#8217;ve been pretty fascinated with <a href="http://mathieu-badimon.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://mathieu-badimon.com');">Mathieu Badimon</a>&#8217;s elegant little 3D vector engine <a href="http://five3d.mathieu-badimon.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://five3d.mathieu-badimon.com');">FIVe3D</a> for some time now:</p>
<p><a href="http://pixelwelders.com/blog/3d/2008/experiments-in-the-third-dimension-five3d/" >Experiments in the Third Dimension: FIVe3D</a><br />
<a href="http://pixelwelders.com/blog/actionscript-3/2008/five3d-and-tweenlite-text-cloud/" >FIVe3D and TweenLite: Text Cloud</a><br />
<a href="http://pixelwelders.com/blog/actionscript-3/2008/best-five3d-experiment-yet-seriously-its-awesome/" >Best FIVe3D Experiment Yet</a><br />
<a href="http://pixelwelders.com/blog/actionscript-3/2008/five3d-textcloud-as3-tutorial-and-source/" >FIVe3D TextCloud: AS3 Tutorial and Source</a></p>
<p>And as I&#8217;ve mentioned, FIVe3D is in my opinion the easiest Flash 3D engine to pick up and play with.  In my tutorial above (link #4), I am able to get a little demo running in just a few lines of ActionScript.  However, my tutorial only covers the DynamicText3D class (and to a lesser extent, the Sprite3D class).  Thus, as a companion work, I&#8217;ve put up a quick summary and comparison of the FIVe3D display classes below.  Hopefully this will help tide a few people over until Mathieu releases the real documentation (which will certainly be much more exhaustive than my little effort).</p>
<h3>Display Classes</h3>
<table>
<tr>
<th>
			Class
		</th>
<th>
			Extends
		</th>
<th>
			Description and Notes
		</th>
<th>
			Dispatches MouseEvents?
		</th>
</tr>
<tr>
<td>
			Scene3D
		</td>
<td>
			Sprite
		</td>
<td>
			This is the base display class for the FIVe3D display list.  It corresponds to the Stage in the normal Flash display list.  Put simply, if it ain&#8217;t on here, it ain&#8217;t getting rendered.
		</td>
<td>
			Yes
		</td>
</tr>
<tr>
<td>
			Graphics3D
		</td>
<td>
			N/A
		</td>
<td>
			This is the FIVe3D equivalent to the AS3 Graphics class.  All FIVe3D display objects (with the exception of Scene3D and Sprite2D) have one, with the instance name of <code>graphics3D</code>.  It has many of the same methods as the normal Graphics class, and you can also send an instance to the <code>Drawing</code> class if you want to draw additional shapes.  Take a look at the example that comes with FIVe3D to see this in action.
		</td>
<td>
			N/A
		</td>
</tr>
<tr>
<td>
			Shape3D
		</td>
<td>
			Shape
		</td>
<td>
			This is as basic (and as lightweight) as FIVe3D gets.  Sprite3D and Shape3D share the same relationship as Sprite and Shape in AS3:  both have a Graphics3D instance for drawing, but Shape3D is non-interactive and cannot have children.
		</td>
<td>
			No
		</td>
</tr>
<tr>
<td>
			Sprite3D
		</td>
<td>
			Sprite
		</td>
<td>
			Just like a Sprite, but in three dimensions.  Unlike Shape3D, this class can have children, each of which adopts its parents&#8217; positions and rotations.  It is also interactive.
		</td>
<td>
			Yes
		</td>
</tr>
<tr>
<td>
			Sprite2D
		</td>
<td>
			Sprite
		</td>
<td>
			Sprite2Ds may be placed in three dimensions (that is, they have x, y, and z coordinates), but they can only rotate around the z axis.  In other words, they&#8217;re just like normal Sprites with a &#8220;z&#8221; coordinate.  Also, Sprite2Ds do not have a <code>graphics3D</code> object- just the plain old <code>graphics</code>.  This means that you can&#8217;t use the methods in the <code>Drawing</code> class with this (unless you tweak the Drawing class).
		</td>
<td>
			Yes
		</td>
</tr>
<tr>
<td>
			DynamicText3D
		</td>
<td>
			Sprite3D
		</td>
<td>
			This is a Sprite3D that displays font glyphs.  Think of it as a 3D TextField.  You can set the size, color, font (&#8221;typography&#8221;), and letter spacing.  Fonts are kept in the <code>typography</code> package.
		</td>
<td>
			Yes
		</td>
</tr>
<tr>
<td>
			Bitmap3D
		</td>
<td>
			Shape
		</td>
<td>
			This is analogous to a Shape3D that displays Bitmaps instead of vector graphics.  Take a look at the <a href="http://five3d.mathieu-badimon.com/gallery/earth/", target="_blank" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://five3d.mathieu-badimon.com/gallery/earth/');">Earth Cube</a> source for an example of this in action.</p>
</td>
<td>
			No
		</td>
</tr>
<tr>
<td>
			Video3D
		</td>
<td>
			Bitmap3D
		</td>
<td>
			Video3D is a dynamic Bitmap3D, and a shell for a Video object.  Just like a Video instance, you can use <code>attachNetStream()</code> or <code>attachCamera()</code> to set the video source.
		</td>
<td>
			No
		</td>
</tr>
</table>
<p>So let me know if this is useful to you- or if not, what would make it useful (more examples?  benchmarks?).  Hopefully it will at least give a little clarity to those who are curious about this engine.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/actionscript-3/2008/five3d-cheat-sheet-the-display-classes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>FIVe3D TextCloud: AS3 Tutorial and Source</title>
		<link>http://pixelwelders.com/blog/actionscript-3/2008/five3d-textcloud-as3-tutorial-and-source/</link>
		<comments>http://pixelwelders.com/blog/actionscript-3/2008/five3d-textcloud-as3-tutorial-and-source/#comments</comments>
		<pubDate>Fri, 23 May 2008 09:25:00 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[3D]]></category>

		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Actionscript]]></category>

		<category><![CDATA[FIVe3D]]></category>

		<category><![CDATA[source]]></category>

		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/actionscript-3/2008/five3d-textcloud-as3-tutorial-and-source/</guid>
		<description><![CDATA[A few people have asked me to release the code to my <a href="http://pixelwelders.com/blog/actionscript-3/2008/five3d-and-tweenlite-text-cloud/">FIVe3D Text Cloud example</a>, so I've cleaned things up to the point where I wouldn't be completely humiliated to release it into the wild.  However, I thought I'd touch on a couple points and turn this post into something halfway between a tutorial and an exhibition.

If you just want the source code, you can download it at the bottom of the page.  If you'd like the whole shebang, pray read on.]]></description>
			<content:encoded><![CDATA[<p>A few people have asked me to release the code to my <a href="http://pixelwelders.com/blog/actionscript-3/2008/five3d-and-tweenlite-text-cloud/" >FIVe3D Text Cloud example</a>, so I&#8217;ve cleaned things up to the point where I wouldn&#8217;t be completely humiliated to release it into the wild.  However, I thought I&#8217;d touch on a couple points and turn this post into something halfway between a tutorial and an exhibition.</p>
<p>If you just want the source code, you can download it at the bottom of the page.  If you&#8217;d like the whole shebang, pray read on.</p>
<h3>The (new and improved) example:</h3>

<object	type="application/x-shockwave-flash"
			data="http://pixelwelders.com/experiments/FIVe3D_tutorial/FIVe3D_experiment2.swf"
			width="750"
			height="400">
	<param name="movie" value="http://pixelwelders.com/experiments/FIVe3D_tutorial/FIVe3D_experiment2.swf" />
</object>
<h3>FIVe3D Basics</h3>
<p>FIVe3D is ridiculously easy to set up.  In this example, I used the following code to set up everything I needed:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript"><span style="color: #808080; font-style: italic;">// the Scene3D class is what contains and renders everything else</span>
<span style="color: #808080; font-style: italic;">// think of it as a 3D Stage class</span>
scene = <span style="color: #000000; font-weight: bold;">new</span> Scene3D<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
scene.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;">375</span>;
scene.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;">200</span>;
addChild<span style="color: #66cc66;">&#40;</span> scene <span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// Sprite3D is, obviously, a 3D version of the standard Sprite class</span>
<span style="color: #808080; font-style: italic;">// it is an actual DisplayObject, so you can use normal positioning, filters, etc. on it</span>
container = <span style="color: #000000; font-weight: bold;">new</span> Sprite3D<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
scene.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span> container <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>You&#8217;ll notice that the syntax is just like AS3 extended into the third dimension.  You can nest Sprite3Ds just like Sprites.  When you move or rotate the parent Sprite3D, the children will move and rotate with it.  The reason I&#8217;ve created a <code>container</code> Sprite3D here is so I can rotate several children at the same time.</p>
<p>Now if I wanted to do this the easy way, I could just add my text in one big chunk with the DynamicText3D class that ships with FIVe3D.  It works much like the AS3 TextField class, except that the fonts are actually ActionScript files (you&#8217;ll see what I mean when you crack open the FIVe3D source).</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript"><span style="color: #000000; font-weight: bold;">var</span> txt:DynamicText3D = <span style="color: #000000; font-weight: bold;">new</span> DynamicText3D<span style="color: #66cc66;">&#40;</span> HelveticaBold <span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// HelveticaBold ships with FIVe3D</span>
txt.<span style="color: #0066CC;">size</span> = <span style="color: #cc66cc;">30</span>;
txt.<span style="color: #0066CC;">color</span> = 0xD34328;
txt.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;Pixelwelders LLC&quot;</span>
container.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span> txt <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>That&#8217;s it.  The Scene3D class takes care of its own rendering, so you don&#8217;t have to trigger it yourself, Papervision-style.  Even when a FIVe3D scene looks static, it is actually rendering at your current frame rate.  Thus, this is enough code to render 3D text in FIVe3D.  Add an <code>ENTER_FRAME</code> listener and increment the <code>container.rotationX</code> property every frame and you&#8217;ll see what I mean.</p>
<h3>Moving On&#8230;</h3>
<p>Now this is fine for your everyday run-of-the-mill 3D text, but not for the effect that I had in mind.  If I had added my text this way, it would have behaved as a single block, each letter forever doomed to stay wedged firmly between its neighbors.  No, I had bigger plans for this text.</p>
<p>For this effect, I created a class called MotifCollection3D.  Not a very good name, but typography is not my strong suite and I wasn&#8217;t quite sure what else to call it.  It&#8217;s an extension of the aforementioned FIVe3D Sprite3D class, and it contains one DynamicText3D instance for every letter of the word that it&#8217;s currently displaying.  This is how you instantiate it:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript"><span style="color: #000000; font-weight: bold;">var</span> cloud:MotifCollection3D = <span style="color: #000000; font-weight: bold;">new</span> MotifCollection3D<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;PIXELWELDERS LLC&quot;</span>, HelveticaBold, <span style="color: #cc66cc;">30</span>, 0xD34328 <span style="color: #66cc66;">&#41;</span>;
container.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span> cloud <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>There&#8217;s nothing to it.  You send the text, the font class (again, included with FIVe3D), the size, and the color.  It creates and assembles all the DynamicText3D instances, and then you can treat it like any other Sprite3D.  However, it also includes two methods: <code>assemble()</code>, and the thrillingly-named <code>explode()</code>.</p>
<p>Calling either of these methods cycles through all the instances of DynamicText3D and tweens them each to a destination using TweenLite.  The <code>explode()</code> method was easy: it just chooses a random destination and rotation for each letter.  The <code>assemble()</code> function, on the other hand, was a bit trickier; it needs to know the exact width of every letter in order to place them next to each other.</p>
<p>Happily, that is one of the things that&#8217;s included with the FIVe3D typography classes.  Each letter, number, and punctuation mark in HelveticaBold contains a <code>__width</code> property, accessible like so:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript"><span style="color: #000000; font-weight: bold;">var</span> letterWidth:<span style="color: #0066CC;">Number</span> = HelveticaBold.__widths<span style="color: #66cc66;">&#91;</span> <span style="color: #ff0000;">&quot;P&quot;</span> <span style="color: #66cc66;">&#93;</span>; <span style="color: #808080; font-style: italic;">// returns the width of the &quot;P&quot; glyph</span></pre></div></div>

<p>That&#8217;s a start, but it returns the same width regardless of what size the font is being displayed at.  After a little experimentation, I found that this code gives the correct glyph width no matter what size the font:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript"><span style="color: #000000; font-weight: bold;">var</span> letterWidth:<span style="color: #0066CC;">Number</span> = HelveticaBold.__widths<span style="color: #66cc66;">&#91;</span> <span style="color: #ff0000;">&quot;P&quot;</span> <span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">size</span> <span style="color: #66cc66;">/</span> <span style="color: #cc66cc;">100</span> <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>I think that pretty much covers anything novel that I may have done.  There are additional comments in the code as well, and it&#8217;s only two classes anyway: it shouldn&#8217;t be too difficult to figure out anything not explicitly laid out here.</p>
<h3>Download Source</h3>
<p><a href="http://pixelwelders.com/experiments/FIVe3D_tutorial/Pixelwelders_text_cloud.zip" onclick="javascript:pageTracker._trackPageview('/downloads/experiments/FIVe3D_tutorial/Pixelwelders_text_cloud.zip');">Pixelwelders FIVe3D Text Cloud</a></p>
<p><strong>NOTE:</strong> You&#8217;ll need to download <a href="http://blog.greensock.com/tweenliteas3/" target="_blank" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://blog.greensock.com/tweenliteas3/');">TweenLite</a> and <a href="http://five3d.mathieu-badimon.com/" target="_blank" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://five3d.mathieu-badimon.com/');">FIVe3D</a> from their respective sites to get this to run.  But you probably already knew that.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/actionscript-3/2008/five3d-textcloud-as3-tutorial-and-source/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Best FIVe3D Experiment Yet- Seriously, It&#8217;s Awesome</title>
		<link>http://pixelwelders.com/blog/actionscript-3/2008/best-five3d-experiment-yet-seriously-its-awesome/</link>
		<comments>http://pixelwelders.com/blog/actionscript-3/2008/best-five3d-experiment-yet-seriously-its-awesome/#comments</comments>
		<pubDate>Tue, 13 May 2008 03:08:35 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[3D]]></category>

		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Actionscript]]></category>

		<category><![CDATA[FIVe3D]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/actionscript-3/2008/best-five3d-experiment-yet-seriously-its-awesome/</guid>
		<description><![CDATA[I'm pretty proud of this one...]]></description>
			<content:encoded><![CDATA[
<object	type="application/x-shockwave-flash"
			data="http://pixelwelders.com/experiments/FIVe3D_1920/FIVe3D_ArcExperiment.swf"
			width="750"
			height="375">
	<param name="movie" value="http://pixelwelders.com/experiments/FIVe3D_1920/FIVe3D_ArcExperiment.swf" />
</object>
<p>The FIVe3D examples are starting to fly hot and heavy through the blogosphere, so here&#8217;s another contribution.  This will probably be the theme of my new portfolio, but I was so impressed with the result that I had to post it.  This will be perfect with a bit of scratchy 1920&#8217;s horn music.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/actionscript-3/2008/best-five3d-experiment-yet-seriously-its-awesome/feed/</wfw:commentRss>
		</item>
		<item>
		<title>FIVe3D and TweenLite: Text Cloud</title>
		<link>http://pixelwelders.com/blog/actionscript-3/2008/five3d-and-tweenlite-text-cloud/</link>
		<comments>http://pixelwelders.com/blog/actionscript-3/2008/five3d-and-tweenlite-text-cloud/#comments</comments>
		<pubDate>Mon, 28 Apr 2008 18:26:36 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[3D]]></category>

		<category><![CDATA[ActionScript 3.0]]></category>

		<category><![CDATA[Actionscript]]></category>

		<category><![CDATA[FIVe3D]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/actionscript-3/2008/five3d-and-tweenlite-text-cloud/</guid>
		<description><![CDATA[I can't seem to get enough of this FIVe3D thing.  It's even becoming natural to capitalize every letter except for that "e" when I write it.  Not that I'm blinded to its faults, for there are a few here and there.  But for quick 3D text rendering, I have yet to find its equal.  Take today's experiment, for example.]]></description>
			<content:encoded><![CDATA[<p>UPDATE: I have another FIVe3D example/experiment (3D graphing) <a href="http://pixelwelders.com/blog/3d/2008/experiments-in-the-third-dimension-five3d/" >here.</a>  And, if you&#8217;re just cruising the web for FIVe3D examples, I have yet another one <a href="http://pixelwelders.com/blog/actionscript-3/2008/best-five3d-experiment-yet-seriously-its-awesome/" >here</a>.</p>
<p>I can&#8217;t seem to get enough of this FIVe3D thing.  It&#8217;s even becoming natural to capitalize every letter except for that &#8220;e&#8221; when I write it.  Not that I&#8217;m blinded to its faults, for there are a few here and there.  But for quick 3D text rendering, I have yet to find its equal.</p>
<p>Take today&#8217;s experiment, for example.  It was originally a <a href="http://twitter.com/ZackJordan" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://twitter.com/ZackJordan');">Twitter</a> viewer, but I haven&#8217;t figured out how to get it working online yet, so I&#8217;ve given it some generic text to render.  It uses <a href="http://blog.greensock.com/tweenliteas3/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://blog.greensock.com/tweenliteas3/');">TweenLite</a> for movement, and <a href="http://five3d.mathieu-badimon.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://five3d.mathieu-badimon.com/');">FIVe3D</a> for rendering.  Try clicking around and moving the mouse.<br />

<object	type="application/x-shockwave-flash"
			data="http://pixelwelders.com/experiments/FIVe3D2/FIVe3D_experiment2.swf"
			width="750"
			height="400">
	<param name="movie" value="http://pixelwelders.com/experiments/FIVe3D2/FIVe3D_experiment2.swf" />
</object>
<p>The part of this project that would have been challenging in PV3D or Sandy is the spacing of the letters.  It was a great relief to find that FIVe3D is already intimately aware of each letter&#8217;s size, since it is rendering them as shapes.  Thus, I didn&#8217;t have to painstakingly experiment to find the proper spacing.</p>
<p>Once I actually think up a clever tagline, I might just turn this into my site header.  This could also be a pretty slick little tag cloud for site content, but I think it might get annoying if this was the only way to find a category.  Ah well.  A man can dream.</p>
<p><strong>UPDATE</strong><br />
I did indeed turn this into my header.  We&#8217;ll see how many people play with it.</p>
<p><strong>UPDATE #2</STRONG><br />
And&#8230; I took it back out.  Seems that something was weird with IE and Kimili Flash Embed.  Or&#8230; it could have been user error.</p>
<p><strong>UPDATE #3</strong>And&#8230; source code is live!  With a tutorial/walkthrough, even!  Get it here:<br />
<a href="http://pixelwelders.com/blog/actionscript-3/2008/five3d-textcloud-as3-tutorial-and-source/" >FIVe3D TextCloud: AS3 Tutorial and Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/actionscript-3/2008/five3d-and-tweenlite-text-cloud/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Experiments in the Third Dimension: FIVe3D</title>
		<link>http://pixelwelders.com/blog/3d/2008/experiments-in-the-third-dimension-five3d/</link>
		<comments>http://pixelwelders.com/blog/3d/2008/experiments-in-the-third-dimension-five3d/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 01:41:38 +0000</pubDate>
		<dc:creator>Zack Jordan</dc:creator>
		
		<category><![CDATA[3D]]></category>

		<category><![CDATA[FIVe3D]]></category>

		<category><![CDATA[graph]]></category>

		<category><![CDATA[vector]]></category>

		<guid isPermaLink="false">http://pixelwelders.com/blog/miscellanea/2008/experiments-in-the-third-dimension-five3d/</guid>
		<description><![CDATA[After some diligent research, I have compiled a list of things that impress me about Mathieu Badimon.  He lives in Paris.  He speaks at least two languages (that is, I assume he speaks French as well as English.)  He has had at least one <a href="http://lab.mathieu-badimon.com">website</a> on <a href="http://thefwa.com">The Flash Website Awards.  He apparently seems to understand exactly what the Flash community needs in a 3D engine.]]></description>
			<content:encoded><![CDATA[<p>UPDATE: For a more interesting and less useful FIVe3D example, see my other post <a href="http://pixelwelders.com/blog/actionscript-3/2008/five3d-and-tweenlite-text-cloud/" >here</a>.  And for yet another example that runs surprisingly well considering the sheer number of filters it uses, see <a href="http://pixelwelders.com/blog/actionscript-3/2008/best-five3d-experiment-yet-seriously-its-awesome/" >here</a>.</p>
<p>After some diligent research, I have compiled a list of things that impress me about Mathieu Badimon.</p>
<ul>
<li>He lives in Paris</li>
<li>He speaks at least two languages (that is, I assume he speaks French as well as English.)</li>
<li>He has had at least one <a href="http://lab.mathieu-badimon.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://lab.mathieu-badimon.com');">website</a> on <a href="http://thefwa.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://thefwa.com');">The Flash Website Awards</a></li>
<li>He apparently seems to understand exactly what the Flash community needs in a 3D engine</li>
</ul>
<p>This last one in particular has gotten me excited today, because today I learned that he has released said 3D engine into the wild.  Apparently he did this some time ago, but I only found out in the last few hours- and I, suffice it to say, am thrilled.</p>
<p>Here&#8217;s why I&#8217;m excited about this engine.  Everybody in the community knows about Papervision3D, Away3D, or Sandy.  There&#8217;s nothing new there.  But all the development in those arenas seems to be in the direction of textured polygons, an area which holds limited appeal to me because of the limited power of the Flash Player.  In general, I&#8217;ve found that nice smooth 3D vector effects that I want, I&#8217;ve had to bend Papervision to my will.  Or, in some cases (such as text), I&#8217;ve never gotten a result I&#8217;m happy with.</p>
<p>So that&#8217;s why I&#8217;m thrilled about FIVe3D, which focuses on 3D <em>vectors</em>.  Nice smooth lines, better text (although still not perfect), and no weird clipping issues that I&#8217;ve run into yet.  It still seems to be pretty basic, and hopefully M. Badimon plans on continuing development, but what I see right now is pretty impressive.  Here&#8217;s what I cooked up in about an hour.  It&#8217;s a little rough, so forgive me- this is my first time with the engine. Reload the page to see the animation.</p>

<object	type="application/x-shockwave-flash"
			data="http://pixelwelders.com/experiments/FIVe3D/FIVe3D_experiment.swf"
			width="500"
			height="400">
	<param name="movie" value="http://pixelwelders.com/experiments/FIVe3D/FIVe3D_experiment.swf" />
</object>
<p>The subject matter is a little boring, but I think it will leave a certain potential client muchly impressed.  Here&#8217;s the direct link, if you&#8217;d like to impress your own clients: <a href="http://five3d.mathieu-badimon.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://five3d.mathieu-badimon.com/');">FIVe3D</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://pixelwelders.com/blog/3d/2008/experiments-in-the-third-dimension-five3d/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
