diff --git a/doc/RFC_XR_Fragments.html b/doc/RFC_XR_Fragments.html index ba9f9f2..36ce378 100644 --- a/doc/RFC_XR_Fragments.html +++ b/doc/RFC_XR_Fragments.html @@ -319,9 +319,9 @@ That way, if the link gets shared, the XR Fragments implementation at http #t -timevector -#t=2,2000,1 -play animation-loop range between frame 2 and 2000 at (normal) speed 1 +media fragment +#t=0,2 +play/loop 3D animation from 0 seconds till 2 seconds @@ -370,66 +370,6 @@ That way, if the link gets shared, the XR Fragments implementation at http

Supported popular compatible 3D fileformats: .gltf, .obj, .fbx, .usdz, .json (THREE.js), .dae and so on.

-

vector datatypes

- -

| type | syntax | example | info |

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
vector2
vector3
timevector
- -
-

NOTE: XR Fragments are optional but also file- and protocol-agnostic, which means that programmatic 3D scene(nodes) can also use the mechanism/metadata.

-
-

Dynamic XR Fragments (+databindings)

These are automatic fragment-to-metadata mappings, which only trigger if the 3D scene metadata matches a specific identifier (aliasname e.g.)

@@ -459,11 +399,18 @@ That way, if the link gets shared, the XR Fragments implementation at http focus object(s) with tag: person or name person by looking up XRWG + +#[-]<tag_or_objectname> +string +#person (#-person) +focus/show (or hide) object(s) with tag: person or name person by looking up XRWG + + #<cameraname> string #cam01 -set camera as active camera +set camera with name cam01 as active camera @@ -484,21 +431,142 @@ That way, if the link gets shared, the XR Fragments implementation at http #<objectname>=<mediafrag> string=media frag #foo=0,1 -play media src using media fragment URI +play 3D animation (or src media) using media fragment URI with looping/speed/texturescroll abilities + + + + +

media fragments and datatypes

+ + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + +
typesyntaxexampleinfo
vector2x,y2,3.02-dimensional vector
#<objectname>=<timevector>string=timevector#sky=0,0.5,0.1,0sets 1D/2D/3D time(line) vectors (uv-position e.g.) to 0,0.5 (and autoscroll x with max 0.1 every second)vector3x,y,z2,3.0,43-dimensional vector
media fragmentx01D timeline: play from 0 seconds to end (and stop)
media fragmentx,y0,21D timeline: play from 0 seconds till 2 seconds (and stop)
media fragmentu,v0,0.52D texture: set uv-coordinate at 0,0.5
media fragment *u,v, … [*speed, …]0*21D timeline: play from 0 seconds till end (and loop) at double (2) speed
* 0,1*21D timeline: play from 0 seconds till 2 seconds (and loop) at double (2) speed
* #music=1,2play media of object (src: podcast.mp3 e.g.) from beginning (1) at double speed (2)0,1*0.12D texture: set uvcoordinates at 0,1 and scroll them 0.1 per second (interpolating)
+ +
+

* = this is extending the W3C media fragments with multidimensionality and loop(speed). The multidimensional (nonspeed) values will be forwarded to shaders as uniforms as following:

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
valueuniform nameimplementation
uusets U of UV-coordinate
vvsets V of UV-coordinate
vendorIdshader library identifier (7447 e.g.)
presetshader presetnumber
presetVersiontargeted version of preset (so libraries can version/update their presets)
preset0preset parameter 0
preset1preset parameter 1
and so on
diff --git a/doc/RFC_XR_Fragments.md b/doc/RFC_XR_Fragments.md index 1654e11..2d0dbe7 100644 --- a/doc/RFC_XR_Fragments.md +++ b/doc/RFC_XR_Fragments.md @@ -233,7 +233,7 @@ That way, if the link gets shared, the XR Fragments implementation at `https://m |-------------------|------------|--------------------|----------------------------------------------------------------------| | `#pos` | vector3 | `#pos=0.5,0,0` | positions camera (or XR floor) to xyz-coord 0.5,0,0, | | `#rot` | vector3 | `#rot=0,90,0` | rotates camera to xyz-coord 0.5,0,0 | -| `#t` | timevector | `#t=2,2000,1` | play animation-loop range between frame 2 and 2000 at (normal) speed 1 | +| `#t` | [media fragment](#media%20fragments%20and%20datatypes) | `#t=0,2` | play/loop 3D animation from 0 seconds till 2 seconds | ## List of metadata for 3D nodes @@ -245,25 +245,6 @@ That way, if the link gets shared, the XR Fragments implementation at `https://m > Supported popular compatible 3D fileformats: `.gltf`, `.obj`, `.fbx`, `.usdz`, `.json` (THREE.js), `.dae` and so on. -## vector datatypes - -| type | syntax | example | info | -|------ -| vector2 | x,y | 2,3.0 | 2-dimensional vector | -| vector3 | x,y,z | 2,3.0,4 | 3-dimensional vector | -| timevector | speed | 1 | 1D timeline: play | -| | | 0 | 1D timeline: stop | -| | x,speed | 1,2 | 1D timeline: play at offset `1` at (normal) speed `2` | -| | | 0,0 | 1D timeline: stop (stopoffset-startoffset == 0) | -| | | 0,1 | 1D timeline: unpause with (normal) speed `1` | -| | | 1..100,1 | 1D timeline: play (loop) between offset `1` and `100` at normal speed (`1`) | -| | x,y,xspeed,yspeed | 0,0.5,0,0 | 2D timeline: stop uv-coordinate at `0,0.5` | -| | | 0,0.5,0.2,0 | 2D timeline: play uv-coordinate at offset `0,0.5` and scroll `x` (=u) `0.2` within each second | -| | | 0,0..0.5,0.2,0 | 2D timeline: play uv-coordinate between offset `0,0` and `0,0.5` (loop) and scroll `x` (=u) `0.2` within each second | -| | x,y,z,xspeed,yspeed,zspeed | 0,0.5,1,0.2,0,2 | XD timeline: play uv-coordinate at `0,0.5` and scroll `x` (=u) `0.2` within each second and pass `1` and `2` as custom data to shader uniforms `za` and `zb` | - -> NOTE: XR Fragments are optional but also file- and protocol-agnostic, which means that programmatic 3D scene(nodes) can also use the mechanism/metadata. - ## Dynamic XR Fragments (+databindings) These are automatic fragment-to-metadata mappings, which only trigger if the 3D scene metadata matches a specific identifier (`aliasname` e.g.) @@ -272,12 +253,42 @@ These are automatic fragment-to-metadata mappings, which only trigger if the 3D |------------------------|----------|-------------------|-------------------------------------------------------------------------------| | `#` | string | `#cubes` | evaluate predefined views (`#cubes: #foo&bar` e.g.) | | `#` | string | `#person` | focus object(s) with `tag: person` or name `person` by looking up XRWG | -| `#` | string | `#cam01` | set camera as active camera | +| `#[-]` | string | `#person` (`#-person`) | focus/show (or hide) object(s) with `tag: person` or name `person` by looking up XRWG | +| `#` | string | `#cam01` | set camera with name `cam01` as active camera | | `#=` | string=string | `#car=metallic`| set material of car to material with name `metallic` | | | string=string | `#product=metallic`| set material of objects tagged with `product` to material with name `metallic` | -| `#=` | string=[media frag](https://www.w3.org/TR/media-frags/#valid-uri) | `#foo=0,1`| play media `src` using [media fragment URI](https://www.w3.org/TR/media-frags/#valid-uri) | -| `#=` | string=timevector | `#sky=0,0.5,0.1,0`| sets 1D/2D/3D time(line) vectors (uv-position e.g.) to `0,0.5` (and autoscroll x with max `0.1` every second)| -| | | `#music=1,2`| play media of object (`src: podcast.mp3` e.g.) from beginning (`1`) at double speed (`2`) | +| `#=` | string=[media frag](https://www.w3.org/TR/media-frags/#valid-uri) | `#foo=0,1`| play 3D animation (or `src` media) using [media fragment URI](https://www.w3.org/TR/media-frags/#valid-uri) with [looping/speed/texturescroll abilities](#media%20fragments%20and%20datatypes) | + +## media fragments and datatypes + +> NOTE: below the word 'play' applies to 3D animations embedded in the 3D scene(file) **but also** media defined in `src`-metadata like audio/video-files (mp3/mp4 e.g.) + +| type | syntax | example | info | +|------------|--------|---------|------| +| vector2 | x,y | 2,3.0 | 2-dimensional vector | +| vector3 | x,y,z | 2,3.0,4 | 3-dimensional vector | +| media fragment | x | 0 | 1D timeline: play from 0 seconds to end (and stop) | +| media fragment | x,y | 0,2 | 1D timeline: play from 0 seconds till 2 seconds (and stop) | +| media fragment | u,v | 0,0.5 | 2D texture: set uv-coordinate at `0,0.5` | +| media fragment * | u,v, ... [*speed, ...] | 0*2 | 1D timeline: play from 0 seconds till end (and loop) at double (2) speed | +| * | | 0,1*2 | 1D timeline: play from 0 seconds till 2 seconds (and loop) at double (2) speed | +| * | | 0,1*0.1 | 2D texture: set uvcoordinates at `0,1` and scroll U with `0.1` per second (interpolating) | +| * | | 0,1*0.1*0.2 | 2D texture: set uvcoordinates at `0,1` and scroll U with `0.1` and V with `0.2` per second (interpolating) | + +> \* = this is extending the [W3C media fragments](https://www.w3.org/TR/media-frags/#mf-advanced) with multidimensionality and loop(speed). The multidimensional (nonspeed) values will be forwarded to shaders as **uniforms** as following: + +| value | uniform name | implementation | +|-----------|--------------|----------------| +| u | u | sets U of UV-coordinate | +| v | v | sets V of UV-coordinate | +| ... | vendor | shader library identifier (7447 e.g.) | +| ... | preset | shader presetnumber (0 e.g.) | +| ... | presetVersion| targeted version of preset (so libraries can version/update their presets)| +| ... | preset0 | preset parameter 0 | +| ... | preset1 | preset parameter 1 | +| ... | ... | and so on | + +> This allows 3D objects to hint the viewer which shader to (not load). If the shader does not support a certain shader-library (7447), then it will simply set the u/v coordinates on a flat shader. # Spatial Referencing 3D XR Fragments assume the following objectname-to-URIFragment mapping: diff --git a/doc/RFC_XR_Fragments.txt b/doc/RFC_XR_Fragments.txt index 05c2241..500c9e4 100644 --- a/doc/RFC_XR_Fragments.txt +++ b/doc/RFC_XR_Fragments.txt @@ -3,7 +3,7 @@ Internet Engineering Task Force L.R. van Kammen -Internet-Draft 30 January 2024 +Internet-Draft 1 February 2024 Intended status: Informational @@ -41,7 +41,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 2 August 2024. + This Internet-Draft will expire on 4 August 2024. Copyright Notice @@ -53,9 +53,9 @@ Copyright Notice -van Kammen Expires 2 August 2024 [Page 1] +van Kammen Expires 4 August 2024 [Page 1] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 This document is subject to BCP 78 and the IETF Trust's Legal @@ -75,43 +75,43 @@ Table of Contents 3.1. XR Fragment URL Grammar . . . . . . . . . . . . . . . . . 6 4. List of URI Fragments . . . . . . . . . . . . . . . . . . . . 7 4.1. List of metadata for 3D nodes . . . . . . . . . . . . . . 8 - 4.2. vector datatypes . . . . . . . . . . . . . . . . . . . . 8 - 4.3. Dynamic XR Fragments (+databindings) . . . . . . . . . . 9 - 5. Spatial Referencing 3D . . . . . . . . . . . . . . . . . . . 10 - 6. Navigating 3D . . . . . . . . . . . . . . . . . . . . . . . . 10 - 7. Top-level URL processing . . . . . . . . . . . . . . . . . . 12 - 8. Embedding XR content using src . . . . . . . . . . . . . . . 12 - 9. Navigating content href portals . . . . . . . . . . . . . . . 14 - 9.1. Walking surfaces . . . . . . . . . . . . . . . . . . . . 16 - 9.2. UX spec . . . . . . . . . . . . . . . . . . . . . . . . . 16 - 9.3. Scaling instanced content . . . . . . . . . . . . . . . . 16 - 10. XR Fragment: pos . . . . . . . . . . . . . . . . . . . . . . 17 - 11. XR Fragment: rot . . . . . . . . . . . . . . . . . . . . . . 17 - 12. XR Fragment: t . . . . . . . . . . . . . . . . . . . . . . . 17 - 13. XR audio/video integration . . . . . . . . . . . . . . . . . 18 - 14. XR Fragment filters . . . . . . . . . . . . . . . . . . . . . 18 - 14.1. including/excluding . . . . . . . . . . . . . . . . . . 19 - 14.2. Filter Parser . . . . . . . . . . . . . . . . . . . . . 19 - 15. Visible links . . . . . . . . . . . . . . . . . . . . . . . . 20 - 16. Text in XR (tagging,linking to spatial objects) . . . . . . . 20 - 16.1. Default Data URI mimetype . . . . . . . . . . . . . . . 24 - 16.2. URL and Data URI . . . . . . . . . . . . . . . . . . . . 25 - 16.3. XR Text example parser . . . . . . . . . . . . . . . . . 26 - 17. Transclusion (broken link) resolution . . . . . . . . . . . . 28 - 18. Topic-based index-less Webrings . . . . . . . . . . . . . . . 29 - 19. Security Considerations . . . . . . . . . . . . . . . . . . . 30 - 20. FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 - 21. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 31 - 22. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 31 - 23. Appendix: Definitions . . . . . . . . . . . . . . . . . . . . 31 + 4.2. Dynamic XR Fragments (+databindings) . . . . . . . . . . 8 + 4.3. media fragments and datatypes . . . . . . . . . . . . . . 9 + 5. Spatial Referencing 3D . . . . . . . . . . . . . . . . . . . 11 + 6. Navigating 3D . . . . . . . . . . . . . . . . . . . . . . . . 11 + 7. Top-level URL processing . . . . . . . . . . . . . . . . . . 13 + 8. Embedding XR content using src . . . . . . . . . . . . . . . 13 + 9. Navigating content href portals . . . . . . . . . . . . . . . 15 + 9.1. Walking surfaces . . . . . . . . . . . . . . . . . . . . 17 + 9.2. UX spec . . . . . . . . . . . . . . . . . . . . . . . . . 17 + 9.3. Scaling instanced content . . . . . . . . . . . . . . . . 17 + 10. XR Fragment: pos . . . . . . . . . . . . . . . . . . . . . . 18 + 11. XR Fragment: rot . . . . . . . . . . . . . . . . . . . . . . 18 + 12. XR Fragment: t . . . . . . . . . . . . . . . . . . . . . . . 18 + 13. XR audio/video integration . . . . . . . . . . . . . . . . . 19 + 14. XR Fragment filters . . . . . . . . . . . . . . . . . . . . . 19 + 14.1. including/excluding . . . . . . . . . . . . . . . . . . 20 + 14.2. Filter Parser . . . . . . . . . . . . . . . . . . . . . 20 + 15. Visible links . . . . . . . . . . . . . . . . . . . . . . . . 21 + 16. Text in XR (tagging,linking to spatial objects) . . . . . . . 21 + 16.1. Default Data URI mimetype . . . . . . . . . . . . . . . 25 + 16.2. URL and Data URI . . . . . . . . . . . . . . . . . . . . 26 + 16.3. XR Text example parser . . . . . . . . . . . . . . . . . 27 + 17. Transclusion (broken link) resolution . . . . . . . . . . . . 29 + 18. Topic-based index-less Webrings . . . . . . . . . . . . . . . 30 + 19. Security Considerations . . . . . . . . . . . . . . . . . . . 31 + 20. FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 + 21. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 32 + 22. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 32 + 23. Appendix: Definitions . . . . . . . . . . . . . . . . . . . . 32 -van Kammen Expires 2 August 2024 [Page 2] +van Kammen Expires 4 August 2024 [Page 2] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 1. Introduction @@ -165,9 +165,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 3] +van Kammen Expires 4 August 2024 [Page 3] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 +───────────────────────────────────────────────────────────────────────────────────────────────+ @@ -221,9 +221,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 4] +van Kammen Expires 4 August 2024 [Page 4] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 +───────────────────────────────────────────────────────────────────────────────────────────────+ @@ -277,9 +277,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 5] +van Kammen Expires 4 August 2024 [Page 5] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 +===========+===============================+====================+ @@ -333,9 +333,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 6] +van Kammen Expires 4 August 2024 [Page 6] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 +==========================+=================================+ @@ -362,38 +362,40 @@ Internet-Draft XR Fragments January 2024 4. List of URI Fragments - +==========+============+==============+===========================+ - | fragment | type | example | info | - +==========+============+==============+===========================+ - | #pos | vector3 | #pos=0.5,0,0 | positions camera (or XR | - | | | | floor) to xyz-coord | - | | | | 0.5,0,0, | - +----------+------------+--------------+---------------------------+ - | #rot | vector3 | #rot=0,90,0 | rotates camera to xyz- | - | | | | coord 0.5,0,0 | - +----------+------------+--------------+---------------------------+ - | #t | timevector | #t=2,2000,1 | play animation-loop range | - | | | | between frame 2 and 2000 | - | | | | at (normal) speed 1 | - +----------+------------+--------------+---------------------------+ - - Table 3 + +========+======================================+============+=========+ + |fragment|type |example |info | + +========+======================================+============+=========+ + |#pos |vector3 |#pos=0.5,0,0|positions| + | | | |camera | + | | | |(or XR | + | | | |floor) to| + | | | |xyz-coord| + | | | |0.5,0,0, | + +--------+--------------------------------------+------------+---------+ + |#rot |vector3 |#rot=0,90,0 |rotates | + | | | |camera to| + | | | |xyz-coord| + | | | |0.5,0,0 | + +--------+--------------------------------------+------------+---------+ + |#t |media fragment |#t=0,2 |play/loop| + | |(#media%20fragments%20and%20datatypes)| |3D | + | | | |animation| + | | | |from 0 | + | | | |seconds | + | | | |till 2 | + | | | |seconds | + +--------+--------------------------------------+------------+---------+ - - - - - - - -van Kammen Expires 2 August 2024 [Page 7] +van Kammen Expires 4 August 2024 [Page 7] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 + Table 3 + 4.1. List of metadata for 3D nodes +======+========+==========+===================+===================+ @@ -416,94 +418,148 @@ Internet-Draft XR Fragments January 2024 | Supported popular compatible 3D fileformats: .gltf, .obj, .fbx, | .usdz, .json (THREE.js), .dae and so on. -4.2. vector datatypes - - | type | syntax | example | info | - - +------------+ - | vector2 | - +------------+ - | vector3 | - +------------+ - | timevector | - +------------+ - +------------+ - +------------+ - +------------+ - +------------+ - +------------+ - +------------+ - +------------+ - +------------+ - +------------+ - - Table 5 - - | NOTE: XR Fragments are optional but also file- and protocol- - | agnostic, which means that programmatic 3D scene(nodes) can also - | use the mechanism/metadata. - - - -van Kammen Expires 2 August 2024 [Page 8] - -Internet-Draft XR Fragments January 2024 - - -4.3. Dynamic XR Fragments (+databindings) +4.2. Dynamic XR Fragments (+databindings) These are automatic fragment-to-metadata mappings, which only trigger if the 3D scene metadata matches a specific identifier (aliasname e.g.) - +==========================+=======================+=================+=======================+ - |fragment |type |example |info | - +==========================+=======================+=================+=======================+ - |# |string |#cubes |evaluate predefined | - | | | |views (#cubes: #foo&bar| - | | | |e.g.) | - +--------------------------+-----------------------+-----------------+-----------------------+ - |# |string |#person |focus object(s) with | - | | | |tag: person or name | - | | | |person by looking up | - | | | |XRWG | - +--------------------------+-----------------------+-----------------+-----------------------+ - |# |string |#cam01 |set camera as active | - | | | |camera | - +--------------------------+-----------------------+-----------------+-----------------------+ - |#= |string=string |#car=metallic |set material of car to | - | | | |material with name | - | | | |metallic | - +--------------------------+-----------------------+-----------------+-----------------------+ - | |string=string |#product=metallic|set material of objects| - | | | |tagged with product to | - | | | |material with name | - | | | |metallic | - +--------------------------+-----------------------+-----------------+-----------------------+ - |#= |string=media frag |#foo=0,1 |play media src using | - | |(https://www.w3.org/TR/| |media fragment URI | - | |media-frags/#valid-uri)| |(https://www.w3.org/TR/| - | | | |media-frags/#valid-uri)| - +--------------------------+-----------------------+-----------------+-----------------------+ - |#=|string=timevector |#sky=0,0.5,0.1,0 |sets 1D/2D/3D | - | | | |time(line) vectors (uv-| - | | | |position e.g.) to 0,0.5| - | | | |(and autoscroll x with | - | | | |max 0.1 every second) | - +--------------------------+-----------------------+-----------------+-----------------------+ - | | |#music=1,2 |play media of object | - | | | |(src: podcast.mp3 e.g.)| - | | | |from beginning (1) at | - | | | |double speed (2) | - +--------------------------+-----------------------+-----------------+-----------------------+ - - Table 6 -van Kammen Expires 2 August 2024 [Page 9] + + + + + + + + + + + + + + + + + + +van Kammen Expires 4 August 2024 [Page 8] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 + + + +=========================+=======================+=================+======================================+ + |fragment |type |example |info | + +=========================+=======================+=================+======================================+ + |# |string |#cubes |evaluate predefined views (#cubes: | + | | | |#foo&bar e.g.) | + +-------------------------+-----------------------+-----------------+--------------------------------------+ + |# |string |#person |focus object(s) with tag: person or | + | | | |name person by looking up XRWG | + +-------------------------+-----------------------+-----------------+--------------------------------------+ + |#[-] |string |#person |focus/show (or hide) object(s) with | + | | |(#-person) |tag: person or name person by looking | + | | | |up XRWG | + +-------------------------+-----------------------+-----------------+--------------------------------------+ + |# |string |#cam01 |set camera with name cam01 as active | + | | | |camera | + +-------------------------+-----------------------+-----------------+--------------------------------------+ + |#= |string=string |#car=metallic |set material of car to material with | + | | | |name metallic | + +-------------------------+-----------------------+-----------------+--------------------------------------+ + | |string=string |#product=metallic|set material of objects tagged with | + | | | |product to material with name metallic| + +-------------------------+-----------------------+-----------------+--------------------------------------+ + |#=|string=media frag |#foo=0,1 |play 3D animation (or src media) using| + | |(https://www.w3.org/TR/| |media fragment URI | + | |media-frags/#valid-uri)| |(https://www.w3.org/TR/media- | + | | | |frags/#valid-uri) with looping/speed/ | + | | | |texturescroll abilities | + | | | |(#media%20fragments%20and%20datatypes)| + +-------------------------+-----------------------+-----------------+--------------------------------------+ + + Table 5 + +4.3. media fragments and datatypes + + +==========+==========+=========+==================================+ + | type | syntax | example | info | + +==========+==========+=========+==================================+ + | vector2 | x,y | 2,3.0 | 2-dimensional vector | + +----------+----------+---------+----------------------------------+ + | vector3 | x,y,z | 2,3.0,4 | 3-dimensional vector | + +----------+----------+---------+----------------------------------+ + | media | x | 0 | 1D timeline: play from 0 seconds | + | fragment | | | to end (and stop) | + +----------+----------+---------+----------------------------------+ + | media | x,y | 0,2 | 1D timeline: play from 0 seconds | + | fragment | | | till 2 seconds (and stop) | + +----------+----------+---------+----------------------------------+ + | media | u,v | 0,0.5 | 2D texture: set uv-coordinate at | + + + +van Kammen Expires 4 August 2024 [Page 9] + +Internet-Draft XR Fragments February 2024 + + + | fragment | | | 0,0.5 | + +----------+----------+---------+----------------------------------+ + | media | u,v, ... | 0*2 | 1D timeline: play from 0 seconds | + | fragment | [*speed, | | till end (and loop) at double | + | * | ...] | | (2) speed | + +----------+----------+---------+----------------------------------+ + | * | | 0,1*2 | 1D timeline: play from 0 seconds | + | | | | till 2 seconds (and loop) at | + | | | | double (2) speed | + +----------+----------+---------+----------------------------------+ + | * | | 0,1*0.1 | 2D texture: set uvcoordinates at | + | | | | 0,1 and scroll them 0.1 per | + | | | | second (interpolating) | + +----------+----------+---------+----------------------------------+ + + Table 6 + + | * = this is extending the W3C media fragments + | (https://www.w3.org/TR/media-frags/#mf-advanced) with + | multidimensionality and loop(speed). The multidimensional + | (nonspeed) values will be forwarded to shaders as *uniforms* as + | following: + + +=======+===============+==========================================+ + | value | uniform name | implementation | + +=======+===============+==========================================+ + | u | u | sets U of UV-coordinate | + +-------+---------------+------------------------------------------+ + | v | v | sets V of UV-coordinate | + +-------+---------------+------------------------------------------+ + | ... | vendorId | shader library identifier (7447 e.g.) | + +-------+---------------+------------------------------------------+ + | ... | preset | shader presetnumber | + +-------+---------------+------------------------------------------+ + | ... | presetVersion | targeted version of preset (so libraries | + | | | can version/update their presets) | + +-------+---------------+------------------------------------------+ + | ... | preset0 | preset parameter 0 | + +-------+---------------+------------------------------------------+ + | ... | preset1 | preset parameter 1 | + +-------+---------------+------------------------------------------+ + | ... | ... | and so on | + +-------+---------------+------------------------------------------+ + + Table 7 + + + + + + +van Kammen Expires 4 August 2024 [Page 10] + +Internet-Draft XR Fragments February 2024 5. Spatial Referencing 3D @@ -557,9 +613,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 10] +van Kammen Expires 4 August 2024 [Page 11] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 | | | scene-animation or src- | @@ -568,7 +624,7 @@ Internet-Draft XR Fragments January 2024 | #rot=0,90,0 | vector3 | rotate camera | +--------------------+---------+-----------------------------+ - Table 7 + Table 8 » example implementation (https://github.com/coderofsalvation/xrfragment/blob/main/src/3rd/js/ @@ -613,9 +669,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 11] +van Kammen Expires 4 August 2024 [Page 12] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 7. Top-level URL processing @@ -661,7 +717,7 @@ Internet-Draft XR Fragments January 2024 | | |foo.mp3#0,0,0 | +--------+--------+---------------------------------------------------+ - Table 8 + Table 9 Here's an ascii representation of a 3D scene-graph with 3D objects ◻ which embeds remote & local 3D objects ◻ with/out using filters: @@ -669,9 +725,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 12] +van Kammen Expires 4 August 2024 [Page 13] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 +────────────────────────────────────────────────────────+ +─────────────────────────+ @@ -725,9 +781,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 13] +van Kammen Expires 4 August 2024 [Page 14] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 6. external src values should be served with appropriate @@ -781,9 +837,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 14] +van Kammen Expires 4 August 2024 [Page 15] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 +==========+==================+============================+ @@ -794,7 +850,7 @@ Internet-Draft XR Fragments January 2024 | | | ://somefile.gltf#pos=1,1,0 | +----------+------------------+----------------------------+ - Table 9 + Table 10 1. clicking an outbound ''external''- or ''file URI'' fully replaces the current scene and assumes pos=0,0,0&rot=0,0,0 by default @@ -837,9 +893,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 15] +van Kammen Expires 4 August 2024 [Page 16] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 » example implementation @@ -893,9 +949,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 16] +van Kammen Expires 4 August 2024 [Page 17] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 * calculate the bounding box of the instanced scene, and @@ -949,9 +1005,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 17] +van Kammen Expires 4 August 2024 [Page 18] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 13. XR audio/video integration @@ -988,7 +1044,7 @@ Internet-Draft XR Fragments January 2024 | | then only show object with price above 10 | +--------------------+-------------------------------------------+ - Table 10 + Table 11 It's simple but powerful syntax which allows filtering the scene using searchengine prompt-style feeling: @@ -1005,9 +1061,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 18] +van Kammen Expires 4 August 2024 [Page 19] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 14.1. including/excluding @@ -1032,7 +1088,7 @@ Internet-Draft XR Fragments January 2024 | | embedded objects (starting with #) | +----------+----------------------------------------------+ - Table 11 + Table 12 | NOTE 1: after an external embedded object has been instanced (src: | https://y.com/bar.fbx#room e.g.), filters do not affect them @@ -1061,9 +1117,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 19] +van Kammen Expires 4 August 2024 [Page 20] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 2. detect object id's & properties foo=1 and foo (reference regex= @@ -1117,9 +1173,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 20] +van Kammen Expires 4 August 2024 [Page 21] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 | The XR Fragments does this by collapsing space into a *Word Graph* @@ -1173,9 +1229,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 21] +van Kammen Expires 4 August 2024 [Page 22] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 Example: @@ -1229,9 +1285,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 22] +van Kammen Expires 4 August 2024 [Page 23] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 As seen above, the XRWG can expand bibs @@ -1253,7 +1309,7 @@ Internet-Draft XR Fragments January 2024 | foo.gltf#house | other objects with tag house or todo | +------------------+--------------------------------------+ - Table 12 + Table 13 | hashtagbibs (https://github.com/coderofsalvation/hashtagbibs) | potentially allow the enduser to annotate text/objects by @@ -1285,9 +1341,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 23] +van Kammen Expires 4 August 2024 [Page 24] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 12. Default font (unless specified otherwise) is a modern monospace @@ -1341,9 +1397,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 24] +van Kammen Expires 4 August 2024 [Page 25] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 * lines beginning with @ will not be rendered verbatim by default @@ -1397,9 +1453,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 25] +van Kammen Expires 4 August 2024 [Page 26] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 +--------------------------------------------------------------+ +------------------------+ @@ -1453,9 +1509,9 @@ xrtext = { -van Kammen Expires 2 August 2024 [Page 26] +van Kammen Expires 4 August 2024 [Page 27] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 // bibtex: ↓@ ↓ ↓property ↓end @@ -1509,9 +1565,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 27] +van Kammen Expires 4 August 2024 [Page 28] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 str = ` @@ -1565,9 +1621,9 @@ console.log( xrtext.encode(text,tags) ) // multiplex text & bibtex back to -van Kammen Expires 2 August 2024 [Page 28] +van Kammen Expires 4 August 2024 [Page 29] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 2. mirroring files on another protocol using (HTTP) errorcode tags @@ -1621,9 +1677,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 29] +van Kammen Expires 4 August 2024 [Page 30] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 * href: university.edu/projects.gltf#math&-theme math @@ -1677,9 +1733,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 30] +van Kammen Expires 4 August 2024 [Page 31] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 Non-HTML Hypermedia browsers should make browser extensions the right @@ -1733,9 +1789,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 31] +van Kammen Expires 4 August 2024 [Page 32] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 | | human minority (academics/developers) | @@ -1789,9 +1845,9 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 32] +van Kammen Expires 4 August 2024 [Page 33] -Internet-Draft XR Fragments January 2024 +Internet-Draft XR Fragments February 2024 | | is a person who lives in oklahoma") | @@ -1816,7 +1872,7 @@ Internet-Draft XR Fragments January 2024 | | XML | +-----------------+---------------------------------------------+ - Table 13 + Table 14 @@ -1845,4 +1901,4 @@ Internet-Draft XR Fragments January 2024 -van Kammen Expires 2 August 2024 [Page 33] +van Kammen Expires 4 August 2024 [Page 34] diff --git a/doc/RFC_XR_Fragments.xml b/doc/RFC_XR_Fragments.xml index bb18064..b42ec14 100644 --- a/doc/RFC_XR_Fragments.xml +++ b/doc/RFC_XR_Fragments.xml @@ -236,9 +236,9 @@ That way, if the link gets shared, the XR Fragments implementation at https: #t -timevector -#t=2,2000,1 -play animation-loop range between frame 2 and 2000 at (normal) speed 1 +media fragment +#t=0,2 +play/loop 3D animation from 0 seconds till 2 seconds @@ -282,61 +282,6 @@ That way, if the link gets shared, the XR Fragments implementation at https:
Supported popular compatible 3D fileformats: .gltf, .obj, .fbx, .usdz, .json (THREE.js), .dae and so on.
-
vector datatypes -| type | syntax | example | info | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
vector2
vector3
timevector
NOTE: XR Fragments are optional but also file- and protocol-agnostic, which means that programmatic 3D scene(nodes) can also use the mechanism/metadata. -
-
Dynamic XR Fragments (+databindings) These are automatic fragment-to-metadata mappings, which only trigger if the 3D scene metadata matches a specific identifier (aliasname e.g.) @@ -364,11 +309,18 @@ That way, if the link gets shared, the XR Fragments implementation at https: + + + + + + + - + @@ -389,21 +341,136 @@ That way, if the link gets shared, the XR Fragments implementation at https: - + + + +
focus object(s) with tag: person or name person by looking up XRWG
#[-]<tag_or_objectname>string#person (#-person)focus/show (or hide) object(s) with tag: person or name person by looking up XRWG
#<cameraname> string #cam01set camera as active cameraset camera with name cam01 as active camera
#<objectname>=<mediafrag> string=media frag #foo=0,1play media src using media fragment URIplay 3D animation (or src media) using media fragment URI with looping/speed/texturescroll abilities
+ +
media fragments and datatypes + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + +
typesyntaxexampleinfo
vector2x,y2,3.02-dimensional vector
#<objectname>=<timevector>string=timevector#sky=0,0.5,0.1,0sets 1D/2D/3D time(line) vectors (uv-position e.g.) to 0,0.5 (and autoscroll x with max 0.1 every second)vector3x,y,z2,3.0,43-dimensional vector
media fragmentx01D timeline: play from 0 seconds to end (and stop)
media fragmentx,y0,21D timeline: play from 0 seconds till 2 seconds (and stop)
media fragmentu,v0,0.52D texture: set uv-coordinate at 0,0.5
media fragment *u,v, ... [*speed, ...]0*21D timeline: play from 0 seconds till end (and loop) at double (2) speed
* 0,1*21D timeline: play from 0 seconds till 2 seconds (and loop) at double (2) speed
* #music=1,2play media of object (src: podcast.mp3 e.g.) from beginning (1) at double speed (2)0,1*0.12D texture: set uvcoordinates at 0,1 and scroll them 0.1 per second (interpolating)
* = this is extending the W3C media fragments with multidimensionality and loop(speed). The multidimensional (nonspeed) values will be forwarded to shaders as uniforms as following: +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
valueuniform nameimplementation
uusets U of UV-coordinate
vvsets V of UV-coordinate
...vendorIdshader library identifier (7447 e.g.)
...presetshader presetnumber
...presetVersiontargeted version of preset (so libraries can version/update their presets)
...preset0preset parameter 0
...preset1preset parameter 1
......and so on
diff --git a/doc/RFC_XR_Macros.txt b/doc/RFC_XR_Macros.txt index e9140dd..b9b2d0b 100644 --- a/doc/RFC_XR_Macros.txt +++ b/doc/RFC_XR_Macros.txt @@ -3,7 +3,7 @@ Internet Engineering Task Force L.R. van Kammen -Internet-Draft 30 January 2024 +Internet-Draft 1 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 2 August 2024. + This Internet-Draft will expire on 4 August 2024. Copyright Notice @@ -53,9 +53,9 @@ Copyright Notice -van Kammen Expires 2 August 2024 [Page 1] +van Kammen Expires 4 August 2024 [Page 1] -Internet-Draft XR Macros January 2024 +Internet-Draft XR Macros February 2024 extracted from this document must include Revised BSD License text as @@ -109,9 +109,9 @@ Table of Contents -van Kammen Expires 2 August 2024 [Page 2] +van Kammen Expires 4 August 2024 [Page 2] -Internet-Draft XR Macros January 2024 +Internet-Draft XR Macros February 2024 3. Metadata-values can contain the | symbol to 🎲 roundrobin variable @@ -165,9 +165,9 @@ Internet-Draft XR Macros January 2024 -van Kammen Expires 2 August 2024 [Page 3] +van Kammen Expires 4 August 2024 [Page 3] -Internet-Draft XR Macros January 2024 +Internet-Draft XR Macros February 2024 +=========+======+===================+=================+=============+ @@ -221,9 +221,9 @@ Internet-Draft XR Macros January 2024 -van Kammen Expires 2 August 2024 [Page 4] +van Kammen Expires 4 August 2024 [Page 4] -Internet-Draft XR Macros January 2024 +Internet-Draft XR Macros February 2024 Table 3 @@ -277,9 +277,9 @@ Internet-Draft XR Macros January 2024 -van Kammen Expires 2 August 2024 [Page 5] +van Kammen Expires 4 August 2024 [Page 5] -Internet-Draft XR Macros January 2024 +Internet-Draft XR Macros February 2024 4.5. Usecase: present context menu with options @@ -333,9 +333,9 @@ click object with (`!clickme`:`!foo|!bar|!flop` e.g.) -van Kammen Expires 2 August 2024 [Page 6] +van Kammen Expires 4 August 2024 [Page 6] -Internet-Draft XR Macros January 2024 +Internet-Draft XR Macros February 2024 | Note that only macro's can trigger roundrobin values or @@ -389,4 +389,4 @@ Internet-Draft XR Macros January 2024 -van Kammen Expires 2 August 2024 [Page 7] +van Kammen Expires 4 August 2024 [Page 7] diff --git a/example/assets/index.glb b/example/assets/index.glb index e5f807e..e1d857d 100644 Binary files a/example/assets/index.glb and b/example/assets/index.glb differ diff --git a/src/3rd/js/three/xrf/dynamic/uvscroll.js b/src/3rd/js/three/xrf/dynamic/uvscroll.js index b435b88..8f69882 100644 --- a/src/3rd/js/three/xrf/dynamic/uvscroll.js +++ b/src/3rd/js/three/xrf/dynamic/uvscroll.js @@ -2,7 +2,6 @@ xrf.addEventListener('dynamicKeyValue', (opts) => { let {scene,match,v} = opts let objname = v.fragment let autoscroll = v.z > 0 || v.w > 0 -return // DISABLED scene.traverse( (mesh) => { if( mesh.name == objname ){ if( !mesh.geometry ) return console.warn(`mesh '${objname}' has no uvcoordinates to offset`) diff --git a/src/xrfragment/Parser.hx b/src/xrfragment/Parser.hx index 386bb67..4d5b7cd 100644 --- a/src/xrfragment/Parser.hx +++ b/src/xrfragment/Parser.hx @@ -21,12 +21,11 @@ class Parser { Frag.set("tag", XRF.ASSET | XRF.T_STRING ); // spatial category: query selector / object manipulation - Frag.set("pos", XRF.PV_OVERRIDE | XRF.T_VECTOR3 | XRF.T_STRING | XRF.T_STRING_OBJ | XRF.METADATA | XRF.NAVIGATOR ); + Frag.set("pos", XRF.PV_OVERRIDE | XRF.T_VECTOR3 | XRF.T_STRING | XRF.METADATA | XRF.NAVIGATOR ); Frag.set("rot", XRF.QUERY_OPERATOR | XRF.PV_OVERRIDE | XRF.T_VECTOR3 | XRF.METADATA | XRF.NAVIGATOR ); // category: animation - Frag.set("t", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_FLOAT | XRF.T_VECTOR2 | XRF.T_STRING | XRF.NAVIGATOR | XRF.METADATA); - Frag.set("tv", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_FLOAT | XRF.T_VECTOR2 | XRF.T_VECTOR3 | XRF.NAVIGATOR | XRF.METADATA); + Frag.set("t", XRF.ASSET | XRF.PV_OVERRIDE | XRF.T_FLOAT | XRF.T_VECTOR2 | XRF.T_MEDIAFRAG | XRF.NAVIGATOR | XRF.METADATA); // category: author / metadata Frag.set("namespace", XRF.ASSET | XRF.T_STRING ); diff --git a/src/xrfragment/XRF.hx b/src/xrfragment/XRF.hx index 1c24914..540ae24 100644 --- a/src/xrfragment/XRF.hx +++ b/src/xrfragment/XRF.hx @@ -32,8 +32,7 @@ class XRF { public static var T_URL:Int = 262144; public static var T_PREDEFINED_VIEW:Int = 524288; public static var T_STRING:Int = 1048576; - public static var T_STRING_OBJ:Int = 2097152; - public static var T_STRING_OBJ_PROP:Int = 4194304; + public static var T_MEDIAFRAG:Int = 2097152; // regexes public static var isColor:EReg = ~/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/; // 1. hex colors are detected using regex `/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/` @@ -41,13 +40,14 @@ class XRF { public static var isFloat:EReg = ~/^[-0-9]+\.[0-9]+$/; // 1. floats are detected using regex `/^[0-9]+\.[0-9]+$/` public static var isVector:EReg = ~/([,]+|\w)/; // 1. vectors are detected using regex `/[,]/` (but can also be an string referring to an entity-ID in the asset) public static var isUrl:EReg = ~/(:\/\/)?\..*/; // 1. url/file */` - public static var isUrlOrPretypedView:EReg = ~/(^#|:\/\/)?\..*/; // 1. url/file */` + public static var isUrlOrPretypedView:EReg = ~/(^#|:\/\/)?\..*/; // 1. url/file */` public static var isString:EReg = ~/.*/; // 1. anything else is string `/.*/` public static var operators:EReg = ~/(^-|[\*]+)/; // 1. detect operators so you can easily strip keys (reference regex= `~/(^-)?(\/)?(\*)?/` ) public static var isProp:EReg = ~/^.*=[><=]?/; // 1. detect object id's & properties `foo=1` and `foo` (reference regex= `~/^.*=[><=]?/` ) public static var isExclude:EReg = ~/^-/; // 1. detect excluders like `-foo`,`-foo=1`,`-.foo`,`-/foo` (reference regex= `/^-/` ) public static var isDeep:EReg = ~/\*/; // 1. detect deep selectors like `foo*` (reference regex= `/\*$/` ) public static var isNumber:EReg = ~/^[0-9\.]+$/; // 1. detect number values like `foo=1` (reference regex= `/^[0-9\.]+$/` ) + public static var isMediaFrag:EReg = ~/^[0-9\.,\*]+$/; // 1. detect (extended) media fragment // value holder(s) // |------|------|--------|----------------------------------| public var fragment:String; @@ -56,7 +56,8 @@ class XRF { public var x:Float; // |vector| x,y,z| comma-separated | #pos=1,2,3 | public var y:Float; public var z:Float; - public var w:Float; + public var floats:Array = new Array(); + public var speed:Array = new Array(); public var color:String; // |string| color| FFFFFF (hex) | #fog=5m,FFAACC | public var string:String; // |string| | | #q=-sun | public var int:Int; // |int | | [-]x[xxxxx] | #price:>=100 | @@ -98,11 +99,13 @@ class XRF { if( !Std.isOfType(str,String) ) return; if( str.length > 0 ){ if( str.split(",").length > 1){ // 1. `,` assumes 1D/2D/3D vector-values like x[,y[,z]] - var xyzw:Array = str.split(","); // 1. parseFloat(..) and parseInt(..) is applied to vector/float and int values - if( xyzw.length > 0 ) v.x = Std.parseFloat(xyzw[0]); // 1. anything else will be treated as string-value - if( xyzw.length > 1 ) v.y = Std.parseFloat(xyzw[1]); // 1. incompatible value-types will be dropped / not used - if( xyzw.length > 2 ) v.z = Std.parseFloat(xyzw[2]); // - if( xyzw.length > 3 ) v.w = Std.parseFloat(xyzw[3]); // + var xyzn:Array = str.split(","); // 1. parseFloat(..) and parseInt(..) is applied to vector/float and int values + if( xyzn.length > 0 ) v.x = Std.parseFloat(xyzn[0]); // 1. anything else will be treated as string-value + if( xyzn.length > 1 ) v.y = Std.parseFloat(xyzn[1]); // 1. incompatible value-types will be dropped / not used + if( xyzn.length > 2 ) v.z = Std.parseFloat(xyzn[2]); // + for( i in 0...xyzn.length ){ + v.floats.push( Std.parseFloat(xyzn[i]) ); + } } // > the xrfragment specification should stay simple enough // > for anyone to write a parser using either regexes or grammar/lexers if( isColor.match(str) ) v.color = str; // > therefore expressions/comprehensions are not supported (max wildcard/comparison operators for queries e.g.) @@ -114,6 +117,16 @@ class XRF { v.int = Std.parseInt(str); v.x = cast(v.int); } + if( isMediaFrag.match(str) ){ + var speed:Array = str.split("*"); + v.speed = new Array(); + if( speed.length > 0 ){ + var values:Array = str.split(","); + for( i in 0...values.length ){ + v.speed.push( Std.parseFloat(values[i]) ); + } + } + } v.filter = new Filter(v.fragment+"="+v.string); }else v.filter = new Filter(v.fragment); }