bugfix: better nav

This commit is contained in:
Leon van Kammen 2024-02-16 16:34:32 +00:00
parent a539559ae9
commit bc25f7fdf1
15 changed files with 2239 additions and 647 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -320,8 +320,8 @@ That way, if the link gets shared, the XR Fragments implementation at <code>http
<tr>
<td><a href="https://www.w3.org/TR/media-frags/">W3C Media Fragments</a></td>
<td><a href="#media%20fragments%20and%20datatypes">media fragment</a></td>
<td><code>#t=0,2</code> <code>#xywh</code></td>
<td>play/loop 3D animation from 0 seconds till 2 seconds</td>
<td><code>#t=0,2&amp;loop</code></td>
<td>play (and loop) 3D animation from 0 seconds till 2 seconds</td>
</tr>
<tr>
@ -448,6 +448,14 @@ That way, if the link gets shared, the XR Fragments implementation at <code>http
<td><code>#foo=bar</code></td>
<td>sets <a href="https://www.rfc-editor.org/rfc/rfc6570">URI Template</a> variable <code>foo</code> to the value <code>#t=0</code> from <strong>existing</strong> object metadata (<code>bar</code>:<code>#t=0</code> e.g.), This allows for reactive <a href="https://www.rfc-editor.org/rfc/rfc6570">URI Template</a> defined in object metadata elsewhere (<code>src</code>:<code>://m.com/cat.mp4#{foo}</code> e.g., to play media using <a href="https://www.w3.org/TR/media-frags/#valid-uri">media fragment URI</a>). NOTE: metadata-key should not start with <code>#</code></td>
</tr>
<tr>
<td><strong>ANIMATION</strong></td>
<td><code>#&lt;tag_or_objectname&gt;=&lt;animationname&gt;</code></td>
<td>string=string</td>
<td><code>#people=walk</code> <code>#people=noanim</code></td>
<td>assign a different animation to object(s)</td>
</tr>
</tbody>
</table>
@ -546,13 +554,14 @@ That way, if the link gets shared, the XR Fragments implementation at <code>http
</tr>
<tr>
<td>media parameter (shader uniform)</td>
<td>u:<uniform>=<string</td>
<td>float</td>
<td>vec2</td>
<td></td>
<td></td>
<td>+0.5,+0.5</td>
<td>scroll instantly by adding 0.5 to the current uv coordinates</td>
</tr>
</tbody>
</table>
<p>| media parameter (shader uniform) | u:<uniform>=<string|float|vec2|vec3|vec4> | u:color=1,0,0 | set shader uniform value |</p>
<blockquote>
<p>* = this is extending the <a href="https://www.w3.org/TR/media-frags/#mf-advanced">W3C media fragments</a> with (missing) playback/viewport-control. Normally <code>#t=0,2</code> implies setting start/stop-values AND starting playback, whereas <code>#s=0&amp;loop</code> allows pausing a video, speeding up/slowing down media, as well as enabling/disabling looping.</p>
@ -666,7 +675,7 @@ For example, to render a portal with a preview-version of the scene, create an 3
<li>the Y-coordinate of <code>pos</code> identifies the floorposition. This means that desktop-projections usually need to add 1.5m (average person height) on top (which is done automatically by VR/AR headsets).</li>
<li>set the position of the camera accordingly to the vector3 values of <code>#pos</code></li>
<li><code>rot</code> sets the rotation of the camera (only for non-VR/AR headsets)</li>
<li><code>t</code> sets the playbackspeed and animation-range of the current scene animation(s) or <code>src</code>-mediacontent (video/audioframes e.g., use <code>t=0,7,7</code> to &lsquo;STOP&rsquo; at frame 7 e.g.)</li>
<li><code>t</code> in the top-URL sets the playbackspeed and animation-range of the global scene animation</li>
<li>after scene load: in case an <code>href</code> does not mention any <code>pos</code>-coordinate, <code>pos=0,0,0</code> will be assumed</li>
</ol>
@ -825,6 +834,8 @@ Resizing will be happen accordingly to its placeholder object <code>aquariumcube
<li><p>ignore previous rule in special cases, like clicking an <code>href</code> using camera-portal collision (the back-button would cause a teleport-loop)</p></li>
<li><p>href-events should bubble upward the node-tree</p></li>
<li><p>the end-user navigator back/forward buttons should repeat a back/forward action until a <code>pos=...</code> primitive is found (the inbetween interaction URI&rsquo;s are only for UX research purposes)</p></li>
</ol>
<p><a href="https://github.com/coderofsalvation/xrfragment/blob/main/src/3rd/js/three/xrf/href.js">» example implementation</a><br>

View File

@ -278,6 +278,8 @@ These are automatic fragment-to-metadata mappings, which only trigger if the 3D
| | | +0.5,+0.5 | scroll instantly by adding 0.5 to the current uv coordinates |
| | | 0.2,1,0.1,0.1 | scroll (lerp) to uv coordinate `0,2,1` with `0.1` units per second |
| | | 0,0,0,+0.1 | scroll v coordinates with `0.1` units per second (infinitely) |
| | | +0.5,+0.5 | scroll instantly by adding 0.5 to the current uv coordinates |
| media parameter (shader uniform) | u:<uniform>=<string|float|vec2|vec3|vec4> | u:color=1,0,0 | set shader uniform value |
> \* = this is extending the [W3C media fragments](https://www.w3.org/TR/media-frags/#mf-advanced) with (missing) playback/viewport-control. Normally `#t=0,2` implies setting start/stop-values AND starting playback, whereas `#s=0&loop` allows pausing a video, speeding up/slowing down media, as well as enabling/disabling looping.

File diff suppressed because it is too large Load Diff

View File

@ -48,18 +48,18 @@ XR Fragments exploits the fact that all 3D models already contain such metadata:
Instead of forcing authors to combine 3D/2D objects programmatically (publishing thru a game-editor e.g.), XR Fragments <strong>integrates all</strong> which allows a universal viewing experience.<br />
</t>
<artwork><![CDATA[ +───────────────────────────────────────────────────────────────────────────────────────────────+
<artwork> +───────────────────────────────────────────────────────────────────────────────────────────────+
│ │
│ U R N │
│ U R L | │
│ | |-----------------+--------| │
│ +--------------------------------------------------| │
│ | │
│ + https://foo.com/some/foo/scene.glb#someview <-- http URI (=URL and has URN)
│ + https://foo.com/some/foo/scene.glb#someview &lt;-- http URI (=URL and has URN) │
│ | │
│ + ipfs://cfe0987ec9r9098ecr/cats.fbx#someview <-- an IPFS URI (=URL and has URN)
│ + ipfs://cfe0987ec9r9098ecr/cats.fbx#someview &lt;-- an IPFS URI (=URL and has URN) │
│ │
│ ec09f7e9cf8e7f09c8e7f98e79c09ef89e000efece8f7ecfe9fe <-- an interpeer URI
│ ec09f7e9cf8e7f09c8e7f98e79c09ef89e000efece8f7ecfe9fe &lt;-- an interpeer URI │
│ │
│ │
│ |------------------------+-------------------------| │
@ -68,20 +68,19 @@ Instead of forcing authors to combine 3D/2D objects programmatically (publishing
│ │
+───────────────────────────────────────────────────────────────────────────────────────────────+
]]>
</artwork>
<t>Fact: our typical browser URL's are just <strong>a possible implementation</strong> of URI's (for untapped humancentric potential of URI's <eref target="https://interpeer.io">see interpeer.io</eref>)</t>
<blockquote><t>XR Fragments does not look at XR (or the web) thru the lens of HTML or URLs.<br />
But approaches things from a higherlevel feedbackloop/hypermedia browser-perspective.</t>
</blockquote><t>Below you can see how this translates back into good-old URLs:</t>
<artwork><![CDATA[ +───────────────────────────────────────────────────────────────────────────────────────────────+
<artwork> +───────────────────────────────────────────────────────────────────────────────────────────────+
│ │
│ the soul of any URL: ://macro /meso ?micro #nano │
│ │
│ 2D URL: ://library.com /document ?search #chapter │
│ │
│ 4D URL: ://park.com /4Dscene.fbx ─> ?other.glb ─> #view ───> hashbus │
│ 4D URL: ://park.com /4Dscene.fbx ─&gt; ?other.glb ─&gt; #view ───&gt; hashbus │
│ │ #filter │ │
│ │ #tag │ │
│ │ (hypermediatic) #material │ │
@ -89,14 +88,13 @@ But approaches things from a higherlevel feedbackloop/hypermedia browser-perspec
│ │ ( loop ) #texture │ │
│ │ #variable │ │
│ │ │ │
│ XRWG <─────────────────────<─────────────+ │
│ XRWG &lt;─────────────────────&lt;─────────────+ │
│ │ │ │
│ └─ objects ──────────────>─────────────+ │
│ └─ objects ──────────────&gt;─────────────+ │
│ │
│ │
+───────────────────────────────────────────────────────────────────────────────────────────────+
]]>
</artwork>
<blockquote><t>?-linked and #-linked navigation allows a Hypermediatic FeedbackLoop (HFL) between external and internal 4D navigation.</t>
</blockquote><t>Traditional webbrowsers can become 4D document-ready by:</t>
@ -174,10 +172,9 @@ But approaches things from a higherlevel feedbackloop/hypermedia browser-perspec
<section anchor="xr-fragment-url-grammar"><name>XR Fragment URL Grammar</name>
<t>For typical HTTP-like browsers/applications:</t>
<artwork><![CDATA[reserved = gen-delims / sub-delims
gen-delims = "#" / "&"
sub-delims = "," / "="
]]>
<artwork>reserved = gen-delims / sub-delims
gen-delims = &quot;#&quot; / &quot;&amp;&quot;
sub-delims = &quot;,&quot; / &quot;=&quot;
</artwork>
<blockquote><t>Example: <tt>://foo.com/my3d.gltf#pos=1,0,0&amp;prio=-5&amp;t=0,100</tt></t>
</blockquote><table>
@ -237,8 +234,8 @@ That way, if the link gets shared, the XR Fragments implementation at <tt>https:
<tr>
<td><eref target="https://www.w3.org/TR/media-frags/">W3C Media Fragments</eref></td>
<td><eref target="#media%20fragments%20and%20datatypes">media fragment</eref></td>
<td><tt>#t=0,2</tt> <tt>#xywh</tt></td>
<td>play/loop 3D animation from 0 seconds till 2 seconds</td>
<td><tt>#t=0,2&amp;loop</tt></td>
<td>play (and loop) 3D animation from 0 seconds till 2 seconds</td>
</tr>
<tr>
@ -358,6 +355,14 @@ That way, if the link gets shared, the XR Fragments implementation at <tt>https:
<td><tt>#foo=bar</tt></td>
<td>sets <eref target="https://www.rfc-editor.org/rfc/rfc6570">URI Template</eref> variable <tt>foo</tt> to the value <tt>#t=0</tt> from <strong>existing</strong> object metadata (<tt>bar</tt>:<tt>#t=0</tt> e.g.), This allows for reactive <eref target="https://www.rfc-editor.org/rfc/rfc6570">URI Template</eref> defined in object metadata elsewhere (<tt>src</tt>:<tt>://m.com/cat.mp4#{foo}</tt> e.g., to play media using <eref target="https://www.w3.org/TR/media-frags/#valid-uri">media fragment URI</eref>). NOTE: metadata-key should not start with <tt>#</tt></td>
</tr>
<tr>
<td><strong>ANIMATION</strong></td>
<td><tt>#&lt;tag_or_objectname&gt;=&lt;animationname&gt;</tt></td>
<td>string=string</td>
<td><tt>#people=walk</tt> <tt>#people=noanim</tt></td>
<td>assign a different animation to object(s)</td>
</tr>
</tbody>
</table></section>
@ -452,13 +457,14 @@ That way, if the link gets shared, the XR Fragments implementation at <tt>https:
</tr>
<tr>
<td>media parameter (shader uniform)</td>
<td>u:&lt;uniform&gt;=&lt;string</td>
<td>float</td>
<td>vec2</td>
<td></td>
<td></td>
<td>+0.5,+0.5</td>
<td>scroll instantly by adding 0.5 to the current uv coordinates</td>
</tr>
</tbody>
</table><blockquote><t>* = this is extending the <eref target="https://www.w3.org/TR/media-frags/#mf-advanced">W3C media fragments</eref> with (missing) playback/viewport-control. Normally <tt>#t=0,2</tt> implies setting start/stop-values AND starting playback, whereas <tt>#s=0&amp;loop</tt> allows pausing a video, speeding up/slowing down media, as well as enabling/disabling looping.</t>
</table><t>| media parameter (shader uniform) | u:&lt;uniform&gt;=&lt;string|float|vec2|vec3|vec4&gt; | u:color=1,0,0 | set shader uniform value |</t>
<blockquote><t>* = this is extending the <eref target="https://www.w3.org/TR/media-frags/#mf-advanced">W3C media fragments</eref> with (missing) playback/viewport-control. Normally <tt>#t=0,2</tt> implies setting start/stop-values AND starting playback, whereas <tt>#s=0&amp;loop</tt> allows pausing a video, speeding up/slowing down media, as well as enabling/disabling looping.</t>
<t>The rationale for <tt>uv</tt> is that the <tt>xywh</tt> Media Fragment deals with rectangular media, which does not translate well to 3D models (which use triangular polygons, not rectangular) positioned by uv-coordinates.</t>
</blockquote><t>Example URI's:</t>
@ -468,11 +474,11 @@ That way, if the link gets shared, the XR Fragments implementation at <tt>https:
<li><tt>https://shaders.org/plasma.glsl#t=0&amp;u:col1=1,0,0&amp;u:col2=0,1,0</tt> (red-green shader plasma starts playing from time-offset 0)</li>
</ul>
<artwork><![CDATA[ +──────────────────────────────────────────────────────────+
<artwork> +──────────────────────────────────────────────────────────+
│ │
│ index.gltf#playall │
│ │ │
│ ├ # : #t=0&shared=play │ apply default XR Fragment on load (`t` plays global 3D animation timeline)
│ ├ # : #t=0&amp;shared=play │ apply default XR Fragment on load (`t` plays global 3D animation timeline)
│ ├ play : #t=l:0,2 │ variable for [URI Templates (RFC6570)](https://www.rfc-editor.org/rfc/rfc6570)
│ │ │
│ ├── ◻ plane (with material) │
@ -482,19 +488,18 @@ That way, if the link gets shared, the XR Fragments implementation at <tt>https:
│ │ └ src: foo.jpg#suv=l:0,0.1 │ infinite texturescroll `v` of uv·coordinates with 0.1/fps
│ │ │
│ ├── ◻ media │
│ │ └ src: cat.mp4#t=l:2,10&uv=0.5,0.5 │ loop cat.mp4 (or mp3/wav/jpg) between 2 and 10 seconds (uv's shifted with 0.5,0.5)
│ │ └ src: cat.mp4#t=l:2,10&amp;uv=0.5,0.5 │ loop cat.mp4 (or mp3/wav/jpg) between 2 and 10 seconds (uv's shifted with 0.5,0.5)
│ │ │
│ └── ◻ wall │
│ ├ href: #color=blue │ updates uniform values (IFS shader e.g.)
│ ├ blue: t=0&u:col=0,0,1 │ variable for [Level1 URI Templates (RFC6570)](https://www.rfc-editor.org/rfc/rfc6570)
│ └ src: ://a.com/art.glsl#{color}&{shared} │ .fs/.vs/.glsl/.wgsl etc shader [Level1 URI Template (RFC6570)](https://www.rfc-editor.org/rfc/rfc6570)
│ ├ blue: t=0&amp;u:col=0,0,1 │ variable for [Level1 URI Templates (RFC6570)](https://www.rfc-editor.org/rfc/rfc6570)
│ └ src: ://a.com/art.glsl#{color}&amp;{shared} │ .fs/.vs/.glsl/.wgsl etc shader [Level1 URI Template (RFC6570)](https://www.rfc-editor.org/rfc/rfc6570)
│ │
│ │
+──────────────────────────────────────────────────────────+
> NOTE: URI Template variables are immutable and respect scope: in other words, the end-user cannot modify `blue` by entering an URL like `#blue=.....` in the browser URL, and `blue` is not accessible by the plane/media-object (however `{play}` would work).
&gt; NOTE: URI Template variables are immutable and respect scope: in other words, the end-user cannot modify `blue` by entering an URL like `#blue=.....` in the browser URL, and `blue` is not accessible by the plane/media-object (however `{play}` would work).
]]>
</artwork>
</section>
</section>
@ -502,7 +507,7 @@ That way, if the link gets shared, the XR Fragments implementation at <tt>https:
<section anchor="spatial-referencing-3d"><name>Spatial Referencing 3D</name>
<t>XR Fragments assume the following objectname-to-URIFragment mapping:</t>
<artwork><![CDATA[
<artwork>
my.io/scene.fbx
+─────────────────────────────+
│ sky │ src: http://my.io/scene.fbx#sky (includes building,mainobject,floor)
@ -518,7 +523,6 @@ That way, if the link gets shared, the XR Fragments implementation at <tt>https:
│ +─────────────────────────+ │
+─────────────────────────────+
]]>
</artwork>
<blockquote><t>Every 3D fileformat supports named 3D object, and this name allows URLs (fragments) to reference them (and their children objects).</t>
</blockquote><t>Clever nested design of 3D scenes allow great ways for re-using content, and/or previewing scenes.<br />
@ -564,24 +568,23 @@ For example, to render a portal with a preview-version of the scene, create an 3
<li>the Y-coordinate of <tt>pos</tt> identifies the floorposition. This means that desktop-projections usually need to add 1.5m (average person height) on top (which is done automatically by VR/AR headsets).</li>
<li>set the position of the camera accordingly to the vector3 values of <tt>#pos</tt></li>
<li><tt>rot</tt> sets the rotation of the camera (only for non-VR/AR headsets)</li>
<li><tt>t</tt> sets the playbackspeed and animation-range of the current scene animation(s) or <tt>src</tt>-mediacontent (video/audioframes e.g., use <tt>t=0,7,7</tt> to 'STOP' at frame 7 e.g.)</li>
<li><tt>t</tt> in the top-URL sets the playbackspeed and animation-range of the global scene animation</li>
<li>after scene load: in case an <tt>href</tt> does not mention any <tt>pos</tt>-coordinate, <tt>pos=0,0,0</tt> will be assumed</li>
</ol>
<t>Here's an ascii representation of a 3D scene-graph which contains 3D objects <tt></tt> and their metadata:</t>
<artwork><![CDATA[ +────────────────────────────────────────────────────────+
<artwork> +────────────────────────────────────────────────────────+
│ │
│ index.gltf │
│ │ │
│ ├── ◻ buttonA │
│ │ └ href: #pos=1,0,1&t=100,200 │
│ │ └ href: #pos=1,0,1&amp;t=100,200 │
│ │ │
│ └── ◻ buttonB │
│ └ href: other.fbx │ <── file─agnostic (can be .gltf .obj etc)
│ └ href: other.fbx │ &lt;── file─agnostic (can be .gltf .obj etc)
│ │
+────────────────────────────────────────────────────────+
]]>
</artwork>
<t>An XR Fragment-compatible browser viewing this scene, allows the end-user to interact with the <tt>buttonA</tt> and <tt>buttonB</tt>.<br />
@ -629,7 +632,7 @@ It instances content (in objects) in the current scene/asset.</t>
</tbody>
</table><t>Here's an ascii representation of a 3D scene-graph with 3D objects <tt></tt> which embeds remote &amp; local 3D objects <tt></tt> with/out using filters:</t>
<artwork><![CDATA[ +────────────────────────────────────────────────────────+ +─────────────────────────+
<artwork> +────────────────────────────────────────────────────────+ +─────────────────────────+
│ │ │ │
│ index.gltf │ │ ocean.com/aquarium.fbx │
│ │ │ │ ├ room │
@ -646,7 +649,6 @@ It instances content (in objects) in the current scene/asset.</t>
│ └ src: #canvas │
│ │
+────────────────────────────────────────────────────────+
]]>
</artwork>
<t>An XR Fragment-compatible browser viewing this scene, lazy-loads and projects <tt>painting.png</tt> onto the (plane) object called <tt>canvas</tt> (which is copy-instanced in the bed and livingroom).<br />
@ -728,6 +730,8 @@ Resizing will be happen accordingly to its placeholder object <tt>aquariumcube</
</li>
<li><t>href-events should bubble upward the node-tree</t>
</li>
<li><t>the end-user navigator back/forward buttons should repeat a back/forward action until a <tt>pos=...</tt> primitive is found (the inbetween interaction URI's are only for UX research purposes)</t>
</li>
</ol>
<t><eref target="https://github.com/coderofsalvation/xrfragment/blob/main/src/3rd/js/three/xrf/href.js">» example implementation</eref><br />
@ -965,7 +969,7 @@ XR Fragments does this by detecting Bib(s)Tex, without introducing a new languag
</ol>
<t>Example:</t>
<artwork><![CDATA[ http://y.io/z.fbx | Derived XRWG (expressed as BibTex)
<artwork> http://y.io/z.fbx | Derived XRWG (expressed as BibTex)
----------------------------------------------------------------------------+--------------------------------------
| @house{castle,
+-[src: data:.....]----------------------+ +-[3D mesh]-+ | url = {https://y.io/z.fbx#castle}
@ -983,12 +987,11 @@ XR Fragments does this by detecting Bib(s)Tex, without introducing a new languag
| /|\ | |
| / \ | |
+--------+ |
]]>
</artwork>
<blockquote><t>the <tt>#john@baroque</tt>-bib associates both text <tt>John</tt> and objectname <tt>john</tt>, with tag <tt>baroque</tt></t>
</blockquote><t>Another example:</t>
<artwork><![CDATA[ http://y.io/z.fbx | Derived XRWG (expressed as BibTex)
<artwork> http://y.io/z.fbx | Derived XRWG (expressed as BibTex)
----------------------------------------------------------------------------+--------------------------------------
|
+-[src: data:.....]----------------------+ +-[3D mesh]-+ | @house{castle,
@ -1006,7 +1009,6 @@ XR Fragments does this by detecting Bib(s)Tex, without introducing a new languag
| #baroque@todo@house | | /|\ | |
| ... | | / \ | |
+----------------------------------------+ +--------+ |
]]>
</artwork>
<blockquote><t>both <tt>#john@baroque</tt>-bib and BibTex <tt>@baroque{john}</tt> result in the same XRWG, however on top of that 2 tages (<tt>house</tt> and <tt>todo</tt>) are now associated with text/objectname/tag 'baroque'.</t>
</blockquote><t>As seen above, the XRWG can expand <eref target="https://github.com/coderofsalvation/hashtagbibs">bibs</eref> (and the whole scene) to BibTeX.<br />
@ -1060,22 +1062,21 @@ Some pointers for good UX (but not necessary to be XR Fragment compatible):</t>
<blockquote><t>The simplicity of appending metadata (and leveling the metadata-playfield between humans and machines) is also demonstrated by <eref target="https://visual-meta.info">visual-meta</eref> in greater detail.</t>
</blockquote><t>Fictional chat:</t>
<artwork><![CDATA[<John> Hey what about this: https://my.com/station.gltf#pos=0,0,1&rot=90,2,0&t=500,1000
<Sarah> I'm checking it right now
<Sarah> I don't see everything..where's our text from yesterday?
<John> Ah wait, that's tagged with tag 'draft' (and hidden)..hold on, try this:
<John> https://my.com/station.gltf#.draft&pos=0,0,1&rot=90,2,0&t=500,1000
<Sarah> how about we link the draft to the upcoming YELLO-event?
<John> ok I'm adding #draft@YELLO
<Sarah> Yesterday I also came up with other usefull assocations between other texts in the scene:
<artwork>&lt;John&gt; Hey what about this: https://my.com/station.gltf#pos=0,0,1&amp;rot=90,2,0&amp;t=500,1000
&lt;Sarah&gt; I'm checking it right now
&lt;Sarah&gt; I don't see everything..where's our text from yesterday?
&lt;John&gt; Ah wait, that's tagged with tag 'draft' (and hidden)..hold on, try this:
&lt;John&gt; https://my.com/station.gltf#.draft&amp;pos=0,0,1&amp;rot=90,2,0&amp;t=500,1000
&lt;Sarah&gt; how about we link the draft to the upcoming YELLO-event?
&lt;John&gt; ok I'm adding #draft@YELLO
&lt;Sarah&gt; Yesterday I also came up with other usefull assocations between other texts in the scene:
#event#YELLO
#2025@YELLO
<John> thanks, added.
<Sarah> Btw. I stumbled upon this spatial book which references station.gltf in some chapters:
<Sarah> https://thecommunity.org/forum/foo/mytrainstory.txt
<John> interesting, I'm importing mytrainstory.txt into station.gltf
<John> ah yes, chapter three points to trainterminal_2A in the scene, cool
]]>
&lt;John&gt; thanks, added.
&lt;Sarah&gt; Btw. I stumbled upon this spatial book which references station.gltf in some chapters:
&lt;Sarah&gt; https://thecommunity.org/forum/foo/mytrainstory.txt
&lt;John&gt; interesting, I'm importing mytrainstory.txt into station.gltf
&lt;John&gt; ah yes, chapter three points to trainterminal_2A in the scene, cool
</artwork>
<section anchor="default-data-uri-mimetype"><name>Default Data URI mimetype</name>
@ -1111,7 +1112,7 @@ to connect text further with its environment ( setup links between textual/spati
<section anchor="url-and-data-uri"><name>URL and Data URI</name>
<artwork><![CDATA[ +--------------------------------------------------------------+ +------------------------+
<artwork> +--------------------------------------------------------------+ +------------------------+
| | | author.com/article.txt |
| index.gltf | +------------------------+
| │ | | |
@ -1123,7 +1124,6 @@ to connect text further with its environment ( setup links between textual/spati
| | +------------------------+
| |
+--------------------------------------------------------------+
]]>
</artwork>
<t>The enduser will only see <tt>welcome human</tt> and <tt>Hello friends</tt> rendered verbatim (see mimetype).
The beauty is that text in Data URI automatically promotes rich copy-paste (retaining metadata).
@ -1135,14 +1135,14 @@ The XR Fragment-compatible browser can let the enduser access visual-meta(data)-
<section anchor="xr-text-example-parser"><name>XR Text example parser</name>
<t>To prime the XRWG with text from plain text <tt>src</tt>-values, here's an example XR Text (de)multiplexer in javascript (which supports inline bibs &amp; bibtex):</t>
<artwork><![CDATA[xrtext = {
<artwork>xrtext = {
expandBibs: (text) => {
expandBibs: (text) =&gt; {
let bibs = { regex: /(#[a-zA-Z0-9_+@\-]+(#)?)/g, tags: {}}
text.replace( bibs.regex , (m,k,v) => {
tok = m.substr(1).split("@")
text.replace( bibs.regex , (m,k,v) =&gt; {
tok = m.substr(1).split(&quot;@&quot;)
match = tok.shift()
if( tok.length ) tok.map( (t) => bibs.tags[t] = `@${t}{${match},\n}` )
if( tok.length ) tok.map( (t) =&gt; bibs.tags[t] = `@${t}{${match},\n}` )
else if( match.substr(-1) == '#' )
bibs.tags[match] = `@{${match.replace(/#/,'')}}`
else bibs.tags[match] = `@${match}{${match},\n}`
@ -1150,16 +1150,16 @@ The XR Fragment-compatible browser can let the enduser access visual-meta(data)-
return text.replace( bibs.regex, '') + Object.values(bibs.tags).join('\n')
},
decode: (str) => {
// bibtex: ↓@ ↓<tag|tag{phrase,|{ruler}> ↓property ↓end
decode: (str) =&gt; {
// bibtex: ↓@ ↓&lt;tag|tag{phrase,|{ruler}&gt; ↓property ↓end
let pat = [ /@/, /^\S+[,{}]/, /},/, /}/ ]
let tags = [], text='', i=0, prop=''
let lines = xrtext.expandBibs(str).replace(/\r?\n/g,'\n').split(/\n/)
for( let i = 0; i < lines.length && !String(lines[i]).match( /^@/ ); i++ )
for( let i = 0; i &lt; lines.length &amp;&amp; !String(lines[i]).match( /^@/ ); i++ )
text += lines[i]+'\n'
bibtex = lines.join('\n').substr( text.length )
bibtex.split( pat[0] ).map( (t) => {
bibtex.split( pat[0] ).map( (t) =&gt; {
try{
let v = {}
if( !(t = t.trim()) ) return
@ -1168,9 +1168,9 @@ The XR Fragment-compatible browser can let the enduser access visual-meta(data)-
if( tag.match( /}$/ ) ) return tags.push({k: tag.replace(/}$/,''), v: {}})
t = t.substr( tag.length )
t.split( pat[2] )
.map( kv => {
if( !(kv = kv.trim()) || kv == "}" ) return
v[ kv.match(/\s?(\S+)\s?=/)[1] ] = kv.substr( kv.indexOf("{")+1 )
.map( kv =&gt; {
if( !(kv = kv.trim()) || kv == &quot;}&quot; ) return
v[ kv.match(/\s?(\S+)\s?=/)[1] ] = kv.substr( kv.indexOf(&quot;{&quot;)+1 )
})
tags.push( { k:tag, v } )
}catch(e){ console.error(e) }
@ -1178,8 +1178,8 @@ The XR Fragment-compatible browser can let the enduser access visual-meta(data)-
return {text, tags}
},
encode: (text,tags) => {
let str = text+"\n"
encode: (text,tags) =&gt; {
let str = text+&quot;\n&quot;
for( let i in tags ){
let item = tags[i]
if( item.ruler ){
@ -1193,12 +1193,11 @@ The XR Fragment-compatible browser can let the enduser access visual-meta(data)-
return str
}
}
]]>
</artwork>
<t>The above functions (de)multiplexe text/metadata, expands bibs, (de)serialize bibtex and vice versa</t>
<blockquote><t>above can be used as a startingpoint for LLVM's to translate/steelman to a more formal form/language.</t>
</blockquote>
<artwork><![CDATA[str = `
<artwork>str = `
hello world
here are some hashtagbibs followed by bibtex:
@ -1211,15 +1210,14 @@ here are some hashtagbibs followed by bibtex:
asdf = {23423}
}`
var {tags,text} = xrtext.decode(str) // demultiplex text & bibtex
tags.find( (t) => t.k == 'flap{' ).v.asdf = 1 // edit tag
var {tags,text} = xrtext.decode(str) // demultiplex text &amp; bibtex
tags.find( (t) =&gt; t.k == 'flap{' ).v.asdf = 1 // edit tag
tags.push({ k:'bar{', v:{abc:123} }) // add tag
console.log( xrtext.encode(text,tags) ) // multiplex text & bibtex back together
]]>
console.log( xrtext.encode(text,tags) ) // multiplex text &amp; bibtex back together
</artwork>
<t>This expands to the following (hidden by default) BibTex appendix:</t>
<artwork><![CDATA[hello world
<artwork>hello world
here are some hashtagbibs followed by bibtex:
@{some-section}
@ -1234,7 +1232,6 @@ here are some hashtagbibs followed by bibtex:
@bar{
abc = {123}
}
]]>
</artwork>
<blockquote><t>when an XR browser updates the human text, a quick scan for nonmatching tags (<tt>@book{nonmatchingbook</tt> e.g.) should be performed and prompt the enduser for deleting them.</t>
</blockquote></section>
@ -1251,7 +1248,7 @@ here are some hashtagbibs followed by bibtex:
<blockquote><t>due to the popularity, maturity and extensiveness of HTTP codes for client/server communication, non-HTTP protocols easily map to HTTP codes (ipfs ERR_NOT_FOUND maps to 404 e.g.)</t>
</blockquote><t>For example:</t>
<artwork><![CDATA[ +────────────────────────────────────────────────────────+
<artwork> +────────────────────────────────────────────────────────+
│ │
│ index.gltf │
│ │ │
@ -1263,14 +1260,13 @@ here are some hashtagbibs followed by bibtex:
│ │ └ href@400: #clienterrortext │
│ │ └ ◻ offlinetext │
│ │ │
│ └── ◻ embeddedObject <--------- the meshdata inside embeddedObject will (not)
│ └── ◻ embeddedObject &lt;--------- the meshdata inside embeddedObject will (not)
│ └ src: https://foo.io/bar.gltf │ be flushed when the request (does not) succeed.
│ └ src@404: http://foo.io/bar.gltf │ So worstcase the 3D data (of the time of publishing index.gltf)
│ └ src@400: https://archive.org/l2kj43.gltf │ will be displayed.
│ │
+────────────────────────────────────────────────────────+
]]>
</artwork>
</section>
@ -1302,7 +1298,7 @@ To filter out non-related objects one could take it a step further using filters
The following demonstrates a simple video player:</t>
<artwork><![CDATA[
<artwork>
+─────────────────────────────────────────────+
│ │
│ foo.usdz │
@ -1310,19 +1306,18 @@ The following demonstrates a simple video player:</t>
│ │ │
│ ├── ◻ stopbutton │
│ │ ├ #: #-stopbutton │
│ │ └ href: #player=stop&-stopbutton │ (stop and hide stop-button)
│ │ └ href: #player=stop&amp;-stopbutton │ (stop and hide stop-button)
│ │ │
│ └── ◻ plane │
│ ├ play: #t=l:0,10 │
│ ├ stop: #t=0,0 │
│ ├ href: #player=play&stopbutton │ (play and show stop-button)
│ ├ href: #player=play&amp;stopbutton │ (play and show stop-button)
│ └ src: cat.mp4#{player} │
│ │
│ │
+─────────────────────────────────────────────+
]]>
</artwork>
</section>

View File

@ -3,7 +3,7 @@
Internet Engineering Task Force L.R. van Kammen
Internet-Draft 8 February 2024
Internet-Draft 16 February 2024
Intended status: Informational
@ -38,7 +38,7 @@ Status of This Memo
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."
This Internet-Draft will expire on 11 August 2024.
This Internet-Draft will expire on 19 August 2024.
Copyright Notice
@ -53,7 +53,7 @@ Copyright Notice
van Kammen Expires 11 August 2024 [Page 1]
van Kammen Expires 19 August 2024 [Page 1]
Internet-Draft XR Macros February 2024
@ -109,13 +109,13 @@ Table of Contents
van Kammen Expires 11 August 2024 [Page 2]
van Kammen Expires 19 August 2024 [Page 2]
Internet-Draft XR Macros February 2024
3. Metadata-values can contain the | symbol to 🎲 roundrobin variable
values (!toggleme: fog=0,10|fog=0,1000 e.g.)
3. Metadata-values can contain the | symbol to &#127922; roundrobin
variable values (!toggleme: fog=0,10|fog=0,1000 e.g.)
4. XR Macros acts as simple eventhandlers for URI Fragments: they
are automatically published on the (XR Fragments
(https://xrfragment.org)) hashbus, to act as events (so more
@ -165,7 +165,7 @@ Internet-Draft XR Macros February 2024
van Kammen Expires 11 August 2024 [Page 3]
van Kammen Expires 19 August 2024 [Page 3]
Internet-Draft XR Macros February 2024
@ -221,7 +221,7 @@ Internet-Draft XR Macros February 2024
van Kammen Expires 11 August 2024 [Page 4]
van Kammen Expires 19 August 2024 [Page 4]
Internet-Draft XR Macros February 2024
@ -277,7 +277,7 @@ Internet-Draft XR Macros February 2024
van Kammen Expires 11 August 2024 [Page 5]
van Kammen Expires 19 August 2024 [Page 5]
Internet-Draft XR Macros February 2024
@ -333,7 +333,7 @@ click object with (`!clickme`:`!foo|!bar|!flop` e.g.)
van Kammen Expires 11 August 2024 [Page 6]
van Kammen Expires 19 August 2024 [Page 6]
Internet-Draft XR Macros February 2024
@ -375,7 +375,7 @@ Internet-Draft XR Macros February 2024
| | (games,VR,AR e.g.), should be as high as |
| | possible |
+---------------+---------------------------------------------------+
| | ascii representation of an 3D object/mesh |
| &#9723; | ascii representation of an 3D object/mesh |
+---------------+---------------------------------------------------+
| (un)obtrusive | obtrusive: wrapping human text/thought in |
| | XML/HTML/JSON obfuscates human text into |
@ -389,4 +389,4 @@ Internet-Draft XR Macros February 2024
van Kammen Expires 11 August 2024 [Page 7]
van Kammen Expires 19 August 2024 [Page 7]

View File

@ -282,17 +282,16 @@ Macros also act as events, so more serious scripting languages can react to them
<section anchor="event-bubble-flow"><name>Event Bubble-flow</name>
<t>click object with (<tt>!clickme</tt>:<tt>AR</tt> or <tt>!clickme</tt>: <tt>!reset</tt> e.g.)</t>
<artwork><![CDATA[
<artwork>
└── does current object contain this property-key (`AR` or `!reset` e.g.)?
└── no: is there any (root)object containing property `AR`
└── yes: evaluate its (roundrobin) XR macro-value(s) (and exit)
└── no: trigger URL: #AR
]]>
</artwork>
<t>click object with (<tt>!clickme</tt>:<tt>#AR|#VR</tt> e.g.)</t>
<artwork><![CDATA[
<artwork>
└── apply the roundrobin (rotate the options, value `#AR` becomes `#VR` upon next click)
└── is there any object with property-key (`#AR` e.g.)?
@ -300,7 +299,6 @@ Macros also act as events, so more serious scripting languages can react to them
└── yes: apply its value to the scene, and update the URL to `#AR`
click object with (`!clickme`:`!foo|!bar|!flop` e.g.)
]]>
</artwork>
<t>
<br />

View File

@ -100,6 +100,7 @@ window.AFRAME.registerComponent('xrf', {
let isLocal = url.match(/^#/)
let hasPos = url.match(/pos=/)
let fastFadeMs = 200
if( !AFRAME.fade ) return p.resolve()
if( isLocal ){
if( hasPos ){

View File

@ -25,9 +25,10 @@ xrf.addEventListener = function(eventName, callback, opts) {
this._listeners[eventName].push(callback);
// sort
this._listeners[eventName] = this._listeners[eventName].sort( (a,b) => a.opts.weight > b.opts.weight )
return () => {
callback.unlisten = () => {
this._listeners[eventName] = this._listeners[eventName].filter( (c) => c != callback )
}
return callback.unlisten
};
xrf.emit = function(eventName, data){
@ -76,7 +77,8 @@ xrf.emit.promise = function(e, opts){
}
xrf.addEventListener('reset', () => {
// *TODO* do this nicely
// xrf._listeners['renderPost'] = []
// xrf._listeners['render'] = []
let events = ['renderPost']
events.map( (e) => {
if( xrf._listeners[e] ) xrf._listeners[e].map( (r) => r.unlisten && r.unlisten() )
})
})

View File

@ -11,7 +11,7 @@ xrf.optimize = (opts) => {
// check unused animations
xrf.optimize.checkAnimations = (opts) => {
console.log("TODO: fix freezeUnAnimatedObjects for SRC's")
if( xrf.debug ) console.log("TODO: fix freezeUnAnimatedObjects for SRC's")
return xrf.optimize
let {model} = opts
@ -35,7 +35,7 @@ xrf.optimize.checkAnimations = (opts) => {
}
xrf.optimize.freezeUnAnimatedObjects = (opts) => {
console.log("TODO: fix freezeUnAnimatedObjects for SRC's")
if( xrf.todo ) console.log("TODO: fix freezeUnAnimatedObjects for SRC's")
return xrf.optimize
let {model} = opts

View File

@ -4,12 +4,7 @@ xrf.frag.defaultPredefinedViews = (opts) => {
let {scene,model} = opts;
scene.traverse( (n) => {
if( n.userData && n.userData['#'] ){
let frag = xrf.URI.parse( n.userData['#'] )
if( !n.parent && document.location.hash.length < 2){
xrf.navigator.to( n.userData['#'] ) // evaluate default XR fragments (global-level)
}else{
xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments (node-level)
}
xrf.hashbus.pub( n.userData['#'], n ) // evaluate default XR fragments without affecting URL
}
})
}

View File

@ -10,7 +10,7 @@ const doFilter = (opts) => {
xrf.addEventListener('dynamicKey', doFilter )
xrf.addEventListener('dynamicKeyValue', (opts) => {
console.log("*TODO* filter integers only")
if( xrf.debug ) console.log("*TODO* filter integers only")
// doFilter(opts)
})

View File

@ -0,0 +1,27 @@
/*
* mimetype: model/gltf+json
*/
xrf.frag.src.type['fbx'] = function( url, opts ){
return new Promise( async (resolve,reject) => {
let {mesh,src} = opts
let {urlObj,dir,file,hash,ext} = xrf.parseUrl(url)
let loader
//let {THREE} = await import('https://unpkg.com/three@0.161.0/build/three.module.js')
//let { FBXLoader } = await import('three/addons/loaders/FBXLoader.js')
//const Loader = xrf.loaders[ext]
//if( !Loader ) throw 'xrfragment: no loader passed to xrfragment for extension .'+ext
//if( !dir.match("://") ){ // force relative path
// dir = dir[0] == './' ? dir : `./${dir}`
// loader = new Loader().setPath( dir )
//}else loader = new Loader()
//loader.load(url, (model) => {
// model.isSRC = true
// resolve(model)
//})
})
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff