<?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>DrPunchBlog &#187; ND3D</title>
	<atom:link href="http://yo.drpunchman.com/tag/nd3d/feed/" rel="self" type="application/rss+xml" />
	<link>http://yo.drpunchman.com</link>
	<description>Living the feaver dream.</description>
	<lastBuildDate>Thu, 02 Feb 2012 02:19:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>ND3D make your own Primitives</title>
		<link>http://yo.drpunchman.com/2010/03/03/nd3d-make-your-own-primitives/</link>
		<comments>http://yo.drpunchman.com/2010/03/03/nd3d-make-your-own-primitives/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 04:27:32 +0000</pubDate>
		<dc:creator>DrPunchman</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[hella rad]]></category>
		<category><![CDATA[ND3D]]></category>
		<category><![CDATA[poly]]></category>
		<category><![CDATA[primitives]]></category>

		<guid isPermaLink="false">http://yo.drpunchman.com/?p=874</guid>
		<description><![CDATA[OK, ND3D just became awesomer. I&#8217;m now making my own 3D primitives for everything. This is because primitives are MUCH smaller in K weight, and therefore more versatile. Admittedly, I will eventually break it down to a &#8220;primitive.as&#8221; class of it&#8217;s own and just force feed it random shapes, but tonight I WIN, and that&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>OK, ND3D just became awesomer. I&#8217;m now making my own 3D primitives for everything. This is because primitives are MUCH smaller in K weight, and therefore more versatile. Admittedly, I will eventually break it down to a &#8220;primitive.as&#8221; class of it&#8217;s own and just force feed it random shapes, but tonight I WIN, and that&#8217;s all I care about.</p>
<p>Here is an example of my &#8220;Dollar.as&#8221; class making a high and low ploy version of a &#8220;$&#8221;. Thanks to [ <a title="Harry Porudominsky" href="http://supamonke.com/" target="_blank">SupaMonke</a> ] for the models.</p>
<p>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_0" width="400" height="400" align="center">
      <param name="movie" value="http://yo.drpunchman.com/wp-content/uploads/2010/03/nd3d_test_01.swf" />
      <param name="align" value="center" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://yo.drpunchman.com/wp-content/uploads/2010/03/nd3d_test_01.swf" width="400" height="400" align="center">
      <!--<![endif]-->
        
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
<br />
<strong>This animation is 24k. </strong><br />
<em>(suck it papervision)</em><br />
The raw ASE file for the low poly is 64k&#8230;<br />
the primitive file is 72k, but is absorbed in the swf when compiled!</p>
<p><span id="more-874"></span><br />
(this needs cleanup, and I&#8217;ll do that for the official class):</p>
<p>Here is how I&#8217;m calling it: </p>
<pre class="brush: as3; title: ; notranslate">

// dollar sign LowPoly
 var mat:Material = new Material(0x0000ff, 1, true, true, true);
 var buck:Dollar = new Dollar(50, mat);
 // admittedly I still have no idea what the angles are... they seem to be between 0-3 or something stupid.
 buck.angleX = 1.8;
 buck.angleZ = 1.8;
 buck.xPos = -100;

 renderList.push(buck);

 // dollar sign HighPoly
 var mat:Material = new Material(0x009900, 1, true, true, true);
 var buck2:Dollar = new Dollar(50, mat, true);
 buck2.container = new Sprite(); // if you want to add a filter add it to the sprite.

 buck2.angleX = 1.55;
 buck2.angleZ = 1.55;
 buck2.xPos = 100;

 renderList.push(buck2);
</pre>
<p>The Dollar Class:</p>
<pre class="brush: as3; title: ; notranslate">
package de.nulldesign.nd3d.objects
{
	import de.nulldesign.nd3d.geom.UV;
	import de.nulldesign.nd3d.geom.Vertex;
	import de.nulldesign.nd3d.material.Material;	

	public class Dollar extends Mesh
	{

		private var Vert:Array;

		public function Dollar(size:Number, mat:Material, highPoly:Boolean = false )
		{

			if(!highPoly)
			{
			// low polygon version
			Vert = [[0 ,-0.4572 ,-1.2321 ,0.0423],[515 ,0.4572 ,-0.2583 ,-0.5363]];
// seriously I am NOT putting all 516 vertexes on my blog.
/*
   basically the array is: [ vertex count, X, Y, Z ]
   I stripped the data from an ASE file.
   ASE files are like girlfriends: hard to find a good one and when you do they are expensive.
*/
			} else {
			// high polygon version
			Vert = [[0,-1.1176,-1.7897,-0.9848],[1883,-1.1874,-1.1504,-2.1646]];
// if you want models, you can give some money to SupeMonke and he might do 'em for you.
			}

			var row:Array = [];
			var i:uint;
			var x:Number;
			var y:Number;
			var z:Number;

			for(i = 0;i &lt; Vert.length; i++)
			{

				x = size * Vert[i][1];
				y = size * Vert[i][2];
				z = size * Vert[i][3];

				v = new Vertex(x, y, z);
				row.push(v);

				if( row.length &gt; 2 )
				{

					addFace(row[0], row[1], row[2], mat);
					row = [];
				}

			}

		}

	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://yo.drpunchman.com/2010/03/03/nd3d-make-your-own-primitives/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

