<?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>Raphael Wichmann</title>
	<atom:link href="http://www.rwichmann.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rwichmann.com</link>
	<description>ActionScript and other computer related stuff.</description>
	<lastBuildDate>Tue, 29 Jan 2013 13:51:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<item>
		<title>IntelliDrink released</title>
		<link>http://www.rwichmann.com/2011/08/26/intellidrink-released/</link>
		<comments>http://www.rwichmann.com/2011/08/26/intellidrink-released/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 11:18:17 +0000</pubDate>
		<dc:creator>Raphael</dc:creator>
				<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://www.rwichmann.com/?p=302</guid>
		<description><![CDATA[My new iPhone app IntelliDrink just hit the Apple AppStore. It is a blood-alcohol content (BAC) calculator which gives you a nice overview about your current BAC and how your BAC is going to rise or drop. Actually there are many apps like that in the store but nevertheless I think IntelliDrink is somehow special. [...]]]></description>
			<content:encoded><![CDATA[<p>My new iPhone app IntelliDrink just hit the Apple AppStore. It is a blood-alcohol content (BAC) calculator which gives you a nice overview about your current BAC and how your BAC is going to rise or drop. Actually there are many apps like that in the store but nevertheless I think IntelliDrink is somehow special.</p>
<p>The main difference is that my goal was not to create a fun app. I wanted to create a serious app which gives you good results. I put a lot of effort into the calculation algorithm which core based on the the scientifically accepted Widmark formula. This formula considers many human characteristics but it does not consider how long you are drinking a drink, how your hungry feeling was when you had the drink and it does not consider how fast your absorption and resorption of alcohol is. Most apps assume that you downed the drink when you entered it. And even worse they assume that you completely digested it which certainly has nothing to do with how it really works.</p>
<p>The algorithm of IntelliDrink takes all of these factors into consideration. It is a complex algorithm which result is visualized on a nice graph. So you can see how your BAC value is rising over time, when your peak is reached and when you are going to be sober again. You can scroll and zoom in the graph too.</p>
<p>Another nice thing is that you can change the drinks you had or even change your profile settings afterwards. The graph is recalculated every time. So removing drinks, changing their sizes or moment of drinking is possible at anytime.</p>
<p>The second difference to other apps is the quality. I wanted to release a really good looking and very usable app. So I put plenty of time in polishing the user interface making it easy to understand and and giving it a valuable feel.</p>
<p>Just have a look for yourself: <a href="http://www.intellidrink.com" title="IntelliDrink" target="_blank">www.intellidrink.com</a><br />
If you like the app, please vote for it!</p>
<p>Cheers,<br />
Raphael <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><a href="http://www.intellidrink.com" target="_blank"><img id="contentimage" src="/wp-content/uploads/2011/08/intellidrink-post1.jpg" alt="IntelliDrink" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rwichmann.com/2011/08/26/intellidrink-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>iKicker &#8211; a simple football game</title>
		<link>http://www.rwichmann.com/2010/06/23/ikicker-a-simple-football-game/</link>
		<comments>http://www.rwichmann.com/2010/06/23/ikicker-a-simple-football-game/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 13:08:42 +0000</pubDate>
		<dc:creator>Raphael</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.rwichmann.com/?p=279</guid>
		<description><![CDATA[I finally developed my first own iPhone app which is now in the App Store. It is a free and simple football game. The game is about about keeping a ball in the air. The more often you hit the ball the harder it gets and the more visual effects motivate you to keep trying. [...]]]></description>
			<content:encoded><![CDATA[<p>I finally developed my first own iPhone app which is now in the App Store. It is a free and simple football game.</p>
<p>The game is about about keeping a ball in the air. The more often you hit the ball the harder it gets and the more visual effects motivate you to keep trying. The audience is also getting louder. If you reach 25 hits the first firework is launching.</p>
<p>The limit is 400 hits. At this score the sensitive area the ball reacts to is not existent anymore. Plus the gravity and the horizontal deflection is increasing. My goal was to have an easy entry for people who are no pro gamers. So the game is very easy if you begin. But it is getting harder an harder. So pro gamers score are not that far away from the beginners which might motivates the beginners trying to get better.</p>
<p>Another nice feature is the feedback you get if you beat your own high score. The app compares your score with the last 1000 submits of other players and tells you which position you reached. The good thing with this approach is that you always have a relative comparison of your score. Even if 100.000 people are playing every day. With a real leaderboard your ranking would decrease with the number of people playing.</p>
<p>After 5 days in the App Store there are now 4500 entries in the database. After one year there are over 600.000 entries in the database.</p>
<p><a href="http://itunes.apple.com/us/app/ikicker-simple-football-game/id376866755?mt=8&#038;uo=4" target="_blank">Download</a> the game and check it out!<br />
If you like the game I would appreciate it very much if you write a short review. Thanks.</p>
<p>Cheers,<br />
Raphael <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><a href="http://itunes.apple.com/us/app/ikicker-simple-football-game/id376866755?mt=8&#038;uo=4" target="_blank"><img id="contentimage" src="/wp-content/uploads/2010/06/ikicker_blog_screenshot.jpg" alt="iKicker Screenshots" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rwichmann.com/2010/06/23/ikicker-a-simple-football-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone controlled RGB LED via Arduino and DMX</title>
		<link>http://www.rwichmann.com/2009/08/26/iphone-controlled-rgb-led-via-arduino-and-dmx/</link>
		<comments>http://www.rwichmann.com/2009/08/26/iphone-controlled-rgb-led-via-arduino-and-dmx/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 18:17:19 +0000</pubDate>
		<dc:creator>Raphael</dc:creator>
				<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[DMX]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[LED]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Processing]]></category>

		<guid isPermaLink="false">http://www.rwichmann.com/?p=256</guid>
		<description><![CDATA[Yes, the title of this post might sound a bit weird but this is actually what I was working on the last days. I actually planned to dive into this physical computing thing. I guess I told some people about it. Because when I turned 30 there were two unexpected but great gifts. A microcontrolled [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, the title of this post might sound a bit weird but this is actually what I was working on the last days.</p>
<p>I actually planned to dive into this physical computing thing. I guess I told some people about it. Because when I turned 30 there were two unexpected but great gifts. A microcontrolled robot which I soldered in one weekend with more than 150(!) solderings. And a new Arduino board! Thanks to the guys from <a href="http://www.bigsource.de">BigSource</a> for the board! <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I wanted to create something that is useful. There are thousands of physical computing examples that do nothing more than switching an LED on or off. I guess there is so much potential in the whole subject. And I&#8217;m sure that we will see more and more computer controlled physical objects that are connected to the internet in our every day life.</p>
<p>The cool thing about it is that you break the common workflow of having Keyboard or Mouse inputs and outputs on the screen. Now you can have inputs from thousand of sensors! I bought a motion sensor which detects a finger flip in 10 meter distance. I&#8217;m not sure what to do with it yet, but this is so cool! The output can be as different as well. You can control servos or lights or switch your outlets, whatever you want. Plus you can connect the whole thing to the internet. You can imagine how many possibilities you have if you know a bit about programming.</p>
<p>My goal was to create something for the everyday life. Something that is useful for me.<br />
Actually I needed some decoration for my naked white walls in my living room. I was looking for pictures and art over five years and nothing could compete with my beautiful white walls. Now I can keep them white but very colorful. I created an iPhone controlled RGB LED light. This nothing new I guess, but it&#8217;s perfect for my living room.</p>
<p>I got the Arduino Board and began programming, soldered a DMX Shield (thanks to <a href="http://iad.projects.zhdk.ch/physicalcomputing/hardware/arduino/dmx-shield-fur-arduino/">Raphael Perret</a> for the etched board), bought a <a href="http://asynclabs.com/store?product_id=17&amp;page=shop.product_details&amp;category_id=6&amp;flypage=flypage.tpl&amp;vmcchk=1">WiFi-Shield</a> and a DMX controller, a RGB LED light and some cables.</p>
<p>Programming in Processing and Objective-C can be very exhausting. There are so many datatypes I never heard of. Something like uint8_t for example which is just a byte. The problem is more about knowing them and knowing when to use which one. Plus the whole pointer stuff really made me want to go back to the warm ActionScript 3 nest where everything made sense and seemed so easy.</p>
<p>Finally it worked. I managed to connect my iPhone with a socket connection via WiFi to my Arduino board. The Arduino board receives the bytes I sent from the iPhone app, converts them, adds some springing for smoother color changes and puts them in a DMX conform protocol. These data are sent to the DMX controller which controlled the lights. Sounds easy, right? It was not. But it was worth the effort! <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Ok, have a look for yourself!</p>
<p>This is a video where you can see the parts I have used and how they are assembled.<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_videoplayer_50362834"
			class="flashmovie"
			width="455"
			height="256">
	<param name="movie" value="/swf/videoplayer.swf" />
	<param name="flashvars" value="path=../video/ledparts.flv&#038&amp;normalWidth=455&#038&amp;normalHeight=256&#038&amp;maxWidth=1024&#038&amp;maxHeight=576" />
	<param name="allowfullscreen" value="true" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/swf/videoplayer.swf"
			name="fm_videoplayer_50362834"
			width="455"
			height="256">
		<param name="flashvars" value="path=../video/ledparts.flv&#038&amp;normalWidth=455&#038&amp;normalHeight=256&#038&amp;maxWidth=1024&#038&amp;maxHeight=576" />
		<param name="allowfullscreen" value="true" />
	<!--<![endif]-->
		<br />
<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>This is the light in action! <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_videoplayer_2077346029"
			class="flashmovie"
			width="455"
			height="256">
	<param name="movie" value="/swf/videoplayer.swf" />
	<param name="flashvars" value="path=../video/ledaction.flv&#038&amp;normalWidth=455&#038&amp;normalHeight=256&#038&amp;maxWidth=1024&#038&amp;maxHeight=576" />
	<param name="allowfullscreen" value="true" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/swf/videoplayer.swf"
			name="fm_videoplayer_2077346029"
			width="455"
			height="256">
		<param name="flashvars" value="path=../video/ledaction.flv&#038&amp;normalWidth=455&#038&amp;normalHeight=256&#038&amp;maxWidth=1024&#038&amp;maxHeight=576" />
		<param name="allowfullscreen" value="true" />
	<!--<![endif]-->
		<br />
<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://www.rwichmann.com/2009/08/26/iphone-controlled-rgb-led-via-arduino-and-dmx/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>Creating Custom 3D DisplayObjects in Papervision &#8211; Part 3</title>
		<link>http://www.rwichmann.com/2009/05/27/creating-custom-3d-displayobjects-in-papervision-part-3/</link>
		<comments>http://www.rwichmann.com/2009/05/27/creating-custom-3d-displayobjects-in-papervision-part-3/#comments</comments>
		<pubDate>Wed, 27 May 2009 19:30:39 +0000</pubDate>
		<dc:creator>Raphael</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[displayobject3d]]></category>
		<category><![CDATA[mesh]]></category>
		<category><![CDATA[papervision]]></category>

		<guid isPermaLink="false">http://www.rwichmann.com/?p=217</guid>
		<description><![CDATA[Ok, now it&#8217;s getting really interesting! In the last posts you learned how to set up your own custom Papervision object and how to display textures on it. Now we are going to animate our object. The idea behind is pretty simple. You add an Event.ENTER_FRAME handler to your object and in every frame you [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, now it&#8217;s getting really interesting! In the last posts you learned how to set up your own custom Papervision object and how to display textures on it.</p>
<p>Now we are going to animate our object. The idea behind is pretty simple. You add an Event.ENTER_FRAME handler to your object and in every frame you add new vertices to your object, draw new triangles and if there are already enough triangles you remove the one you don&#8217;t need anymore.</p>
<p>In detail it will work like this: In every frame we create 2 new vertices and draw 2 new triangles with it. But to draw 2 triangels we need a minimum of 4 vertices. So we take the the last ones we added the frame before.<br />
In every frame we take slightly different coordinates so that or vertices are moving.<br />
Theres only one situation that is special. It is when we start our Event.ENTER_FRAME handler we don&#8217;t have 4 vertices. So we just add 2 vertices and wait for the next frame. And this is the code:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> AnimatedMesh <span style="color: #000000;">&#40;</span>meshMaterial <span style="color: #000066; font-weight: bold;">:</span> MaterialObject3D<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">stage</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Stage</span><span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span> meshMaterial<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; _stage = <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; _count = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; _width = <span style="color: #000000; font-weight:bold;">50</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; _stage<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ENTER_FRAME</span><span style="color: #000066; font-weight: bold;">,</span> onEnterFrame <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span><br />
<br />
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onEnterFrame <span style="color: #000000;">&#40;</span>event <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> vertices <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = geometry<span style="color: #000066; font-weight: bold;">.</span>vertices<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> faces <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = geometry<span style="color: #000066; font-weight: bold;">.</span>faces<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> v1 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D<span style="color: #000066; font-weight: bold;">,</span> v2 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D<span style="color: #000066; font-weight: bold;">,</span> v3 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D<span style="color: #000066; font-weight: bold;">,</span> v4 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> z<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = _count <span style="color: #000066; font-weight: bold;">*</span> _width<span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>vertices<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> == <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; v1 = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> z <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; v2 = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> _width<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> z <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; vertices<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> v1<span style="color: #000066; font-weight: bold;">,</span> v2 <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">else</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; v1 = vertices<span style="color: #000000;">&#91;</span>vertices<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; v2 = vertices<span style="color: #000000;">&#91;</span>vertices<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; v3 = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> z <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; v4 = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> _width<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> z <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; vertices<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> v3<span style="color: #000066; font-weight: bold;">,</span> v4 <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangle1Vertices <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span> v1<span style="color: #000066; font-weight: bold;">,</span> v2<span style="color: #000066; font-weight: bold;">,</span> v3 <span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangle1Face <span style="color: #000066; font-weight: bold;">:</span> Triangle3D = <span style="color: #0033ff; font-weight: bold;">new</span> Triangle3D<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">,</span> triangle1Vertices<span style="color: #000066; font-weight: bold;">,</span> material<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">null</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; faces<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> triangle1Face <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangle2Vertices <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span> v2<span style="color: #000066; font-weight: bold;">,</span> v3<span style="color: #000066; font-weight: bold;">,</span> v4 <span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangle2Face <span style="color: #000066; font-weight: bold;">:</span> Triangle3D = <span style="color: #0033ff; font-weight: bold;">new</span> Triangle3D<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">,</span> triangle2Vertices<span style="color: #000066; font-weight: bold;">,</span> material<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">null</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; faces<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> triangle2Face <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; geometry<span style="color: #000066; font-weight: bold;">.</span>ready = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; _count<span style="color: #000066; font-weight: bold;">++;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>And the compiled SWF looks like this. If you try it for yourself and you just see a growing line, move your camera up.<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_custommesh_animated0_550127925"
			class="flashmovie"
			width="455"
			height="256">
	<param name="movie" value="/swf/custommesh_animated0.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/swf/custommesh_animated0.swf"
			name="fm_custommesh_animated0_550127925"
			width="455"
			height="256">
	<!--<![endif]-->
		<br />
<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
Simply adding the same value to one axis is pretty boring. If you draw a circle with Sinus and Cosinus its getting better. I also deleted some vertices and faces if we have enough from them:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> AnimatedMesh <span style="color: #000000;">&#40;</span>meshMaterial <span style="color: #000066; font-weight: bold;">:</span> MaterialObject3D<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">stage</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Stage</span><span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span> meshMaterial<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; _stage = <span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; _count = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; _segments = <span style="color: #000000; font-weight:bold;">40</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; _width = <span style="color: #000000; font-weight:bold;">50</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; _radius = <span style="color: #000000; font-weight:bold;">300</span><span style="color: #000066; font-weight: bold;">;</span> <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; _stage<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ENTER_FRAME</span><span style="color: #000066; font-weight: bold;">,</span> onEnterFrame <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span> &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onEnterFrame <span style="color: #000000;">&#40;</span>event <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> vertices <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = geometry<span style="color: #000066; font-weight: bold;">.</span>vertices<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> faces <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = geometry<span style="color: #000066; font-weight: bold;">.</span>faces<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> v1 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D<span style="color: #000066; font-weight: bold;">,</span> v2 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D<span style="color: #000066; font-weight: bold;">,</span> v3 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D<span style="color: #000066; font-weight: bold;">,</span> v4 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">y</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Number</span> = <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">cos</span><span style="color: #000000;">&#40;</span> _count <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">8</span> <span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> _radius<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> z <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Number</span> = <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">sin</span><span style="color: #000000;">&#40;</span> _count <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">8</span> <span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> _radius<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>vertices<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> == <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; v1 = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">,</span> z <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; v2 = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">+</span> _width<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">,</span> z <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; vertices<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> v1<span style="color: #000066; font-weight: bold;">,</span> v2 <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">else</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; v1 = vertices<span style="color: #000000;">&#91;</span>vertices<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; v2 = vertices<span style="color: #000000;">&#91;</span>vertices<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; v3 = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">,</span> z <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; v4 = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">+</span> _width<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">,</span> z <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; vertices<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> v3<span style="color: #000066; font-weight: bold;">,</span> v4 <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangle1Vertices <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span> v1<span style="color: #000066; font-weight: bold;">,</span> v2<span style="color: #000066; font-weight: bold;">,</span> v3 <span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangle1Face <span style="color: #000066; font-weight: bold;">:</span> Triangle3D = <span style="color: #0033ff; font-weight: bold;">new</span> Triangle3D<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">,</span> triangle1Vertices<span style="color: #000066; font-weight: bold;">,</span> material<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">null</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; faces<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> triangle1Face <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangle2Vertices <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span> v2<span style="color: #000066; font-weight: bold;">,</span> v3<span style="color: #000066; font-weight: bold;">,</span> v4 <span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangle2Face <span style="color: #000066; font-weight: bold;">:</span> Triangle3D = <span style="color: #0033ff; font-weight: bold;">new</span> Triangle3D<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">,</span> triangle2Vertices<span style="color: #000066; font-weight: bold;">,</span> material<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">null</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; faces<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> triangle2Face <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; geometry<span style="color: #000066; font-weight: bold;">.</span>ready = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; _count<span style="color: #000066; font-weight: bold;">++;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>_count <span style="color: #000066; font-weight: bold;">&gt;</span> _segments<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; vertices<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">splice</span><span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">2</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; faces<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">splice</span><span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">2</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>And the compiled SWF:<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_custommesh_animated1_1822353051"
			class="flashmovie"
			width="455"
			height="256">
	<param name="movie" value="/swf/custommesh_animated1.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/swf/custommesh_animated1.swf"
			name="fm_custommesh_animated1_1822353051"
			width="455"
			height="256">
	<!--<![endif]-->
		<br />
<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
That&#8217;s a nice circle.<br />
If you change this line</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>to this line</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">x</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Number</span> = <span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">sin</span><span style="color: #000000;">&#40;</span> _count <span style="color: #000066; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">5</span> <span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">*</span> _radius<span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>The result is this:<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_custommesh_animated2_498342119"
			class="flashmovie"
			width="455"
			height="256">
	<param name="movie" value="/swf/custommesh_animated2.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/swf/custommesh_animated2.swf"
			name="fm_custommesh_animated2_498342119"
			width="455"
			height="256">
	<!--<![endif]-->
		<br />
<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
Now I just changed the material from WireFrameMaterial to ColorMaterial and I drew the whole scene to a BitmapData added a BlurFilter and a ColorTransform.<br />
Then you finally get this <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_custommesh_final_1402632697"
			class="flashmovie"
			width="455"
			height="256">
	<param name="movie" value="/swf/custommesh_final.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/swf/custommesh_final.swf"
			name="fm_custommesh_final_1402632697"
			width="455"
			height="256">
	<!--<![endif]-->
		<br />
<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>
I hope that helped you to understand the basic principle of animating objects in Papervision. If you got it you can do so many cool things with it. Imaging that you could code for examle a flying paper in the wind or a moving sea! Or you could transform spheres to planes or whatever you want.</p>
<p>I think it is great, I&#8217;m just waiting for my next project where I can make use of that! <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.rwichmann.com/2009/05/27/creating-custom-3d-displayobjects-in-papervision-part-3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Creating Custom 3D DisplayObjects in Papervision &#8211; Part 2</title>
		<link>http://www.rwichmann.com/2009/05/03/creating-custom-3d-displayobjects-in-papervision-part-2/</link>
		<comments>http://www.rwichmann.com/2009/05/03/creating-custom-3d-displayobjects-in-papervision-part-2/#comments</comments>
		<pubDate>Sun, 03 May 2009 10:07:35 +0000</pubDate>
		<dc:creator>Raphael</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[displayobject3d]]></category>
		<category><![CDATA[mesh]]></category>
		<category><![CDATA[papervision]]></category>

		<guid isPermaLink="false">http://www.rwichmann.com/?p=181</guid>
		<description><![CDATA[Ok, now that you know how to set up your own custom object in Papervision I&#8217;m going to show you how texture maps work. In the preceding Post we omitted the texture map in our face. So if you want to apply a BitmapMaterial to your object you won&#8217;t see the texture. So we need [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, now that you know how to set up your own custom object in Papervision I&#8217;m going to show you how texture maps work.</p>
<p>In the preceding Post we omitted the texture map in our face. So if you want to apply a BitmapMaterial to your object you won&#8217;t see the texture. So we need a texture map.</p>
<p>The first thing we are going to do is adding another triangle and making our object a rectangle. Something like the Plane primitive. A rectangle consists of a minimum of 2 triangles. So if we want to draw another triangle we need one more vertex.</p>
<p>Ok, so the code will look like this:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> CustomTriangle <span style="color: #000000;">&#40;</span>triangleMaterial <span style="color: #000066; font-weight: bold;">:</span> MaterialObject3D<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span> triangleMaterial<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> v1 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> v2 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> v3 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> v4 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; geometry<span style="color: #000066; font-weight: bold;">.</span>vertices<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> v1<span style="color: #000066; font-weight: bold;">,</span> v2<span style="color: #000066; font-weight: bold;">,</span> v3<span style="color: #000066; font-weight: bold;">,</span> v4 <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangleVertices1 <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span> v1<span style="color: #000066; font-weight: bold;">,</span> v2<span style="color: #000066; font-weight: bold;">,</span> v3 <span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangleFace1 <span style="color: #000066; font-weight: bold;">:</span> Triangle3D = <span style="color: #0033ff; font-weight: bold;">new</span> Triangle3D<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">,</span> triangleVertices1<span style="color: #000066; font-weight: bold;">,</span> material <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; geometry<span style="color: #000066; font-weight: bold;">.</span>faces<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> triangleFace1 <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangleVertices2 <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span> v1<span style="color: #000066; font-weight: bold;">,</span> v3<span style="color: #000066; font-weight: bold;">,</span> v4 <span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangleFace2 <span style="color: #000066; font-weight: bold;">:</span> Triangle3D = <span style="color: #0033ff; font-weight: bold;">new</span> Triangle3D<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">,</span> triangleVertices2<span style="color: #000066; font-weight: bold;">,</span> material <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; geometry<span style="color: #000066; font-weight: bold;">.</span>faces<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> triangleFace2 <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
<br />
&nbsp; &nbsp; geometry<span style="color: #000066; font-weight: bold;">.</span>ready = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>We added another vertex and built another face. As you see we used the same vertices we used with our first face. That is pretty important to understand. The vertices are not bound to the triangles. We can use them with different triangles. They are just coordinates in our 3D space.</p>
<p>Ok, our new rectangle will look like this now. I applied a WireFrameMaterial to it because it is better to see the triangles we made:<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_custommesh_rectangle_2014746653"
			class="flashmovie"
			width="455"
			height="256">
	<param name="movie" value="/swf/custommesh_rectangle.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/swf/custommesh_rectangle.swf"
			name="fm_custommesh_rectangle_2014746653"
			width="455"
			height="256">
	<!--<![endif]-->
		<br />
<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Ok, now it is getting interesting. We have our object and we want to apply a BitmapMaterial to it. If you already tried that you would have realized that your object did not show the texture. That is because the texture maps were missing in our faces.</p>
<p>A texture map is basically the information about where to display which part of the texture in every face or triangle. So every triangle gets its own texture map. And because every triangle consists of 3 vertices our texture map will need 3 information about the position of the texture. The information is an instance of the NumberUV class which holds two properties. The u and the v. Which represent the horizontal and vertical axes of our texture. Think of them as x- and y-axes. Textures are always 2D so we don&#8217;t have a z-axis here.<br />
The u and v are numbers which go from 0 to 1. u=0 means the most left pixel of our texture and u=1 is the most right pixel in our texture. </p>
<p>Ok, so we take our first triangle which consists of these three vertices:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6699cc; font-weight: bold;">var</span> triangleVertices1 <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span> v1<span style="color: #000066; font-weight: bold;">,</span> v2<span style="color: #000066; font-weight: bold;">,</span> v3 <span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>v1 is the vertex in the lower left corner. That means it should display the lower left corner of our texture. That represents u=0 and v=0. You might have noticed that the y-axis is flipped in Papervision.<br />
v2 is in the lower right corner which represents u=1 and v=0. v3 is on the upper right corner and so it gets u=1 and v=1.</p>
<p>In code this will look like this:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6699cc; font-weight: bold;">var</span> triangleTextureMap1 <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span> <span style="color: #0033ff; font-weight: bold;">new</span> NumberUV<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> NumberUV<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> NumberUV<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>Ok, now we need to pass our triangle the texturemap.<br />
Before:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6699cc; font-weight: bold;">var</span> triangleFace1 <span style="color: #000066; font-weight: bold;">:</span> Triangle3D = <span style="color: #0033ff; font-weight: bold;">new</span> Triangle3D<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">,</span> triangleVertices1<span style="color: #000066; font-weight: bold;">,</span> material <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>After:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6699cc; font-weight: bold;">var</span> triangleFace1 <span style="color: #000066; font-weight: bold;">:</span> Triangle3D = <span style="color: #0033ff; font-weight: bold;">new</span> Triangle3D<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">,</span> triangleVertices1<span style="color: #000066; font-weight: bold;">,</span> material<span style="color: #000066; font-weight: bold;">,</span> triangleTextureMap1 <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>Ok, so we have to do the same for our second triangle. I hope it is clear now how to handle the second texturemap. Our class will look like this now:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> CustomTriangle <span style="color: #000000;">&#40;</span>triangleMaterial <span style="color: #000066; font-weight: bold;">:</span> MaterialObject3D<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span> triangleMaterial<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> v1 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> v2 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> v3 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> v4 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">200</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; geometry<span style="color: #000066; font-weight: bold;">.</span>vertices<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> v1<span style="color: #000066; font-weight: bold;">,</span> v2<span style="color: #000066; font-weight: bold;">,</span> v3<span style="color: #000066; font-weight: bold;">,</span> v4 <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangleVertices1 <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span> v1<span style="color: #000066; font-weight: bold;">,</span> v2<span style="color: #000066; font-weight: bold;">,</span> v3 <span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangleTextureMap1 <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span> <span style="color: #0033ff; font-weight: bold;">new</span> NumberUV<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> NumberUV<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> NumberUV<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangleFace1 <span style="color: #000066; font-weight: bold;">:</span> Triangle3D = <span style="color: #0033ff; font-weight: bold;">new</span> Triangle3D<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">,</span> triangleVertices1<span style="color: #000066; font-weight: bold;">,</span> material<span style="color: #000066; font-weight: bold;">,</span> triangleTextureMap1 <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; geometry<span style="color: #000066; font-weight: bold;">.</span>faces<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> triangleFace1 <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangleVertices2 <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span> v1<span style="color: #000066; font-weight: bold;">,</span> v3<span style="color: #000066; font-weight: bold;">,</span> v4 <span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangleTextureMap2 <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span> <span style="color: #0033ff; font-weight: bold;">new</span> NumberUV<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> NumberUV<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> NumberUV<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangleFace2 <span style="color: #000066; font-weight: bold;">:</span> Triangle3D = <span style="color: #0033ff; font-weight: bold;">new</span> Triangle3D<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">,</span> triangleVertices2<span style="color: #000066; font-weight: bold;">,</span> material<span style="color: #000066; font-weight: bold;">,</span> triangleTextureMap2 <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; geometry<span style="color: #000066; font-weight: bold;">.</span>faces<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> triangleFace2 <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
<br />
&nbsp; &nbsp; geometry<span style="color: #000066; font-weight: bold;">.</span>ready = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>And if you apply a BitmapMaterial from the outside to your object it will look like that:<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_custommesh_rectangle_tex_1934940157"
			class="flashmovie"
			width="455"
			height="256">
	<param name="movie" value="/swf/custommesh_rectangle_tex.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/swf/custommesh_rectangle_tex.swf"
			name="fm_custommesh_rectangle_tex_1934940157"
			width="455"
			height="256">
	<!--<![endif]-->
		<br />
<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
It looks a bit distorted. This is because we should actually build up a rectangle with more than 2 triangles. The more you use the better the texture is rendered and the more your CPU needs to work.</p>
<p>We could also tell our texture map that we don&#8217;t want to display the whole texture. With your set of NumberUV instances you can practically tell every triangle to display a different part of your texture. Just use .5 instead of 1 to display only the lower left part of the texure for example. Let&#8217;s play around with the values and you will see what I mean.</p>
<p>Im changing the values of our first texture map like this:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6699cc; font-weight: bold;">var</span> triangleTextureMap1 <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span> <span style="color: #0033ff; font-weight: bold;">new</span> NumberUV<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">1</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> NumberUV<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> NumberUV<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>I replaced the first with the last coordinate and the texture from our first triangle is rotated now:<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_custommesh_rectangle_tex_rot_1381830019"
			class="flashmovie"
			width="455"
			height="256">
	<param name="movie" value="/swf/custommesh_rectangle_tex_rot.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/swf/custommesh_rectangle_tex_rot.swf"
			name="fm_custommesh_rectangle_tex_rot_1381830019"
			width="455"
			height="256">
	<!--<![endif]-->
		<br />
<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
It is just important for you to understand, that you can tell every triangle which part of the texture it should display.</p>
<p>Ok, thats it for now. In the next part we are going to animate our object.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rwichmann.com/2009/05/03/creating-custom-3d-displayobjects-in-papervision-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating Custom 3D DisplayObjects in Papervision &#8211; Part 1</title>
		<link>http://www.rwichmann.com/2009/04/08/creating-custom-3d-displayobjects-in-papervision-part-1/</link>
		<comments>http://www.rwichmann.com/2009/04/08/creating-custom-3d-displayobjects-in-papervision-part-1/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 12:01:24 +0000</pubDate>
		<dc:creator>Raphael</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[displayobject3d]]></category>
		<category><![CDATA[mesh]]></category>
		<category><![CDATA[papervision]]></category>

		<guid isPermaLink="false">http://www.rwichmann.com/?p=147</guid>
		<description><![CDATA[Have you ever thought of how to do these moving and transforming objects in Papervision? Click &#8220;Start&#8221; to see what I mean. 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_custommesh_final_712308000"
			class="flashmovie"
			width="455"
			height="256">
	<param name="movie" value="/swf/custommesh_final.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/swf/custommesh_final.swf"
			name="fm_custommesh_final_712308000"
			width="455"
			height="256">
	<!--<![endif]-->
		 
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object> I did. My world was limited to the Papervision primitives and collada objects. Then I needed a growing and transforming object for my current project. [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever thought of how to do these moving and transforming objects in Papervision? Click &#8220;Start&#8221; to see what I mean.<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_custommesh_final_429731004"
			class="flashmovie"
			width="455"
			height="256">
	<param name="movie" value="/swf/custommesh_final.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/swf/custommesh_final.swf"
			name="fm_custommesh_final_429731004"
			width="455"
			height="256">
	<!--<![endif]-->
		<br />
<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>I did. My world was limited to the Papervision primitives and collada objects. Then I needed a growing and transforming object for my current project. So I asked my friend Lars who already did things like that (he also created his own <a href="http://code.google.com/p/nd3d/" target="_blank">3D framework</a> by the way). He said that it is not that simple. I didn&#8217;t understand everything he was saying but had a rough idea in mind.</p>
<p>I found some information in the internet and set up my own custom object. Actually it is pretty much like drawing lines in ActionScript. You know this stuff:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">shape<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">beginFill</span><span style="color: #000000;">&#40;</span> 0xFF <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
shape<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
shape<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">100</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
shape<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">graphics</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">lineTo</span><span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>This will give you a blue triangle. That is easy.</p>
<p>Creating custom objects in a 3D world is pretty much the same.<br />
3D objects in Papervision are basically defined through vertices and faces. Vertices are something like Points in 3D Space. They are stored in an array called vertices and are instances of the Vertex3D class.</p>
<p>The faces are the triangles (polygons) you draw with your vertices. Easily spoken you take 3 vertices and build a triangle with them. You should know that every 3D Object is made out of triangles.<br />
And you also need tell your face how it should display a texture. If you just have a WireFrameMaterial or a ColorMaterial applied to your object you don&#8217;t need that necessarily. But you never know what kind of material people will use with your Object, so it is better to define it.</p>
<p>Let&#8217;s try that with a really simple custom 3D object. A triangle.<br />
I assume that you have basic Papervision knowledge and that you use Papervision 2.0 Great White.</p>
<p>Ok, this will look like this:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #9900cc; font-weight: bold;">package</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> org<span style="color: #000066; font-weight: bold;">.</span>papervision3d<span style="color: #000066; font-weight: bold;">.</span>core<span style="color: #000066; font-weight: bold;">.</span>geom<span style="color: #000066; font-weight: bold;">.</span>TriangleMesh3D<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> org<span style="color: #000066; font-weight: bold;">.</span>papervision3d<span style="color: #000066; font-weight: bold;">.</span>core<span style="color: #000066; font-weight: bold;">.</span>geom<span style="color: #000066; font-weight: bold;">.</span>renderables<span style="color: #000066; font-weight: bold;">.</span>Triangle3D<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> org<span style="color: #000066; font-weight: bold;">.</span>papervision3d<span style="color: #000066; font-weight: bold;">.</span>core<span style="color: #000066; font-weight: bold;">.</span>geom<span style="color: #000066; font-weight: bold;">.</span>renderables<span style="color: #000066; font-weight: bold;">.</span>Vertex3D<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> org<span style="color: #000066; font-weight: bold;">.</span>papervision3d<span style="color: #000066; font-weight: bold;">.</span>core<span style="color: #000066; font-weight: bold;">.</span>math<span style="color: #000066; font-weight: bold;">.</span>NumberUV<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> org<span style="color: #000066; font-weight: bold;">.</span>papervision3d<span style="color: #000066; font-weight: bold;">.</span>core<span style="color: #000066; font-weight: bold;">.</span>proto<span style="color: #000066; font-weight: bold;">.</span>MaterialObject3D<span style="color: #000066; font-weight: bold;">;</span> &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> CustomTriangle <span style="color: #0033ff; font-weight: bold;">extends</span> TriangleMesh3D<br />
&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> CustomTriangle <span style="color: #000000;">&#40;</span>triangleMaterial <span style="color: #000066; font-weight: bold;">:</span> MaterialObject3D<span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span> triangleMaterial<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> v1 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> v2 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> v3 <span style="color: #000066; font-weight: bold;">:</span> Vertex3D = <span style="color: #0033ff; font-weight: bold;">new</span> Vertex3D<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; geometry<span style="color: #000066; font-weight: bold;">.</span>vertices<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> v1<span style="color: #000066; font-weight: bold;">,</span> v2<span style="color: #000066; font-weight: bold;">,</span> v3 <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangleVertices <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span> v1<span style="color: #000066; font-weight: bold;">,</span> v2<span style="color: #000066; font-weight: bold;">,</span> v3 <span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> triangleFace <span style="color: #000066; font-weight: bold;">:</span> Triangle3D = <span style="color: #0033ff; font-weight: bold;">new</span> Triangle3D<span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">,</span> triangleVertices<span style="color: #000066; font-weight: bold;">,</span> material<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">null</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; geometry<span style="color: #000066; font-weight: bold;">.</span>faces<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span> triangleFace <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span> <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; geometry<span style="color: #000066; font-weight: bold;">.</span>ready = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>Our custom object is extending the TriangleMesh3D class. If you take a look in the Papervision primitives classes you will see that they all extend this class.</p>
<p>Ok, so the constructor of the TriangleMesh3D needs 3 parameters. A material, a vertices array and a faces array. Our custom triangle requires a material as well so we push it to the super constructor. Then we give our super class 2 empty arrays which means something like: We don&#8217;t have any vertices and faces for you yet but you will get them very soon.</p>
<p>Let&#8217;s build the triangle. A triangle consits of 3 points and 1 shape. Here we will call it 3 vertices and 1 face. We create 3 instances of the Vertex3D class, give them the coordinates in 3D Space and push them in the vertices array which is a property of the geometry instance. The coordinates are pretty much the same as in our lineTo example earlier.</p>
<p>Now that we have 3 vertices we can make a face. In our lineTo example flash automatically connected the 3 points and draw a shape. Here we have to say with which vertices we want to create a face with. So basically we just choose 3 vertices push them in an array and pass them to our new instance of the Triangle3D class which represents the face. The Triangle3D class also needs a material. We just take the one of our displayobject. And it wants a texture map. I will explain that later for keeping things simple at this point it is null for now. As long as you don&#8217;t apply a texture material on the object you won&#8217;t need it.</p>
<p>So, here we go. Our first custom 3D Object:<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_custommesh_triangle_2051195805"
			class="flashmovie"
			width="455"
			height="256">
	<param name="movie" value="/swf/custommesh_triangle.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/swf/custommesh_triangle.swf"
			name="fm_custommesh_triangle_2051195805"
			width="455"
			height="256">
	<!--<![endif]-->
		<br />
<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object><br />
Here is the code which does the Papervision setup:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> init3D <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; _basicView = <span style="color: #0033ff; font-weight: bold;">new</span> BasicView<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">455</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">256</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">,</span> CameraType<span style="color: #000066; font-weight: bold;">.</span>FREE <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span> _basicView <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ENTER_FRAME</span><span style="color: #000066; font-weight: bold;">,</span> onRender <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> material <span style="color: #000066; font-weight: bold;">:</span> ColorMaterial = <span style="color: #0033ff; font-weight: bold;">new</span> ColorMaterial<span style="color: #000000;">&#40;</span> 0xFF <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; material<span style="color: #000066; font-weight: bold;">.</span>doubleSided = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; _arrow = <span style="color: #0033ff; font-weight: bold;">new</span> CustomTriangle<span style="color: #000000;">&#40;</span> material <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; _basicView<span style="color: #000066; font-weight: bold;">.</span>scene<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span> _arrow <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span><br />
<br />
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onRender <span style="color: #000000;">&#40;</span>event <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span><br />
<span style="color: #000000;">&#123;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; _arrow<span style="color: #000066; font-weight: bold;">.</span>yaw<span style="color: #000000;">&#40;</span> <span style="color: #000000; font-weight:bold;">2</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; _basicView<span style="color: #000066; font-weight: bold;">.</span>singleRender<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>Ok, cool. So now you know how to set up your own custom Papervision DisplayObject. In the next part I&#8217;m going to show you how texturemaps work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rwichmann.com/2009/04/08/creating-custom-3d-displayobjects-in-papervision-part-1/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Beginning iPhone Development</title>
		<link>http://www.rwichmann.com/2009/03/05/beginning-iphone-development/</link>
		<comments>http://www.rwichmann.com/2009/03/05/beginning-iphone-development/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 18:22:51 +0000</pubDate>
		<dc:creator>Raphael</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.rwichmann.com/?p=104</guid>
		<description><![CDATA[The title says what I am doing and it&#8217;s also the title of my current favourite book. I bought two books. One is for diving into Objective-C and the other one is about the iPhone SDK. It worked out to be a good idea having two books. One for Objective-C basics and the other one [...]]]></description>
			<content:encoded><![CDATA[<p>The title says what I am doing and it&#8217;s also the title of my current favourite book.</p>
<p>I bought two books. One is for diving into Objective-C and the other one is about the iPhone SDK. It worked out to be a good idea having two books. One for Objective-C basics and the other one more iPhone specific. Although the iPhone book is my favourite book, you need to have basic knowledge about Objective-C to understand what they are doing there.</p>
<p>This book: <a href="http://www.amazon.com/Beginning-iPhone-Development-Exploring-SDK/dp/1430216263/ref=pd_bbs_sr_1" target="_blank">Beginning iPhone Development</a> is really good. Every chapter contains a Step by Step tutorial on a specific theme. It&#8217;s really fun reading and everything is really easy explained.</p>
<p>The second book called <a href="http://www.amazon.com/Programming-Objective-C-Developers-Library-Stephen/dp/0672325861/ref=sr_1_4" target="_blank">Programming in Objective-C</a> is ok but it&#8217;s nothing special. It&#8217;s not bad though. It&#8217;s just a usual book about a programming language. If you consider buying this book better buy this one: &#8220;Programming in Objective-C 2.0&#8243;. Or a completely different one.</p>
<p>So I started reading the Objective-C book. If you are familiar with ActionScript everything seems different to you. How you declare variables, call functions, handle events and a lot more. Tracing! So simple in ActionScript. And a good example for a comparison:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;myNumber: &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> myNumber<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">NSLog<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> alloc<span style="color: #002200;">&#93;</span><br />
&nbsp; &nbsp; initWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;myNumber: %f&quot;</span>, myNumber<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;</div></div>
<p>What is that?! Some things are really strange. And I&#8217;m not into it that much that I could say: &#8220;Ok, it is a little bit odd but actually it is better because &#8230; &#8220;. So I just accepted it <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Even if it is a little bit painful for me leaving the comfortable ActionScript enviroment it is a lot fun starting with iPhone programming. You simply have access to data you normally don&#8217;t have in ActionScript. Think of things like multitouch, accelerometer, GPS location, access to the adressbook of the user and a lot more.</p>
<p>So I started developing a really simple game. I think it is always good if you set yourself a goal to achieve. My goal is to develop a simple football game. The concept is pretty easy. You kick a ball and have to keep in the air. The longer you keep the ball in the air the higher the score. The score is to be saved in a database later.</p>
<p>I read the iPhone book and Keith Peters <a href="http://www.bit-101.com/blog/?p=1784" target="_blank">tutorial</a> about gravity on the iPhone. And i watched some videos on this site: <a href="http://www.iphonedevcentral.org/" target="_blank">www.iphonedevcentral.org</a>.</p>
<p>This is the current state. Unfortunately it doesn&#8217;t run that smooth on the iPhone. The difference between the X-Code-Simulator and the runtime on the iPhone is pretty big. I guess I should do the movement with openGL. Another language I don&#8217;t know. But the book is already ordered <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Have a look for yourself:</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_videoplayer_1217600435"
			class="flashmovie"
			width="455"
			height="256">
	<param name="movie" value="/swf/videoplayer.swf" />
	<param name="flashvars" value="path=../video/beginningiphone.mp4&#038&amp;normalWidth=455&#038&amp;normalHeight=256&#038&amp;maxWidth=1024&#038&amp;maxHeight=576" />
	<param name="allowfullscreen" value="true" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/swf/videoplayer.swf"
			name="fm_videoplayer_1217600435"
			width="455"
			height="256">
		<param name="flashvars" value="path=../video/beginningiphone.mp4&#038&amp;normalWidth=455&#038&amp;normalHeight=256&#038&amp;maxWidth=1024&#038&amp;maxHeight=576" />
		<param name="allowfullscreen" value="true" />
	<!--<![endif]-->
		<br />
<a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a><br />

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://www.rwichmann.com/2009/03/05/beginning-iphone-development/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Custom Events in Objective-C</title>
		<link>http://www.rwichmann.com/2009/03/02/custom-events-in-objective-c/</link>
		<comments>http://www.rwichmann.com/2009/03/02/custom-events-in-objective-c/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 19:59:38 +0000</pubDate>
		<dc:creator>Raphael</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[notifications]]></category>

		<guid isPermaLink="false">http://www.rwichmann.com/?p=87</guid>
		<description><![CDATA[If you are living in the ActionScript world and you are looking for something like an event handling system, you might won&#8217;t find any. I googled events and custom events, callbacks and finally figured out that they call it &#8220;Notifications&#8221;. Events or in this case Notifications are used for having loosely coupled relationships between instances [...]]]></description>
			<content:encoded><![CDATA[<p>If you are living in the ActionScript world and you are looking for something like an event handling system, you might won&#8217;t find any. I googled events and custom events, callbacks and finally figured out that they call it &#8220;Notifications&#8221;.</p>
<p>Events or in this case Notifications are used for having loosely coupled relationships between instances in your application. So it is possible to let other instances listen to specific events without knowing each other.</p>
<p>If you want to listen to a custom event in ActionScript it would look something like this:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">instance<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;eventType&quot;</span><span style="color: #000066; font-weight: bold;">,</span> eventHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #339966; font-weight: bold;">function</span> eventHandler<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;event triggered&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>In your instance you would trigger the event like this:</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #004993;">dispatchEvent</span><span style="color: #000000;">&#40;</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Event</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;eventType&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></div>
<p>The Objective-C approach to listen to a Notification looks like this:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSNotificationCenter</span> defaultCenter<span style="color: #002200;">&#93;</span><br />
&nbsp; &nbsp; addObserver<span style="color: #002200;">:</span>self<br />
&nbsp; &nbsp; selector<span style="color: #002200;">:</span><span style="color: #a61390;">@selector</span><span style="color: #002200;">&#40;</span>eventHandler<span style="color: #002200;">:</span><span style="color: #002200;">&#41;</span><br />
&nbsp; &nbsp; name<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;eventType&quot;</span><br />
&nbsp; &nbsp; object<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> <span style="color: #002200;">&#93;</span>;<br />
<br />
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>eventHandler<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSNotification</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> notification<br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;event triggered&quot;</span><span style="color: #002200;">&#41;</span>;<br />
<span style="color: #002200;">&#125;</span></div></div>
<p>The funny thing is that you don&#8217;t need to put this Event Listener on an instance. It just listens to the eventtype and as far as I understood you can trigger this event wherever you want. This makes it even more loosely coupled than the instance.addEventListener(); approach.</p>
<p>The &#8220;NSNotificationCenter&#8221; is something like a Singleton which is one unique Class that manages your events in your application.</p>
<p>And this is how you dispatch or trigger the event:</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSNotificationCenter</span> defaultCenter<span style="color: #002200;">&#93;</span><br />
&nbsp; &nbsp; postNotificationName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;eventType&quot;</span><br />
&nbsp; &nbsp; object<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> <span style="color: #002200;">&#93;</span>;</div></div>
<p>That&#8217;s it. Actually I like the approach in Objective-C even if it is more to write it is pretty easy to read.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rwichmann.com/2009/03/02/custom-events-in-objective-c/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Objective-C, first steps</title>
		<link>http://www.rwichmann.com/2009/02/08/objective-c-first-steps/</link>
		<comments>http://www.rwichmann.com/2009/02/08/objective-c-first-steps/#comments</comments>
		<pubDate>Sun, 08 Feb 2009 17:14:53 +0000</pubDate>
		<dc:creator>Raphael</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=34</guid>
		<description><![CDATA[Actually I&#8217;m wondering how many people start coding Objective-C these days. Especially Flash coders. It must be the App-Store that comes with the iPhone making it really easy to publish your applications to millions of people with a minimum of effort. Plus Flash 10 doesn&#8217;t really come with that much new stuff that you don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Actually I&#8217;m wondering how many people start coding Objective-C these days. Especially Flash coders. It must be the App-Store that comes with the iPhone making it really easy to publish your applications to millions of people with a minimum of effort.</p>
<p>Plus Flash 10 doesn&#8217;t really come with that much new stuff that you don&#8217;t need to study every day to keep track with the development. Compared to the times when AS2 was released for example. It&#8217;s not that there is nothing new to learn for me. Especially in the area of Application Frameworks.. I&#8217;m still stuck with Cairngorm which does a good job for me though.</p>
<p>I&#8217;m just interested in some new things. And Objective-C is something pretty new for me. Its a C-Language and the syntax is fairly different from what you know from ActionScript.</p>
<p>The good thing I realized is: If you understood the core concepts of object oriented programming, you can easily learn Objective-C. It&#8217;s more like a different dialect from the same logical language.</p>
<p>Today I wrote my first application. It&#8217;s a really simple calculator but it gives you an impression on how the Objective-C syntax looks like.</p>
<div class="codecolorer-container objc default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #11740a; font-style: italic;">//</span><br />
<span style="color: #11740a; font-style: italic;">// &nbsp;main.m</span><br />
<span style="color: #11740a; font-style: italic;">// &nbsp;Calculator</span><br />
<span style="color: #11740a; font-style: italic;">//</span><br />
<span style="color: #11740a; font-style: italic;">// &nbsp;Created by Raphael Wichmann on 05.02.09.</span><br />
<span style="color: #11740a; font-style: italic;">// &nbsp;Copyright Raphael Wichmann 2009. All rights reserved.</span><br />
<span style="color: #11740a; font-style: italic;">//</span><br />
<br />
<span style="color: #6e371a;">#import &lt;stdio.h&gt;</span><br />
<span style="color: #6e371a;">#import &lt;objc/Object.h&gt;</span><br />
<br />
<br />
<span style="color: #a61390;">@interface</span> Calculator<span style="color: #002200;">:</span> Object<br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #a61390;">int</span> _numbera;<br />
&nbsp; &nbsp; <span style="color: #a61390;">int</span> _numberb;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> print;<br />
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> setNumberA<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span> a;<br />
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> setNumberB<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span> b;<br />
<br />
<span style="color: #a61390;">@end</span><br />
<br />
<br />
<span style="color: #a61390;">@implementation</span> Calculator<br />
<br />
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> print<br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #a61390;">int</span> result <span style="color: #002200;">=</span> _numbera <span style="color: #002200;">+</span> _numberb;<br />
&nbsp; &nbsp; <span style="color: #a61390;">printf</span><span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">&quot;Result: %i + %i = %i&quot;</span>, _numbera, _numberb, result<span style="color: #002200;">&#41;</span>;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> setNumberA<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span> a<br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; _numbera <span style="color: #002200;">=</span> a;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span> setNumberB<span style="color: #002200;">:</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span><span style="color: #002200;">&#41;</span> b<br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; _numberb <span style="color: #002200;">=</span> b;<br />
<span style="color: #002200;">&#125;</span><br />
<br />
<span style="color: #a61390;">@end</span><br />
<br />
<br />
<br />
<br />
<span style="color: #a61390;">int</span> main<span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span> argc, <span style="color: #a61390;">char</span> <span style="color: #002200;">*</span>argv<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span><br />
<span style="color: #002200;">&#123;</span><br />
&nbsp; &nbsp; Calculator <span style="color: #002200;">*</span>_calculator <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>Calculator new<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>_calculator setNumberA<span style="color: #002200;">:</span><span style="color: #2400d9;">15</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>_calculator setNumberB<span style="color: #002200;">:</span><span style="color: #2400d9;">7</span><span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #002200;">&#91;</span>_calculator print<span style="color: #002200;">&#93;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #a61390;">return</span> <span style="color: #2400d9;">0</span>;<br />
<span style="color: #002200;">&#125;</span></div></div>
<p>With the magic of Objective-C this complex application is capable of adding 15 to 7 which makes 22. Whew <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.rwichmann.com/2009/02/08/objective-c-first-steps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Just another Flash-Blog</title>
		<link>http://www.rwichmann.com/2009/02/06/just-another-blog/</link>
		<comments>http://www.rwichmann.com/2009/02/06/just-another-blog/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 10:51:05 +0000</pubDate>
		<dc:creator>Raphael</dc:creator>
				<category><![CDATA[Private]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[first entry]]></category>

		<guid isPermaLink="false">http://blog.rwichmann.com/?p=13</guid>
		<description><![CDATA[Yes, it&#8217;s true. This is just another Flash-Blog. One of thousand others.. And actually I don&#8217;t think that this one is going to be better than other blogs or that it&#8217;s a cool idea of having a blog. So what&#8217;s my motivation for it? I think it&#8217;s just fair sharing some information about things I [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, it&#8217;s true. This is just another Flash-Blog. One of thousand others..<br />
And actually I don&#8217;t think that this one is going to be better than other blogs or that it&#8217;s a cool idea of having a blog.</p>
<p>So what&#8217;s my motivation for it?<br />
I think it&#8217;s just fair sharing some information about things I figured out about ActionScript or others things people may want to know. If I think about how many information I&#8217;m pulling out of the Internet every day.. So what is my contribution? Maybe this blog is a good starting point.</p>
<p>Why English?<br />
I am German and my mother tongue is German. My clients are German and the most people I know in this business are German. But in a globalized world it&#8217;s just better to speak English. I don&#8217;t restrict the information to german people only and the programming languages are English too. Last but not least I like this language and I&#8217;m getting some more practice with it. I&#8217;m sorry if some sentences sound weird.. <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   </p>
<p>Ok, so welcome to my new Blog! I hope you&#8217;ll enjoy it.<br />
Raphael <img src='http://www.rwichmann.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.rwichmann.com/2009/02/06/just-another-blog/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
