<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>SceneKit &#8211; Wade Tregaskis</title>
	<atom:link href="https://wadetregaskis.com/tags/scenekit/feed/" rel="self" type="application/rss+xml" />
	<link>https://wadetregaskis.com</link>
	<description></description>
	<lastBuildDate>Tue, 02 Jan 2024 02:23:12 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://wadetregaskis.com/wp-content/uploads/2016/03/Stitch-512x512-1-256x256.png</url>
	<title>SceneKit &#8211; Wade Tregaskis</title>
	<link>https://wadetregaskis.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">226351702</site>	<item>
		<title>Things you find googling yourself</title>
		<link>https://wadetregaskis.com/things-you-find-googling-yourself/</link>
					<comments>https://wadetregaskis.com/things-you-find-googling-yourself/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Sun, 26 Feb 2017 16:21:53 +0000</pubDate>
				<category><![CDATA[Ancient History]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[Build Installer]]></category>
		<category><![CDATA[CoreGraphicsServices]]></category>
		<category><![CDATA[DePC]]></category>
		<category><![CDATA[dial-up]]></category>
		<category><![CDATA[Hotline]]></category>
		<category><![CDATA[Keychain Framework]]></category>
		<category><![CDATA[memorabilia]]></category>
		<category><![CDATA[Minecraft]]></category>
		<category><![CDATA[Mission to the ISS]]></category>
		<category><![CDATA[National Park Foundation]]></category>
		<category><![CDATA[SceneKit]]></category>
		<category><![CDATA[Sourceforge]]></category>
		<category><![CDATA[USF Maritime Law Journal]]></category>
		<guid isPermaLink="false">https://blog.wadetregaskis.com/?p=3865</guid>

					<description><![CDATA[In no particular order. The Hotline File Transfer Protocol v1.1.1.  I presume I was interested in, or actively doing, a third party Hotline client.  I did tend to make lots of data transfer clients back then (e.g. HTTP, FTP, even POP3 &#38; SMTP). My little gallery of childhood toys &#38; memorabilia.  I hadn&#8217;t forgotten about this&#8230; <a class="read-more-link" href="https://wadetregaskis.com/things-you-find-googling-yourself/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[<p>In no particular order.</p>
<ul>
<li>The <a href="https://codebox.net/assets/documents/hotline/HLFileTransferProtocol.pdf" data-wpel-link="external" target="_blank" rel="external noopener">Hotline File Transfer Protocol v1.1.1</a>.  I presume I was interested in, or actively doing, a third party <a href="https://en.wikipedia.org/wiki/Hotline_Communications" data-wpel-link="external" target="_blank" rel="external noopener">Hotline</a> client.  I did tend to make lots of data transfer clients back then (e.g. HTTP, FTP, even POP3 &amp; SMTP).</li>
<li>My <a href="https://wadetregaskis.com/MobileMe/Sites/Photos/1597.html" data-wpel-link="internal">little gallery of childhood toys &amp; memorabilia</a>.  I hadn&#8217;t forgotten about this per se, but it&#8217;d certainly been a long time since I&#8217;d look at it.  In hindsight I&#8217;m really glad I took the time to take these photos &#8211; most of this stuff is long gone now, so the photos are all the remains to pique my nostalgia.</li>
<li>Apparently I discovered <a href="https://www.cnet.com/tech/computing/fix-for-ibooktitanium-powerbook-modem-failure-under-mac-os-x-10-2-4/#!" data-wpel-link="external" target="_blank" rel="external noopener">some &#8216;fix&#8217; for Apple breaking dial-up modems in a Mac OS X Jaguar (10.2.4) update</a>.  I vaguely recall that, though I&#8217;m pretty sure that&#8217;s not the only time I&#8217;ve had to fix stupid regressions in Mac OS X by reinstalling frameworks, kexts, etc from a prior OS build.  Sigh.
<ul>
<li><a href="https://www.cnet.com/tech/computing/mac-os-x-10-2-4-special-report/" data-wpel-link="external" target="_blank" rel="external noopener">Here&#8217;s a second reference</a> to the same thing.</li>
</ul>
</li>
<li>I&#8217;m listed in the <a href="https://web.archive.org/web/20170207100106/https://www.nationalparks.org/sites/default/files/NPF_Donor_Honor_Roll_FY2015.pdf" data-wpel-link="external" target="_blank" rel="external noopener">National Park Foundation&#8217;s 2015 donor list</a>.  I&#8217;m also in the 2016 one too, though it doesn&#8217;t show up in a web search [yet], and expect to be in the 2017 one as well.
<ul>
<li>If you&#8217;re interested, <a href="https://www.nationalparks.org/other-ways-to-give" data-wpel-link="external" target="_blank" rel="external noopener">here&#8217;s the many ways you can contribute to the NPF</a> too.  Not listed prominently, but relevant for others in the tech industry, is that <a href="https://money.usnews.com/money/blogs/the-smarter-mutual-fund-investor/2013/09/26/how-to-give-stock-to-charity-2" data-wpel-link="external" target="_blank" rel="external noopener">you can donate stock without paying capital gains on it, while still receiving the tax benefits of the stock&#8217;s full, current market value</a>.  I wish I&#8217;d known this years ago when I started doing non-trivial charitable giving. 😔</li>
</ul>
</li>
<li><a href="https://web.archive.org/web/20170821035144/https://en.wikipedia.org/wiki/Steven_Troughton-Smith" data-wpel-link="external" target="_blank" rel="external noopener">Steven Troughton-Smith</a> gives a call out to me (among others) in his little <a href="https://github.com/steventroughtonsmith/scenekitgeometry" data-wpel-link="external" target="_blank" rel="external noopener">SceneKit demo program</a> and his pretty impressive &#8220;<a href="https://github.com/steventroughtonsmith/OpenWorldTest" data-wpel-link="external" target="_blank" rel="external noopener">OpenWorldTest</a>&#8221; (i.e. Minecraft tech demo clone).  I don&#8217;t recall have any specific contribution, but way back when Steven &amp; I did chat a bunch about SceneKit, and other topics.
<ul>
<li>It tickles me now, though I haven&#8217;t talked to Steven much in years, that his name appears increasingly often in pretty high profile places (e.g. <a href="https://atp.fm" data-wpel-link="external" target="_blank" rel="external noopener">the ATP podcast</a> mentions him almost every episode lately).  He&#8217;s certainly made a name for himself.</li>
<li>Someone called &#8220;<a href="https://github.com/takataka" data-wpel-link="external" target="_blank" rel="external noopener">Taka Taka</a>&#8221; has also <a href="https://github.com/takataka/OpenWorldTest" data-wpel-link="external" target="_blank" rel="external noopener">run with OpenWorldTest a bit</a>, to add VR support among other things.  Nothing to do with me any more than Steven&#8217;s original version &#8211; I mention it just because it&#8217;s cool.</li>
</ul>
</li>
<li><a href="https://lawblog.usfca.edu/lawreview/wp-content/uploads/2014/09/45-4-C3.pdf" data-wpel-link="external" target="_blank" rel="external noopener">I&#8217;m cited in the USF Maritime Law Journal</a> (alas a broken link as I write).  Yep, I&#8217;m a big mover &amp; shaker in the legal circle… which is to say, <a href="https://www.marisanelson.com" data-wpel-link="external" target="_blank" rel="external noopener">Marisa</a> had an article published there and thanked me for supporting her as she wrote it. 😉
<ul>
<li>And I get a mention on every single page on her website too, for taking <a href="https://web.archive.org/web/20170312175434/https://www.marisanelson.com/about/" data-wpel-link="external" target="_blank" rel="external noopener">one of the photos of her</a> on it.  Booyah!</li>
</ul>
</li>
<li>In reference to <a href="https://wadetregaskis.com/rotated-windows/" data-wpel-link="internal">my hacking on CoreGraphicsServices</a>, Nat! (no other name given, as far as I can see) wrote <a href="https://www.mulle-kybernetik.com/weblog/2004/apple_is_a_harsh_mistress_but.html" data-wpel-link="external" target="_blank" rel="external noopener">a journal entry</a> about how some people in the Apple community can be, well, wet towels.</li>
<li>A bajillion years ago I wrote <a href="https://sourceforge.net/projects/keychain/" data-wpel-link="external" target="_blank" rel="external noopener">the Keychain Framework</a>, a relatively clean &#8216;Cocoa&#8217; (Objective-C &amp; Foundation) framework that wrapped Apple&#8217;s C-based libraries for keychain access &amp; basic security functionality (which is in turn an implementation &amp; based on the <a href="https://web.archive.org/web/20170413002342/http://www.opengroup.org:80/security/l2-cdsa.htm" data-wpel-link="external" target="_blank" rel="external noopener">CDSA</a> &#8216;standard&#8217; that nobody but Apple appears to have ever actually implemented).  Anyway, <a href="https://www.malcolmhardie.com/sqleditor/releases/deployed/readme.html" data-wpel-link="external" target="_blank" rel="external noopener">apparently it&#8217;s used in SQLEditor</a>.  I&#8217;m pretty stoked &#8211; I sunk a spectacular amount of time into that framework, for very dubious benefit in hindsight. 😕</li>
<li>And another old pet project that shows up is <a href="https://sourceforge.net/projects/mailcash/" data-wpel-link="external" target="_blank" rel="external noopener">my Mailcash plug-in for Apple Mail</a>.  This was an implementation of <a href="http://www.hashcash.org" data-wpel-link="external" target="_blank" rel="external noopener">Hashcash</a>, which I still think is a neat idea for reducing email spam, by making senders &#8216;pay&#8217; for every email like a virtual stamp.  I have no idea if anyone ever really adopted it, nor if my Apple Mail plug-in still works at all.  Presumably not &#8211; I recall Apple Mail breaking plug-ins repeatedly over the last ten years or so, since I wrote Mailcash.
<ul>
<li>Oh how easy it is to date an open-source project when it&#8217;s still hosted on Sourceforge.  Poor, sad, lost-its-way Sourceforge.</li>
</ul>
</li>
</ul>
<p>Curiously, there&#8217;s several other open-source projects of mine on Sourceforge that <em>don&#8217;t</em> show up in a web search for my name:</p>
<ul>
<li><a href="https://sourceforge.net/projects/buildinstaller/" data-wpel-link="external" target="_blank" rel="external noopener">Build Installer</a>, a template for software installers that build the software from source on the user&#8217;s machine &#8211; assuming they&#8217;ve installed Apple&#8217;s developer tools, that is.  From memory this was inspired by the tedious and error-prone nature of various open-source projects, w.r.t. how they distributed &amp; installed their software on Mac OS X.  Sadly, nothing much has changed &#8211; there&#8217;s now <a href="https://brew.sh" data-wpel-link="external" target="_blank" rel="external noopener">brew</a> &amp; such package managers, but in my experience they make just as a big a mess as doing it manually &amp; ad-hoc did.</li>
<li><a href="https://sourceforge.net/projects/depc/" data-wpel-link="external" target="_blank" rel="external noopener">DePC</a>, a tool for stripping files of those nasty DOS-based file extensions, and instead setting the files&#8217; type &amp; creator codes correctly.  Sigh… I lost that battle.  To this day I still think that was a bad choice, that Apple made, to cave in to file extensions.  They&#8217;re still ugly and error-prone.</li>
<li><a href="https://sourceforge.net/projects/miss/" data-wpel-link="external" target="_blank" rel="external noopener">Mission to the ISS</a>, the horrible group project I did with various folks in university, for the CSE32PRO (3rd-year Computer Science Project) class.  Back in 2004, I&#8217;d guess, based on the open-source release being in January 2005.  That was a fun project in many ways, though the end result was a bit embarrassing &#8211; we ran out of time, during the class, to actually finish it properly, so for example the underlying algorithms that control the simulation are fundamentally step-based, but are stepped every time the user provides any input, so high user interaction makes the simulation run faster than intended, with silly and sometimes outright broken results.  Sad panda.</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/things-you-find-googling-yourself/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3865</post-id>	</item>
		<item>
		<title>SceneKit &#038; shaders</title>
		<link>https://wadetregaskis.com/scenekit-shaders/</link>
					<comments>https://wadetregaskis.com/scenekit-shaders/#comments</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Sat, 29 Dec 2012 08:11:36 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[SceneKit]]></category>
		<category><![CDATA[Snafu]]></category>
		<category><![CDATA[Undocumented]]></category>
		<guid isPermaLink="false">http://blog.wadetregaskis.com/?p=2622</guid>

					<description><![CDATA[Note: Since writing this originally I&#8217;ve figured out how to get at least some aspects of shaders working.  I&#8217;m still trying to flesh out the rest.  I&#8217;ll post an update or revised entry at some point. Ugh.  SceneKit supports shaders, technically.  But it&#8217;s almost unequivocally unusable.  Let me count the reasons: It doesn&#8217;t support geometry shaders&#8230; <a class="read-more-link" href="https://wadetregaskis.com/scenekit-shaders/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[<p><strong>Note</strong>: Since writing this originally I&#8217;ve figured out how to get at least some aspects of shaders working.  I&#8217;m still trying to flesh out the rest.  I&#8217;ll post an update or revised entry at some point.</p>
<p>Ugh.  SceneKit supports shaders, <em>technically</em>.  But it&#8217;s almost unequivocally unusable.  Let me count the reasons:</p>
<ol>
<li>It doesn&#8217;t support geometry shaders at all.</li>
<li>There&#8217;s absolutely no example code anywhere on the web.  Certainly none from Apple.</li>
<li>There&#8217;s essentially zero documentation.  Not even from 3rd parties.</li>
<li>You must set <em>both</em> a fragment and a vertex shader on every SCNProgram.  This is actually documented, though poorly, and the behaviour is certainly not intuitive.  It&#8217;s not hard to write a &#8220;no-op&#8221; version of either, but it&#8217;s stupid and it exacerbates all the other issues below.</li>
</ol>
<p>Those are just the warnings.  I should have paid heed.  Instead I decided to reverse-engineer it anyway.  Turns out it was a waste of time, because:</p>
<ol>
<li>Once you start using shaders, you lose all the functionality of SceneKit.  The most obvious being textures, but it&#8217;s actually everything &#8211; geometry, projections, positions &#8211; <em>everything</em>.  Now you must load and bind everything manually.  Vertices must be fed into your shader manually.  Everything is manual.  No intrinsics, no built-ins.  Stupidly simple things like gl_Color and gl_ModelViewProjectionMatrix are considered arbitrary and treated as uniforms, that must be bound manually.  And to do so you have to implement an Objective-C delegate method, so your performance is going to be shit unless they utilise IMP caching, in which case it&#8217;s merely going to be terrible.  I don&#8217;t understand how this could possibly be made to work.</li>
<li>Your shader is compiled not only once for every single material it&#8217;s used on, but<em> plus 50 percent</em>.  i.e. if you create a single SCNProgram and assign it to 100 distinct SCNMaterials (each on their own unique SCNNode), SceneKit will compile both the vertex &amp; fragment shaders 150 times each.  This only makes sense when you consider it in the context of the above observation; all the SceneKit objects your shaders happen to hang off are completely irrelevant.  So of course each use is treated as a completely independent shader, because each one has to be completely setup manually.  Though I have no idea what the extra 50% are about.</li>
<li>Since your shader is not shared between materials or nodes, it gets set up and torn down once for every single drawable.  Every SCNNode.  So you get ~twenty OpenGL calls <em>minimum</em> per drawable.  Admittedly some of these are SceneKits usual drawing commands, but most are related to the shader, and include gems like resetting the blend function every single time, and glMatrixMode + glPopMatrix + glMatrixMode + glPushMatrix in sequence, repeated, for the same matrix &amp; value (the identity matrix, naturally).</li>
</ol>
<p>As far as I can tell, if you want to use any shaders at all, you can&#8217;t use SceneKit.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/scenekit-shaders/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2622</post-id>	</item>
		<item>
		<title>SCNSphere can be expensive to recreate</title>
		<link>https://wadetregaskis.com/scnsphere-can-be-expensive-to-recreate/</link>
					<comments>https://wadetregaskis.com/scnsphere-can-be-expensive-to-recreate/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Thu, 27 Dec 2012 08:52:53 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[SceneKit]]></category>
		<guid isPermaLink="false">http://blog.wadetregaskis.com/?p=2616</guid>

					<description><![CDATA[In a current project I&#8217;m drawing hundreds of spheres, of varying sizes.  I discovered at one point that with them all in view simultaneously, performance was very bad (&#60;10 FPS on my 6970M).  Trial and error revealed that changing the geometry complexity &#8211; by changing the segment count of my spheres &#8211; made a huge difference.&#8230; <a class="read-more-link" href="https://wadetregaskis.com/scnsphere-can-be-expensive-to-recreate/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[<p>In a current project I&#8217;m drawing hundreds of spheres, of varying sizes.  I discovered at one point that with them all in view simultaneously, performance was very bad (&lt;10 FPS on my 6970M).  Trial and error revealed that changing the geometry complexity &#8211; by changing the segment count of my spheres &#8211; made a huge difference.  Seems logical.</p>
<p>Unfortunately, it turns out frequently recreating that geometry (as is necessary each time you change the segmentCount of an SCNSphere) is not cheap.  So I went from a consistent but low frame rate to a fast but wildly varying frame rate &#8211; with stutters of a second or more at a time.  Ick.  It seems the GPU can handle that &#8211; the bandwidth involved is pretty tiny, and I don&#8217;t have any relevant latency concerns [yet], but the CPU cost is substantial.</p>
<p>An obvious thought is to create multiple versions of each sphere, one for each desired segmentCount, and then swap them in and out on demand.  This does actually work &#8220;fine&#8221;, though I worry about its efficiency &#8211; I haven&#8217;t yet measured the RAM cost of the cached geometry, let alone what impact it might have on the OpenGL side (e.g. does it store every one in an FBO for the lifetime of the SCNSphere? OpenGL Profiler shows a <em>lot</em> of FBOs active at one time).</p>
<p>The best solution would probably be a geometry shader to perform the generation on the fly (or tessellation in some form).  Unfortunately SceneKit doesn&#8217;t currently support geometry shaders.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/scnsphere-can-be-expensive-to-recreate/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2616</post-id>	</item>
		<item>
		<title>-[SCNView hitTest:options:] doesn&#8217;t work correctly for orthographic projections</title>
		<link>https://wadetregaskis.com/scnview-hittestoptions-doesnt-work-correctly-for-orthographic-projections/</link>
					<comments>https://wadetregaskis.com/scnview-hittestoptions-doesnt-work-correctly-for-orthographic-projections/#comments</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Mon, 17 Dec 2012 05:33:21 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Bugs!]]></category>
		<category><![CDATA[SceneKit]]></category>
		<guid isPermaLink="false">http://blog.wadetregaskis.com/?p=2611</guid>

					<description><![CDATA[How frustrating it was to find this out.  Luckily, it didn&#8217;t take long to realise that there was a pattern to its madness.  It turns out it&#8217;s not taking into account the scale of the projection (as set by the camera node&#8217;s scale property).  So you can fudge the location appropriately to work around the&#8230; <a class="read-more-link" href="https://wadetregaskis.com/scnview-hittestoptions-doesnt-work-correctly-for-orthographic-projections/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p>How frustrating it was to find this out.  Luckily, it didn&#8217;t take long to realise that there was a pattern to its madness.  It turns out it&#8217;s not taking into account the scale of the projection (as set by the camera node&#8217;s <code>scale</code> property).  So you can fudge the location appropriately to work around the bug, using code like:</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-disabled" data-code-block-pro-font-family="" style="font-size:.875rem;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><pre class="shiki light-plus" style="background-color: #FFFFFF" tabindex="0"><code><span class="line"><span style="color: #000000">- (</span><span style="color: #0000FF">void</span><span style="color: #000000">)mouseDown:(</span><span style="color: #267F99">NSEvent</span><span style="color: #000000">*)theEvent {</span></span>
<span class="line"><span style="color: #000000">    </span><span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #267F99">NSPoint</span><span style="color: #000000"> locationInView = [</span><span style="color: #0000FF">self</span><span style="color: #000000"> </span><span style="color: #795E26">convertPoint:</span><span style="color: #000000">[theEvent </span><span style="color: #795E26">locationInWindow</span><span style="color: #000000">] </span><span style="color: #795E26">fromView:</span><span style="color: #0000FF">nil</span><span style="color: #000000">];</span></span>
<span class="line"><span style="color: #000000">    </span><span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #267F99">NSSize</span><span style="color: #000000"> boundsSize = </span><span style="color: #0000FF">self</span><span style="color: #000000">.</span><span style="color: #001080">bounds</span><span style="color: #000000">.</span><span style="color: #001080">size</span><span style="color: #000000">;</span></span>
<span class="line"><span style="color: #000000">    </span><span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #267F99">NSPoint</span><span style="color: #000000"> fudgedLocationInView = </span><span style="color: #795E26">NSMakePoint</span><span style="color: #000000">((</span><span style="color: #001080">boundsSize</span><span style="color: #000000">.</span><span style="color: #001080">width</span><span style="color: #000000"> / </span><span style="color: #098658">2.0</span><span style="color: #000000">)</span></span>
<span class="line"><span style="color: #000000">                                                      + ((</span><span style="color: #001080">locationInView</span><span style="color: #000000">.</span><span style="color: #001080">x</span><span style="color: #000000"> - (</span><span style="color: #001080">boundsSize</span><span style="color: #000000">.</span><span style="color: #001080">width</span><span style="color: #000000"> / </span><span style="color: #098658">2.0</span><span style="color: #000000">))</span></span>
<span class="line"><span style="color: #000000">                                                         * </span><span style="color: #0000FF">self</span><span style="color: #000000">.</span><span style="color: #001080">pointOfView</span><span style="color: #000000">.</span><span style="color: #001080">scale</span><span style="color: #000000">.</span><span style="color: #001080">x</span><span style="color: #000000">),</span></span>
<span class="line"><span style="color: #000000">                                                     (</span><span style="color: #001080">boundsSize</span><span style="color: #000000">.</span><span style="color: #001080">height</span><span style="color: #000000"> / </span><span style="color: #098658">2.0</span><span style="color: #000000">)</span></span>
<span class="line"><span style="color: #000000">                                                      + ((</span><span style="color: #001080">locationInView</span><span style="color: #000000">.</span><span style="color: #001080">y</span><span style="color: #000000"> - (</span><span style="color: #001080">boundsSize</span><span style="color: #000000">.</span><span style="color: #001080">height</span><span style="color: #000000"> / </span><span style="color: #098658">2.0</span><span style="color: #000000">))</span></span>
<span class="line"><span style="color: #000000">                                                         * </span><span style="color: #0000FF">self</span><span style="color: #000000">.</span><span style="color: #001080">pointOfView</span><span style="color: #000000">.</span><span style="color: #001080">scale</span><span style="color: #000000">.</span><span style="color: #001080">y</span><span style="color: #000000">));</span></span>
<span class="line"></span>
<span class="line"><span style="color: #000000">    </span><span style="color: #795E26">NSLog</span><span style="color: #000000">(</span><span style="color: #A31515">@&quot;Real location = {</span><span style="color: #001080">%f</span><span style="color: #A31515">, </span><span style="color: #001080">%f</span><span style="color: #A31515">}. Bounds size = {</span><span style="color: #001080">%f</span><span style="color: #A31515">, </span><span style="color: #001080">%f</span><span style="color: #A31515">} and scale is </span><span style="color: #001080">%f</span><span style="color: #A31515">, therefore translating perceived location to {</span><span style="color: #001080">%f</span><span style="color: #A31515">, </span><span style="color: #001080">%f</span><span style="color: #A31515">} in order to work around SceneKit bug (rdar://12890554)&quot;</span><span style="color: #000000">,</span></span>
<span class="line"><span style="color: #000000">          </span><span style="color: #001080">locationInView</span><span style="color: #000000">.</span><span style="color: #001080">x</span><span style="color: #000000">,</span></span>
<span class="line"><span style="color: #000000">          </span><span style="color: #001080">locationInView</span><span style="color: #000000">.</span><span style="color: #001080">y</span><span style="color: #000000">,</span></span>
<span class="line"><span style="color: #000000">          </span><span style="color: #001080">boundsSize</span><span style="color: #000000">.</span><span style="color: #001080">width</span><span style="color: #000000">,</span></span>
<span class="line"><span style="color: #000000">          </span><span style="color: #001080">boundsSize</span><span style="color: #000000">.</span><span style="color: #001080">height</span><span style="color: #000000">,</span></span>
<span class="line"><span style="color: #000000">          </span><span style="color: #0000FF">self</span><span style="color: #000000">.</span><span style="color: #001080">pointOfView</span><span style="color: #000000">.</span><span style="color: #001080">scale</span><span style="color: #000000">.</span><span style="color: #001080">x</span><span style="color: #000000">,</span></span>
<span class="line"><span style="color: #000000">          </span><span style="color: #001080">fudgedLocationInView</span><span style="color: #000000">.</span><span style="color: #001080">x</span><span style="color: #000000">,</span></span>
<span class="line"><span style="color: #000000">          </span><span style="color: #001080">fudgedLocationInView</span><span style="color: #000000">.</span><span style="color: #001080">y</span><span style="color: #000000">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #000000">    </span><span style="color: #267F99">NSArray</span><span style="color: #000000"> *clickedObjects = [</span><span style="color: #0000FF">self</span><span style="color: #000000"> </span><span style="color: #795E26">hitTest:</span><span style="color: #000000">fudgedLocationInView </span><span style="color: #795E26">options:</span><span style="color: #0000FF">nil</span><span style="color: #000000">];</span></span>
<span class="line"><span style="color: #000000">    </span></span>
<span class="line"><span style="color: #000000">    …</span></span>
<span class="line"><span style="color: #000000">}</span></span></code></pre></div>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/scnview-hittestoptions-doesnt-work-correctly-for-orthographic-projections/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2611</post-id>	</item>
		<item>
		<title>SCNView can have overlapping views, but only if layer-backed</title>
		<link>https://wadetregaskis.com/scnview-can-have-overlapping-views-but-only-if-layer-backed/</link>
					<comments>https://wadetregaskis.com/scnview-can-have-overlapping-views-but-only-if-layer-backed/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Sun, 16 Dec 2012 04:07:16 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[SceneKit]]></category>
		<guid isPermaLink="false">http://blog.wadetregaskis.com/?p=2606</guid>

					<description><![CDATA[In fact I&#8217;m pretty sure this behaviour dates back to NSOpenGLView and possibly others.  I suppose technically this has always been the case; that overlapping views weren&#8217;t supported at all before layer-backing.  But I had forgotten, so it took a little bit of experimenting to jog my memory. It&#8217;s interesting that when not layer-backed, all&#8230; <a class="read-more-link" href="https://wadetregaskis.com/scnview-can-have-overlapping-views-but-only-if-layer-backed/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p>In fact I&#8217;m pretty sure this behaviour dates back to <code>NSOpenGLView</code> and possibly others.  I suppose technically this has always been the case; that overlapping views weren&#8217;t supported at all before layer-backing.  But I had forgotten, so it took a little bit of experimenting to jog my memory.</p>



<p>It&#8217;s interesting that when not layer-backed, all that happens is that the <code>SCNView</code> draws over any overlapping views.  If its background colour is transparent you can actually see the views overlapping it.  In any case, they can receive events just fine.</p>



<p>Tangentially, that you can use translucency to reveal other views &#8220;underneath&#8221; your <code>SCNView</code> is interesting.  You could use it to present a relatively fixed backdrop for your 3D world, for example, rather than having to deal with actual <code>SCNNode</code>s and camera movement and all that.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/scnview-can-have-overlapping-views-but-only-if-layer-backed/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2606</post-id>	</item>
		<item>
		<title>+[SCNTransaction setCompletionBlock:] always invokes the block immediately</title>
		<link>https://wadetregaskis.com/scntransaction-setcompletionblock-always-invokes-the-block-immediately/</link>
					<comments>https://wadetregaskis.com/scntransaction-setcompletionblock-always-invokes-the-block-immediately/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Tue, 27 Nov 2012 17:59:01 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Bugs!]]></category>
		<category><![CDATA[SceneKit]]></category>
		<category><![CDATA[Undocumented]]></category>
		<guid isPermaLink="false">http://blog.wadetregaskis.com/?p=2597</guid>

					<description><![CDATA[It&#8217;s supposed to invoke your block when all the animations in the current transaction have completed. It doesn&#8217;t; it runs it as soon as the transaction is committed. Le sigh. It does appear to do it from the main runloop at least, as documented. So there is technically a delay, as a consequence of that&#8230; <a class="read-more-link" href="https://wadetregaskis.com/scntransaction-setcompletionblock-always-invokes-the-block-immediately/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p>It&#8217;s supposed to invoke your block when all the animations in the current transaction have completed. It doesn&#8217;t; it runs it as soon as the transaction is committed. Le sigh.</p>



<p>It does appear to do it from the main runloop at least, as documented. So there is technically a delay, as a consequence of that scheduling. Not helpful though.</p>



<p><strong>Update</strong>: turns out that you have to set the completion block <em>before</em> calling <code>+[SCNTransaction begin]</code>.  Grrr.  Undocumented behaviour #bajillion+1.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/scntransaction-setcompletionblock-always-invokes-the-block-immediately/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2597</post-id>	</item>
		<item>
		<title>+[SCNTransaction setDisableActions:] does nothing between begin/commit</title>
		<link>https://wadetregaskis.com/scntransaction-setdisableactions-does-nothing-between-begincommit/</link>
					<comments>https://wadetregaskis.com/scntransaction-setdisableactions-does-nothing-between-begincommit/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Tue, 27 Nov 2012 17:55:37 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Bugs!]]></category>
		<category><![CDATA[SceneKit]]></category>
		<category><![CDATA[Undocumented]]></category>
		<guid isPermaLink="false">http://blog.wadetregaskis.com/?p=2595</guid>

					<description><![CDATA[Obnoxious undocumented behaviour #bajillion: you can&#8217;t disable implicit animation with setDisableActions: inbetween begin &#38; commit on the same SCNTransaction. It just doesn&#8217;t work. Update: &#160;rdar://problem/12758940]]></description>
										<content:encoded><![CDATA[
<p>Obnoxious undocumented behaviour #bajillion: you can&#8217;t disable implicit animation with <code>setDisableActions:</code> inbetween begin &amp; commit on the same <code>SCNTransaction</code>. It just doesn&#8217;t work.</p>



<p><strong>Update:</strong> &nbsp;<a href="rdar://problem/12758940" data-wpel-link="internal">rdar://problem/12758940</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/scntransaction-setdisableactions-does-nothing-between-begincommit/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2595</post-id>	</item>
		<item>
		<title>SCNView frame rate</title>
		<link>https://wadetregaskis.com/scnview-frame-rate/</link>
					<comments>https://wadetregaskis.com/scnview-frame-rate/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Thu, 22 Nov 2012 06:32:55 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[SceneKit]]></category>
		<guid isPermaLink="false">http://blog.wadetregaskis.com/?p=2584</guid>

					<description><![CDATA[There&#8217;s no API to get any kind of performance information from an SCNView, even as basic as a rolling frame rate.  But it&#8217;s not hard to add &#8211; you can be notified when each frame is drawn by overriding the -draw method.  For example: Update:However, if you&#8217;re layer-backed the &#8220;draw&#8221; method isn&#8217;t used. Instead you&#8230; <a class="read-more-link" href="https://wadetregaskis.com/scnview-frame-rate/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p>There&#8217;s no API to get any kind of performance information from an <code>SCNView</code>, even as basic as a rolling frame rate.  But it&#8217;s not hard to add &#8211; you can be notified when each frame is drawn by overriding the <code>-draw</code> method.  For example:</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-disabled" data-code-block-pro-font-family="" style="font-size:.875rem;line-height:1.25rem;--cbp-tab-width:4;tab-size:var(--cbp-tab-width, 2)"><pre class="shiki light-plus" style="background-color: #FFFFFF" tabindex="0"><code><span class="line"><span style="color: #267F99">NSDate</span><span style="color: #000000"> *nextFrameCounterReset;</span></span>
<span class="line"><span style="color: #267F99">NSUInteger</span><span style="color: #000000"> frameCount;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #000000">- (</span><span style="color: #0000FF">void</span><span style="color: #000000">)draw {</span></span>
<span class="line"><span style="color: #000000">    </span><span style="color: #267F99">NSDate</span><span style="color: #000000"> *now = [</span><span style="color: #267F99">NSDate</span><span style="color: #000000"> </span><span style="color: #795E26">date</span><span style="color: #000000">];</span></span>
<span class="line"></span>
<span class="line"><span style="color: #000000">    </span><span style="color: #AF00DB">if</span><span style="color: #000000"> (nextFrameCounterReset) {</span></span>
<span class="line"><span style="color: #000000">        </span><span style="color: #AF00DB">if</span><span style="color: #000000"> (NSOrderedDescending == [now </span><span style="color: #795E26">compare:</span><span style="color: #000000">nextFrameCounterReset]) {</span></span>
<span class="line"><span style="color: #000000">            [frameRateView </span><span style="color: #795E26">setLabel:</span><span style="color: #000000">frameCount];</span></span>
<span class="line"><span style="color: #000000">            frameCount = </span><span style="color: #098658">0</span><span style="color: #000000">;</span></span>
<span class="line"><span style="color: #000000">            nextFrameCounterReset = [now </span><span style="color: #795E26">dateByAddingTimeInterval:</span><span style="color: #098658">1.0</span><span style="color: #000000">];</span></span>
<span class="line"><span style="color: #000000">        }</span></span>
<span class="line"><span style="color: #000000">    } </span><span style="color: #AF00DB">else</span><span style="color: #000000"> {</span></span>
<span class="line"><span style="color: #000000">        nextFrameCounterReset = [now </span><span style="color: #795E26">dateByAddingTimeInterval:</span><span style="color: #098658">1.0</span><span style="color: #000000">];</span></span>
<span class="line"><span style="color: #000000">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #000000">    ++frameCount;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #000000">    [</span><span style="color: #0000FF">super</span><span style="color: #000000"> </span><span style="color: #795E26">draw</span><span style="color: #000000">];</span></span>
<span class="line"><span style="color: #000000">}</span></span></code></pre></div>



<p><strong>Update:</strong><br>However, if you&#8217;re layer-backed the &#8220;draw&#8221; method isn&#8217;t used. Instead you can override:</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-disabled" data-code-block-pro-font-family="" style="font-size:.875rem;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><pre class="shiki light-plus" style="background-color: #FFFFFF" tabindex="0"><code><span class="line"><span style="color: #000000">- (</span><span style="color: #0000FF">void</span><span style="color: #000000">)drawInBackingLayerWithCGLContext:(CGLContextObj)arg1;</span></span></code></pre></div>



<p>Like so:</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-disabled" data-code-block-pro-font-family="" style="font-size:.875rem;line-height:1.25rem;--cbp-tab-width:4;tab-size:var(--cbp-tab-width, 2)"><pre class="shiki light-plus" style="background-color: #FFFFFF" tabindex="0"><code><span class="line"><span style="color: #267F99">NSDate</span><span style="color: #000000"> *nextFrameCounterReset;</span></span>
<span class="line"><span style="color: #267F99">NSUInteger</span><span style="color: #000000"> frameCount;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #000000">- (</span><span style="color: #0000FF">void</span><span style="color: #000000">)drawInBackingLayerWithCGLContext:(CGLContextObj)arg1 {</span></span>
<span class="line"><span style="color: #000000">    </span><span style="color: #267F99">NSDate</span><span style="color: #000000"> *now = [</span><span style="color: #267F99">NSDate</span><span style="color: #000000"> </span><span style="color: #795E26">date</span><span style="color: #000000">];</span></span>
<span class="line"></span>
<span class="line"><span style="color: #000000">    </span><span style="color: #AF00DB">if</span><span style="color: #000000"> (nextFrameCounterReset) {</span></span>
<span class="line"><span style="color: #000000">        </span><span style="color: #AF00DB">if</span><span style="color: #000000"> (NSOrderedDescending == [now </span><span style="color: #795E26">compare:</span><span style="color: #000000">nextFrameCounterReset]) {</span></span>
<span class="line"><span style="color: #000000">            [frameRateView </span><span style="color: #795E26">setLabel:</span><span style="color: #000000">frameCount];</span></span>
<span class="line"><span style="color: #000000">            frameCount = </span><span style="color: #098658">0</span><span style="color: #000000">;</span></span>
<span class="line"><span style="color: #000000">            nextFrameCounterReset = [now </span><span style="color: #795E26">dateByAddingTimeInterval:</span><span style="color: #098658">1.0</span><span style="color: #000000">];</span></span>
<span class="line"><span style="color: #000000">        }</span></span>
<span class="line"><span style="color: #000000">    } </span><span style="color: #AF00DB">else</span><span style="color: #000000"> {</span></span>
<span class="line"><span style="color: #000000">        nextFrameCounterReset = [now </span><span style="color: #795E26">dateByAddingTimeInterval:</span><span style="color: #098658">1.0</span><span style="color: #000000">];</span></span>
<span class="line"><span style="color: #000000">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #000000">    ++frameCount;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #000000">    [</span><span style="color: #0000FF">super</span><span style="color: #000000"> </span><span style="color: #795E26">draw</span><span style="color: #000000">];</span></span>
<span class="line"><span style="color: #000000">}</span></span></code></pre></div>



<p>But don&#8217;t. Because in actual fact you can get this information via supported API &#8211; the <code>SCNSceneRendererDelegate</code> protocol.  You can register your view as its own delegate, or put your frame rate calculation in another object.  Either way, your code should look something like:</p>



<div class="wp-block-kevinbatdorf-code-block-pro padding-disabled" data-code-block-pro-font-family="" style="font-size:.875rem;line-height:1.25rem;--cbp-tab-width:4;tab-size:var(--cbp-tab-width, 2)"><pre class="shiki light-plus" style="background-color: #FFFFFF" tabindex="0"><code><span class="line"><span style="color: #267F99">NSDate</span><span style="color: #000000"> *nextFrameCounterReset;</span></span>
<span class="line"><span style="color: #267F99">NSUInteger</span><span style="color: #000000"> frameCount;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #000000">- (</span><span style="color: #0000FF">void</span><span style="color: #000000">)renderer:(</span><span style="color: #0000FF">id</span><span style="color: #000000">&lt;SCNSceneRenderer&gt;)aRenderer</span></span>
<span class="line"><span style="color: #000000">  didRenderScene:(SCNScene*)scene</span></span>
<span class="line"><span style="color: #000000">          atTime:(</span><span style="color: #267F99">NSTimeInterval</span><span style="color: #000000">)time {</span></span>
<span class="line"><span style="color: #000000">    </span><span style="color: #267F99">NSDate</span><span style="color: #000000"> *now = [</span><span style="color: #267F99">NSDate</span><span style="color: #000000"> </span><span style="color: #795E26">date</span><span style="color: #000000">];</span></span>
<span class="line"></span>
<span class="line"><span style="color: #000000">    </span><span style="color: #AF00DB">if</span><span style="color: #000000"> (nextFrameCounterReset) {</span></span>
<span class="line"><span style="color: #000000">        </span><span style="color: #AF00DB">if</span><span style="color: #000000"> (NSOrderedDescending == [now </span><span style="color: #795E26">compare:</span><span style="color: #000000">nextFrameCounterReset]) {</span></span>
<span class="line"><span style="color: #000000">            [frameRateView </span><span style="color: #795E26">setLabel:</span><span style="color: #000000">frameCount];</span></span>
<span class="line"><span style="color: #000000">            frameCount = </span><span style="color: #098658">0</span><span style="color: #000000">;</span></span>
<span class="line"><span style="color: #000000">            nextFrameCounterReset = [now </span><span style="color: #795E26">dateByAddingTimeInterval:</span><span style="color: #098658">1.0</span><span style="color: #000000">];</span></span>
<span class="line"><span style="color: #000000">        }</span></span>
<span class="line"><span style="color: #000000">    } </span><span style="color: #AF00DB">else</span><span style="color: #000000"> {</span></span>
<span class="line"><span style="color: #000000">        nextFrameCounterReset = [now </span><span style="color: #795E26">dateByAddingTimeInterval:</span><span style="color: #098658">1.0</span><span style="color: #000000">];</span></span>
<span class="line"><span style="color: #000000">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #000000">    ++frameCount;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #000000">    [</span><span style="color: #0000FF">super</span><span style="color: #000000"> </span><span style="color: #795E26">draw</span><span style="color: #000000">];</span></span>
<span class="line"><span style="color: #000000">}</span></span></code></pre></div>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/scnview-frame-rate/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2584</post-id>	</item>
		<item>
		<title>SCNGeometrys can be shared by multiple SCNNodes</title>
		<link>https://wadetregaskis.com/scngeometrys-can-be-shared-by-multiple-scnnodes/</link>
					<comments>https://wadetregaskis.com/scngeometrys-can-be-shared-by-multiple-scnnodes/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Thu, 22 Nov 2012 06:02:03 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[SceneKit]]></category>
		<guid isPermaLink="false">http://blog.wadetregaskis.com/?p=2578</guid>

					<description><![CDATA[It&#8217;s not explicitly documented either way, but it is perfectly valid, evidently, to attach the same SCNGeometry to multiple SCNNodes.  Works as you&#8217;d expect &#8211; changes to the geometry are reflected across all the nodes identically. It doesn&#8217;t appear to have any performance impact though, oddly. &#160;At least not in fairly trivial scenes. &#160;It might&#8230; <a class="read-more-link" href="https://wadetregaskis.com/scngeometrys-can-be-shared-by-multiple-scnnodes/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p>It&#8217;s not explicitly documented either way, but it is perfectly valid, evidently, to attach the same <code>SCNGeometry</code> to multiple <code>SCNNode</code>s.  Works as you&#8217;d expect &#8211; changes to the geometry are reflected across all the nodes identically.</p>



<p>It doesn&#8217;t appear to have any performance impact though, oddly. &nbsp;At least not in fairly trivial scenes. &nbsp;It might be that it uses more RAM (and VRAM) for the duplicates behind the scenes; the geometry in my testing isn&#8217;t complicated enough for that to matter.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/scngeometrys-can-be-shared-by-multiple-scnnodes/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2578</post-id>	</item>
		<item>
		<title>CAAnimations can be applied to multiple SCNNodes concurrently</title>
		<link>https://wadetregaskis.com/caanimations-can-be-applied-to-multiple-scnnodes-concurrently/</link>
					<comments>https://wadetregaskis.com/caanimations-can-be-applied-to-multiple-scnnodes-concurrently/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Tue, 20 Nov 2012 07:09:11 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[SceneKit]]></category>
		<guid isPermaLink="false">http://blog.wadetregaskis.com/?p=2576</guid>

					<description><![CDATA[You can create a CAAnimation and hand it to -[SCNNode addAnimation:forKey:] on as many nodes as you want.  No apparent side-effects.  I just couldn&#8217;t find this documented anywhere.]]></description>
										<content:encoded><![CDATA[
<p>You can create a <code>CAAnimation</code> and hand it to <code>-[SCNNode addAnimation:forKey:]</code> on as many nodes as you want.  No apparent side-effects.  I just couldn&#8217;t find this documented anywhere.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/caanimations-can-be-applied-to-multiple-scnnodes-concurrently/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2576</post-id>	</item>
		<item>
		<title>Animations only work when the node is already in the scene</title>
		<link>https://wadetregaskis.com/animations-only-work-when-the-node-is-already-in-the-scene/</link>
					<comments>https://wadetregaskis.com/animations-only-work-when-the-node-is-already-in-the-scene/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Tue, 20 Nov 2012 06:50:56 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[SceneKit]]></category>
		<guid isPermaLink="false">http://blog.wadetregaskis.com/?p=2573</guid>

					<description><![CDATA[If you try to add an animation to an SCNNode that&#8217;s not yet part of a scene graph, nothing will happen.  It won&#8217;t give any indication of failing, and the performance of rendering implies it&#8217;s still running them, but there will be no visible effect.  So, addChildNode: and then addAnimation:forKey:.]]></description>
										<content:encoded><![CDATA[
<p>If you try to add an animation to an <code>SCNNode</code> that&#8217;s not yet part of a scene graph, nothing will happen.  It won&#8217;t give any indication of failing, and the performance of rendering implies it&#8217;s still running them, but there will be no visible effect.  So, <code>addChildNode:</code> and <em>then</em> <code>addAnimation:forKey:</code>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/animations-only-work-when-the-node-is-already-in-the-scene/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2573</post-id>	</item>
		<item>
		<title>SCNView may change your point of view</title>
		<link>https://wadetregaskis.com/scnview-may-change-your-point-of-view/</link>
					<comments>https://wadetregaskis.com/scnview-may-change-your-point-of-view/#respond</comments>
		
		<dc:creator><![CDATA[]]></dc:creator>
		<pubDate>Sat, 17 Nov 2012 06:00:20 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Bugs!]]></category>
		<category><![CDATA[SceneKit]]></category>
		<guid isPermaLink="false">http://blog.wadetregaskis.com/?p=2532</guid>

					<description><![CDATA[Ugh&#8230; SceneKit is both promising and frustrating. &#160;It appears to be a very stereotypical case of &#8220;version 1&#8221; syndrome &#8211; nice idea, flaky implementation and very skimpy documentation. So amongst the many strange, undocumented foibles it has, one in particular is quite egregious.  When you add an SCNNode to your SCNView-rendered scene, containing an SCNCamera, the&#8230; <a class="read-more-link" href="https://wadetregaskis.com/scnview-may-change-your-point-of-view/" data-wpel-link="internal">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p>Ugh&#8230; SceneKit is both promising and frustrating. &nbsp;It appears to be a very stereotypical case of &#8220;version 1&#8221; syndrome &#8211; nice idea, flaky implementation and very skimpy documentation.</p>



<p>So amongst the many strange, undocumented foibles it has, one in particular is quite egregious.  When you add an <code>SCNNode</code> to your <code>SCNView</code>-rendered scene, containing an <code>SCNCamera</code>, the <code>pointOfView</code> property of the <code>SCNView</code> is magically updated to point to it.  Pretty cool.  I&#8217;m not sure when &#8211; not when it&#8217;s added to the scene, that&#8217;s for sure&#8230; perhaps when the scene next draws, and find it doesn&#8217;t have a <code>pointOfView</code> assigned yet?</p>



<p>Anyway, so far so good.  What&#8217;s not good is when you switch apps and come back to find your camera hasn&#8217;t visibly moved &#8211; your scene renders as you left it &#8211; yet none of your camera controls work anymore.  WTF?  An hour of <code>NSLog</code>s and lldb tedium later, and I discover that the <code>pointOfView</code> has been &#8220;magically&#8221; changed to some other node.  This other node doesn&#8217;t appear in the scene, wasn&#8217;t created by me, still has my <code>SCNCamera</code> attached to it &#8211; I hope it&#8217;s not fighting with my real <code>SCNNode</code>, which still thinks it owns the camera &#8211; and has no identity other than the name <code>kSCNFreeViewCameraName</code>.</p>



<p>What&#8217;s weirdest in all this is that it only happens if you switch apps in a certain way. &nbsp;Command-tab or clicking on another window won&#8217;t do it, but clicking on an app in the dock will. &nbsp;WTF?</p>



<p><strong>Update:</strong> this only happens if the &#8220;Allow Camera Control&#8221; property is set on the <code>SCNView</code>.  It appears it&#8217;s not the changing of apps or focus or anything else that triggers this bug &#8211; perhaps better dubbed &#8220;a deliberate but poor design choice&#8221;, given this new information &#8211; but rather a mouse event arriving at the view.  I&#8217;m not sure how you&#8217;re supposed to deal with that&#8230; I guess if you&#8217;re doing <em>any</em> custom camera work yourself, you&#8217;ll just have to turn that property off.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://wadetregaskis.com/scnview-may-change-your-point-of-view/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2532</post-id>	</item>
	</channel>
</rss>
