Compare commits
	
		
			No commits in common. "main" and "feat/remotestorage" have entirely different histories.
		
	
	
		
			main
			...
			feat/remot
		
	
		
							
								
								
									
										11
									
								
								.env
									
										
									
									
									
								
							
							
						
						| 
						 | 
				
			
			@ -20,14 +20,5 @@ test "$GITEA_ROOT_URL" = "https://forgejo.isvery.ninja/" && {
 | 
			
		|||
  # on the website xrfragment.org copy examples to root-dir 
 | 
			
		||||
  # (so https://xrfragment.org/index.glb can be requested remotely)
 | 
			
		||||
  # because that really emphasizes a nice WebXR experience-at-website-root paradigm
 | 
			
		||||
  wget "https://raw.codeberg.page/coderofsalvation/xrfragment-haxe/example/assets/index.glb"
 | 
			
		||||
  test -d dist && rm -rf dist 
 | 
			
		||||
  mkdir dist
 | 
			
		||||
  cd dist
 | 
			
		||||
  wget "https://raw.codeberg.page/coderofsalvation/xrfragment-haxe/dist/xrfragment.aframe.all.js"
 | 
			
		||||
  wget "https://raw.codeberg.page/coderofsalvation/xrfragment-haxe/dist/xrfragment.aframe.js"
 | 
			
		||||
  wget "https://raw.codeberg.page/coderofsalvation/xrfragment-haxe/dist/xrfragment.js"
 | 
			
		||||
  wget "https://raw.codeberg.page/coderofsalvation/xrfragment-haxe/dist/xrfragment.module.js"
 | 
			
		||||
  wget "https://raw.codeberg.page/coderofsalvation/xrfragment-haxe/dist/xrfragment.three.js"
 | 
			
		||||
  wget "https://raw.codeberg.page/coderofsalvation/xrfragment-haxe/dist/xrfragment.three.module.js"
 | 
			
		||||
  cp -r example/assets/* .
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										22
									
								
								.github/workflows/test.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
name: test
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    branches:
 | 
			
		||||
    - main
 | 
			
		||||
    - feature/*
 | 
			
		||||
    - bugfix/*
 | 
			
		||||
  pull_request:
 | 
			
		||||
    branches: [ main ]
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  test:
 | 
			
		||||
    runs-on: ubuntu-22.04
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
      - name: install haxe
 | 
			
		||||
        run: ./make install
 | 
			
		||||
      - name: transpile haxe into languages
 | 
			
		||||
        run: ./make
 | 
			
		||||
      - name: run tests
 | 
			
		||||
        run: ./make tests
 | 
			
		||||
							
								
								
									
										115
									
								
								.github/workflows/website.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,115 @@
 | 
			
		|||
# Simple workflow for deploying static content to GitHub Pages
 | 
			
		||||
name: Deploy static content to Pages
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  # Runs on pushes targeting the default branch
 | 
			
		||||
  push:
 | 
			
		||||
    branches: ["main"] # ["main","feat/multiparty"]
 | 
			
		||||
 | 
			
		||||
  # Allows you to run this workflow manually from the Actions tab
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
 | 
			
		||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
 | 
			
		||||
permissions:
 | 
			
		||||
  contents: read
 | 
			
		||||
  pages: write
 | 
			
		||||
  id-token: write
 | 
			
		||||
 | 
			
		||||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
 | 
			
		||||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
 | 
			
		||||
concurrency:
 | 
			
		||||
  group: "pages"
 | 
			
		||||
  cancel-in-progress: false
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  # Single deploy job since we're just deploying
 | 
			
		||||
  deploy:
 | 
			
		||||
    environment:
 | 
			
		||||
      name: github-pages
 | 
			
		||||
      url: ${{ steps.deployment.outputs.page_url }}
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout
 | 
			
		||||
        uses: actions/checkout@v3
 | 
			
		||||
      #- name: Checkout feat/multiparty
 | 
			
		||||
      #  uses: actions/checkout@v3
 | 
			
		||||
      #  with:
 | 
			
		||||
      #    ref: feat/multiparty 
 | 
			
		||||
      #    path: feat/multiparty 
 | 
			
		||||
      - name: Setup Pages
 | 
			
		||||
        uses: actions/configure-pages@v3
 | 
			
		||||
      - name: create index.glb
 | 
			
		||||
        run: cp example/assets/*.glb .
 | 
			
		||||
      - name: cleanup 1
 | 
			
		||||
        run: test -f example/three/sandbox/other.gltf && rm example/three/sandbox/other.gltf || true
 | 
			
		||||
      - name: cleanup 2
 | 
			
		||||
        run: test -f example/three/sandbox/assets/2wa.gitlab.io && rm -rf example/three/sandbox/assets/2wa.gitlab.io || true
 | 
			
		||||
      #  working-directory: ./
 | 
			
		||||
      - name: Upload artifact
 | 
			
		||||
        uses: actions/upload-pages-artifact@v2
 | 
			
		||||
        with:
 | 
			
		||||
          path: '.'
 | 
			
		||||
      - name: Deploy to GitHub Pages
 | 
			
		||||
        id: deployment
 | 
			
		||||
        uses: actions/deploy-pages@v2
 | 
			
		||||
 | 
			
		||||
## Simple workflow for deploying static content to GitHub Pages
 | 
			
		||||
#name: Deploy static content to Pages
 | 
			
		||||
#
 | 
			
		||||
#on:
 | 
			
		||||
#  # Runs on pushes targeting the default branch
 | 
			
		||||
#  push:
 | 
			
		||||
#    branches: ["main"]
 | 
			
		||||
#
 | 
			
		||||
#  # Allows you to run this workflow manually from the Actions tab
 | 
			
		||||
#  workflow_dispatch:
 | 
			
		||||
#
 | 
			
		||||
## Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
 | 
			
		||||
#permissions:
 | 
			
		||||
#  contents: read
 | 
			
		||||
#  pages: write
 | 
			
		||||
#  id-token: write
 | 
			
		||||
#
 | 
			
		||||
## Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
 | 
			
		||||
## However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
 | 
			
		||||
#concurrency:
 | 
			
		||||
#  group: "pages"
 | 
			
		||||
#  cancel-in-progress: false
 | 
			
		||||
#
 | 
			
		||||
#jobs:
 | 
			
		||||
#  # Single deploy job since we're just deploying
 | 
			
		||||
#  deploy:
 | 
			
		||||
#    environment:
 | 
			
		||||
#      name: github-pages
 | 
			
		||||
#      url: ${{ steps.deployment.outputs.page_url }}
 | 
			
		||||
#    runs-on: ubuntu-latest
 | 
			
		||||
#    steps:
 | 
			
		||||
#      - name: Checkout main
 | 
			
		||||
#        uses: actions/checkout@v3
 | 
			
		||||
#      - name: Checkout feat/multiparty
 | 
			
		||||
#        uses: actions/checkout@v3
 | 
			
		||||
#        with:
 | 
			
		||||
#          ref: feat/multiparty 
 | 
			
		||||
#          path: feat/multiparty 
 | 
			
		||||
#      #- name: mkdir branches 
 | 
			
		||||
#      #  run: mkdir -p public/feat/multiparty
 | 
			
		||||
#      - name: Setup Pages
 | 
			
		||||
#        uses: actions/configure-pages@v3
 | 
			
		||||
#      - name: create public-folder
 | 
			
		||||
#        uses: mkdir public
 | 
			
		||||
#      - name: copy master-branch 
 | 
			
		||||
#        run:  cp -r * public/.
 | 
			
		||||
#      - name: create index.gltf 
 | 
			
		||||
#        run: cp example/assets/query.gltf public/index.gltf
 | 
			
		||||
#      - name: copy gltfs 
 | 
			
		||||
#        run: cp example/assets/*.gltf public/.
 | 
			
		||||
#      # Checkout other branches 
 | 
			
		||||
#      #  working-directory: ./
 | 
			
		||||
#      - name: Upload artifact
 | 
			
		||||
#        uses: actions/upload-pages-artifact@v1
 | 
			
		||||
#        with:
 | 
			
		||||
#          path: 'public'
 | 
			
		||||
#      - name: Deploy to GitHub Pages
 | 
			
		||||
#        id: deployment
 | 
			
		||||
#        uses: actions/deploy-pages@v2
 | 
			
		||||
#
 | 
			
		||||
							
								
								
									
										8
									
								
								.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
dist/*.pyc
 | 
			
		||||
src/spec/tmp.json
 | 
			
		||||
tags
 | 
			
		||||
example/assets/*.blend*
 | 
			
		||||
2wa.gitlab.io/*
 | 
			
		||||
src/3rd/js/aframe/build/aframe
 | 
			
		||||
example/godot/addons
 | 
			
		||||
example/godot/dist
 | 
			
		||||
							
								
								
									
										3
									
								
								.gitmodules
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
[submodule "example/godot"]
 | 
			
		||||
	path = example/godot
 | 
			
		||||
	url = https://codeberg.org/coderofsalvation/xrfragment-godot.git
 | 
			
		||||
							
								
								
									
										4
									
								
								.vimrc
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,4 @@
 | 
			
		|||
noremap <silent> <F8> :!haxe --no-output %<CR>
 | 
			
		||||
noremap <silent> <F9> :!./make build js<CR>
 | 
			
		||||
noremap <silent> <F10> :!./make build && ./make tests<CR>
 | 
			
		||||
noremap <silent> <F11> :!./make tests \| less<CR>
 | 
			
		||||
							
								
								
									
										661
									
								
								LICENSE
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,661 @@
 | 
			
		|||
                    GNU AFFERO GENERAL PUBLIC LICENSE
 | 
			
		||||
                       Version 3, 19 November 2007
 | 
			
		||||
 | 
			
		||||
 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
 | 
			
		||||
 Everyone is permitted to copy and distribute verbatim copies
 | 
			
		||||
 of this license document, but changing it is not allowed.
 | 
			
		||||
 | 
			
		||||
                            Preamble
 | 
			
		||||
 | 
			
		||||
  The GNU Affero General Public License is a free, copyleft license for
 | 
			
		||||
software and other kinds of works, specifically designed to ensure
 | 
			
		||||
cooperation with the community in the case of network server software.
 | 
			
		||||
 | 
			
		||||
  The licenses for most software and other practical works are designed
 | 
			
		||||
to take away your freedom to share and change the works.  By contrast,
 | 
			
		||||
our General Public Licenses are intended to guarantee your freedom to
 | 
			
		||||
share and change all versions of a program--to make sure it remains free
 | 
			
		||||
software for all its users.
 | 
			
		||||
 | 
			
		||||
  When we speak of free software, we are referring to freedom, not
 | 
			
		||||
price.  Our General Public Licenses are designed to make sure that you
 | 
			
		||||
have the freedom to distribute copies of free software (and charge for
 | 
			
		||||
them if you wish), that you receive source code or can get it if you
 | 
			
		||||
want it, that you can change the software or use pieces of it in new
 | 
			
		||||
free programs, and that you know you can do these things.
 | 
			
		||||
 | 
			
		||||
  Developers that use our General Public Licenses protect your rights
 | 
			
		||||
with two steps: (1) assert copyright on the software, and (2) offer
 | 
			
		||||
you this License which gives you legal permission to copy, distribute
 | 
			
		||||
and/or modify the software.
 | 
			
		||||
 | 
			
		||||
  A secondary benefit of defending all users' freedom is that
 | 
			
		||||
improvements made in alternate versions of the program, if they
 | 
			
		||||
receive widespread use, become available for other developers to
 | 
			
		||||
incorporate.  Many developers of free software are heartened and
 | 
			
		||||
encouraged by the resulting cooperation.  However, in the case of
 | 
			
		||||
software used on network servers, this result may fail to come about.
 | 
			
		||||
The GNU General Public License permits making a modified version and
 | 
			
		||||
letting the public access it on a server without ever releasing its
 | 
			
		||||
source code to the public.
 | 
			
		||||
 | 
			
		||||
  The GNU Affero General Public License is designed specifically to
 | 
			
		||||
ensure that, in such cases, the modified source code becomes available
 | 
			
		||||
to the community.  It requires the operator of a network server to
 | 
			
		||||
provide the source code of the modified version running there to the
 | 
			
		||||
users of that server.  Therefore, public use of a modified version, on
 | 
			
		||||
a publicly accessible server, gives the public access to the source
 | 
			
		||||
code of the modified version.
 | 
			
		||||
 | 
			
		||||
  An older license, called the Affero General Public License and
 | 
			
		||||
published by Affero, was designed to accomplish similar goals.  This is
 | 
			
		||||
a different license, not a version of the Affero GPL, but Affero has
 | 
			
		||||
released a new version of the Affero GPL which permits relicensing under
 | 
			
		||||
this license.
 | 
			
		||||
 | 
			
		||||
  The precise terms and conditions for copying, distribution and
 | 
			
		||||
modification follow.
 | 
			
		||||
 | 
			
		||||
                       TERMS AND CONDITIONS
 | 
			
		||||
 | 
			
		||||
  0. Definitions.
 | 
			
		||||
 | 
			
		||||
  "This License" refers to version 3 of the GNU Affero General Public License.
 | 
			
		||||
 | 
			
		||||
  "Copyright" also means copyright-like laws that apply to other kinds of
 | 
			
		||||
works, such as semiconductor masks.
 | 
			
		||||
 | 
			
		||||
  "The Program" refers to any copyrightable work licensed under this
 | 
			
		||||
License.  Each licensee is addressed as "you".  "Licensees" and
 | 
			
		||||
"recipients" may be individuals or organizations.
 | 
			
		||||
 | 
			
		||||
  To "modify" a work means to copy from or adapt all or part of the work
 | 
			
		||||
in a fashion requiring copyright permission, other than the making of an
 | 
			
		||||
exact copy.  The resulting work is called a "modified version" of the
 | 
			
		||||
earlier work or a work "based on" the earlier work.
 | 
			
		||||
 | 
			
		||||
  A "covered work" means either the unmodified Program or a work based
 | 
			
		||||
on the Program.
 | 
			
		||||
 | 
			
		||||
  To "propagate" a work means to do anything with it that, without
 | 
			
		||||
permission, would make you directly or secondarily liable for
 | 
			
		||||
infringement under applicable copyright law, except executing it on a
 | 
			
		||||
computer or modifying a private copy.  Propagation includes copying,
 | 
			
		||||
distribution (with or without modification), making available to the
 | 
			
		||||
public, and in some countries other activities as well.
 | 
			
		||||
 | 
			
		||||
  To "convey" a work means any kind of propagation that enables other
 | 
			
		||||
parties to make or receive copies.  Mere interaction with a user through
 | 
			
		||||
a computer network, with no transfer of a copy, is not conveying.
 | 
			
		||||
 | 
			
		||||
  An interactive user interface displays "Appropriate Legal Notices"
 | 
			
		||||
to the extent that it includes a convenient and prominently visible
 | 
			
		||||
feature that (1) displays an appropriate copyright notice, and (2)
 | 
			
		||||
tells the user that there is no warranty for the work (except to the
 | 
			
		||||
extent that warranties are provided), that licensees may convey the
 | 
			
		||||
work under this License, and how to view a copy of this License.  If
 | 
			
		||||
the interface presents a list of user commands or options, such as a
 | 
			
		||||
menu, a prominent item in the list meets this criterion.
 | 
			
		||||
 | 
			
		||||
  1. Source Code.
 | 
			
		||||
 | 
			
		||||
  The "source code" for a work means the preferred form of the work
 | 
			
		||||
for making modifications to it.  "Object code" means any non-source
 | 
			
		||||
form of a work.
 | 
			
		||||
 | 
			
		||||
  A "Standard Interface" means an interface that either is an official
 | 
			
		||||
standard defined by a recognized standards body, or, in the case of
 | 
			
		||||
interfaces specified for a particular programming language, one that
 | 
			
		||||
is widely used among developers working in that language.
 | 
			
		||||
 | 
			
		||||
  The "System Libraries" of an executable work include anything, other
 | 
			
		||||
than the work as a whole, that (a) is included in the normal form of
 | 
			
		||||
packaging a Major Component, but which is not part of that Major
 | 
			
		||||
Component, and (b) serves only to enable use of the work with that
 | 
			
		||||
Major Component, or to implement a Standard Interface for which an
 | 
			
		||||
implementation is available to the public in source code form.  A
 | 
			
		||||
"Major Component", in this context, means a major essential component
 | 
			
		||||
(kernel, window system, and so on) of the specific operating system
 | 
			
		||||
(if any) on which the executable work runs, or a compiler used to
 | 
			
		||||
produce the work, or an object code interpreter used to run it.
 | 
			
		||||
 | 
			
		||||
  The "Corresponding Source" for a work in object code form means all
 | 
			
		||||
the source code needed to generate, install, and (for an executable
 | 
			
		||||
work) run the object code and to modify the work, including scripts to
 | 
			
		||||
control those activities.  However, it does not include the work's
 | 
			
		||||
System Libraries, or general-purpose tools or generally available free
 | 
			
		||||
programs which are used unmodified in performing those activities but
 | 
			
		||||
which are not part of the work.  For example, Corresponding Source
 | 
			
		||||
includes interface definition files associated with source files for
 | 
			
		||||
the work, and the source code for shared libraries and dynamically
 | 
			
		||||
linked subprograms that the work is specifically designed to require,
 | 
			
		||||
such as by intimate data communication or control flow between those
 | 
			
		||||
subprograms and other parts of the work.
 | 
			
		||||
 | 
			
		||||
  The Corresponding Source need not include anything that users
 | 
			
		||||
can regenerate automatically from other parts of the Corresponding
 | 
			
		||||
Source.
 | 
			
		||||
 | 
			
		||||
  The Corresponding Source for a work in source code form is that
 | 
			
		||||
same work.
 | 
			
		||||
 | 
			
		||||
  2. Basic Permissions.
 | 
			
		||||
 | 
			
		||||
  All rights granted under this License are granted for the term of
 | 
			
		||||
copyright on the Program, and are irrevocable provided the stated
 | 
			
		||||
conditions are met.  This License explicitly affirms your unlimited
 | 
			
		||||
permission to run the unmodified Program.  The output from running a
 | 
			
		||||
covered work is covered by this License only if the output, given its
 | 
			
		||||
content, constitutes a covered work.  This License acknowledges your
 | 
			
		||||
rights of fair use or other equivalent, as provided by copyright law.
 | 
			
		||||
 | 
			
		||||
  You may make, run and propagate covered works that you do not
 | 
			
		||||
convey, without conditions so long as your license otherwise remains
 | 
			
		||||
in force.  You may convey covered works to others for the sole purpose
 | 
			
		||||
of having them make modifications exclusively for you, or provide you
 | 
			
		||||
with facilities for running those works, provided that you comply with
 | 
			
		||||
the terms of this License in conveying all material for which you do
 | 
			
		||||
not control copyright.  Those thus making or running the covered works
 | 
			
		||||
for you must do so exclusively on your behalf, under your direction
 | 
			
		||||
and control, on terms that prohibit them from making any copies of
 | 
			
		||||
your copyrighted material outside their relationship with you.
 | 
			
		||||
 | 
			
		||||
  Conveying under any other circumstances is permitted solely under
 | 
			
		||||
the conditions stated below.  Sublicensing is not allowed; section 10
 | 
			
		||||
makes it unnecessary.
 | 
			
		||||
 | 
			
		||||
  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
 | 
			
		||||
 | 
			
		||||
  No covered work shall be deemed part of an effective technological
 | 
			
		||||
measure under any applicable law fulfilling obligations under article
 | 
			
		||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
 | 
			
		||||
similar laws prohibiting or restricting circumvention of such
 | 
			
		||||
measures.
 | 
			
		||||
 | 
			
		||||
  When you convey a covered work, you waive any legal power to forbid
 | 
			
		||||
circumvention of technological measures to the extent such circumvention
 | 
			
		||||
is effected by exercising rights under this License with respect to
 | 
			
		||||
the covered work, and you disclaim any intention to limit operation or
 | 
			
		||||
modification of the work as a means of enforcing, against the work's
 | 
			
		||||
users, your or third parties' legal rights to forbid circumvention of
 | 
			
		||||
technological measures.
 | 
			
		||||
 | 
			
		||||
  4. Conveying Verbatim Copies.
 | 
			
		||||
 | 
			
		||||
  You may convey verbatim copies of the Program's source code as you
 | 
			
		||||
receive it, in any medium, provided that you conspicuously and
 | 
			
		||||
appropriately publish on each copy an appropriate copyright notice;
 | 
			
		||||
keep intact all notices stating that this License and any
 | 
			
		||||
non-permissive terms added in accord with section 7 apply to the code;
 | 
			
		||||
keep intact all notices of the absence of any warranty; and give all
 | 
			
		||||
recipients a copy of this License along with the Program.
 | 
			
		||||
 | 
			
		||||
  You may charge any price or no price for each copy that you convey,
 | 
			
		||||
and you may offer support or warranty protection for a fee.
 | 
			
		||||
 | 
			
		||||
  5. Conveying Modified Source Versions.
 | 
			
		||||
 | 
			
		||||
  You may convey a work based on the Program, or the modifications to
 | 
			
		||||
produce it from the Program, in the form of source code under the
 | 
			
		||||
terms of section 4, provided that you also meet all of these conditions:
 | 
			
		||||
 | 
			
		||||
    a) The work must carry prominent notices stating that you modified
 | 
			
		||||
    it, and giving a relevant date.
 | 
			
		||||
 | 
			
		||||
    b) The work must carry prominent notices stating that it is
 | 
			
		||||
    released under this License and any conditions added under section
 | 
			
		||||
    7.  This requirement modifies the requirement in section 4 to
 | 
			
		||||
    "keep intact all notices".
 | 
			
		||||
 | 
			
		||||
    c) You must license the entire work, as a whole, under this
 | 
			
		||||
    License to anyone who comes into possession of a copy.  This
 | 
			
		||||
    License will therefore apply, along with any applicable section 7
 | 
			
		||||
    additional terms, to the whole of the work, and all its parts,
 | 
			
		||||
    regardless of how they are packaged.  This License gives no
 | 
			
		||||
    permission to license the work in any other way, but it does not
 | 
			
		||||
    invalidate such permission if you have separately received it.
 | 
			
		||||
 | 
			
		||||
    d) If the work has interactive user interfaces, each must display
 | 
			
		||||
    Appropriate Legal Notices; however, if the Program has interactive
 | 
			
		||||
    interfaces that do not display Appropriate Legal Notices, your
 | 
			
		||||
    work need not make them do so.
 | 
			
		||||
 | 
			
		||||
  A compilation of a covered work with other separate and independent
 | 
			
		||||
works, which are not by their nature extensions of the covered work,
 | 
			
		||||
and which are not combined with it such as to form a larger program,
 | 
			
		||||
in or on a volume of a storage or distribution medium, is called an
 | 
			
		||||
"aggregate" if the compilation and its resulting copyright are not
 | 
			
		||||
used to limit the access or legal rights of the compilation's users
 | 
			
		||||
beyond what the individual works permit.  Inclusion of a covered work
 | 
			
		||||
in an aggregate does not cause this License to apply to the other
 | 
			
		||||
parts of the aggregate.
 | 
			
		||||
 | 
			
		||||
  6. Conveying Non-Source Forms.
 | 
			
		||||
 | 
			
		||||
  You may convey a covered work in object code form under the terms
 | 
			
		||||
of sections 4 and 5, provided that you also convey the
 | 
			
		||||
machine-readable Corresponding Source under the terms of this License,
 | 
			
		||||
in one of these ways:
 | 
			
		||||
 | 
			
		||||
    a) Convey the object code in, or embodied in, a physical product
 | 
			
		||||
    (including a physical distribution medium), accompanied by the
 | 
			
		||||
    Corresponding Source fixed on a durable physical medium
 | 
			
		||||
    customarily used for software interchange.
 | 
			
		||||
 | 
			
		||||
    b) Convey the object code in, or embodied in, a physical product
 | 
			
		||||
    (including a physical distribution medium), accompanied by a
 | 
			
		||||
    written offer, valid for at least three years and valid for as
 | 
			
		||||
    long as you offer spare parts or customer support for that product
 | 
			
		||||
    model, to give anyone who possesses the object code either (1) a
 | 
			
		||||
    copy of the Corresponding Source for all the software in the
 | 
			
		||||
    product that is covered by this License, on a durable physical
 | 
			
		||||
    medium customarily used for software interchange, for a price no
 | 
			
		||||
    more than your reasonable cost of physically performing this
 | 
			
		||||
    conveying of source, or (2) access to copy the
 | 
			
		||||
    Corresponding Source from a network server at no charge.
 | 
			
		||||
 | 
			
		||||
    c) Convey individual copies of the object code with a copy of the
 | 
			
		||||
    written offer to provide the Corresponding Source.  This
 | 
			
		||||
    alternative is allowed only occasionally and noncommercially, and
 | 
			
		||||
    only if you received the object code with such an offer, in accord
 | 
			
		||||
    with subsection 6b.
 | 
			
		||||
 | 
			
		||||
    d) Convey the object code by offering access from a designated
 | 
			
		||||
    place (gratis or for a charge), and offer equivalent access to the
 | 
			
		||||
    Corresponding Source in the same way through the same place at no
 | 
			
		||||
    further charge.  You need not require recipients to copy the
 | 
			
		||||
    Corresponding Source along with the object code.  If the place to
 | 
			
		||||
    copy the object code is a network server, the Corresponding Source
 | 
			
		||||
    may be on a different server (operated by you or a third party)
 | 
			
		||||
    that supports equivalent copying facilities, provided you maintain
 | 
			
		||||
    clear directions next to the object code saying where to find the
 | 
			
		||||
    Corresponding Source.  Regardless of what server hosts the
 | 
			
		||||
    Corresponding Source, you remain obligated to ensure that it is
 | 
			
		||||
    available for as long as needed to satisfy these requirements.
 | 
			
		||||
 | 
			
		||||
    e) Convey the object code using peer-to-peer transmission, provided
 | 
			
		||||
    you inform other peers where the object code and Corresponding
 | 
			
		||||
    Source of the work are being offered to the general public at no
 | 
			
		||||
    charge under subsection 6d.
 | 
			
		||||
 | 
			
		||||
  A separable portion of the object code, whose source code is excluded
 | 
			
		||||
from the Corresponding Source as a System Library, need not be
 | 
			
		||||
included in conveying the object code work.
 | 
			
		||||
 | 
			
		||||
  A "User Product" is either (1) a "consumer product", which means any
 | 
			
		||||
tangible personal property which is normally used for personal, family,
 | 
			
		||||
or household purposes, or (2) anything designed or sold for incorporation
 | 
			
		||||
into a dwelling.  In determining whether a product is a consumer product,
 | 
			
		||||
doubtful cases shall be resolved in favor of coverage.  For a particular
 | 
			
		||||
product received by a particular user, "normally used" refers to a
 | 
			
		||||
typical or common use of that class of product, regardless of the status
 | 
			
		||||
of the particular user or of the way in which the particular user
 | 
			
		||||
actually uses, or expects or is expected to use, the product.  A product
 | 
			
		||||
is a consumer product regardless of whether the product has substantial
 | 
			
		||||
commercial, industrial or non-consumer uses, unless such uses represent
 | 
			
		||||
the only significant mode of use of the product.
 | 
			
		||||
 | 
			
		||||
  "Installation Information" for a User Product means any methods,
 | 
			
		||||
procedures, authorization keys, or other information required to install
 | 
			
		||||
and execute modified versions of a covered work in that User Product from
 | 
			
		||||
a modified version of its Corresponding Source.  The information must
 | 
			
		||||
suffice to ensure that the continued functioning of the modified object
 | 
			
		||||
code is in no case prevented or interfered with solely because
 | 
			
		||||
modification has been made.
 | 
			
		||||
 | 
			
		||||
  If you convey an object code work under this section in, or with, or
 | 
			
		||||
specifically for use in, a User Product, and the conveying occurs as
 | 
			
		||||
part of a transaction in which the right of possession and use of the
 | 
			
		||||
User Product is transferred to the recipient in perpetuity or for a
 | 
			
		||||
fixed term (regardless of how the transaction is characterized), the
 | 
			
		||||
Corresponding Source conveyed under this section must be accompanied
 | 
			
		||||
by the Installation Information.  But this requirement does not apply
 | 
			
		||||
if neither you nor any third party retains the ability to install
 | 
			
		||||
modified object code on the User Product (for example, the work has
 | 
			
		||||
been installed in ROM).
 | 
			
		||||
 | 
			
		||||
  The requirement to provide Installation Information does not include a
 | 
			
		||||
requirement to continue to provide support service, warranty, or updates
 | 
			
		||||
for a work that has been modified or installed by the recipient, or for
 | 
			
		||||
the User Product in which it has been modified or installed.  Access to a
 | 
			
		||||
network may be denied when the modification itself materially and
 | 
			
		||||
adversely affects the operation of the network or violates the rules and
 | 
			
		||||
protocols for communication across the network.
 | 
			
		||||
 | 
			
		||||
  Corresponding Source conveyed, and Installation Information provided,
 | 
			
		||||
in accord with this section must be in a format that is publicly
 | 
			
		||||
documented (and with an implementation available to the public in
 | 
			
		||||
source code form), and must require no special password or key for
 | 
			
		||||
unpacking, reading or copying.
 | 
			
		||||
 | 
			
		||||
  7. Additional Terms.
 | 
			
		||||
 | 
			
		||||
  "Additional permissions" are terms that supplement the terms of this
 | 
			
		||||
License by making exceptions from one or more of its conditions.
 | 
			
		||||
Additional permissions that are applicable to the entire Program shall
 | 
			
		||||
be treated as though they were included in this License, to the extent
 | 
			
		||||
that they are valid under applicable law.  If additional permissions
 | 
			
		||||
apply only to part of the Program, that part may be used separately
 | 
			
		||||
under those permissions, but the entire Program remains governed by
 | 
			
		||||
this License without regard to the additional permissions.
 | 
			
		||||
 | 
			
		||||
  When you convey a copy of a covered work, you may at your option
 | 
			
		||||
remove any additional permissions from that copy, or from any part of
 | 
			
		||||
it.  (Additional permissions may be written to require their own
 | 
			
		||||
removal in certain cases when you modify the work.)  You may place
 | 
			
		||||
additional permissions on material, added by you to a covered work,
 | 
			
		||||
for which you have or can give appropriate copyright permission.
 | 
			
		||||
 | 
			
		||||
  Notwithstanding any other provision of this License, for material you
 | 
			
		||||
add to a covered work, you may (if authorized by the copyright holders of
 | 
			
		||||
that material) supplement the terms of this License with terms:
 | 
			
		||||
 | 
			
		||||
    a) Disclaiming warranty or limiting liability differently from the
 | 
			
		||||
    terms of sections 15 and 16 of this License; or
 | 
			
		||||
 | 
			
		||||
    b) Requiring preservation of specified reasonable legal notices or
 | 
			
		||||
    author attributions in that material or in the Appropriate Legal
 | 
			
		||||
    Notices displayed by works containing it; or
 | 
			
		||||
 | 
			
		||||
    c) Prohibiting misrepresentation of the origin of that material, or
 | 
			
		||||
    requiring that modified versions of such material be marked in
 | 
			
		||||
    reasonable ways as different from the original version; or
 | 
			
		||||
 | 
			
		||||
    d) Limiting the use for publicity purposes of names of licensors or
 | 
			
		||||
    authors of the material; or
 | 
			
		||||
 | 
			
		||||
    e) Declining to grant rights under trademark law for use of some
 | 
			
		||||
    trade names, trademarks, or service marks; or
 | 
			
		||||
 | 
			
		||||
    f) Requiring indemnification of licensors and authors of that
 | 
			
		||||
    material by anyone who conveys the material (or modified versions of
 | 
			
		||||
    it) with contractual assumptions of liability to the recipient, for
 | 
			
		||||
    any liability that these contractual assumptions directly impose on
 | 
			
		||||
    those licensors and authors.
 | 
			
		||||
 | 
			
		||||
  All other non-permissive additional terms are considered "further
 | 
			
		||||
restrictions" within the meaning of section 10.  If the Program as you
 | 
			
		||||
received it, or any part of it, contains a notice stating that it is
 | 
			
		||||
governed by this License along with a term that is a further
 | 
			
		||||
restriction, you may remove that term.  If a license document contains
 | 
			
		||||
a further restriction but permits relicensing or conveying under this
 | 
			
		||||
License, you may add to a covered work material governed by the terms
 | 
			
		||||
of that license document, provided that the further restriction does
 | 
			
		||||
not survive such relicensing or conveying.
 | 
			
		||||
 | 
			
		||||
  If you add terms to a covered work in accord with this section, you
 | 
			
		||||
must place, in the relevant source files, a statement of the
 | 
			
		||||
additional terms that apply to those files, or a notice indicating
 | 
			
		||||
where to find the applicable terms.
 | 
			
		||||
 | 
			
		||||
  Additional terms, permissive or non-permissive, may be stated in the
 | 
			
		||||
form of a separately written license, or stated as exceptions;
 | 
			
		||||
the above requirements apply either way.
 | 
			
		||||
 | 
			
		||||
  8. Termination.
 | 
			
		||||
 | 
			
		||||
  You may not propagate or modify a covered work except as expressly
 | 
			
		||||
provided under this License.  Any attempt otherwise to propagate or
 | 
			
		||||
modify it is void, and will automatically terminate your rights under
 | 
			
		||||
this License (including any patent licenses granted under the third
 | 
			
		||||
paragraph of section 11).
 | 
			
		||||
 | 
			
		||||
  However, if you cease all violation of this License, then your
 | 
			
		||||
license from a particular copyright holder is reinstated (a)
 | 
			
		||||
provisionally, unless and until the copyright holder explicitly and
 | 
			
		||||
finally terminates your license, and (b) permanently, if the copyright
 | 
			
		||||
holder fails to notify you of the violation by some reasonable means
 | 
			
		||||
prior to 60 days after the cessation.
 | 
			
		||||
 | 
			
		||||
  Moreover, your license from a particular copyright holder is
 | 
			
		||||
reinstated permanently if the copyright holder notifies you of the
 | 
			
		||||
violation by some reasonable means, this is the first time you have
 | 
			
		||||
received notice of violation of this License (for any work) from that
 | 
			
		||||
copyright holder, and you cure the violation prior to 30 days after
 | 
			
		||||
your receipt of the notice.
 | 
			
		||||
 | 
			
		||||
  Termination of your rights under this section does not terminate the
 | 
			
		||||
licenses of parties who have received copies or rights from you under
 | 
			
		||||
this License.  If your rights have been terminated and not permanently
 | 
			
		||||
reinstated, you do not qualify to receive new licenses for the same
 | 
			
		||||
material under section 10.
 | 
			
		||||
 | 
			
		||||
  9. Acceptance Not Required for Having Copies.
 | 
			
		||||
 | 
			
		||||
  You are not required to accept this License in order to receive or
 | 
			
		||||
run a copy of the Program.  Ancillary propagation of a covered work
 | 
			
		||||
occurring solely as a consequence of using peer-to-peer transmission
 | 
			
		||||
to receive a copy likewise does not require acceptance.  However,
 | 
			
		||||
nothing other than this License grants you permission to propagate or
 | 
			
		||||
modify any covered work.  These actions infringe copyright if you do
 | 
			
		||||
not accept this License.  Therefore, by modifying or propagating a
 | 
			
		||||
covered work, you indicate your acceptance of this License to do so.
 | 
			
		||||
 | 
			
		||||
  10. Automatic Licensing of Downstream Recipients.
 | 
			
		||||
 | 
			
		||||
  Each time you convey a covered work, the recipient automatically
 | 
			
		||||
receives a license from the original licensors, to run, modify and
 | 
			
		||||
propagate that work, subject to this License.  You are not responsible
 | 
			
		||||
for enforcing compliance by third parties with this License.
 | 
			
		||||
 | 
			
		||||
  An "entity transaction" is a transaction transferring control of an
 | 
			
		||||
organization, or substantially all assets of one, or subdividing an
 | 
			
		||||
organization, or merging organizations.  If propagation of a covered
 | 
			
		||||
work results from an entity transaction, each party to that
 | 
			
		||||
transaction who receives a copy of the work also receives whatever
 | 
			
		||||
licenses to the work the party's predecessor in interest had or could
 | 
			
		||||
give under the previous paragraph, plus a right to possession of the
 | 
			
		||||
Corresponding Source of the work from the predecessor in interest, if
 | 
			
		||||
the predecessor has it or can get it with reasonable efforts.
 | 
			
		||||
 | 
			
		||||
  You may not impose any further restrictions on the exercise of the
 | 
			
		||||
rights granted or affirmed under this License.  For example, you may
 | 
			
		||||
not impose a license fee, royalty, or other charge for exercise of
 | 
			
		||||
rights granted under this License, and you may not initiate litigation
 | 
			
		||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
 | 
			
		||||
any patent claim is infringed by making, using, selling, offering for
 | 
			
		||||
sale, or importing the Program or any portion of it.
 | 
			
		||||
 | 
			
		||||
  11. Patents.
 | 
			
		||||
 | 
			
		||||
  A "contributor" is a copyright holder who authorizes use under this
 | 
			
		||||
License of the Program or a work on which the Program is based.  The
 | 
			
		||||
work thus licensed is called the contributor's "contributor version".
 | 
			
		||||
 | 
			
		||||
  A contributor's "essential patent claims" are all patent claims
 | 
			
		||||
owned or controlled by the contributor, whether already acquired or
 | 
			
		||||
hereafter acquired, that would be infringed by some manner, permitted
 | 
			
		||||
by this License, of making, using, or selling its contributor version,
 | 
			
		||||
but do not include claims that would be infringed only as a
 | 
			
		||||
consequence of further modification of the contributor version.  For
 | 
			
		||||
purposes of this definition, "control" includes the right to grant
 | 
			
		||||
patent sublicenses in a manner consistent with the requirements of
 | 
			
		||||
this License.
 | 
			
		||||
 | 
			
		||||
  Each contributor grants you a non-exclusive, worldwide, royalty-free
 | 
			
		||||
patent license under the contributor's essential patent claims, to
 | 
			
		||||
make, use, sell, offer for sale, import and otherwise run, modify and
 | 
			
		||||
propagate the contents of its contributor version.
 | 
			
		||||
 | 
			
		||||
  In the following three paragraphs, a "patent license" is any express
 | 
			
		||||
agreement or commitment, however denominated, not to enforce a patent
 | 
			
		||||
(such as an express permission to practice a patent or covenant not to
 | 
			
		||||
sue for patent infringement).  To "grant" such a patent license to a
 | 
			
		||||
party means to make such an agreement or commitment not to enforce a
 | 
			
		||||
patent against the party.
 | 
			
		||||
 | 
			
		||||
  If you convey a covered work, knowingly relying on a patent license,
 | 
			
		||||
and the Corresponding Source of the work is not available for anyone
 | 
			
		||||
to copy, free of charge and under the terms of this License, through a
 | 
			
		||||
publicly available network server or other readily accessible means,
 | 
			
		||||
then you must either (1) cause the Corresponding Source to be so
 | 
			
		||||
available, or (2) arrange to deprive yourself of the benefit of the
 | 
			
		||||
patent license for this particular work, or (3) arrange, in a manner
 | 
			
		||||
consistent with the requirements of this License, to extend the patent
 | 
			
		||||
license to downstream recipients.  "Knowingly relying" means you have
 | 
			
		||||
actual knowledge that, but for the patent license, your conveying the
 | 
			
		||||
covered work in a country, or your recipient's use of the covered work
 | 
			
		||||
in a country, would infringe one or more identifiable patents in that
 | 
			
		||||
country that you have reason to believe are valid.
 | 
			
		||||
 | 
			
		||||
  If, pursuant to or in connection with a single transaction or
 | 
			
		||||
arrangement, you convey, or propagate by procuring conveyance of, a
 | 
			
		||||
covered work, and grant a patent license to some of the parties
 | 
			
		||||
receiving the covered work authorizing them to use, propagate, modify
 | 
			
		||||
or convey a specific copy of the covered work, then the patent license
 | 
			
		||||
you grant is automatically extended to all recipients of the covered
 | 
			
		||||
work and works based on it.
 | 
			
		||||
 | 
			
		||||
  A patent license is "discriminatory" if it does not include within
 | 
			
		||||
the scope of its coverage, prohibits the exercise of, or is
 | 
			
		||||
conditioned on the non-exercise of one or more of the rights that are
 | 
			
		||||
specifically granted under this License.  You may not convey a covered
 | 
			
		||||
work if you are a party to an arrangement with a third party that is
 | 
			
		||||
in the business of distributing software, under which you make payment
 | 
			
		||||
to the third party based on the extent of your activity of conveying
 | 
			
		||||
the work, and under which the third party grants, to any of the
 | 
			
		||||
parties who would receive the covered work from you, a discriminatory
 | 
			
		||||
patent license (a) in connection with copies of the covered work
 | 
			
		||||
conveyed by you (or copies made from those copies), or (b) primarily
 | 
			
		||||
for and in connection with specific products or compilations that
 | 
			
		||||
contain the covered work, unless you entered into that arrangement,
 | 
			
		||||
or that patent license was granted, prior to 28 March 2007.
 | 
			
		||||
 | 
			
		||||
  Nothing in this License shall be construed as excluding or limiting
 | 
			
		||||
any implied license or other defenses to infringement that may
 | 
			
		||||
otherwise be available to you under applicable patent law.
 | 
			
		||||
 | 
			
		||||
  12. No Surrender of Others' Freedom.
 | 
			
		||||
 | 
			
		||||
  If conditions are imposed on you (whether by court order, agreement or
 | 
			
		||||
otherwise) that contradict the conditions of this License, they do not
 | 
			
		||||
excuse you from the conditions of this License.  If you cannot convey a
 | 
			
		||||
covered work so as to satisfy simultaneously your obligations under this
 | 
			
		||||
License and any other pertinent obligations, then as a consequence you may
 | 
			
		||||
not convey it at all.  For example, if you agree to terms that obligate you
 | 
			
		||||
to collect a royalty for further conveying from those to whom you convey
 | 
			
		||||
the Program, the only way you could satisfy both those terms and this
 | 
			
		||||
License would be to refrain entirely from conveying the Program.
 | 
			
		||||
 | 
			
		||||
  13. Remote Network Interaction; Use with the GNU General Public License.
 | 
			
		||||
 | 
			
		||||
  Notwithstanding any other provision of this License, if you modify the
 | 
			
		||||
Program, your modified version must prominently offer all users
 | 
			
		||||
interacting with it remotely through a computer network (if your version
 | 
			
		||||
supports such interaction) an opportunity to receive the Corresponding
 | 
			
		||||
Source of your version by providing access to the Corresponding Source
 | 
			
		||||
from a network server at no charge, through some standard or customary
 | 
			
		||||
means of facilitating copying of software.  This Corresponding Source
 | 
			
		||||
shall include the Corresponding Source for any work covered by version 3
 | 
			
		||||
of the GNU General Public License that is incorporated pursuant to the
 | 
			
		||||
following paragraph.
 | 
			
		||||
 | 
			
		||||
  Notwithstanding any other provision of this License, you have
 | 
			
		||||
permission to link or combine any covered work with a work licensed
 | 
			
		||||
under version 3 of the GNU General Public License into a single
 | 
			
		||||
combined work, and to convey the resulting work.  The terms of this
 | 
			
		||||
License will continue to apply to the part which is the covered work,
 | 
			
		||||
but the work with which it is combined will remain governed by version
 | 
			
		||||
3 of the GNU General Public License.
 | 
			
		||||
 | 
			
		||||
  14. Revised Versions of this License.
 | 
			
		||||
 | 
			
		||||
  The Free Software Foundation may publish revised and/or new versions of
 | 
			
		||||
the GNU Affero General Public License from time to time.  Such new versions
 | 
			
		||||
will be similar in spirit to the present version, but may differ in detail to
 | 
			
		||||
address new problems or concerns.
 | 
			
		||||
 | 
			
		||||
  Each version is given a distinguishing version number.  If the
 | 
			
		||||
Program specifies that a certain numbered version of the GNU Affero General
 | 
			
		||||
Public License "or any later version" applies to it, you have the
 | 
			
		||||
option of following the terms and conditions either of that numbered
 | 
			
		||||
version or of any later version published by the Free Software
 | 
			
		||||
Foundation.  If the Program does not specify a version number of the
 | 
			
		||||
GNU Affero General Public License, you may choose any version ever published
 | 
			
		||||
by the Free Software Foundation.
 | 
			
		||||
 | 
			
		||||
  If the Program specifies that a proxy can decide which future
 | 
			
		||||
versions of the GNU Affero General Public License can be used, that proxy's
 | 
			
		||||
public statement of acceptance of a version permanently authorizes you
 | 
			
		||||
to choose that version for the Program.
 | 
			
		||||
 | 
			
		||||
  Later license versions may give you additional or different
 | 
			
		||||
permissions.  However, no additional obligations are imposed on any
 | 
			
		||||
author or copyright holder as a result of your choosing to follow a
 | 
			
		||||
later version.
 | 
			
		||||
 | 
			
		||||
  15. Disclaimer of Warranty.
 | 
			
		||||
 | 
			
		||||
  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
 | 
			
		||||
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
 | 
			
		||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
 | 
			
		||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
 | 
			
		||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
			
		||||
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
 | 
			
		||||
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
 | 
			
		||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
 | 
			
		||||
 | 
			
		||||
  16. Limitation of Liability.
 | 
			
		||||
 | 
			
		||||
  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
 | 
			
		||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
 | 
			
		||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
 | 
			
		||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
 | 
			
		||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
 | 
			
		||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
 | 
			
		||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
 | 
			
		||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
SUCH DAMAGES.
 | 
			
		||||
 | 
			
		||||
  17. Interpretation of Sections 15 and 16.
 | 
			
		||||
 | 
			
		||||
  If the disclaimer of warranty and limitation of liability provided
 | 
			
		||||
above cannot be given local legal effect according to their terms,
 | 
			
		||||
reviewing courts shall apply local law that most closely approximates
 | 
			
		||||
an absolute waiver of all civil liability in connection with the
 | 
			
		||||
Program, unless a warranty or assumption of liability accompanies a
 | 
			
		||||
copy of the Program in return for a fee.
 | 
			
		||||
 | 
			
		||||
                     END OF TERMS AND CONDITIONS
 | 
			
		||||
 | 
			
		||||
            How to Apply These Terms to Your New Programs
 | 
			
		||||
 | 
			
		||||
  If you develop a new program, and you want it to be of the greatest
 | 
			
		||||
possible use to the public, the best way to achieve this is to make it
 | 
			
		||||
free software which everyone can redistribute and change under these terms.
 | 
			
		||||
 | 
			
		||||
  To do so, attach the following notices to the program.  It is safest
 | 
			
		||||
to attach them to the start of each source file to most effectively
 | 
			
		||||
state the exclusion of warranty; and each file should have at least
 | 
			
		||||
the "copyright" line and a pointer to where the full notice is found.
 | 
			
		||||
 | 
			
		||||
    <one line to give the program's name and a brief idea of what it does.>
 | 
			
		||||
    Copyright (C) <year>  <name of author>
 | 
			
		||||
 | 
			
		||||
    This program is free software: you can redistribute it and/or modify
 | 
			
		||||
    it under the terms of the GNU Affero General Public License as published by
 | 
			
		||||
    the Free Software Foundation, either version 3 of the License, or
 | 
			
		||||
    (at your option) any later version.
 | 
			
		||||
 | 
			
		||||
    This program is distributed in the hope that it will be useful,
 | 
			
		||||
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
    GNU Affero General Public License for more details.
 | 
			
		||||
 | 
			
		||||
    You should have received a copy of the GNU Affero General Public License
 | 
			
		||||
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
Also add information on how to contact you by electronic and paper mail.
 | 
			
		||||
 | 
			
		||||
  If your software can interact with users remotely through a computer
 | 
			
		||||
network, you should also make sure that it provides a way for users to
 | 
			
		||||
get its source.  For example, if your program is a web application, its
 | 
			
		||||
interface could display a "Source" link that leads users to an archive
 | 
			
		||||
of the code.  There are many ways you could offer source, and different
 | 
			
		||||
solutions will be better for different programs; see section 13 for the
 | 
			
		||||
specific requirements.
 | 
			
		||||
 | 
			
		||||
  You should also get your employer (if you work as a programmer) or school,
 | 
			
		||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
 | 
			
		||||
For more information on this, and how to apply and follow the GNU AGPL, see
 | 
			
		||||
<https://www.gnu.org/licenses/>.
 | 
			
		||||
							
								
								
									
										67
									
								
								README.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,67 @@
 | 
			
		|||
<link rel="stylesheet" href="doc/style.css"/>
 | 
			
		||||
<link href="https://fonts.cdnfonts.com/css/montserrat" rel="stylesheet"/>
 | 
			
		||||
 | 
			
		||||
[](https://github.com/coderofsalvation/xrfragment/actions)
 | 
			
		||||
 | 
			
		||||
<img src="https://xrfragment.org/example/assets/logo.png" width="200"/>
 | 
			
		||||
 | 
			
		||||
A tiny specification for viewing 3D models as linkable AR/VR websites.<br>
 | 
			
		||||
Address and Control anything inside a 3D model with [W3C Media Fragments](https://www.w3.org/TR/media-frags/) and [URI Templates](https://www.rfc-editor.org/rfc/rfc6570).<br>
 | 
			
		||||
<br>
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
<br>
 | 
			
		||||
Simply SURF a 3D file-verse and design for a Spatial Open Internet with the highest degree of interoperability ❤
 | 
			
		||||
 | 
			
		||||
# Documentation / Website 
 | 
			
		||||
 | 
			
		||||
https://xrfragment.org 
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
# Getting started
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
https://xrfragmenorg 
 | 
			
		||||
 | 
			
		||||
# available parser-implementations
 | 
			
		||||
 | 
			
		||||
* [javascript](dist/xrfragment.js) [(+example)](test/test.js)
 | 
			
		||||
* [javascript module](dist/xrfragment.module.js) 
 | 
			
		||||
* [python](dist/xrfragment.py) [(+example)](test/test.py)
 | 
			
		||||
* [lua](dist/xrfragment.lua) [(+example)](test/test.lua)
 | 
			
		||||
* [haXe](src/xrfragment) (allows exporting to various programming languages)
 | 
			
		||||
* [Godot](https://codeberg.org/coderofsalvation/xrfragment-godot) exports to all platforms
 | 
			
		||||
 | 
			
		||||
See documentation for more info
 | 
			
		||||
 | 
			
		||||
# development
 | 
			
		||||
 | 
			
		||||
Pre-build libraries can be found in [/dist folder](dist)<br>
 | 
			
		||||
If you really want to build from source:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
$ nix-shell           # nix-users: drops you into a dev-ready shell 
 | 
			
		||||
$ ./make install      # debian-users: install deps via apt-get
 | 
			
		||||
$ ./make build && ./make tests
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
> NOTE #1: to rebundle the THREE/AFRAME javascripts during dev run `./make build js`
 | 
			
		||||
> NOTE #2: to regenerate the parser in various languages (via haxe), run `./make build parser`
 | 
			
		||||
 | 
			
		||||
# Godot (>=v4.3.1)
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
$ ./make install godot       # this installs the godot-xr-tools addon
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
> NOTE: the godot project is in [src/xrfragment/godot](./src/xrfragment/godot) (open the folder in godot)
 | 
			
		||||
 | 
			
		||||
# Credits
 | 
			
		||||
 | 
			
		||||
<br>
 | 
			
		||||
<a href="https://nlnet.nl" target="_blank">
 | 
			
		||||
  <img src="https://nlnet.nl/image/logo_nlnet.svg" width="100"/>
 | 
			
		||||
</a>
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 88 KiB  | 
| 
						 | 
				
			
			@ -1,89 +0,0 @@
 | 
			
		|||
{
 | 
			
		||||
  "$schema": "https://manyfold.app/profiles/0.0/datapackage.json",
 | 
			
		||||
  "name": "xr-fragments-assets",
 | 
			
		||||
  "title": "XR Fragments assets",
 | 
			
		||||
  "homepage": "http://xrfragment.org",
 | 
			
		||||
  "image": "assets.webp",
 | 
			
		||||
  "keywords": [
 | 
			
		||||
    "!new",
 | 
			
		||||
    "fontmap"
 | 
			
		||||
  ],
 | 
			
		||||
  "licenses": [
 | 
			
		||||
    {
 | 
			
		||||
      "name": "CC-BY-SA-4.0",
 | 
			
		||||
      "path": "https://spdx.org/licenses/CC-BY-SA-4.0.html"
 | 
			
		||||
    }
 | 
			
		||||
  ],
 | 
			
		||||
  "resources": [
 | 
			
		||||
    {
 | 
			
		||||
      "name": "assets",
 | 
			
		||||
      "path": "assets.webp",
 | 
			
		||||
      "mediatype": "image/webp",
 | 
			
		||||
      "up": "+z",
 | 
			
		||||
      "presupported": false
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "fontmap",
 | 
			
		||||
      "path": "tiles_fontmap.glb",
 | 
			
		||||
      "mediatype": "model/gltf",
 | 
			
		||||
      "up": "+y",
 | 
			
		||||
      "presupported": false
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "tree",
 | 
			
		||||
      "path": "object_tree.glb",
 | 
			
		||||
      "mediatype": "model/gltf",
 | 
			
		||||
      "up": "+y",
 | 
			
		||||
      "presupported": false
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "glass",
 | 
			
		||||
      "path": "material_glass.glb",
 | 
			
		||||
      "mediatype": "model/gltf",
 | 
			
		||||
      "up": "+y",
 | 
			
		||||
      "presupported": false
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "lake",
 | 
			
		||||
      "path": "material_lake.glb",
 | 
			
		||||
      "mediatype": "model/gltf",
 | 
			
		||||
      "up": "+y",
 | 
			
		||||
      "presupported": false
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "blocktronic",
 | 
			
		||||
      "path": "space_blocktronic.glb",
 | 
			
		||||
      "mediatype": "model/gltf",
 | 
			
		||||
      "up": "+y",
 | 
			
		||||
      "presupported": false
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "fogtronic",
 | 
			
		||||
      "path": "space_fogtronic.glb",
 | 
			
		||||
      "mediatype": "model/gltf",
 | 
			
		||||
      "up": "+y",
 | 
			
		||||
      "presupported": false
 | 
			
		||||
    }
 | 
			
		||||
  ],
 | 
			
		||||
  "sensitive": false,
 | 
			
		||||
  "contributors": [
 | 
			
		||||
    {
 | 
			
		||||
      "title": "xrfragments",
 | 
			
		||||
      "path": "http://localhost:3214/creators/xrfragments",
 | 
			
		||||
      "roles": [
 | 
			
		||||
        "creator"
 | 
			
		||||
      ],
 | 
			
		||||
      "caption": "",
 | 
			
		||||
      "description": "XR Fragments is an open specification for hyperlinking & deeplinking 3D fileformats .\nTurn 3D files into linkable AR/VR websites .\n3D files with XR Fragments enable interoperable, networkable and interactions via so-called extras and promote URL standards .",
 | 
			
		||||
      "links": [
 | 
			
		||||
        {
 | 
			
		||||
          "path": "https://xrfragment.org"
 | 
			
		||||
        }
 | 
			
		||||
      ]
 | 
			
		||||
    }
 | 
			
		||||
  ],
 | 
			
		||||
  "collections": [
 | 
			
		||||
  ],
 | 
			
		||||
  "links": [
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,54 +0,0 @@
 | 
			
		|||
{
 | 
			
		||||
  "$schema": "https://manyfold.app/profiles/0.0/datapackage.json",
 | 
			
		||||
  "name": "xr-fragments-template-website",
 | 
			
		||||
  "title": "Spatial website template",
 | 
			
		||||
  "homepage": "http://xrfragment.org",
 | 
			
		||||
  "image": "website.jpg",
 | 
			
		||||
  "keywords": [
 | 
			
		||||
    "!new",
 | 
			
		||||
    "template"
 | 
			
		||||
  ],
 | 
			
		||||
  "licenses": [
 | 
			
		||||
    {
 | 
			
		||||
      "name": "CC-BY-SA-4.0",
 | 
			
		||||
      "path": "https://spdx.org/licenses/CC-BY-SA-4.0.html"
 | 
			
		||||
    }
 | 
			
		||||
  ],
 | 
			
		||||
  "resources": [
 | 
			
		||||
    {
 | 
			
		||||
      "name": "website",
 | 
			
		||||
      "path": "website.jpg",
 | 
			
		||||
      "mediatype": "image/jpeg",
 | 
			
		||||
      "up": "+z",
 | 
			
		||||
      "presupported": false
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "website",
 | 
			
		||||
      "path": "website.glb",
 | 
			
		||||
      "mediatype": "model/gltf",
 | 
			
		||||
      "up": "+z",
 | 
			
		||||
      "presupported": false
 | 
			
		||||
    }
 | 
			
		||||
  ],
 | 
			
		||||
  "sensitive": false,
 | 
			
		||||
  "contributors": [
 | 
			
		||||
    {
 | 
			
		||||
      "title": "xrfragments",
 | 
			
		||||
      "path": "http://localhost:3214/creators/xrfragments",
 | 
			
		||||
      "roles": [
 | 
			
		||||
        "creator"
 | 
			
		||||
      ],
 | 
			
		||||
      "caption": "",
 | 
			
		||||
      "description": "XR Fragments is an open specification for hyperlinking & deeplinking 3D fileformats .\nTurn 3D files into linkable AR/VR websites .\n3D files with XR Fragments enable interoperable, networkable and interactions via so-called extras and promote URL standards .",
 | 
			
		||||
      "links": [
 | 
			
		||||
        {
 | 
			
		||||
          "path": "https://xrfragment.org"
 | 
			
		||||
        }
 | 
			
		||||
      ]
 | 
			
		||||
    }
 | 
			
		||||
  ],
 | 
			
		||||
  "collections": [
 | 
			
		||||
  ],
 | 
			
		||||
  "links": [
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 56 KiB  | 
							
								
								
									
										89
									
								
								build.hxml
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,89 @@
 | 
			
		|||
-dce full
 | 
			
		||||
-cp src
 | 
			
		||||
xrfragment
 | 
			
		||||
-D shallow-expose
 | 
			
		||||
-js dist/xrfragment.js
 | 
			
		||||
 | 
			
		||||
--next
 | 
			
		||||
-dce full
 | 
			
		||||
-cp src
 | 
			
		||||
Test
 | 
			
		||||
-D shallow-expose
 | 
			
		||||
-m Test
 | 
			
		||||
-js test/generated/test.js
 | 
			
		||||
 | 
			
		||||
--next
 | 
			
		||||
-dce full
 | 
			
		||||
-cp src
 | 
			
		||||
xrfragment
 | 
			
		||||
-lua dist/xrfragment.lua
 | 
			
		||||
 | 
			
		||||
--next
 | 
			
		||||
-dce full
 | 
			
		||||
-cp src
 | 
			
		||||
xrfragment
 | 
			
		||||
-python dist/xrfragment.py
 | 
			
		||||
 | 
			
		||||
#--next
 | 
			
		||||
#-dce full
 | 
			
		||||
#-cp src
 | 
			
		||||
#xrfragment
 | 
			
		||||
#-cpp dist/xrfragment.cpp
 | 
			
		||||
 | 
			
		||||
#--next
 | 
			
		||||
#-dce full
 | 
			
		||||
#-cp src
 | 
			
		||||
#xrfragment
 | 
			
		||||
#-php dist/xrfragment.php
 | 
			
		||||
#
 | 
			
		||||
#--next
 | 
			
		||||
#-dce full
 | 
			
		||||
#-cp src
 | 
			
		||||
#xrfragment
 | 
			
		||||
#-java dist/xrfragment.java
 | 
			
		||||
 | 
			
		||||
--next
 | 
			
		||||
-dce full
 | 
			
		||||
-cp src
 | 
			
		||||
Test
 | 
			
		||||
-m Test
 | 
			
		||||
-python test/generated/test.py
 | 
			
		||||
 | 
			
		||||
#--next
 | 
			
		||||
#-dce full
 | 
			
		||||
#-cp src
 | 
			
		||||
#xrfragment
 | 
			
		||||
#-lib gdscript
 | 
			
		||||
#-D gdscript-output=dist/godot 
 | 
			
		||||
#-D generate_godot_plugin
 | 
			
		||||
 | 
			
		||||
#--next
 | 
			
		||||
#
 | 
			
		||||
#-dce full
 | 
			
		||||
#-cp src
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
#--next
 | 
			
		||||
#
 | 
			
		||||
#-dce full
 | 
			
		||||
#-cp src
 | 
			
		||||
#
 | 
			
		||||
#xrfragment.Query
 | 
			
		||||
#-cppia dist/xrfragment.cppia
 | 
			
		||||
#
 | 
			
		||||
#--next
 | 
			
		||||
#
 | 
			
		||||
#-dce full
 | 
			
		||||
#-cp src
 | 
			
		||||
#
 | 
			
		||||
#xrfragment.Query
 | 
			
		||||
#-cs dist/xrfragment.csharp
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
#--next
 | 
			
		||||
#
 | 
			
		||||
#-dce full
 | 
			
		||||
#-cp src
 | 
			
		||||
#
 | 
			
		||||
#xrfragment.Query
 | 
			
		||||
#-java xrfragment.jdk
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								dist/__pycache__/__init__.cpython-310.pyc
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								dist/__pycache__/xrfragment.cpython-310.pyc
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										2
									
								
								dist/aframe-blink-controls.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										1
									
								
								dist/aframe-hand-tracking-controls-extras.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										18
									
								
								dist/aframe-troika-text.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										2
									
								
								dist/aframe.min.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								dist/audio/click.wav
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								dist/audio/hover.wav
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								dist/audio/teleport.wav
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										9
									
								
								dist/xrfragment.aframe.all.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
							
								
								
									
										7
									
								
								dist/xrfragment.aframe.js
									
										
									
									
										vendored
									
									
								
							
							
						
						| 
						 | 
				
			
			@ -1,8 +1,3 @@
 | 
			
		|||
/*
 | 
			
		||||
 * v0.5.1 generated at Thu May 22 07:30:49 PM CEST 2025
 | 
			
		||||
 * https://xrfragment.org
 | 
			
		||||
 * SPDX-License-Identifier: AGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * v0.5.1 generated at Thu May 15 04:48:16 PM CEST 2025
 | 
			
		||||
 * https://xrfragment.org
 | 
			
		||||
| 
						 | 
				
			
			@ -6798,7 +6793,7 @@ AFRAME.registerSystem('xrf-hands',{
 | 
			
		|||
  },
 | 
			
		||||
 | 
			
		||||
  tick: function(){
 | 
			
		||||
    if( !this.indexFinger || !xrf.interactive ) return 
 | 
			
		||||
    if( !this.indexFinger ) return 
 | 
			
		||||
    if( !this.el.sceneEl.renderer.xr.isPresenting || !this.indexFinger.length ) return 
 | 
			
		||||
    for( let i = 0; i < this.indexFinger.length; i++ ){
 | 
			
		||||
      let indexFinger = this.indexFinger[i]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										5
									
								
								dist/xrfragment.js
									
										
									
									
										vendored
									
									
								
							
							
						
						| 
						 | 
				
			
			@ -1,8 +1,3 @@
 | 
			
		|||
/*
 | 
			
		||||
 * v0.5.1 generated at Thu May 22 07:30:49 PM CEST 2025
 | 
			
		||||
 * https://xrfragment.org
 | 
			
		||||
 * SPDX-License-Identifier: AGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * v0.5.1 generated at Thu May 15 04:48:16 PM CEST 2025
 | 
			
		||||
 * https://xrfragment.org
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										9
									
								
								dist/xrfragment.model-viewer.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
							
								
								
									
										3242
									
								
								dist/xrfragment.module.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
							
								
								
									
										2
									
								
								dist/xrfragment.plugin.editor.js
									
										
									
									
										vendored
									
									
								
							
							
						
						| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * v0.5.1 generated at Thu May 22 07:30:49 PM CEST 2025
 | 
			
		||||
 * v0.5.1 generated at Thu May 15 04:48:16 PM CEST 2025
 | 
			
		||||
 * https://xrfragment.org
 | 
			
		||||
 * SPDX-License-Identifier: AGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								dist/xrfragment.plugin.frontend.css.js
									
										
									
									
										vendored
									
									
								
							
							
						
						| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * v0.5.1 generated at Thu May 22 07:30:49 PM CEST 2025
 | 
			
		||||
 * v0.5.1 generated at Thu May 15 04:48:16 PM CEST 2025
 | 
			
		||||
 * https://xrfragment.org
 | 
			
		||||
 * SPDX-License-Identifier: AGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								dist/xrfragment.plugin.frontend.js
									
										
									
									
										vendored
									
									
								
							
							
						
						| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * v0.5.1 generated at Thu May 22 07:30:49 PM CEST 2025
 | 
			
		||||
 * v0.5.1 generated at Thu May 15 04:48:16 PM CEST 2025
 | 
			
		||||
 * https://xrfragment.org
 | 
			
		||||
 * SPDX-License-Identifier: AGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								dist/xrfragment.plugin.matrix.js
									
										
									
									
										vendored
									
									
								
							
							
						
						| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * v0.5.1 generated at Thu May 22 07:30:49 PM CEST 2025
 | 
			
		||||
 * v0.5.1 generated at Thu May 15 04:48:16 PM CEST 2025
 | 
			
		||||
 * https://xrfragment.org
 | 
			
		||||
 * SPDX-License-Identifier: AGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								dist/xrfragment.plugin.network.js
									
										
									
									
										vendored
									
									
								
							
							
						
						| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * v0.5.1 generated at Thu May 22 07:30:49 PM CEST 2025
 | 
			
		||||
 * v0.5.1 generated at Thu May 15 04:48:16 PM CEST 2025
 | 
			
		||||
 * https://xrfragment.org
 | 
			
		||||
 * SPDX-License-Identifier: AGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								dist/xrfragment.plugin.p2p.js
									
										
									
									
										vendored
									
									
								
							
							
						
						| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * v0.5.1 generated at Thu May 22 07:30:49 PM CEST 2025
 | 
			
		||||
 * v0.5.1 generated at Thu May 15 04:48:16 PM CEST 2025
 | 
			
		||||
 * https://xrfragment.org
 | 
			
		||||
 * SPDX-License-Identifier: AGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								dist/xrfragment.plugin.remotestorage.js
									
										
									
									
										vendored
									
									
								
							
							
						
						| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * v0.5.1 generated at Thu May 22 07:30:49 PM CEST 2025
 | 
			
		||||
 * v0.5.1 generated at Thu May 15 04:48:16 PM CEST 2025
 | 
			
		||||
 * https://xrfragment.org
 | 
			
		||||
 * SPDX-License-Identifier: AGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										5
									
								
								dist/xrfragment.three.js
									
										
									
									
										vendored
									
									
								
							
							
						
						| 
						 | 
				
			
			@ -1,8 +1,3 @@
 | 
			
		|||
/*
 | 
			
		||||
 * v0.5.1 generated at Thu May 22 07:30:49 PM CEST 2025
 | 
			
		||||
 * https://xrfragment.org
 | 
			
		||||
 * SPDX-License-Identifier: AGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * v0.5.1 generated at Thu May 15 04:48:16 PM CEST 2025
 | 
			
		||||
 * https://xrfragment.org
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										5
									
								
								dist/xrfragment.three.module.js
									
										
									
									
										vendored
									
									
								
							
							
						
						| 
						 | 
				
			
			@ -1,8 +1,3 @@
 | 
			
		|||
/*
 | 
			
		||||
 * v0.5.1 generated at Thu May 22 07:30:49 PM CEST 2025
 | 
			
		||||
 * https://xrfragment.org
 | 
			
		||||
 * SPDX-License-Identifier: AGPL-3.0-or-later
 | 
			
		||||
 */
 | 
			
		||||
/*
 | 
			
		||||
 * v0.5.1 generated at Thu May 15 04:48:16 PM CEST 2025
 | 
			
		||||
 * https://xrfragment.org
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
		 Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 30 KiB  | 
							
								
								
									
										465
									
								
								doc/RFC_XR_Macros.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,465 @@
 | 
			
		|||
<!DOCTYPE html>
 | 
			
		||||
<html>
 | 
			
		||||
<head>
 | 
			
		||||
  <title>XR Macros</title>
 | 
			
		||||
  <meta name="GENERATOR" content="github.com/mmarkdown/mmark Mmark Markdown Processor - mmark.miek.nl">
 | 
			
		||||
  <meta charset="utf-8">
 | 
			
		||||
</head>
 | 
			
		||||
<body>
 | 
			
		||||
 | 
			
		||||
<!-- for annotated version see: https://raw.githubusercontent.com/ietf-tools/rfcxml-templates-and-schemas/main/draft-rfcxml-general-template-annotated-00.xml -->
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  <style type="text/css">
 | 
			
		||||
  body{
 | 
			
		||||
    font-family: monospace;
 | 
			
		||||
    max-width: 1000px;
 | 
			
		||||
    font-size: 15px;
 | 
			
		||||
    padding: 0% 20%;
 | 
			
		||||
    line-height: 30px;
 | 
			
		||||
    color:#555;
 | 
			
		||||
    background:#F0F0F3
 | 
			
		||||
  }
 | 
			
		||||
  h1 { margin-top:40px; }
 | 
			
		||||
  pre{ line-height:18px; }
 | 
			
		||||
  a,a:visited,a:active{ color: #70f; }
 | 
			
		||||
  code{
 | 
			
		||||
    border: 1px solid #AAA;
 | 
			
		||||
    border-radius: 3px;
 | 
			
		||||
    padding: 0px 5px 2px 5px;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  pre{
 | 
			
		||||
    line-height: 18px;
 | 
			
		||||
    overflow: auto;
 | 
			
		||||
    padding: 12px;
 | 
			
		||||
  }
 | 
			
		||||
  pre + code {
 | 
			
		||||
    background:#DDD;
 | 
			
		||||
  }
 | 
			
		||||
  pre>code{
 | 
			
		||||
    border:none;
 | 
			
		||||
    border-radius:0px;
 | 
			
		||||
    padding:0;
 | 
			
		||||
  }
 | 
			
		||||
  blockquote{
 | 
			
		||||
    padding-left: 30px;
 | 
			
		||||
    margin: 0;
 | 
			
		||||
    border-left: 5px solid #CCC;
 | 
			
		||||
  }
 | 
			
		||||
  th {
 | 
			
		||||
      border-bottom: 1px solid #000;
 | 
			
		||||
      text-align: left;
 | 
			
		||||
      padding-right:45px;
 | 
			
		||||
      padding-left:7px;
 | 
			
		||||
      background: #DDD;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  td {
 | 
			
		||||
      border-bottom: 1px solid #CCC;
 | 
			
		||||
      font-size:13px; 
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  </style>
 | 
			
		||||
 | 
			
		||||
<br>
 | 
			
		||||
<h1>XR Macros</h1>
 | 
			
		||||
<br>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
stream:    IETF
 | 
			
		||||
area:      Internet
 | 
			
		||||
status:    informational
 | 
			
		||||
author:    Leon van Kammen
 | 
			
		||||
date:      2023-04-12T00:00:00Z
 | 
			
		||||
workgroup: Internet Engineering Task Force
 | 
			
		||||
value:     draft-XRMACROS-leonvankammen-00
 | 
			
		||||
</pre>  
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<h1 class="special" id="abstract">Abstract</h1>
 | 
			
		||||
 | 
			
		||||
<p>This draft offers a specification for embedding macros in existing 3D scenes/assets, to offer simple interactions and configure the renderer further.<br>
 | 
			
		||||
Together with URI Fragments, it allows for rich immersive experiences without the need of a complicated sandboxed scripting languages.</p>
 | 
			
		||||
 | 
			
		||||
<blockquote>
 | 
			
		||||
<p>Almost every idea in this document is demonstrated at <a href="https://xrfragment.org">https://xrfragment.org</a>, as this spec was created during the <a href="https://xrfragment.org">XR Fragments</a> spec.</p>
 | 
			
		||||
</blockquote>
 | 
			
		||||
<section data-matter="main">
 | 
			
		||||
<h1 id="introduction">Introduction</h1>
 | 
			
		||||
 | 
			
		||||
<p>How can we add more features to existing text & 3D scenes, without introducing new dataformats?<br>
 | 
			
		||||
Historically, there’s many attempts to create the ultimate markuplanguage or 3D fileformat.<br>
 | 
			
		||||
Their lowest common denominator is: (co)authoring using plain text.<br>
 | 
			
		||||
Therefore, XR Macros allows us to enrich/connect existing dataformats, by offering a polyglot notation based on existing notations:<br></p>
 | 
			
		||||
 | 
			
		||||
<ol>
 | 
			
		||||
<li>getting/setting common used 3D properties using querystring- or JSON-notation</li>
 | 
			
		||||
<li>targeting 3D properties using the lightweight query notation present in <a href="https://xrfragment.org">XR Fragments</a></li>
 | 
			
		||||
</ol>
 | 
			
		||||
 | 
			
		||||
<blockquote>
 | 
			
		||||
<p>NOTE: The chapters in this document are ordered from highlevel to lowlevel (technical) as much as possible</p>
 | 
			
		||||
</blockquote>
 | 
			
		||||
 | 
			
		||||
<h1 id="core-principle">Core principle</h1>
 | 
			
		||||
 | 
			
		||||
<ol>
 | 
			
		||||
<li>XR Macros use querystrings, but are HTML-agnostic (though pseudo-XR Fragment browsers <strong>can</strong> be implemented on top of HTML/Javascript).</li>
 | 
			
		||||
<li>An XR Macro is 3D metadata which starts with ‘!’ (<code>!clickme: fog=0,10</code> e.g.)</li>
 | 
			
		||||
<li>Metadata-values can contain the <code>|</code> symbol to 🎲 roundrobin variable values (<code>!toggleme: fog=0,10|fog=0,1000</code> e.g.)</li>
 | 
			
		||||
<li>XR Macros acts as simple eventhandlers for URI Fragments: they are automatically published on the (<a href="https://xrfragment.org">XR Fragments</a>) hashbus, to act as events (so more serious scripting languages can react to them as well).</li>
 | 
			
		||||
<li>XR Macros can assign object metadata (<code>!setlocal: foo=1</code> writes <code>foo:1</code> metadata to the object containing the <code>!setlocal</code> metadata)</li>
 | 
			
		||||
<li>XR Macros can assign global metadata  (<code>!setfoo: #foo=1</code> writes <code>foo:1</code> metadata to the root scene-node)</li>
 | 
			
		||||
</ol>
 | 
			
		||||
 | 
			
		||||
<blockquote>
 | 
			
		||||
<p>These very simple principles allow for rich interactions and dynamic querying</p>
 | 
			
		||||
</blockquote>
 | 
			
		||||
 | 
			
		||||
<h1 id="conventions-and-definitions">Conventions and Definitions</h1>
 | 
			
		||||
 | 
			
		||||
<p>See appendix below in case certain terms are not clear.</p>
 | 
			
		||||
 | 
			
		||||
<h1 id="list-of-xr-macros">List of XR Macros</h1>
 | 
			
		||||
 | 
			
		||||
<p>(XR) Macros can be embedded in 3D assets/scenes.<br>
 | 
			
		||||
Macros enrich existing spatial content with a lowcode, limited logic-layer, by recursive (economic) use of the querystring syntax (which search engines and <a href="https://xrfragment.org">XR Fragments</a> already uses.<br>
 | 
			
		||||
This is done by allowing string/integer variables, and the <code>|</code> symbol to roundrobin variable values.<br>
 | 
			
		||||
Macros also act as events, so more serious scripting languages can react to them as well.<br></p>
 | 
			
		||||
 | 
			
		||||
<table>
 | 
			
		||||
<thead>
 | 
			
		||||
<tr>
 | 
			
		||||
<th>key</th>
 | 
			
		||||
<th>type</th>
 | 
			
		||||
<th>example (JSON)</th>
 | 
			
		||||
<th>function</th>
 | 
			
		||||
<th>existing compatibility</th>
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
 | 
			
		||||
<tbody>
 | 
			
		||||
<tr>
 | 
			
		||||
<td><code>@bg</code></td>
 | 
			
		||||
<td>string</td>
 | 
			
		||||
<td><code>"@bg":"#cube"</code></td>
 | 
			
		||||
<td>bg: binds fog near/far based to cube x/y/z (anim) values</td>
 | 
			
		||||
<td>custom property in 3D fileformats</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td><code>@fog</code></td>
 | 
			
		||||
<td>string</td>
 | 
			
		||||
<td><code>"@fog":"#cube"</code></td>
 | 
			
		||||
<td>fog: binds fog near/far based to cube x/y (anim) values</td>
 | 
			
		||||
<td>custom property in 3D fileformats</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td><code>@scroll</code></td>
 | 
			
		||||
<td>string</td>
 | 
			
		||||
<td><code>"@scroll":"#cube"</code></td>
 | 
			
		||||
<td>texturescrolling: binds texture x/y/rot based to cube x/y/z (anim) values</td>
 | 
			
		||||
<td>custom property in 3D fileformats</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td><code>@emissive</code></td>
 | 
			
		||||
<td>string</td>
 | 
			
		||||
<td><code>"@emissive":"#cube"</code></td>
 | 
			
		||||
<td>day/night/mood: binds material’s emissive value to cube x/y/z (anim) values</td>
 | 
			
		||||
<td>custom property in 3D fileformats</td>
 | 
			
		||||
</tr>
 | 
			
		||||
</tbody>
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
<h2 id="usecase-click-object">Usecase: click object</h2>
 | 
			
		||||
 | 
			
		||||
<table>
 | 
			
		||||
<thead>
 | 
			
		||||
<tr>
 | 
			
		||||
<th>custom property</th>
 | 
			
		||||
<th>value</th>
 | 
			
		||||
<th>trigger when</th>
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
 | 
			
		||||
<tbody>
 | 
			
		||||
<tr>
 | 
			
		||||
<td>!clickme</td>
 | 
			
		||||
<td>bg=1,1,1&foo=2</td>
 | 
			
		||||
<td>object clicked</td>
 | 
			
		||||
</tr>
 | 
			
		||||
</tbody>
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
<h2 id="usecase-conditional-click-object">Usecase: conditional click object</h2>
 | 
			
		||||
 | 
			
		||||
<table>
 | 
			
		||||
<thead>
 | 
			
		||||
<tr>
 | 
			
		||||
<th>custom property</th>
 | 
			
		||||
<th>value</th>
 | 
			
		||||
<th>trigger when</th>
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
 | 
			
		||||
<tbody>
 | 
			
		||||
<tr>
 | 
			
		||||
<td>#</td>
 | 
			
		||||
<td>foo=1</td>
 | 
			
		||||
<td>scene</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>!clickme</td>
 | 
			
		||||
<td>q=foo>2&bg=1,1,1</td>
 | 
			
		||||
<td>object clicked and foo > 2</td>
 | 
			
		||||
</tr>
 | 
			
		||||
</tbody>
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
<blockquote>
 | 
			
		||||
<p>when a user clicks an object with the custom properties above, it should set the backgroundcolor to <code>1,1,1</code> when <code>foo</code> is greater than <code>2</code> (see previous example)</p>
 | 
			
		||||
</blockquote>
 | 
			
		||||
 | 
			
		||||
<h2 id="usecase-click-object-roundrobin">Usecase: click object (roundrobin)</h2>
 | 
			
		||||
 | 
			
		||||
<table>
 | 
			
		||||
<thead>
 | 
			
		||||
<tr>
 | 
			
		||||
<th>custom property</th>
 | 
			
		||||
<th>value</th>
 | 
			
		||||
<th>trigger when</th>
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
 | 
			
		||||
<tbody>
 | 
			
		||||
<tr>
 | 
			
		||||
<td>!cycleme</td>
 | 
			
		||||
<td>day|noon|night</td>
 | 
			
		||||
<td>object clicked</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>day</td>
 | 
			
		||||
<td>bg=1,1,1</td>
 | 
			
		||||
<td>roundrobin</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>noon</td>
 | 
			
		||||
<td>bg=0.5,0.5,0.5</td>
 | 
			
		||||
<td>roundrobin</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>night</td>
 | 
			
		||||
<td>bg=0,0,0&foo=2</td>
 | 
			
		||||
<td>roundrobin</td>
 | 
			
		||||
</tr>
 | 
			
		||||
</tbody>
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
<blockquote>
 | 
			
		||||
<p>when a user clicks an object with the custom properties above, it should trigger either <code>day</code> <code>noon</code> or <code>night</code> in roundrobin fashion.</p>
 | 
			
		||||
</blockquote>
 | 
			
		||||
 | 
			
		||||
<h2 id="usecase-click-object-or-uri-fragment-and-scene-load-trigger">Usecase: click object or URI fragment, and scene load trigger</h2>
 | 
			
		||||
 | 
			
		||||
<table>
 | 
			
		||||
<thead>
 | 
			
		||||
<tr>
 | 
			
		||||
<th>custom property</th>
 | 
			
		||||
<th>value</th>
 | 
			
		||||
<th>trigger when</th>
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
 | 
			
		||||
<tbody>
 | 
			
		||||
<tr>
 | 
			
		||||
<td>#</td>
 | 
			
		||||
<td>random</td>
 | 
			
		||||
<td>scene loaded</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>#random</td>
 | 
			
		||||
<td>random</td>
 | 
			
		||||
<td>URL contains #random</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>!random</td>
 | 
			
		||||
<td>day|noon|night</td>
 | 
			
		||||
<td>#random, # or click</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>day</td>
 | 
			
		||||
<td>bg=1,1,1</td>
 | 
			
		||||
<td>roundrobin</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>noon</td>
 | 
			
		||||
<td>bg=0.5,0.5,0.5</td>
 | 
			
		||||
<td>roundrobin</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>night</td>
 | 
			
		||||
<td>bg=0,0,0&foo=2</td>
 | 
			
		||||
<td>roundrobin</td>
 | 
			
		||||
</tr>
 | 
			
		||||
</tbody>
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
<h2 id="usecase-present-context-menu-with-options">Usecase: present context menu with options</h2>
 | 
			
		||||
 | 
			
		||||
<table>
 | 
			
		||||
<thead>
 | 
			
		||||
<tr>
 | 
			
		||||
<th>custom property</th>
 | 
			
		||||
<th>value</th>
 | 
			
		||||
<th>trigger when</th>
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
 | 
			
		||||
<tbody>
 | 
			
		||||
<tr>
 | 
			
		||||
<td>!random</td>
 | 
			
		||||
<td>!day</td>
 | 
			
		||||
<td>!noon</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>!day</td>
 | 
			
		||||
<td>bg=1,1,1</td>
 | 
			
		||||
<td>clicked in contextmenu</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>!noon</td>
 | 
			
		||||
<td>bg=0.5,0.5,0.5</td>
 | 
			
		||||
<td>clicked in contextmenu</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>!night</td>
 | 
			
		||||
<td>bg=0,0,0&foo=2</td>
 | 
			
		||||
<td>clicked in contextmenu</td>
 | 
			
		||||
</tr>
 | 
			
		||||
</tbody>
 | 
			
		||||
</table>
 | 
			
		||||
 | 
			
		||||
<blockquote>
 | 
			
		||||
<p>When interacting with an object with more than one <code>!</code>-macro, the XR Browser should offer a contextmenu to execute a macro.</p>
 | 
			
		||||
</blockquote>
 | 
			
		||||
 | 
			
		||||
<p>In a similar way, when <strong>any</strong> <code>!</code>-macro is present on the sceneroot, the XR Browser should offer a context-menu to execute those macro’s.</p>
 | 
			
		||||
 | 
			
		||||
<h2 id="event-bubble-flow">Event Bubble-flow</h2>
 | 
			
		||||
 | 
			
		||||
<p>click object with (<code>!clickme</code>:<code>AR</code> or <code>!clickme</code>: <code>!reset</code> e.g.)</p>
 | 
			
		||||
 | 
			
		||||
<pre><code>  ◻
 | 
			
		||||
  │  
 | 
			
		||||
  └── 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 
 | 
			
		||||
</code></pre>
 | 
			
		||||
 | 
			
		||||
<p>click object with (<code>!clickme</code>:<code>#AR|#VR</code> e.g.)</p>
 | 
			
		||||
 | 
			
		||||
<pre><code>  ◻
 | 
			
		||||
  │  
 | 
			
		||||
  └── apply the roundrobin (rotate the options, value `#AR` becomes `#VR` upon next click)
 | 
			
		||||
      └── is there any object with property-key (`#AR` e.g.)?
 | 
			
		||||
         └── no: just update the URL to `#AR`
 | 
			
		||||
           └── yes: apply its value to the scene, and update the URL to `#AR`
 | 
			
		||||
 | 
			
		||||
click object with (`!clickme`:`!foo|!bar|!flop` e.g.)
 | 
			
		||||
</code></pre>
 | 
			
		||||
 | 
			
		||||
<p>◻
 | 
			
		||||
  │<br>
 | 
			
		||||
  └── apply the roundrobin (rotate the options, value <code>!foo</code> becomes <code>!bar</code> upon next click)
 | 
			
		||||
      └── is there any object with property-key (<code>!foo</code> e.g.)?
 | 
			
		||||
         └── no: do nothing
 | 
			
		||||
           └── yes: apply its value to the scene
 | 
			
		||||
“`</p>
 | 
			
		||||
 | 
			
		||||
<blockquote>
 | 
			
		||||
<p>Note that only macro’s can trigger roundrobin values or contextmenu’s, as well as roundrobin values never ending up in the toplevel URL.</p>
 | 
			
		||||
</blockquote>
 | 
			
		||||
 | 
			
		||||
<h1 id="security-considerations">Security Considerations</h1>
 | 
			
		||||
 | 
			
		||||
<h1 id="iana-considerations">IANA Considerations</h1>
 | 
			
		||||
 | 
			
		||||
<p>This document has no IANA actions.</p>
 | 
			
		||||
 | 
			
		||||
<h1 id="acknowledgments">Acknowledgments</h1>
 | 
			
		||||
 | 
			
		||||
<ul>
 | 
			
		||||
<li><a href="https://nlnet.nl">NLNET</a></li>
 | 
			
		||||
<li><a href="https://futureoftext.org">Future of Text</a></li>
 | 
			
		||||
<li><a href="https://visual-meta.info">visual-meta.info</a></li>
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
<h1 id="appendix-definitions">Appendix: Definitions</h1>
 | 
			
		||||
 | 
			
		||||
<table>
 | 
			
		||||
<thead>
 | 
			
		||||
<tr>
 | 
			
		||||
<th>definition</th>
 | 
			
		||||
<th>explanation</th>
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
 | 
			
		||||
<tbody>
 | 
			
		||||
<tr>
 | 
			
		||||
<td>scene</td>
 | 
			
		||||
<td>a (local/remote) 3D scene or 3D file (index.gltf e.g.)</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>3D object</td>
 | 
			
		||||
<td>an object inside a scene characterized by vertex-, face- and customproperty data.</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>XR fragments</td>
 | 
			
		||||
<td>URI Fragment with spatial hints like <code>#pos=0,0,0&t=1,100</code> e.g.</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>query</td>
 | 
			
		||||
<td>an URI Fragment-operator which queries object(s) from a scene like <code>#q=cube</code></td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>FPS</td>
 | 
			
		||||
<td>frames per second in spatial experiences (games,VR,AR e.g.), should be as high as possible</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td><code>◻</code></td>
 | 
			
		||||
<td>ascii representation of an 3D object/mesh</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>(un)obtrusive</td>
 | 
			
		||||
<td>obtrusive: wrapping human text/thought in XML/HTML/JSON obfuscates human text into a salad of machine-symbols and words</td>
 | 
			
		||||
</tr>
 | 
			
		||||
</tbody>
 | 
			
		||||
</table>
 | 
			
		||||
</section>
 | 
			
		||||
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										251
									
								
								doc/RFC_XR_Macros.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,251 @@
 | 
			
		|||
%%%
 | 
			
		||||
Title = "XR Macros"
 | 
			
		||||
area = "Internet"
 | 
			
		||||
workgroup = "Internet Engineering Task Force"
 | 
			
		||||
 | 
			
		||||
[seriesInfo]
 | 
			
		||||
name = "XR-Macros"
 | 
			
		||||
value = "draft-XRMACROS-leonvankammen-00"
 | 
			
		||||
stream = "IETF"
 | 
			
		||||
status = "informational"
 | 
			
		||||
 | 
			
		||||
date = 2023-04-12T00:00:00Z
 | 
			
		||||
 | 
			
		||||
[[author]]
 | 
			
		||||
initials="L.R."
 | 
			
		||||
surname="van Kammen"
 | 
			
		||||
fullname="L.R. van Kammen"
 | 
			
		||||
 | 
			
		||||
%%%
 | 
			
		||||
 | 
			
		||||
<!-- for annotated version see: https://raw.githubusercontent.com/ietf-tools/rfcxml-templates-and-schemas/main/draft-rfcxml-general-template-annotated-00.xml -->
 | 
			
		||||
 | 
			
		||||
<!--{
 | 
			
		||||
 | 
			
		||||
  <style type="text/css">
 | 
			
		||||
  body{
 | 
			
		||||
    font-family: monospace;
 | 
			
		||||
    max-width: 1000px;
 | 
			
		||||
    font-size: 15px;
 | 
			
		||||
    padding: 0% 20%;
 | 
			
		||||
    line-height: 30px;
 | 
			
		||||
    color:#555;
 | 
			
		||||
    background:#F0F0F3
 | 
			
		||||
  }
 | 
			
		||||
  h1 { margin-top:40px; }
 | 
			
		||||
  pre{ line-height:18px; }
 | 
			
		||||
  a,a:visited,a:active{ color: #70f; }
 | 
			
		||||
  code{
 | 
			
		||||
    border: 1px solid #AAA;
 | 
			
		||||
    border-radius: 3px;
 | 
			
		||||
    padding: 0px 5px 2px 5px;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  pre{
 | 
			
		||||
    line-height: 18px;
 | 
			
		||||
    overflow: auto;
 | 
			
		||||
    padding: 12px;
 | 
			
		||||
  }
 | 
			
		||||
  pre + code {
 | 
			
		||||
    background:#DDD;
 | 
			
		||||
  }
 | 
			
		||||
  pre>code{
 | 
			
		||||
    border:none;
 | 
			
		||||
    border-radius:0px;
 | 
			
		||||
    padding:0;
 | 
			
		||||
  }
 | 
			
		||||
  blockquote{
 | 
			
		||||
    padding-left: 30px;
 | 
			
		||||
    margin: 0;
 | 
			
		||||
    border-left: 5px solid #CCC;
 | 
			
		||||
  }
 | 
			
		||||
  th {
 | 
			
		||||
      border-bottom: 1px solid #000;
 | 
			
		||||
      text-align: left;
 | 
			
		||||
      padding-right:45px;
 | 
			
		||||
      padding-left:7px;
 | 
			
		||||
      background: #DDD;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  td {
 | 
			
		||||
      border-bottom: 1px solid #CCC;
 | 
			
		||||
      font-size:13px; 
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  </style>
 | 
			
		||||
 | 
			
		||||
<br>
 | 
			
		||||
<h1>XR Macros</h1>
 | 
			
		||||
<br>
 | 
			
		||||
 | 
			
		||||
<pre>
 | 
			
		||||
stream:    IETF
 | 
			
		||||
area:      Internet
 | 
			
		||||
status:    informational
 | 
			
		||||
author:    Leon van Kammen
 | 
			
		||||
date:      2023-04-12T00:00:00Z
 | 
			
		||||
workgroup: Internet Engineering Task Force
 | 
			
		||||
value:     draft-XRMACROS-leonvankammen-00
 | 
			
		||||
</pre>  
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}-->
 | 
			
		||||
 | 
			
		||||
.# Abstract
 | 
			
		||||
 | 
			
		||||
This draft offers a specification for embedding macros in existing 3D scenes/assets, to offer simple interactions and configure the renderer further.<br>
 | 
			
		||||
Together with URI Fragments, it allows for rich immersive experiences without the need of a complicated sandboxed scripting languages.
 | 
			
		||||
 | 
			
		||||
> Almost every idea in this document is demonstrated at [https://xrfragment.org](https://xrfragment.org), as this spec was created during the [XR Fragments](https://xrfragment.org) spec.
 | 
			
		||||
 | 
			
		||||
{mainmatter}
 | 
			
		||||
 | 
			
		||||
# Introduction
 | 
			
		||||
 | 
			
		||||
How can we add more features to existing text & 3D scenes, without introducing new dataformats?<br>
 | 
			
		||||
Historically, there's many attempts to create the ultimate markuplanguage or 3D fileformat.<br>
 | 
			
		||||
Their lowest common denominator is: (co)authoring using plain text.<br>
 | 
			
		||||
Therefore, XR Macros allows us to enrich/connect existing dataformats, by offering a polyglot notation based on existing notations:<br>
 | 
			
		||||
 | 
			
		||||
1. getting/setting common used 3D properties using querystring- or JSON-notation 
 | 
			
		||||
1. targeting 3D properties using the lightweight query notation present in [XR Fragments](https://xrfragment.org)
 | 
			
		||||
 | 
			
		||||
> NOTE: The chapters in this document are ordered from highlevel to lowlevel (technical) as much as possible
 | 
			
		||||
 | 
			
		||||
# Core principle
 | 
			
		||||
 | 
			
		||||
1. XR Macros use querystrings, but are HTML-agnostic (though pseudo-XR Fragment browsers **can** be implemented on top of HTML/Javascript). 
 | 
			
		||||
1. An XR Macro is 3D metadata which starts with '!' (`!clickme: fog=0,10` e.g.)
 | 
			
		||||
1. Metadata-values can contain the `|` symbol to 🎲 roundrobin variable values (`!toggleme: fog=0,10|fog=0,1000` e.g.)
 | 
			
		||||
1. 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 serious scripting languages can react to them as well).
 | 
			
		||||
1. XR Macros can assign object metadata (`!setlocal: foo=1` writes `foo:1` metadata to the object containing the `!setlocal` metadata)
 | 
			
		||||
1. XR Macros can assign global metadata  (`!setfoo: #foo=1` writes `foo:1` metadata to the root scene-node)
 | 
			
		||||
 | 
			
		||||
> These very simple principles allow for rich interactions and dynamic querying
 | 
			
		||||
 | 
			
		||||
# Conventions and Definitions
 | 
			
		||||
 | 
			
		||||
See appendix below in case certain terms are not clear.
 | 
			
		||||
 | 
			
		||||
# List of XR Macros 
 | 
			
		||||
 | 
			
		||||
(XR) Macros can be embedded in 3D assets/scenes.<br>
 | 
			
		||||
Macros enrich existing spatial content with a lowcode, limited logic-layer, by recursive (economic) use of the querystring syntax (which search engines and [XR Fragments](https://xrfragment.org) already uses.<br>
 | 
			
		||||
This is done by allowing string/integer variables, and the `|` symbol to roundrobin variable values.<br>
 | 
			
		||||
Macros also act as events, so more serious scripting languages can react to them as well.<br>
 | 
			
		||||
 | 
			
		||||
| key          | type     | example (JSON)         | function            | existing compatibility                 |
 | 
			
		||||
|--------------|----------|------------------------|---------------------|----------------------------------------|
 | 
			
		||||
| `@bg`        | string   | `"@bg":"#cube"`        | bg: binds fog near/far based to cube x/y/z (anim) values | custom property in 3D fileformats      |
 | 
			
		||||
| `@fog`       | string   | `"@fog":"#cube"`       | fog: binds fog near/far based to cube x/y (anim) values | custom property in 3D fileformats      |
 | 
			
		||||
| `@scroll`    | string   | `"@scroll":"#cube"`    | texturescrolling: binds texture x/y/rot based to cube x/y/z (anim) values | custom property in 3D fileformats      |
 | 
			
		||||
| `@emissive`  | string   | `"@emissive":"#cube"`  | day/night/mood: binds material's emissive value to cube x/y/z (anim) values | custom property in 3D fileformats      |
 | 
			
		||||
 | 
			
		||||
## Usecase: click object
 | 
			
		||||
 | 
			
		||||
| custom property | value                    | trigger when           |
 | 
			
		||||
|-----------------|--------------------------|------------------------|
 | 
			
		||||
| !clickme        | bg=1,1,1&foo=2           | object clicked         |
 | 
			
		||||
 | 
			
		||||
## Usecase: conditional click object
 | 
			
		||||
 | 
			
		||||
| custom property | value                    | trigger when                |
 | 
			
		||||
|-----------------|--------------------------|-----------------------------|
 | 
			
		||||
| #               | foo=1                    | scene                       |
 | 
			
		||||
| !clickme        | q=foo>2&bg=1,1,1         | object clicked and foo > 2  |
 | 
			
		||||
 | 
			
		||||
> when a user clicks an object with the custom properties above, it should set the backgroundcolor to `1,1,1` when `foo` is greater than `2` (see previous example)
 | 
			
		||||
 | 
			
		||||
## Usecase: click object (roundrobin)
 | 
			
		||||
 | 
			
		||||
| custom property | value                    | trigger when           |
 | 
			
		||||
|-----------------|--------------------------|------------------------|
 | 
			
		||||
| !cycleme        | day|noon|night | object clicked         |
 | 
			
		||||
| day             | bg=1,1,1                 | roundrobin             |
 | 
			
		||||
| noon            | bg=0.5,0.5,0.5           | roundrobin             |
 | 
			
		||||
| night           | bg=0,0,0&foo=2           | roundrobin             |
 | 
			
		||||
 | 
			
		||||
> when a user clicks an object with the custom properties above, it should trigger either `day` `noon` or `night` in roundrobin fashion.
 | 
			
		||||
 | 
			
		||||
## Usecase: click object or URI fragment, and scene load trigger
 | 
			
		||||
 | 
			
		||||
| custom property | value                    | trigger when           |
 | 
			
		||||
|-----------------|--------------------------|------------------------|
 | 
			
		||||
| #               | random                   | scene loaded           |
 | 
			
		||||
| #random         | random                   | URL contains #random   |
 | 
			
		||||
| !random         | day|noon|night | #random, # or click    |
 | 
			
		||||
| day             | bg=1,1,1                 | roundrobin             |
 | 
			
		||||
| noon            | bg=0.5,0.5,0.5           | roundrobin             |
 | 
			
		||||
| night           | bg=0,0,0&foo=2           | roundrobin             |
 | 
			
		||||
 | 
			
		||||
## Usecase: present context menu with options
 | 
			
		||||
 | 
			
		||||
| custom property | value                    | trigger when           |
 | 
			
		||||
|-----------------|--------------------------|------------------------|
 | 
			
		||||
| !random         | !day|!noon|!night        | clicked in contextmenu |
 | 
			
		||||
| !day            | bg=1,1,1                 | clicked in contextmenu |
 | 
			
		||||
| !noon           | bg=0.5,0.5,0.5           | clicked in contextmenu |
 | 
			
		||||
| !night          | bg=0,0,0&foo=2           | clicked in contextmenu |
 | 
			
		||||
 | 
			
		||||
> When interacting with an object with more than one `!`-macro, the XR Browser should offer a contextmenu to execute a macro.
 | 
			
		||||
 | 
			
		||||
In a similar way, when **any** `!`-macro is present on the sceneroot, the XR Browser should offer a context-menu to execute those macro's.
 | 
			
		||||
 | 
			
		||||
## Event Bubble-flow
 | 
			
		||||
 | 
			
		||||
click object with (`!clickme`:`AR` or `!clickme`: `!reset` e.g.)
 | 
			
		||||
```
 | 
			
		||||
  ◻
 | 
			
		||||
  │  
 | 
			
		||||
  └── 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 
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
click object with (`!clickme`:`#AR|#VR` e.g.)
 | 
			
		||||
```
 | 
			
		||||
  ◻
 | 
			
		||||
  │  
 | 
			
		||||
  └── apply the roundrobin (rotate the options, value `#AR` becomes `#VR` upon next click)
 | 
			
		||||
      └── is there any object with property-key (`#AR` e.g.)?
 | 
			
		||||
         └── no: just update the URL to `#AR`
 | 
			
		||||
           └── yes: apply its value to the scene, and update the URL to `#AR`
 | 
			
		||||
 | 
			
		||||
click object with (`!clickme`:`!foo|!bar|!flop` e.g.)
 | 
			
		||||
```
 | 
			
		||||
  ◻
 | 
			
		||||
  │  
 | 
			
		||||
  └── apply the roundrobin (rotate the options, value `!foo` becomes `!bar` upon next click)
 | 
			
		||||
      └── is there any object with property-key (`!foo` e.g.)?
 | 
			
		||||
         └── no: do nothing 
 | 
			
		||||
           └── yes: apply its value to the scene
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
> Note that only macro's can trigger roundrobin values or contextmenu's, as well as roundrobin values never ending up in the toplevel URL.
 | 
			
		||||
 | 
			
		||||
# Security Considerations
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# IANA Considerations
 | 
			
		||||
 | 
			
		||||
This document has no IANA actions.
 | 
			
		||||
 | 
			
		||||
# Acknowledgments
 | 
			
		||||
 | 
			
		||||
* [NLNET](https://nlnet.nl)
 | 
			
		||||
* [Future of Text](https://futureoftext.org)
 | 
			
		||||
* [visual-meta.info](https://visual-meta.info)
 | 
			
		||||
 | 
			
		||||
# Appendix: Definitions 
 | 
			
		||||
 | 
			
		||||
|definition            | explanation                                                                                                                   |
 | 
			
		||||
|----------------------|-------------------------------------------------------------------------------------------------------------------------------|
 | 
			
		||||
|scene                 | a (local/remote) 3D scene or 3D file (index.gltf e.g.)                                                                        |
 | 
			
		||||
|3D object             | an object inside a scene characterized by vertex-, face- and customproperty data.                                             |
 | 
			
		||||
|XR fragments          | URI Fragment with spatial hints like `#pos=0,0,0&t=1,100` e.g.                                                                |
 | 
			
		||||
|query                 | an URI Fragment-operator which queries object(s) from a scene like `#q=cube`                                                  |
 | 
			
		||||
|FPS                   | frames per second in spatial experiences (games,VR,AR e.g.), should be as high as possible                                    |
 | 
			
		||||
|`◻`                   | ascii representation of an 3D object/mesh                                                                                     |
 | 
			
		||||
|(un)obtrusive         | obtrusive: wrapping human text/thought in XML/HTML/JSON obfuscates human text into a salad of machine-symbols and words       |
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										392
									
								
								doc/RFC_XR_Macros.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,392 @@
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Internet Engineering Task Force                          L.R. van Kammen
 | 
			
		||||
Internet-Draft                                         27 September 2024
 | 
			
		||||
Intended status: Informational                                          
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                               XR Macros
 | 
			
		||||
                    draft-XRMACROS-leonvankammen-00
 | 
			
		||||
 | 
			
		||||
Abstract
 | 
			
		||||
 | 
			
		||||
   This draft offers a specification for embedding macros in existing 3D
 | 
			
		||||
   scenes/assets, to offer simple interactions and configure the
 | 
			
		||||
   renderer further.
 | 
			
		||||
   Together with URI Fragments, it allows for rich immersive experiences
 | 
			
		||||
   without the need of a complicated sandboxed scripting languages.
 | 
			
		||||
 | 
			
		||||
   Almost every idea in this document is demonstrated at
 | 
			
		||||
   https://xrfragment.org (https://xrfragment.org), as this spec was
 | 
			
		||||
   created during the XR Fragments (https://xrfragment.org) spec.
 | 
			
		||||
 | 
			
		||||
Status of This Memo
 | 
			
		||||
 | 
			
		||||
   This Internet-Draft is submitted in full conformance with the
 | 
			
		||||
   provisions of BCP 78 and BCP 79.
 | 
			
		||||
 | 
			
		||||
   Internet-Drafts are working documents of the Internet Engineering
 | 
			
		||||
   Task Force (IETF).  Note that other groups may also distribute
 | 
			
		||||
   working documents as Internet-Drafts.  The list of current Internet-
 | 
			
		||||
   Drafts is at https://datatracker.ietf.org/drafts/current/.
 | 
			
		||||
 | 
			
		||||
   Internet-Drafts are draft documents valid for a maximum of six months
 | 
			
		||||
   and may be updated, replaced, or obsoleted by other documents at any
 | 
			
		||||
   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 31 March 2025.
 | 
			
		||||
 | 
			
		||||
Copyright Notice
 | 
			
		||||
 | 
			
		||||
   Copyright (c) 2024 IETF Trust and the persons identified as the
 | 
			
		||||
   document authors.  All rights reserved.
 | 
			
		||||
 | 
			
		||||
   This document is subject to BCP 78 and the IETF Trust's Legal
 | 
			
		||||
   Provisions Relating to IETF Documents (https://trustee.ietf.org/
 | 
			
		||||
   license-info) in effect on the date of publication of this document.
 | 
			
		||||
   Please review these documents carefully, as they describe your rights
 | 
			
		||||
   and restrictions with respect to this document.  Code Components
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
van Kammen                Expires 31 March 2025                 [Page 1]
 | 
			
		||||
 | 
			
		||||
Internet-Draft                  XR Macros                 September 2024
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   extracted from this document must include Revised BSD License text as
 | 
			
		||||
   described in Section 4.e of the Trust Legal Provisions and are
 | 
			
		||||
   provided without warranty as described in the Revised BSD License.
 | 
			
		||||
 | 
			
		||||
Table of Contents
 | 
			
		||||
 | 
			
		||||
   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
 | 
			
		||||
   2.  Core principle  . . . . . . . . . . . . . . . . . . . . . . .   2
 | 
			
		||||
   3.  Conventions and Definitions . . . . . . . . . . . . . . . . .   3
 | 
			
		||||
   4.  List of XR Macros . . . . . . . . . . . . . . . . . . . . . .   3
 | 
			
		||||
     4.1.  Usecase: click object . . . . . . . . . . . . . . . . . .   4
 | 
			
		||||
     4.2.  Usecase: conditional click object . . . . . . . . . . . .   4
 | 
			
		||||
     4.3.  Usecase: click object (roundrobin)  . . . . . . . . . . .   5
 | 
			
		||||
     4.4.  Usecase: click object or URI fragment, and scene load
 | 
			
		||||
           trigger . . . . . . . . . . . . . . . . . . . . . . . . .   5
 | 
			
		||||
     4.5.  Usecase: present context menu with options  . . . . . . .   6
 | 
			
		||||
     4.6.  Event Bubble-flow . . . . . . . . . . . . . . . . . . . .   6
 | 
			
		||||
   5.  Security Considerations . . . . . . . . . . . . . . . . . . .   7
 | 
			
		||||
   6.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .   7
 | 
			
		||||
   7.  Acknowledgments . . . . . . . . . . . . . . . . . . . . . . .   7
 | 
			
		||||
   8.  Appendix: Definitions . . . . . . . . . . . . . . . . . . . .   7
 | 
			
		||||
 | 
			
		||||
1.  Introduction
 | 
			
		||||
 | 
			
		||||
   How can we add more features to existing text & 3D scenes, without
 | 
			
		||||
   introducing new dataformats?
 | 
			
		||||
   Historically, there's many attempts to create the ultimate
 | 
			
		||||
   markuplanguage or 3D fileformat.
 | 
			
		||||
   Their lowest common denominator is: (co)authoring using plain text.
 | 
			
		||||
   Therefore, XR Macros allows us to enrich/connect existing
 | 
			
		||||
   dataformats, by offering a polyglot notation based on existing
 | 
			
		||||
   notations:
 | 
			
		||||
 | 
			
		||||
   1.  getting/setting common used 3D properties using querystring- or
 | 
			
		||||
       JSON-notation
 | 
			
		||||
   2.  targeting 3D properties using the lightweight query notation
 | 
			
		||||
       present in XR Fragments (https://xrfragment.org)
 | 
			
		||||
 | 
			
		||||
   |  NOTE: The chapters in this document are ordered from highlevel to
 | 
			
		||||
   |  lowlevel (technical) as much as possible
 | 
			
		||||
 | 
			
		||||
2.  Core principle
 | 
			
		||||
 | 
			
		||||
   1.  XR Macros use querystrings, but are HTML-agnostic (though pseudo-
 | 
			
		||||
       XR Fragment browsers *can* be implemented on top of HTML/
 | 
			
		||||
       Javascript).
 | 
			
		||||
   2.  An XR Macro is 3D metadata which starts with '!' (!clickme:
 | 
			
		||||
       fog=0,10 e.g.)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
van Kammen                Expires 31 March 2025                 [Page 2]
 | 
			
		||||
 | 
			
		||||
Internet-Draft                  XR Macros                 September 2024
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   3.  Metadata-values can contain the | symbol to 🎲 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
 | 
			
		||||
       serious scripting languages can react to them as well).
 | 
			
		||||
   5.  XR Macros can assign object metadata (!setlocal: foo=1 writes
 | 
			
		||||
       foo:1 metadata to the object containing the !setlocal metadata)
 | 
			
		||||
   6.  XR Macros can assign global metadata (!setfoo: #foo=1 writes
 | 
			
		||||
       foo:1 metadata to the root scene-node)
 | 
			
		||||
 | 
			
		||||
   |  These very simple principles allow for rich interactions and
 | 
			
		||||
   |  dynamic querying
 | 
			
		||||
 | 
			
		||||
3.  Conventions and Definitions
 | 
			
		||||
 | 
			
		||||
   See appendix below in case certain terms are not clear.
 | 
			
		||||
 | 
			
		||||
4.  List of XR Macros
 | 
			
		||||
 | 
			
		||||
   (XR) Macros can be embedded in 3D assets/scenes.
 | 
			
		||||
   Macros enrich existing spatial content with a lowcode, limited logic-
 | 
			
		||||
   layer, by recursive (economic) use of the querystring syntax (which
 | 
			
		||||
   search engines and XR Fragments (https://xrfragment.org) already
 | 
			
		||||
   uses.
 | 
			
		||||
   This is done by allowing string/integer variables, and the | symbol
 | 
			
		||||
   to roundrobin variable values.
 | 
			
		||||
   Macros also act as events, so more serious scripting languages can
 | 
			
		||||
   react to them as well.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
van Kammen                Expires 31 March 2025                 [Page 3]
 | 
			
		||||
 | 
			
		||||
Internet-Draft                  XR Macros                 September 2024
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   +=========+======+===================+=================+=============+
 | 
			
		||||
   |key      |type  |example (JSON)     |function         |existing     |
 | 
			
		||||
   |         |      |                   |                 |compatibility|
 | 
			
		||||
   +=========+======+===================+=================+=============+
 | 
			
		||||
   |@bg      |string|"@bg":"#cube"      |bg: binds fog    |custom       |
 | 
			
		||||
   |         |      |                   |near/far based to|property in  |
 | 
			
		||||
   |         |      |                   |cube x/y/z (anim)|3D           |
 | 
			
		||||
   |         |      |                   |values           |fileformats  |
 | 
			
		||||
   +---------+------+-------------------+-----------------+-------------+
 | 
			
		||||
   |@fog     |string|"@fog":"#cube"     |fog: binds fog   |custom       |
 | 
			
		||||
   |         |      |                   |near/far based to|property in  |
 | 
			
		||||
   |         |      |                   |cube x/y (anim)  |3D           |
 | 
			
		||||
   |         |      |                   |values           |fileformats  |
 | 
			
		||||
   +---------+------+-------------------+-----------------+-------------+
 | 
			
		||||
   |@scroll  |string|"@scroll":"#cube"  |texturescrolling:|custom       |
 | 
			
		||||
   |         |      |                   |binds texture    |property in  |
 | 
			
		||||
   |         |      |                   |x/y/rot based to |3D           |
 | 
			
		||||
   |         |      |                   |cube x/y/z (anim)|fileformats  |
 | 
			
		||||
   |         |      |                   |values           |             |
 | 
			
		||||
   +---------+------+-------------------+-----------------+-------------+
 | 
			
		||||
   |@emissive|string|"@emissive":"#cube"|day/night/mood:  |custom       |
 | 
			
		||||
   |         |      |                   |binds material's |property in  |
 | 
			
		||||
   |         |      |                   |emissive value to|3D           |
 | 
			
		||||
   |         |      |                   |cube x/y/z (anim)|fileformats  |
 | 
			
		||||
   |         |      |                   |values           |             |
 | 
			
		||||
   +---------+------+-------------------+-----------------+-------------+
 | 
			
		||||
 | 
			
		||||
                                  Table 1
 | 
			
		||||
 | 
			
		||||
4.1.  Usecase: click object
 | 
			
		||||
 | 
			
		||||
           +=================+================+================+
 | 
			
		||||
           | custom property | value          | trigger when   |
 | 
			
		||||
           +=================+================+================+
 | 
			
		||||
           | !clickme        | bg=1,1,1&foo=2 | object clicked |
 | 
			
		||||
           +-----------------+----------------+----------------+
 | 
			
		||||
 | 
			
		||||
                                  Table 2
 | 
			
		||||
 | 
			
		||||
4.2.  Usecase: conditional click object
 | 
			
		||||
 | 
			
		||||
    +=================+==================+============================+
 | 
			
		||||
    | custom property | value            | trigger when               |
 | 
			
		||||
    +=================+==================+============================+
 | 
			
		||||
    | #               | foo=1            | scene                      |
 | 
			
		||||
    +-----------------+------------------+----------------------------+
 | 
			
		||||
    | !clickme        | q=foo>2&bg=1,1,1 | object clicked and foo > 2 |
 | 
			
		||||
    +-----------------+------------------+----------------------------+
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
van Kammen                Expires 31 March 2025                 [Page 4]
 | 
			
		||||
 | 
			
		||||
Internet-Draft                  XR Macros                 September 2024
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                                  Table 3
 | 
			
		||||
 | 
			
		||||
   |  when a user clicks an object with the custom properties above, it
 | 
			
		||||
   |  should set the backgroundcolor to 1,1,1 when foo is greater than 2
 | 
			
		||||
   |  (see previous example)
 | 
			
		||||
 | 
			
		||||
4.3.  Usecase: click object (roundrobin)
 | 
			
		||||
 | 
			
		||||
           +=================+================+================+
 | 
			
		||||
           | custom property | value          | trigger when   |
 | 
			
		||||
           +=================+================+================+
 | 
			
		||||
           | !cycleme        | day|noon|night | object clicked |
 | 
			
		||||
           +-----------------+----------------+----------------+
 | 
			
		||||
           | day             | bg=1,1,1       | roundrobin     |
 | 
			
		||||
           +-----------------+----------------+----------------+
 | 
			
		||||
           | noon            | bg=0.5,0.5,0.5 | roundrobin     |
 | 
			
		||||
           +-----------------+----------------+----------------+
 | 
			
		||||
           | night           | bg=0,0,0&foo=2 | roundrobin     |
 | 
			
		||||
           +-----------------+----------------+----------------+
 | 
			
		||||
 | 
			
		||||
                                  Table 4
 | 
			
		||||
 | 
			
		||||
   |  when a user clicks an object with the custom properties above, it
 | 
			
		||||
   |  should trigger either day noon or night in roundrobin fashion.
 | 
			
		||||
 | 
			
		||||
4.4.  Usecase: click object or URI fragment, and scene load trigger
 | 
			
		||||
 | 
			
		||||
        +=================+================+======================+
 | 
			
		||||
        | custom property | value          | trigger when         |
 | 
			
		||||
        +=================+================+======================+
 | 
			
		||||
        | #               | random         | scene loaded         |
 | 
			
		||||
        +-----------------+----------------+----------------------+
 | 
			
		||||
        | #random         | random         | URL contains #random |
 | 
			
		||||
        +-----------------+----------------+----------------------+
 | 
			
		||||
        | !random         | day|noon|night | #random, # or click  |
 | 
			
		||||
        +-----------------+----------------+----------------------+
 | 
			
		||||
        | day             | bg=1,1,1       | roundrobin           |
 | 
			
		||||
        +-----------------+----------------+----------------------+
 | 
			
		||||
        | noon            | bg=0.5,0.5,0.5 | roundrobin           |
 | 
			
		||||
        +-----------------+----------------+----------------------+
 | 
			
		||||
        | night           | bg=0,0,0&foo=2 | roundrobin           |
 | 
			
		||||
        +-----------------+----------------+----------------------+
 | 
			
		||||
 | 
			
		||||
                                  Table 5
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
van Kammen                Expires 31 March 2025                 [Page 5]
 | 
			
		||||
 | 
			
		||||
Internet-Draft                  XR Macros                 September 2024
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
4.5.  Usecase: present context menu with options
 | 
			
		||||
 | 
			
		||||
       +=================+================+========================+
 | 
			
		||||
       | custom property | value          | trigger when           |
 | 
			
		||||
       +=================+================+========================+
 | 
			
		||||
       | !random         | !day           | !noon                  |
 | 
			
		||||
       +-----------------+----------------+------------------------+
 | 
			
		||||
       | !day            | bg=1,1,1       | clicked in contextmenu |
 | 
			
		||||
       +-----------------+----------------+------------------------+
 | 
			
		||||
       | !noon           | bg=0.5,0.5,0.5 | clicked in contextmenu |
 | 
			
		||||
       +-----------------+----------------+------------------------+
 | 
			
		||||
       | !night          | bg=0,0,0&foo=2 | clicked in contextmenu |
 | 
			
		||||
       +-----------------+----------------+------------------------+
 | 
			
		||||
 | 
			
		||||
                                  Table 6
 | 
			
		||||
 | 
			
		||||
   |  When interacting with an object with more than one !-macro, the XR
 | 
			
		||||
   |  Browser should offer a contextmenu to execute a macro.
 | 
			
		||||
 | 
			
		||||
   In a similar way, when *any* !-macro is present on the sceneroot, the
 | 
			
		||||
   XR Browser should offer a context-menu to execute those macro's.
 | 
			
		||||
 | 
			
		||||
4.6.  Event Bubble-flow
 | 
			
		||||
 | 
			
		||||
   click object with (!clickme:AR or !clickme: !reset e.g.)
 | 
			
		||||
 | 
			
		||||
  ◻
 | 
			
		||||
  │
 | 
			
		||||
  └── 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
 | 
			
		||||
 | 
			
		||||
   click object with (!clickme:#AR|#VR e.g.)
 | 
			
		||||
 | 
			
		||||
  ◻
 | 
			
		||||
  │
 | 
			
		||||
  └── apply the roundrobin (rotate the options, value `#AR` becomes `#VR` upon next click)
 | 
			
		||||
      └── is there any object with property-key (`#AR` e.g.)?
 | 
			
		||||
         └── no: just update the URL to `#AR`
 | 
			
		||||
           └── yes: apply its value to the scene, and update the URL to `#AR`
 | 
			
		||||
 | 
			
		||||
click object with (`!clickme`:`!foo|!bar|!flop` e.g.)
 | 
			
		||||
 | 
			
		||||
   ◻ │
 | 
			
		||||
   └── apply the roundrobin (rotate the options, value !foo becomes !bar
 | 
			
		||||
   upon next click) └── is there any object with property-key (!foo
 | 
			
		||||
   e.g.)?  └── no: do nothing └── yes: apply its value to the scene ```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
van Kammen                Expires 31 March 2025                 [Page 6]
 | 
			
		||||
 | 
			
		||||
Internet-Draft                  XR Macros                 September 2024
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   |  Note that only macro's can trigger roundrobin values or
 | 
			
		||||
   |  contextmenu's, as well as roundrobin values never ending up in the
 | 
			
		||||
   |  toplevel URL.
 | 
			
		||||
 | 
			
		||||
5.  Security Considerations
 | 
			
		||||
 | 
			
		||||
6.  IANA Considerations
 | 
			
		||||
 | 
			
		||||
   This document has no IANA actions.
 | 
			
		||||
 | 
			
		||||
7.  Acknowledgments
 | 
			
		||||
 | 
			
		||||
   *  NLNET (https://nlnet.nl)
 | 
			
		||||
   *  Future of Text (https://futureoftext.org)
 | 
			
		||||
   *  visual-meta.info (https://visual-meta.info)
 | 
			
		||||
 | 
			
		||||
8.  Appendix: Definitions
 | 
			
		||||
 | 
			
		||||
   +===============+===================================================+
 | 
			
		||||
   | definition    | explanation                                       |
 | 
			
		||||
   +===============+===================================================+
 | 
			
		||||
   | scene         | a (local/remote) 3D scene or 3D file              |
 | 
			
		||||
   |               | (index.gltf e.g.)                                 |
 | 
			
		||||
   +---------------+---------------------------------------------------+
 | 
			
		||||
   | 3D object     | an object inside a scene characterized by         |
 | 
			
		||||
   |               | vertex-, face- and customproperty data.           |
 | 
			
		||||
   +---------------+---------------------------------------------------+
 | 
			
		||||
   | XR fragments  | URI Fragment with spatial hints like              |
 | 
			
		||||
   |               | #pos=0,0,0&t=1,100 e.g.                           |
 | 
			
		||||
   +---------------+---------------------------------------------------+
 | 
			
		||||
   | query         | an URI Fragment-operator which queries            |
 | 
			
		||||
   |               | object(s) from a scene like #q=cube               |
 | 
			
		||||
   +---------------+---------------------------------------------------+
 | 
			
		||||
   | FPS           | frames per second in spatial experiences          |
 | 
			
		||||
   |               | (games,VR,AR e.g.), should be as high as          |
 | 
			
		||||
   |               | possible                                          |
 | 
			
		||||
   +---------------+---------------------------------------------------+
 | 
			
		||||
   | ◻             | ascii representation of an 3D object/mesh         |
 | 
			
		||||
   +---------------+---------------------------------------------------+
 | 
			
		||||
   | (un)obtrusive | obtrusive: wrapping human text/thought in         |
 | 
			
		||||
   |               | XML/HTML/JSON obfuscates human text into          |
 | 
			
		||||
   |               | a salad of machine-symbols and words              |
 | 
			
		||||
   +---------------+---------------------------------------------------+
 | 
			
		||||
 | 
			
		||||
                                  Table 7
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
van Kammen                Expires 31 March 2025                 [Page 7]
 | 
			
		||||
							
								
								
									
										381
									
								
								doc/RFC_XR_Macros.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,381 @@
 | 
			
		|||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<!-- name="GENERATOR" content="github.com/mmarkdown/mmark Mmark Markdown Processor - mmark.miek.nl" -->
 | 
			
		||||
<rfc version="3" ipr="trust200902" docName="draft-XRMACROS-leonvankammen-00" submissionType="IETF" category="info" xml:lang="en" xmlns:xi="http://www.w3.org/2001/XInclude" indexInclude="true" consensus="true">
 | 
			
		||||
 | 
			
		||||
<front>
 | 
			
		||||
<title>XR Macros</title><seriesInfo value="draft-XRMACROS-leonvankammen-00" stream="IETF" status="informational" name="XR-Macros"></seriesInfo>
 | 
			
		||||
<author initials="L.R." surname="van Kammen" fullname="L.R. van Kammen"><organization></organization><address><postal><street></street>
 | 
			
		||||
</postal></address></author><date/>
 | 
			
		||||
<area>Internet</area>
 | 
			
		||||
<workgroup>Internet Engineering Task Force</workgroup>
 | 
			
		||||
 | 
			
		||||
<abstract>
 | 
			
		||||
<t>This draft offers a specification for embedding macros in existing 3D scenes/assets, to offer simple interactions and configure the renderer further.<br />
 | 
			
		||||
 | 
			
		||||
Together with URI Fragments, it allows for rich immersive experiences without the need of a complicated sandboxed scripting languages.</t>
 | 
			
		||||
<t>Almost every idea in this document is demonstrated at <eref target="https://xrfragment.org">https://xrfragment.org</eref>, as this spec was created during the <eref target="https://xrfragment.org">XR Fragments</eref> spec.</t>
 | 
			
		||||
</abstract>
 | 
			
		||||
 | 
			
		||||
</front>
 | 
			
		||||
 | 
			
		||||
<middle>
 | 
			
		||||
 | 
			
		||||
<section anchor="introduction"><name>Introduction</name>
 | 
			
		||||
<t>How can we add more features to existing text & 3D scenes, without introducing new dataformats?<br />
 | 
			
		||||
 | 
			
		||||
Historically, there's many attempts to create the ultimate markuplanguage or 3D fileformat.<br />
 | 
			
		||||
 | 
			
		||||
Their lowest common denominator is: (co)authoring using plain text.<br />
 | 
			
		||||
 | 
			
		||||
Therefore, XR Macros allows us to enrich/connect existing dataformats, by offering a polyglot notation based on existing notations:<br />
 | 
			
		||||
</t>
 | 
			
		||||
 | 
			
		||||
<ol spacing="compact">
 | 
			
		||||
<li>getting/setting common used 3D properties using querystring- or JSON-notation</li>
 | 
			
		||||
<li>targeting 3D properties using the lightweight query notation present in <eref target="https://xrfragment.org">XR Fragments</eref></li>
 | 
			
		||||
</ol>
 | 
			
		||||
<blockquote><t>NOTE: The chapters in this document are ordered from highlevel to lowlevel (technical) as much as possible</t>
 | 
			
		||||
</blockquote></section>
 | 
			
		||||
 | 
			
		||||
<section anchor="core-principle"><name>Core principle</name>
 | 
			
		||||
 | 
			
		||||
<ol spacing="compact">
 | 
			
		||||
<li>XR Macros use querystrings, but are HTML-agnostic (though pseudo-XR Fragment browsers <strong>can</strong> be implemented on top of HTML/Javascript).</li>
 | 
			
		||||
<li>An XR Macro is 3D metadata which starts with '!' (<tt>!clickme: fog=0,10</tt> e.g.)</li>
 | 
			
		||||
<li>Metadata-values can contain the <tt>|</tt> symbol to 🎲 roundrobin variable values (<tt>!toggleme: fog=0,10|fog=0,1000</tt> e.g.)</li>
 | 
			
		||||
<li>XR Macros acts as simple eventhandlers for URI Fragments: they are automatically published on the (<eref target="https://xrfragment.org">XR Fragments</eref>) hashbus, to act as events (so more serious scripting languages can react to them as well).</li>
 | 
			
		||||
<li>XR Macros can assign object metadata (<tt>!setlocal: foo=1</tt> writes <tt>foo:1</tt> metadata to the object containing the <tt>!setlocal</tt> metadata)</li>
 | 
			
		||||
<li>XR Macros can assign global metadata  (<tt>!setfoo: #foo=1</tt> writes <tt>foo:1</tt> metadata to the root scene-node)</li>
 | 
			
		||||
</ol>
 | 
			
		||||
<blockquote><t>These very simple principles allow for rich interactions and dynamic querying</t>
 | 
			
		||||
</blockquote></section>
 | 
			
		||||
 | 
			
		||||
<section anchor="conventions-and-definitions"><name>Conventions and Definitions</name>
 | 
			
		||||
<t>See appendix below in case certain terms are not clear.</t>
 | 
			
		||||
</section>
 | 
			
		||||
 | 
			
		||||
<section anchor="list-of-xr-macros"><name>List of XR Macros</name>
 | 
			
		||||
<t>(XR) Macros can be embedded in 3D assets/scenes.<br />
 | 
			
		||||
 | 
			
		||||
Macros enrich existing spatial content with a lowcode, limited logic-layer, by recursive (economic) use of the querystring syntax (which search engines and <eref target="https://xrfragment.org">XR Fragments</eref> already uses.<br />
 | 
			
		||||
 | 
			
		||||
This is done by allowing string/integer variables, and the <tt>|</tt> symbol to roundrobin variable values.<br />
 | 
			
		||||
 | 
			
		||||
Macros also act as events, so more serious scripting languages can react to them as well.<br />
 | 
			
		||||
</t>
 | 
			
		||||
<table>
 | 
			
		||||
<thead>
 | 
			
		||||
<tr>
 | 
			
		||||
<th>key</th>
 | 
			
		||||
<th>type</th>
 | 
			
		||||
<th>example (JSON)</th>
 | 
			
		||||
<th>function</th>
 | 
			
		||||
<th>existing compatibility</th>
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
 | 
			
		||||
<tbody>
 | 
			
		||||
<tr>
 | 
			
		||||
<td><tt>@bg</tt></td>
 | 
			
		||||
<td>string</td>
 | 
			
		||||
<td><tt>"@bg":"#cube"</tt></td>
 | 
			
		||||
<td>bg: binds fog near/far based to cube x/y/z (anim) values</td>
 | 
			
		||||
<td>custom property in 3D fileformats</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td><tt>@fog</tt></td>
 | 
			
		||||
<td>string</td>
 | 
			
		||||
<td><tt>"@fog":"#cube"</tt></td>
 | 
			
		||||
<td>fog: binds fog near/far based to cube x/y (anim) values</td>
 | 
			
		||||
<td>custom property in 3D fileformats</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td><tt>@scroll</tt></td>
 | 
			
		||||
<td>string</td>
 | 
			
		||||
<td><tt>"@scroll":"#cube"</tt></td>
 | 
			
		||||
<td>texturescrolling: binds texture x/y/rot based to cube x/y/z (anim) values</td>
 | 
			
		||||
<td>custom property in 3D fileformats</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td><tt>@emissive</tt></td>
 | 
			
		||||
<td>string</td>
 | 
			
		||||
<td><tt>"@emissive":"#cube"</tt></td>
 | 
			
		||||
<td>day/night/mood: binds material's emissive value to cube x/y/z (anim) values</td>
 | 
			
		||||
<td>custom property in 3D fileformats</td>
 | 
			
		||||
</tr>
 | 
			
		||||
</tbody>
 | 
			
		||||
</table>
 | 
			
		||||
<section anchor="usecase-click-object"><name>Usecase: click object</name>
 | 
			
		||||
<table>
 | 
			
		||||
<thead>
 | 
			
		||||
<tr>
 | 
			
		||||
<th>custom property</th>
 | 
			
		||||
<th>value</th>
 | 
			
		||||
<th>trigger when</th>
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
 | 
			
		||||
<tbody>
 | 
			
		||||
<tr>
 | 
			
		||||
<td>!clickme</td>
 | 
			
		||||
<td>bg=1,1,1&foo=2</td>
 | 
			
		||||
<td>object clicked</td>
 | 
			
		||||
</tr>
 | 
			
		||||
</tbody>
 | 
			
		||||
</table></section>
 | 
			
		||||
 | 
			
		||||
<section anchor="usecase-conditional-click-object"><name>Usecase: conditional click object</name>
 | 
			
		||||
<table>
 | 
			
		||||
<thead>
 | 
			
		||||
<tr>
 | 
			
		||||
<th>custom property</th>
 | 
			
		||||
<th>value</th>
 | 
			
		||||
<th>trigger when</th>
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
 | 
			
		||||
<tbody>
 | 
			
		||||
<tr>
 | 
			
		||||
<td>#</td>
 | 
			
		||||
<td>foo=1</td>
 | 
			
		||||
<td>scene</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>!clickme</td>
 | 
			
		||||
<td>q=foo>2&bg=1,1,1</td>
 | 
			
		||||
<td>object clicked and foo > 2</td>
 | 
			
		||||
</tr>
 | 
			
		||||
</tbody>
 | 
			
		||||
</table><blockquote><t>when a user clicks an object with the custom properties above, it should set the backgroundcolor to <tt>1,1,1</tt> when <tt>foo</tt> is greater than <tt>2</tt> (see previous example)</t>
 | 
			
		||||
</blockquote></section>
 | 
			
		||||
 | 
			
		||||
<section anchor="usecase-click-object-roundrobin"><name>Usecase: click object (roundrobin)</name>
 | 
			
		||||
<table>
 | 
			
		||||
<thead>
 | 
			
		||||
<tr>
 | 
			
		||||
<th>custom property</th>
 | 
			
		||||
<th>value</th>
 | 
			
		||||
<th>trigger when</th>
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
 | 
			
		||||
<tbody>
 | 
			
		||||
<tr>
 | 
			
		||||
<td>!cycleme</td>
 | 
			
		||||
<td>day|noon|night</td>
 | 
			
		||||
<td>object clicked</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>day</td>
 | 
			
		||||
<td>bg=1,1,1</td>
 | 
			
		||||
<td>roundrobin</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>noon</td>
 | 
			
		||||
<td>bg=0.5,0.5,0.5</td>
 | 
			
		||||
<td>roundrobin</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>night</td>
 | 
			
		||||
<td>bg=0,0,0&foo=2</td>
 | 
			
		||||
<td>roundrobin</td>
 | 
			
		||||
</tr>
 | 
			
		||||
</tbody>
 | 
			
		||||
</table><blockquote><t>when a user clicks an object with the custom properties above, it should trigger either <tt>day</tt> <tt>noon</tt> or <tt>night</tt> in roundrobin fashion.</t>
 | 
			
		||||
</blockquote></section>
 | 
			
		||||
 | 
			
		||||
<section anchor="usecase-click-object-or-uri-fragment-and-scene-load-trigger"><name>Usecase: click object or URI fragment, and scene load trigger</name>
 | 
			
		||||
<table>
 | 
			
		||||
<thead>
 | 
			
		||||
<tr>
 | 
			
		||||
<th>custom property</th>
 | 
			
		||||
<th>value</th>
 | 
			
		||||
<th>trigger when</th>
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
 | 
			
		||||
<tbody>
 | 
			
		||||
<tr>
 | 
			
		||||
<td>#</td>
 | 
			
		||||
<td>random</td>
 | 
			
		||||
<td>scene loaded</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>#random</td>
 | 
			
		||||
<td>random</td>
 | 
			
		||||
<td>URL contains #random</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>!random</td>
 | 
			
		||||
<td>day|noon|night</td>
 | 
			
		||||
<td>#random, # or click</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>day</td>
 | 
			
		||||
<td>bg=1,1,1</td>
 | 
			
		||||
<td>roundrobin</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>noon</td>
 | 
			
		||||
<td>bg=0.5,0.5,0.5</td>
 | 
			
		||||
<td>roundrobin</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>night</td>
 | 
			
		||||
<td>bg=0,0,0&foo=2</td>
 | 
			
		||||
<td>roundrobin</td>
 | 
			
		||||
</tr>
 | 
			
		||||
</tbody>
 | 
			
		||||
</table></section>
 | 
			
		||||
 | 
			
		||||
<section anchor="usecase-present-context-menu-with-options"><name>Usecase: present context menu with options</name>
 | 
			
		||||
<table>
 | 
			
		||||
<thead>
 | 
			
		||||
<tr>
 | 
			
		||||
<th>custom property</th>
 | 
			
		||||
<th>value</th>
 | 
			
		||||
<th>trigger when</th>
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
 | 
			
		||||
<tbody>
 | 
			
		||||
<tr>
 | 
			
		||||
<td>!random</td>
 | 
			
		||||
<td>!day</td>
 | 
			
		||||
<td>!noon</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>!day</td>
 | 
			
		||||
<td>bg=1,1,1</td>
 | 
			
		||||
<td>clicked in contextmenu</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>!noon</td>
 | 
			
		||||
<td>bg=0.5,0.5,0.5</td>
 | 
			
		||||
<td>clicked in contextmenu</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>!night</td>
 | 
			
		||||
<td>bg=0,0,0&foo=2</td>
 | 
			
		||||
<td>clicked in contextmenu</td>
 | 
			
		||||
</tr>
 | 
			
		||||
</tbody>
 | 
			
		||||
</table><blockquote><t>When interacting with an object with more than one <tt>!</tt>-macro, the XR Browser should offer a contextmenu to execute a macro.</t>
 | 
			
		||||
</blockquote><t>In a similar way, when <strong>any</strong> <tt>!</tt>-macro is present on the sceneroot, the XR Browser should offer a context-menu to execute those macro's.</t>
 | 
			
		||||
</section>
 | 
			
		||||
 | 
			
		||||
<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[  ◻
 | 
			
		||||
  │  
 | 
			
		||||
  └── 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[  ◻
 | 
			
		||||
  │  
 | 
			
		||||
  └── apply the roundrobin (rotate the options, value `#AR` becomes `#VR` upon next click)
 | 
			
		||||
      └── is there any object with property-key (`#AR` e.g.)?
 | 
			
		||||
         └── no: just update the URL to `#AR`
 | 
			
		||||
           └── 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 />
 | 
			
		||||
  └── apply the roundrobin (rotate the options, value <tt>!foo</tt> becomes <tt>!bar</tt> upon next click)
 | 
			
		||||
      └── is there any object with property-key (<tt>!foo</tt> e.g.)?
 | 
			
		||||
         └── no: do nothing
 | 
			
		||||
           └── yes: apply its value to the scene
 | 
			
		||||
```</t>
 | 
			
		||||
<blockquote><t>Note that only macro's can trigger roundrobin values or contextmenu's, as well as roundrobin values never ending up in the toplevel URL.</t>
 | 
			
		||||
</blockquote></section>
 | 
			
		||||
</section>
 | 
			
		||||
 | 
			
		||||
<section anchor="security-considerations"><name>Security Considerations</name>
 | 
			
		||||
</section>
 | 
			
		||||
 | 
			
		||||
<section anchor="iana-considerations"><name>IANA Considerations</name>
 | 
			
		||||
<t>This document has no IANA actions.</t>
 | 
			
		||||
</section>
 | 
			
		||||
 | 
			
		||||
<section anchor="acknowledgments"><name>Acknowledgments</name>
 | 
			
		||||
 | 
			
		||||
<ul spacing="compact">
 | 
			
		||||
<li><eref target="https://nlnet.nl">NLNET</eref></li>
 | 
			
		||||
<li><eref target="https://futureoftext.org">Future of Text</eref></li>
 | 
			
		||||
<li><eref target="https://visual-meta.info">visual-meta.info</eref></li>
 | 
			
		||||
</ul>
 | 
			
		||||
</section>
 | 
			
		||||
 | 
			
		||||
<section anchor="appendix-definitions"><name>Appendix: Definitions</name>
 | 
			
		||||
<table>
 | 
			
		||||
<thead>
 | 
			
		||||
<tr>
 | 
			
		||||
<th>definition</th>
 | 
			
		||||
<th>explanation</th>
 | 
			
		||||
</tr>
 | 
			
		||||
</thead>
 | 
			
		||||
 | 
			
		||||
<tbody>
 | 
			
		||||
<tr>
 | 
			
		||||
<td>scene</td>
 | 
			
		||||
<td>a (local/remote) 3D scene or 3D file (index.gltf e.g.)</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>3D object</td>
 | 
			
		||||
<td>an object inside a scene characterized by vertex-, face- and customproperty data.</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>XR fragments</td>
 | 
			
		||||
<td>URI Fragment with spatial hints like <tt>#pos=0,0,0&t=1,100</tt> e.g.</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>query</td>
 | 
			
		||||
<td>an URI Fragment-operator which queries object(s) from a scene like <tt>#q=cube</tt></td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>FPS</td>
 | 
			
		||||
<td>frames per second in spatial experiences (games,VR,AR e.g.), should be as high as possible</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td><tt>◻</tt></td>
 | 
			
		||||
<td>ascii representation of an 3D object/mesh</td>
 | 
			
		||||
</tr>
 | 
			
		||||
 | 
			
		||||
<tr>
 | 
			
		||||
<td>(un)obtrusive</td>
 | 
			
		||||
<td>obtrusive: wrapping human text/thought in XML/HTML/JSON obfuscates human text into a salad of machine-symbols and words</td>
 | 
			
		||||
</tr>
 | 
			
		||||
</tbody>
 | 
			
		||||
</table></section>
 | 
			
		||||
 | 
			
		||||
</middle>
 | 
			
		||||
 | 
			
		||||
</rfc>
 | 
			
		||||
| 
						 | 
				
			
			@ -1,25 +1,13 @@
 | 
			
		|||
{ pkgs ? import <nixos-unstable> {} } :
 | 
			
		||||
{
 | 
			
		||||
{ pkgs ? import <nixpkgs> {} }:
 | 
			
		||||
 | 
			
		||||
  pkgs = import (builtins.fetchGit {
 | 
			
		||||
      name = "nixos-23.05";
 | 
			
		||||
    url = "https://github.com/nixos/nixpkgs/";
 | 
			
		||||
    ref = "refs/heads/nixos-unstable";
 | 
			
		||||
    rev = "ef99fa5c5ed624460217c31ac4271cfb5cb2502c";
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  foo = pkgs.mkShell {
 | 
			
		||||
  pkgs.mkShell {
 | 
			
		||||
    # nativeBuildInputs is usually what you want -- tools you need to run
 | 
			
		||||
    nativeBuildInputs = with pkgs.buildPackages; [ 
 | 
			
		||||
 | 
			
		||||
      mmark
 | 
			
		||||
      xml2rfc
 | 
			
		||||
      python312Packages.lxml
 | 
			
		||||
      wkhtmltopdf-bin
 | 
			
		||||
      imagemagick
 | 
			
		||||
 | 
			
		||||
    ];
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  # to create [markdown] table of contents use LLM with this input: awk '/id="/ { print $0 }' RFC_XR_Fragments.html | grep -v idx
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1
									
								
								doc/tags
									
										
									
									
									
								
							
							
						
						| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
/home/leon/.ctags.js
 | 
			
		||||
							
								
								
									
										1
									
								
								example/aframe/export/assets
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
../../assets
 | 
			
		||||
							
								
								
									
										1
									
								
								example/aframe/export/dist
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
../../../dist
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								example/aframe/export/equirect.jpg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 153 KiB  | 
							
								
								
									
										1
									
								
								example/aframe/export/index.glb
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
assets/index.glb
 | 
			
		||||
							
								
								
									
										115
									
								
								example/aframe/export/index.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,115 @@
 | 
			
		|||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
  <head>
 | 
			
		||||
    <title>XR Fragments aframe exporter</title>
 | 
			
		||||
    <meta charset="utf-8">
 | 
			
		||||
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
 | 
			
		||||
 | 
			
		||||
    <!-- AFRAME v1.5.0 + extra THREE.js extra loaders --> 
 | 
			
		||||
    <script src="./../../../dist/aframe.min.js"></script> 
 | 
			
		||||
    <script src="./../../../dist/xrfragment.aframe.js"></script>
 | 
			
		||||
 | 
			
		||||
    <!-- environment component -->
 | 
			
		||||
    <script src="https://unpkg.com/aframe-environment-component@1.3.3/dist/aframe-environment-component.min.js"></script>
 | 
			
		||||
 | 
			
		||||
    <!-- important: allow touchevents in AR -->
 | 
			
		||||
    <style type="text/css"> canvas.a-dom-overlay:not(.a-no-style) { padding: 0; pointer-events: auto; }</style>
 | 
			
		||||
 | 
			
		||||
  </head>
 | 
			
		||||
  <body>
 | 
			
		||||
    <a-scene xr-mode-ui="XRMode: xr"  
 | 
			
		||||
             renderer="colorManagement: true"
 | 
			
		||||
             device-orientation-permission-ui
 | 
			
		||||
             light="defaultLightsEnabled: true"
 | 
			
		||||
             xrf>
 | 
			
		||||
 | 
			
		||||
      <a-entity xrf="#pos=place1" environment>
 | 
			
		||||
 | 
			
		||||
        <a-entity id="place1">
 | 
			
		||||
          <a-plane position="0 0.01 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
 | 
			
		||||
          <a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9"></a-box>
 | 
			
		||||
          <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
 | 
			
		||||
          <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
 | 
			
		||||
          <a-box position="0 1.2 -2" depth="0.1" width="1.2" height="0.6" color="#222222" href="#pos=place2" billboard>
 | 
			
		||||
            <a-text value="click me" position="-0.4 0.02 0.1"></a-text>
 | 
			
		||||
          </a-box>
 | 
			
		||||
        </a-entity>
 | 
			
		||||
 | 
			
		||||
        <a-entity id="place2" position="0 0 3">
 | 
			
		||||
          <a-plane position="0 0.01 0" rotation="-90 0 0" width="4" height="4" color="#FF00FF"></a-plane>
 | 
			
		||||
        </a-entity>
 | 
			
		||||
 | 
			
		||||
      </a-entity>
 | 
			
		||||
 | 
			
		||||
      <a-entity id="player" movement-controls touch-controls wasd-controls="fly:false" look-controls="magicWindowTrackingEnabled:true">
 | 
			
		||||
        <a-entity camera="fov:90" position="0 1.6 0" id="camera"></a-entity>
 | 
			
		||||
        <a-entity id="left-hand" hand-tracking-grab-controls="hand:left;modelColor:#cccccc" raycaster="objects:.ray" blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: .floor">
 | 
			
		||||
          <a-entity rotation="-35 0 0" position="0 0.1 0" id="navigator"> 
 | 
			
		||||
            <a-entity id="back" xrf-button="label: <; width:0.05; action: history.back()"    position="-0.025 0 0" class="ray"></a-entity>
 | 
			
		||||
            <a-entity id="next" xrf-button="label: >; width:0.05; action: history.forward()" position=" 0.025 0 0" class="ray"></a-entity>
 | 
			
		||||
          </a-entity>
 | 
			
		||||
        </a-entity>
 | 
			
		||||
        <a-entity id="right-hand" hand-tracking-grab-controls="hand:right;modelColor:#cccccc" laser-controls="hand: right" raycaster="objects:.ray" blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: .floor" xrf-pinchmove="rig: #player"></a-entity>
 | 
			
		||||
      </a-entity>
 | 
			
		||||
 | 
			
		||||
    </a-scene>
 | 
			
		||||
 | 
			
		||||
    <div class="menu">
 | 
			
		||||
      <b>WARNING:</b> this AFRAME-to-Model exporter is very incomplete<br><br>
 | 
			
		||||
      <button onclick="exportModel()">export to 3D model</button>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <style type="text/css">
 | 
			
		||||
      .menu { position:fixed; width: 300px; height: 90px; background: #000; display: block; top: 0px; left: 0px; padding: 20px; color: #CCC; font-family: Arial; }
 | 
			
		||||
    </style>
 | 
			
		||||
 | 
			
		||||
    <!-- billboarding component -->
 | 
			
		||||
    <script>
 | 
			
		||||
      AFRAME.registerComponent('billboard', {
 | 
			
		||||
        schema: {
 | 
			
		||||
          target: {type: 'string', default: 'camera'}
 | 
			
		||||
        },
 | 
			
		||||
        init: function () { },
 | 
			
		||||
        update: function () { },
 | 
			
		||||
        tick: function () {
 | 
			
		||||
          const targetEl = document.getElementById(this.data.target).object3D;
 | 
			
		||||
          const el = this.el.object3D;
 | 
			
		||||
          const vec = new THREE.Vector3();
 | 
			
		||||
          targetEl.getWorldDirection(vec);
 | 
			
		||||
          vec.y = 0;
 | 
			
		||||
          vec.add(el.position)
 | 
			
		||||
          el.lookAt(vec);
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      function exportModel(){
 | 
			
		||||
        function download(dataurl, filename) {
 | 
			
		||||
          var a = document.createElement("a");
 | 
			
		||||
          a.href = URL.createObjectURL( new Blob([dataurl]) );
 | 
			
		||||
          a.setAttribute("download", filename);
 | 
			
		||||
          a.click();
 | 
			
		||||
          return false;
 | 
			
		||||
        }
 | 
			
		||||
        // setup exporters
 | 
			
		||||
        let defaultExporter = THREE.GLTFExporter
 | 
			
		||||
        xrf.loaders['gltf'].exporter    = defaultExporter
 | 
			
		||||
        xrf.loaders['glb'].exporter     = defaultExporter
 | 
			
		||||
        const exporter = new THREE.GLTFExporter() 
 | 
			
		||||
        exporter.parse(
 | 
			
		||||
          xrf.model.scene,
 | 
			
		||||
          function ( glb   ) { download(glb, `index.glb`) },    // ready
 | 
			
		||||
          function ( error ) { console.error(error) },   // error
 | 
			
		||||
          {
 | 
			
		||||
            binary:true, 
 | 
			
		||||
            onlyVisible: false, 
 | 
			
		||||
            animations: xrf.model.animations,
 | 
			
		||||
            includeCustomExtensions: true,
 | 
			
		||||
            trs:true
 | 
			
		||||
          } 
 | 
			
		||||
        );
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
    </script>
 | 
			
		||||
 | 
			
		||||
  </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										1
									
								
								example/aframe/export/other.glb
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
../../assets/other.glb
 | 
			
		||||
							
								
								
									
										1
									
								
								example/aframe/sandbox/assets
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
../../assets
 | 
			
		||||
							
								
								
									
										1
									
								
								example/aframe/sandbox/dist
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
../../../dist
 | 
			
		||||
							
								
								
									
										1
									
								
								example/aframe/sandbox/index.glb
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
./../../assets/index.glb
 | 
			
		||||
							
								
								
									
										94
									
								
								example/aframe/sandbox/index.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,94 @@
 | 
			
		|||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
  <head>
 | 
			
		||||
    <title>XR Fragments aframe viewer</title>
 | 
			
		||||
    <meta charset="utf-8">
 | 
			
		||||
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
 | 
			
		||||
 | 
			
		||||
    <!-- AFRAME v1.5.0 + extra THREE.js extra loaders --> 
 | 
			
		||||
    <script src="./../../../dist/aframe.min.js"></script> 
 | 
			
		||||
    <script src="./../../../dist/xrfragment.aframe.js"></script>
 | 
			
		||||
 | 
			
		||||
    <!-- important: allow touchevents in AR -->
 | 
			
		||||
    <style type="text/css">
 | 
			
		||||
      canvas.a-dom-overlay:not(.a-no-style) { padding: 0; pointer-events: auto; }
 | 
			
		||||
    </style>
 | 
			
		||||
 | 
			
		||||
  </head>
 | 
			
		||||
  <body>
 | 
			
		||||
    <a-scene xr-mode-ui="XRMode: xr"  
 | 
			
		||||
             renderer="colorManagement: false; stencil: true; antialias:true; highRefreshRate:true; foveationLevel: 0.5; toneMapping: ACESFilmic; exposure: 3.0" 
 | 
			
		||||
             device-orientation-permission-ui xrf-gaze-always joystick
 | 
			
		||||
             light="defaultLightsEnabled: false">
 | 
			
		||||
      <a-entity id="player" movement-controls touch-controls="axis:y" wasd-controls="fly:true" look-controls="magicWindowTrackingEnabled:true">
 | 
			
		||||
        <a-entity camera="fov:90" position="0 1.6 0" id="camera"></a-entity>
 | 
			
		||||
        <a-entity id="left-hand" hand-tracking-grab-controls="hand:left;modelColor:#cccccc" raycaster="objects:.ray" blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: .floor">
 | 
			
		||||
          <a-entity rotation="-35 0 0" position="0 0.1 0" id="navigator"> 
 | 
			
		||||
            <a-entity id="back" xrf-button="label: <; width:0.05; action: history.back()"    position="-0.025 0 0" class="ray"></a-entity>
 | 
			
		||||
            <a-entity id="next" xrf-button="label: >; width:0.05; action: history.forward()" position=" 0.025 0 0" class="ray"></a-entity>
 | 
			
		||||
          </a-entity>
 | 
			
		||||
        </a-entity>
 | 
			
		||||
        <a-entity id="right-hand" hand-tracking-grab-controls="hand:right;modelColor:#cccccc" laser-controls="hand: right" raycaster="objects:.ray" blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: .floor" xrf-pinchmove="rig: #player"></a-entity>
 | 
			
		||||
      </a-entity>
 | 
			
		||||
 | 
			
		||||
      <a-entity id="home" xrf="./../../assets/index.glb"></a-entity>
 | 
			
		||||
    </a-scene>
 | 
			
		||||
 | 
			
		||||
    <!-- OPTIONAL                                                                                            -->
 | 
			
		||||
    <!--                                                                                                     -->
 | 
			
		||||
    <!-- everything below is completely optional, but handy to add a quick menu / connectivity to your space -->
 | 
			
		||||
    <!--                                                                                                     -->
 | 
			
		||||
    <script>
 | 
			
		||||
 | 
			
		||||
      document.addEventListener('$menu:ready', (e) => {
 | 
			
		||||
        // add your menubuttons:
 | 
			
		||||
        let {$menu} = e.detail
 | 
			
		||||
        $menu.buttons = $menu.buttons.concat([
 | 
			
		||||
          `<a class="btn" aria-label="button" aria-title="menu button" onclick="$menu.showAbout()"><i class="gg-info"></i>   about</a><br>`
 | 
			
		||||
        ])
 | 
			
		||||
        $menu.collapsed = false
 | 
			
		||||
        $menu.showAbout = () => window.notify(`
 | 
			
		||||
            <h1>💁 Hi there!</h1>
 | 
			
		||||
 | 
			
		||||
            This XR fragments experience works almost anywhere.<br>
 | 
			
		||||
            Allowing rich audiovisual events with(out)<br>
 | 
			
		||||
            VR/AR headsets (it's awesome though ♥️)<br>
 | 
			
		||||
            <br>
 | 
			
		||||
            <b>This uses only open standards:</b><br>
 | 
			
		||||
            📦 surf 3D models using URLs<br>
 | 
			
		||||
            🎞 interactive <a href="https://www.w3.org/TR/media-frags/" target="_blank">W3C Media Fragments</a> and <a href="https://en.wikipedia.org/wiki/URI_Template" target="_blank">URI Templates</a><br>
 | 
			
		||||
            🧑🤝🧑 <b>instant</b> meetings inside hyperlinked 3D models<br>
 | 
			
		||||
            🚫 <b>zero proprietary</b> tech/game engines or platforms<br>
 | 
			
		||||
            🙈 unhosted, privacy-friendly, avatar-agnostic scenes<br> 
 | 
			
		||||
            🔗 <a href="https://xrfragment.org" target="_blank">XR Fragments</a> for 3D <b>hyper-linking</b> & navigation<br> 
 | 
			
		||||
            📷 Serverless & encrypted <a href="https://webrtc.org" target="_blank">P2P WebRTC</a> using <a href="https://github.com/dmotz/trystero" target="_blank">trystero</a><br> 
 | 
			
		||||
            🦍 <a href="https://immersiveweb.dev" target="_blank">WebXR</a> using <a href="https://aframe.io" target="_blank">AFRAME</a> + <a href="https://three.org" target="_blank">Three.js</a><br>
 | 
			
		||||
            🙉 go selfhost <a href="https://github.com/coderofsalvation/xrfragment-helloworld">worlds-in-a-webpage</a><br>
 | 
			
		||||
            ♥️  Be sustainable: go 100% <a href="https://www.forbes.com/sites/adrianbridgwater/2023/02/06/the-future-for-open-source/" target="_blank">opensource</a>
 | 
			
		||||
            <br><br>
 | 
			
		||||
            <a href="https://nlnet.nl" target="_blank">
 | 
			
		||||
              <img src="https://nlnet.nl/image/logo_nlnet.svg" width="100"/>
 | 
			
		||||
            </a>
 | 
			
		||||
            <br><br>
 | 
			
		||||
            `,{timeout:false})
 | 
			
		||||
 | 
			
		||||
        frontend.notify_links           = true  // shows href/src's as notifications when hovering buttons
 | 
			
		||||
        xrf.navigator.opts.openInNewTab = false // open webpages in new tabs
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
    </script>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <!-- everything below is completely optional and not part of the spec -->
 | 
			
		||||
 | 
			
		||||
    <script src="./../../../dist/aframe-blink-controls.min.js"></script>      <!-- teleporting using controllers -->
 | 
			
		||||
    <script src="./../../../dist/xrfragment.plugin.p2p.js"></script>          <!-- serverless p2p connectivity   -->
 | 
			
		||||
    <script src="./../../../dist/xrfragment.plugin.matrix.js"></script>       <!-- matrix connectivity           -->
 | 
			
		||||
    <script src="./../../../dist/xrfragment.plugin.network.js"></script>      <!-- matrix and webrtc chat/scene examples --> 
 | 
			
		||||
    <script src="./../../../dist/xrfragment.plugin.editor.js"></script>       <!-- basic editor example          --> 
 | 
			
		||||
    <script src="./../../../dist/xrfragment.plugin.remotestorage.js"></script><!-- basic remotestorage example   --> 
 | 
			
		||||
    <script src="./../../../dist/xrfragment.plugin.frontend.css.js"></script> <!-- basic menu interface css      -->
 | 
			
		||||
    <script src="./../../../dist/xrfragment.plugin.frontend.js"></script>     <!-- basic menu interface          -->
 | 
			
		||||
 | 
			
		||||
  </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										1
									
								
								example/aframe/sandbox/other.glb
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
../../assets/other.glb
 | 
			
		||||
							
								
								
									
										1
									
								
								example/aframe/xrsh/assets
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
../../assets
 | 
			
		||||
							
								
								
									
										1
									
								
								example/aframe/xrsh/dist
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
../../../dist
 | 
			
		||||
							
								
								
									
										1
									
								
								example/aframe/xrsh/index.glb
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
./../../assets/index.glb
 | 
			
		||||
							
								
								
									
										109
									
								
								example/aframe/xrsh/index.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,109 @@
 | 
			
		|||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
  <head>
 | 
			
		||||
    <title>XR Fragments aframe viewer</title>
 | 
			
		||||
    <meta charset="utf-8">
 | 
			
		||||
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
 | 
			
		||||
 | 
			
		||||
    <!-- AFRAME v1.5.0 + extra THREE.js extra loaders --> 
 | 
			
		||||
    <script src="./../../../dist/aframe.min.js"></script> 
 | 
			
		||||
    <script src="./../../../dist/xrfragment.aframe.js"></script>
 | 
			
		||||
    <script src="./../../../src/3rd/js/plugin/frontend/tab-to-href.js"></script>
 | 
			
		||||
    <script src="https://xrsh.isvery.ninja/xrsh.js"></script>
 | 
			
		||||
 | 
			
		||||
    <!-- important: allow touchevents in AR -->
 | 
			
		||||
    <style type="text/css">
 | 
			
		||||
      canvas.a-dom-overlay:not(.a-no-style) { padding: 0; pointer-events: auto; }
 | 
			
		||||
    </style>
 | 
			
		||||
 | 
			
		||||
  </head>
 | 
			
		||||
  <body>
 | 
			
		||||
    <a-scene xr-mode-ui="XRMode: xr"  
 | 
			
		||||
             renderer="colorManagement: false; stencil: true; antialias:true; highRefreshRate:true; foveationLevel: 0.5; toneMapping: ACESFilmic; exposure: 3.0" 
 | 
			
		||||
             device-orientation-permission-ui xrf-gaze-always joystick
 | 
			
		||||
             light="defaultLightsEnabled: false">
 | 
			
		||||
      <a-entity id="player" movement-controls touch-controls="axis:y" wasd-controls="fly:false" look-controls="magicWindowTrackingEnabled:true">
 | 
			
		||||
        <a-entity camera="fov:90" position="0 1.6 0" id="camera"></a-entity>
 | 
			
		||||
        <a-entity id="left-hand" hand-tracking-grab-controls="hand:left;modelColor:#cccccc" raycaster="objects:.ray" blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: .floor">
 | 
			
		||||
          <a-entity rotation="-35 0 0" position="0 0.1 0" id="navigator"> 
 | 
			
		||||
            <a-entity id="back" xrf-button="label: <; width:0.05; action: history.back()"    position="-0.025 0 0" class="ray"></a-entity>
 | 
			
		||||
            <a-entity id="next" xrf-button="label: >; width:0.05; action: history.forward()" position=" 0.025 0 0" class="ray"></a-entity>
 | 
			
		||||
          </a-entity>
 | 
			
		||||
        </a-entity>
 | 
			
		||||
        <a-entity id="right-hand" hand-tracking-grab-controls="hand:right;modelColor:#cccccc" laser-controls="hand: right" raycaster="objects:.ray" blink-controls="cameraRig:#player; teleportOrigin: #camera; collisionEntities: .floor" xrf-pinchmove="rig: #player"></a-entity>
 | 
			
		||||
 | 
			
		||||
        <a-entity isoterminal="width: 600; height:300" position="0 1.0 0.03"></a-entity>
 | 
			
		||||
 | 
			
		||||
      </a-entity>
 | 
			
		||||
 | 
			
		||||
      <a-entity id="home" xrf="./../../assets/elearning.glb"></a-entity>
 | 
			
		||||
    </a-scene>
 | 
			
		||||
 | 
			
		||||
    <!-- initialize XRSH -->
 | 
			
		||||
    <script>
 | 
			
		||||
      document.querySelector('a-scene').addEventListener('isoterminal_init', function(e){
 | 
			
		||||
 | 
			
		||||
        const isoterminal = document.querySelector('[isoterminal]').components.isoterminal
 | 
			
		||||
 | 
			
		||||
        const transcriptToText = (t) => t.map( (o) => `[36m${o.name}[0m ${o.description}`).join(" ")
 | 
			
		||||
 | 
			
		||||
        const describeScene = () => {
 | 
			
		||||
          let subscene = xrf.frag.pos.last || xrf.navigator.URI.XRF?.pos?.string
 | 
			
		||||
          subscene = subscene ? subscene = xrf.scene.getObjectByName( subscene ) : false
 | 
			
		||||
          let transcript = transcriptToText( xrf.sceneToTranscript(subscene) )
 | 
			
		||||
          term.send(`\r${transcript}\n\n\r`)
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // describe current scene
 | 
			
		||||
        xrf.addEventListener('navigateLoaded', () => setTimeout( () => describeScene(),100) )
 | 
			
		||||
 | 
			
		||||
        isoterminal.el.addEventListener('init', () => {
 | 
			
		||||
          // clear bootmenu-array 
 | 
			
		||||
          // see com/isoterminal/feat/boot.REPL.*.js for REPL examples
 | 
			
		||||
          ISOTerminal.prototype.boot.menu = [] 
 | 
			
		||||
 | 
			
		||||
          // we've received our terminal \o/
 | 
			
		||||
          term = window.term = isoterminal.term
 | 
			
		||||
 | 
			
		||||
          // describe mouseover button (and scene to be teleported to, if any)
 | 
			
		||||
          xrf.addEventListener('href', (e) => {
 | 
			
		||||
            if( !e.selected || !e.mesh ) return; // only process mouse-overs
 | 
			
		||||
            let name     = "object"
 | 
			
		||||
            let info     = ""
 | 
			
		||||
            let subscene = false
 | 
			
		||||
            if( e.click ){
 | 
			
		||||
              return setTimeout( () => {
 | 
			
		||||
                if( lastPos != xrf.frag.pos.last ) return 
 | 
			
		||||
                describeScene()
 | 
			
		||||
              }, 100 )
 | 
			
		||||
              lastPos = xrf.frag.pos.last
 | 
			
		||||
            }
 | 
			
		||||
            if( e.mesh.userData ){
 | 
			
		||||
              if( e.mesh.userData.href && e.mesh.userData.href.match("pos=")  ){
 | 
			
		||||
                name = "action: "
 | 
			
		||||
                subscene = xrfragment.URI.parse( e.mesh.userData.href ).XRF.pos.string 
 | 
			
		||||
              }
 | 
			
		||||
              if( e.mesh.userData['aria-label'] ){
 | 
			
		||||
                info = e.mesh.userData['aria-label']
 | 
			
		||||
              }else if( e.mesh.userData['aria-description'] ){
 | 
			
		||||
                info = e.mesh.userData['aria-description']
 | 
			
		||||
              }else if( subscene ){
 | 
			
		||||
                info = `${transcriptToText( xrf.sceneToTranscript(subscene,false,true) )}`
 | 
			
		||||
              }
 | 
			
		||||
              if( !info && e.mesh.name ) name = e.mesh.name
 | 
			
		||||
            }
 | 
			
		||||
            term.send(`${name} ${info}\n\r`)
 | 
			
		||||
          })
 | 
			
		||||
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
      })
 | 
			
		||||
    </script>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <!-- everything below is completely optional and not part of the spec -->
 | 
			
		||||
 | 
			
		||||
    <script src="./../../../dist/aframe-blink-controls.min.js"></script>      <!-- teleporting using controllers -->
 | 
			
		||||
 | 
			
		||||
  </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										1
									
								
								example/aframe/xrsh/other.glb
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
../../assets/other.glb
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								example/assets/ARwindow.glb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								example/assets/audio/bgloop.wav
									
										
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								example/assets/audio/nobodyhere.wav
									
										
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								example/assets/audio/podcast.mp3
									
										
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								example/assets/elearning.glb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								example/assets/escaperoom.glb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								example/assets/example.blend
									
										
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								example/assets/example.glb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								example/assets/index.fbx
									
										
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								example/assets/index.glb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										164
									
								
								example/assets/index.mtl
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,164 @@
 | 
			
		|||
# Blender MTL File: 'None'
 | 
			
		||||
# Material Count: 16
 | 
			
		||||
 | 
			
		||||
newmtl None
 | 
			
		||||
Ns 500
 | 
			
		||||
Ka 0.8 0.8 0.8
 | 
			
		||||
Kd 0.8 0.8 0.8
 | 
			
		||||
Ks 0.8 0.8 0.8
 | 
			
		||||
d 1
 | 
			
		||||
illum 2
 | 
			
		||||
 | 
			
		||||
newmtl environmentMap.002
 | 
			
		||||
Ns 359.999993
 | 
			
		||||
Ka 1.000000 1.000000 1.000000
 | 
			
		||||
Kd 0.800000 0.800000 0.800000
 | 
			
		||||
Ks 0.500000 0.500000 0.500000
 | 
			
		||||
Ke 0.000000 0.000000 0.000000
 | 
			
		||||
Ni 1.000000
 | 
			
		||||
d 1.000000
 | 
			
		||||
illum 2
 | 
			
		||||
 | 
			
		||||
newmtl environmentMap.004
 | 
			
		||||
Ns 359.999993
 | 
			
		||||
Ka 1.000000 1.000000 1.000000
 | 
			
		||||
Kd 0.800000 0.800000 0.800000
 | 
			
		||||
Ks 0.500000 0.500000 0.500000
 | 
			
		||||
Ke 0.000000 0.000000 0.000000
 | 
			
		||||
Ni 1.000000
 | 
			
		||||
d 1.000000
 | 
			
		||||
illum 2
 | 
			
		||||
 | 
			
		||||
newmtl floorstone.003
 | 
			
		||||
Ns 349.173522
 | 
			
		||||
Ka 1.000000 1.000000 1.000000
 | 
			
		||||
Kd 0.370787 0.337474 0.425554
 | 
			
		||||
Ks 0.500000 0.500000 0.500000
 | 
			
		||||
Ke 0.000000 0.000000 0.000000
 | 
			
		||||
Ni 1.500000
 | 
			
		||||
d 1.000000
 | 
			
		||||
illum 3
 | 
			
		||||
map_Ke .
 | 
			
		||||
 | 
			
		||||
newmtl floorstone.004
 | 
			
		||||
Ns 349.173522
 | 
			
		||||
Ka 1.000000 1.000000 1.000000
 | 
			
		||||
Kd 0.370787 0.337474 0.425554
 | 
			
		||||
Ks 0.500000 0.500000 0.500000
 | 
			
		||||
Ke 0.000000 0.000000 0.000000
 | 
			
		||||
Ni 1.500000
 | 
			
		||||
d 1.000000
 | 
			
		||||
illum 3
 | 
			
		||||
map_Ke .
 | 
			
		||||
 | 
			
		||||
newmtl glass.002
 | 
			
		||||
Ns 1000.000000
 | 
			
		||||
Ka 0.963543 0.963543 0.963543
 | 
			
		||||
Kd 1.000000 1.000000 1.000000
 | 
			
		||||
Ks 0.234677 0.234677 0.234677
 | 
			
		||||
Ke 0.000000 0.000000 0.000000
 | 
			
		||||
Ni 1.450000
 | 
			
		||||
d 0.143627
 | 
			
		||||
illum 6
 | 
			
		||||
 | 
			
		||||
newmtl hotspot
 | 
			
		||||
Ns 359.999993
 | 
			
		||||
Ka 1.000000 1.000000 1.000000
 | 
			
		||||
Kd 0.800000 0.800000 0.800000
 | 
			
		||||
Ks 0.500000 0.500000 0.500000
 | 
			
		||||
Ke 0.000000 0.000000 0.000000
 | 
			
		||||
Ni 1.000000
 | 
			
		||||
d 1.000000
 | 
			
		||||
illum 2
 | 
			
		||||
 | 
			
		||||
newmtl placeholder.003
 | 
			
		||||
Ns 854.195174
 | 
			
		||||
Ka 0.886364 0.886364 0.886364
 | 
			
		||||
Kd 1.000000 1.000000 1.000000
 | 
			
		||||
Ks 0.327273 0.327273 0.327273
 | 
			
		||||
Ke 0.113646 0.000000 35.199997
 | 
			
		||||
Ni 1.450000
 | 
			
		||||
d 0.159091
 | 
			
		||||
illum 6
 | 
			
		||||
 | 
			
		||||
newmtl placeholder.004
 | 
			
		||||
Ns 854.195174
 | 
			
		||||
Ka 0.886364 0.886364 0.886364
 | 
			
		||||
Kd 1.000000 1.000000 1.000000
 | 
			
		||||
Ks 0.327273 0.327273 0.327273
 | 
			
		||||
Ke 0.000000 0.330810 35.199997
 | 
			
		||||
Ni 1.450000
 | 
			
		||||
d 0.159091
 | 
			
		||||
illum 6
 | 
			
		||||
 | 
			
		||||
newmtl portal_bg.004
 | 
			
		||||
Ns 0.000000
 | 
			
		||||
Ka 1.000000 1.000000 1.000000
 | 
			
		||||
Kd 0.000000 0.000000 0.000000
 | 
			
		||||
Ks 0.068182 0.068182 0.068182
 | 
			
		||||
Ke 0.000000 0.000000 0.000000
 | 
			
		||||
Ni 1.500000
 | 
			
		||||
d 0.222727
 | 
			
		||||
illum 6
 | 
			
		||||
 | 
			
		||||
newmtl portal_bg.005
 | 
			
		||||
Ns 0.000000
 | 
			
		||||
Ka 1.000000 1.000000 1.000000
 | 
			
		||||
Kd 0.000000 0.000000 0.000000
 | 
			
		||||
Ks 0.068182 0.068182 0.068182
 | 
			
		||||
Ke 0.000000 0.000000 0.000000
 | 
			
		||||
Ni 1.500000
 | 
			
		||||
d 0.222727
 | 
			
		||||
illum 6
 | 
			
		||||
 | 
			
		||||
newmtl portal_bg.006
 | 
			
		||||
Ns 0.000000
 | 
			
		||||
Ka 1.000000 1.000000 1.000000
 | 
			
		||||
Kd 0.000000 0.000000 0.000000
 | 
			
		||||
Ks 0.068182 0.068182 0.068182
 | 
			
		||||
Ke 0.000000 0.000000 0.000000
 | 
			
		||||
Ni 1.500000
 | 
			
		||||
d 0.222727
 | 
			
		||||
illum 6
 | 
			
		||||
 | 
			
		||||
newmtl text.004
 | 
			
		||||
Ns 854.195174
 | 
			
		||||
Ka 0.886364 0.886364 0.886364
 | 
			
		||||
Kd 1.000000 1.000000 1.000000
 | 
			
		||||
Ks 0.327273 0.327273 0.327273
 | 
			
		||||
Ke 1.000000 1.000000 1.000000
 | 
			
		||||
Ni 1.450000
 | 
			
		||||
d 1.000000
 | 
			
		||||
illum 3
 | 
			
		||||
 | 
			
		||||
newmtl text.005
 | 
			
		||||
Ns 0.000000
 | 
			
		||||
Ka 1.000000 1.000000 1.000000
 | 
			
		||||
Kd 0.080782 0.080782 0.080782
 | 
			
		||||
Ks 0.068182 0.068182 0.068182
 | 
			
		||||
Ke 0.000000 0.000000 0.000000
 | 
			
		||||
Ni 1.500000
 | 
			
		||||
d 1.000000
 | 
			
		||||
illum 3
 | 
			
		||||
 | 
			
		||||
newmtl text.006
 | 
			
		||||
Ns 854.195174
 | 
			
		||||
Ka 0.886364 0.886364 0.886364
 | 
			
		||||
Kd 0.518619 0.518619 0.518619
 | 
			
		||||
Ks 0.327273 0.327273 0.327273
 | 
			
		||||
Ke 1.000000 1.000000 1.000000
 | 
			
		||||
Ni 1.450000
 | 
			
		||||
d 1.000000
 | 
			
		||||
illum 3
 | 
			
		||||
 | 
			
		||||
newmtl vaporgradient.002
 | 
			
		||||
Ns 951.107117
 | 
			
		||||
Ka 0.827273 0.827273 0.827273
 | 
			
		||||
Kd 0.800000 0.800000 0.800000
 | 
			
		||||
Ks 0.327273 0.327273 0.327273
 | 
			
		||||
Ke 0.000000 0.000000 0.000000
 | 
			
		||||
Ni 1.450000
 | 
			
		||||
d 1.000000
 | 
			
		||||
illum 3
 | 
			
		||||
map_Kd .
 | 
			
		||||
map_Ke .
 | 
			
		||||
							
								
								
									
										194201
									
								
								example/assets/index.obj
									
										
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										70
									
								
								example/assets/index.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,70 @@
 | 
			
		|||
#
 | 
			
		||||
# This is a convenient way to convert the scene to lowpoly
 | 
			
		||||
# (by adding decimate-modifiers)
 | 
			
		||||
# and then exporting a gltf to to <blenderdocument>.glb
 | 
			
		||||
# 
 | 
			
		||||
# All this is done automatically when saving the blender file
 | 
			
		||||
#
 | 
			
		||||
import bpy
 | 
			
		||||
import os
 | 
			
		||||
from bpy_extras.io_utils import ImportHelper
 | 
			
		||||
 | 
			
		||||
# uncomment below in case you want to hardcode the exported filename
 | 
			
		||||
data = {
 | 
			
		||||
 #gltf_file="/some/path/foo.index.glb"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
def notify(message = "", title = "Message Box", icon = 'INFO'):
 | 
			
		||||
    def draw(self, context):
 | 
			
		||||
        self.layout.label(text=message)
 | 
			
		||||
    bpy.context.window_manager.popup_menu(draw, title = title, icon = icon)
 | 
			
		||||
 | 
			
		||||
# redirect print to all consoles
 | 
			
		||||
def print(data):
 | 
			
		||||
    for window in bpy.context.window_manager.windows:
 | 
			
		||||
        screen = window.screen
 | 
			
		||||
        for area in screen.areas:
 | 
			
		||||
            if area.type == 'CONSOLE':
 | 
			
		||||
                override = {'window': window, 'screen': screen, 'area': area}
 | 
			
		||||
                bpy.ops.console.scrollback_append(override, text=str(data), type="OUTPUT")
 | 
			
		||||
                
 | 
			
		||||
 | 
			
		||||
# Function to add Decimate Modifier to objects without one (except those in the exclusion list)
 | 
			
		||||
def add_decimate_modifier_to_objects():
 | 
			
		||||
    for obj in bpy.data.objects:
 | 
			
		||||
        print(obj.type)
 | 
			
		||||
        if obj is not None and (obj.type == 'FONT' or (obj.type == 'MESH' and len(obj.data.polygons) > 8)):
 | 
			
		||||
            if not obj.modifiers.get("Decimate"):
 | 
			
		||||
                #if obj.name not in exclusion_list and "Decimate" not in obj.modifiers:
 | 
			
		||||
                print("adding decimate-modifier to:"+obj.name)
 | 
			
		||||
                bpy.context.view_layer.objects.active = obj
 | 
			
		||||
                bpy.data.objects[obj.name].select_set(True)
 | 
			
		||||
 | 
			
		||||
                # Add Decimate Modifier with ratio 0.5
 | 
			
		||||
                bpy.ops.object.modifier_add(type='DECIMATE')
 | 
			
		||||
                bpy.context.object.modifiers["Decimate"].ratio = 0.5
 | 
			
		||||
 | 
			
		||||
# Function to be called on file save
 | 
			
		||||
def on_save_handler(blenderdoc):
 | 
			
		||||
    if 'gltf_file' not in data:
 | 
			
		||||
        gltf_file = bpy.data.filepath.replace('.blend','.glb')
 | 
			
		||||
    else:
 | 
			
		||||
        gltf_file = data['gltf_file']
 | 
			
		||||
    
 | 
			
		||||
    add_decimate_modifier_to_objects()
 | 
			
		||||
    
 | 
			
		||||
    # Export to glTF with specified settings and apply modifiers
 | 
			
		||||
    bpy.ops.export_scene.gltf(
 | 
			
		||||
        filepath=gltf_file,
 | 
			
		||||
        export_format='GLB',
 | 
			
		||||
        export_extras=True,
 | 
			
		||||
        export_lights=True,
 | 
			
		||||
        export_apply=True,
 | 
			
		||||
        export_force_sampling=False,
 | 
			
		||||
    )
 | 
			
		||||
    notify(os.path.basename(gltf_file),"OK export")
 | 
			
		||||
 | 
			
		||||
# Register the handler
 | 
			
		||||
bpy.app.handlers.save_post.clear()
 | 
			
		||||
bpy.app.handlers.save_post.append(on_save_handler)
 | 
			
		||||
print("sourced gltf_export_on_save")
 | 
			
		||||
							
								
								
									
										796
									
								
								example/assets/js/qr.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,796 @@
 | 
			
		|||
// https://github.com/yyx990803/QR.js
 | 
			
		||||
//
 | 
			
		||||
window.QR = (function () {
 | 
			
		||||
 | 
			
		||||
    // alignment pattern
 | 
			
		||||
    adelta = [
 | 
			
		||||
      0, 11, 15, 19, 23, 27, 31, // force 1 pat
 | 
			
		||||
      16, 18, 20, 22, 24, 26, 28, 20, 22, 24, 24, 26, 28, 28, 22, 24, 24,
 | 
			
		||||
      26, 26, 28, 28, 24, 24, 26, 26, 26, 28, 28, 24, 26, 26, 26, 28, 28
 | 
			
		||||
      ];
 | 
			
		||||
 | 
			
		||||
    // version block
 | 
			
		||||
    vpat = [
 | 
			
		||||
        0xc94, 0x5bc, 0xa99, 0x4d3, 0xbf6, 0x762, 0x847, 0x60d,
 | 
			
		||||
        0x928, 0xb78, 0x45d, 0xa17, 0x532, 0x9a6, 0x683, 0x8c9,
 | 
			
		||||
        0x7ec, 0xec4, 0x1e1, 0xfab, 0x08e, 0xc1a, 0x33f, 0xd75,
 | 
			
		||||
        0x250, 0x9d5, 0x6f0, 0x8ba, 0x79f, 0xb0b, 0x42e, 0xa64,
 | 
			
		||||
        0x541, 0xc69
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    // final format bits with mask: level << 3 | mask
 | 
			
		||||
    fmtword = [
 | 
			
		||||
        0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976,    //L
 | 
			
		||||
        0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0,    //M
 | 
			
		||||
        0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed,    //Q
 | 
			
		||||
        0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b    //H
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    // 4 per version: number of blocks 1,2; data width; ecc width
 | 
			
		||||
    eccblocks = [
 | 
			
		||||
        1, 0, 19, 7, 1, 0, 16, 10, 1, 0, 13, 13, 1, 0, 9, 17,
 | 
			
		||||
        1, 0, 34, 10, 1, 0, 28, 16, 1, 0, 22, 22, 1, 0, 16, 28,
 | 
			
		||||
        1, 0, 55, 15, 1, 0, 44, 26, 2, 0, 17, 18, 2, 0, 13, 22,
 | 
			
		||||
        1, 0, 80, 20, 2, 0, 32, 18, 2, 0, 24, 26, 4, 0, 9, 16,
 | 
			
		||||
        1, 0, 108, 26, 2, 0, 43, 24, 2, 2, 15, 18, 2, 2, 11, 22,
 | 
			
		||||
        2, 0, 68, 18, 4, 0, 27, 16, 4, 0, 19, 24, 4, 0, 15, 28,
 | 
			
		||||
        2, 0, 78, 20, 4, 0, 31, 18, 2, 4, 14, 18, 4, 1, 13, 26,
 | 
			
		||||
        2, 0, 97, 24, 2, 2, 38, 22, 4, 2, 18, 22, 4, 2, 14, 26,
 | 
			
		||||
        2, 0, 116, 30, 3, 2, 36, 22, 4, 4, 16, 20, 4, 4, 12, 24,
 | 
			
		||||
        2, 2, 68, 18, 4, 1, 43, 26, 6, 2, 19, 24, 6, 2, 15, 28,
 | 
			
		||||
        4, 0, 81, 20, 1, 4, 50, 30, 4, 4, 22, 28, 3, 8, 12, 24,
 | 
			
		||||
        2, 2, 92, 24, 6, 2, 36, 22, 4, 6, 20, 26, 7, 4, 14, 28,
 | 
			
		||||
        4, 0, 107, 26, 8, 1, 37, 22, 8, 4, 20, 24, 12, 4, 11, 22,
 | 
			
		||||
        3, 1, 115, 30, 4, 5, 40, 24, 11, 5, 16, 20, 11, 5, 12, 24,
 | 
			
		||||
        5, 1, 87, 22, 5, 5, 41, 24, 5, 7, 24, 30, 11, 7, 12, 24,
 | 
			
		||||
        5, 1, 98, 24, 7, 3, 45, 28, 15, 2, 19, 24, 3, 13, 15, 30,
 | 
			
		||||
        1, 5, 107, 28, 10, 1, 46, 28, 1, 15, 22, 28, 2, 17, 14, 28,
 | 
			
		||||
        5, 1, 120, 30, 9, 4, 43, 26, 17, 1, 22, 28, 2, 19, 14, 28,
 | 
			
		||||
        3, 4, 113, 28, 3, 11, 44, 26, 17, 4, 21, 26, 9, 16, 13, 26,
 | 
			
		||||
        3, 5, 107, 28, 3, 13, 41, 26, 15, 5, 24, 30, 15, 10, 15, 28,
 | 
			
		||||
        4, 4, 116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19, 6, 16, 30,
 | 
			
		||||
        2, 7, 111, 28, 17, 0, 46, 28, 7, 16, 24, 30, 34, 0, 13, 24,
 | 
			
		||||
        4, 5, 121, 30, 4, 14, 47, 28, 11, 14, 24, 30, 16, 14, 15, 30,
 | 
			
		||||
        6, 4, 117, 30, 6, 14, 45, 28, 11, 16, 24, 30, 30, 2, 16, 30,
 | 
			
		||||
        8, 4, 106, 26, 8, 13, 47, 28, 7, 22, 24, 30, 22, 13, 15, 30,
 | 
			
		||||
        10, 2, 114, 28, 19, 4, 46, 28, 28, 6, 22, 28, 33, 4, 16, 30,
 | 
			
		||||
        8, 4, 122, 30, 22, 3, 45, 28, 8, 26, 23, 30, 12, 28, 15, 30,
 | 
			
		||||
        3, 10, 117, 30, 3, 23, 45, 28, 4, 31, 24, 30, 11, 31, 15, 30,
 | 
			
		||||
        7, 7, 116, 30, 21, 7, 45, 28, 1, 37, 23, 30, 19, 26, 15, 30,
 | 
			
		||||
        5, 10, 115, 30, 19, 10, 47, 28, 15, 25, 24, 30, 23, 25, 15, 30,
 | 
			
		||||
        13, 3, 115, 30, 2, 29, 46, 28, 42, 1, 24, 30, 23, 28, 15, 30,
 | 
			
		||||
        17, 0, 115, 30, 10, 23, 46, 28, 10, 35, 24, 30, 19, 35, 15, 30,
 | 
			
		||||
        17, 1, 115, 30, 14, 21, 46, 28, 29, 19, 24, 30, 11, 46, 15, 30,
 | 
			
		||||
        13, 6, 115, 30, 14, 23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30,
 | 
			
		||||
        12, 7, 121, 30, 12, 26, 47, 28, 39, 14, 24, 30, 22, 41, 15, 30,
 | 
			
		||||
        6, 14, 121, 30, 6, 34, 47, 28, 46, 10, 24, 30, 2, 64, 15, 30,
 | 
			
		||||
        17, 4, 122, 30, 29, 14, 46, 28, 49, 10, 24, 30, 24, 46, 15, 30,
 | 
			
		||||
        4, 18, 122, 30, 13, 32, 46, 28, 48, 14, 24, 30, 42, 32, 15, 30,
 | 
			
		||||
        20, 4, 117, 30, 40, 7, 47, 28, 43, 22, 24, 30, 10, 67, 15, 30,
 | 
			
		||||
        19, 6, 118, 30, 18, 31, 47, 28, 34, 34, 24, 30, 20, 61, 15, 30
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    // Galois field log table
 | 
			
		||||
    glog = [
 | 
			
		||||
        0xff, 0x00, 0x01, 0x19, 0x02, 0x32, 0x1a, 0xc6, 0x03, 0xdf, 0x33, 0xee, 0x1b, 0x68, 0xc7, 0x4b,
 | 
			
		||||
        0x04, 0x64, 0xe0, 0x0e, 0x34, 0x8d, 0xef, 0x81, 0x1c, 0xc1, 0x69, 0xf8, 0xc8, 0x08, 0x4c, 0x71,
 | 
			
		||||
        0x05, 0x8a, 0x65, 0x2f, 0xe1, 0x24, 0x0f, 0x21, 0x35, 0x93, 0x8e, 0xda, 0xf0, 0x12, 0x82, 0x45,
 | 
			
		||||
        0x1d, 0xb5, 0xc2, 0x7d, 0x6a, 0x27, 0xf9, 0xb9, 0xc9, 0x9a, 0x09, 0x78, 0x4d, 0xe4, 0x72, 0xa6,
 | 
			
		||||
        0x06, 0xbf, 0x8b, 0x62, 0x66, 0xdd, 0x30, 0xfd, 0xe2, 0x98, 0x25, 0xb3, 0x10, 0x91, 0x22, 0x88,
 | 
			
		||||
        0x36, 0xd0, 0x94, 0xce, 0x8f, 0x96, 0xdb, 0xbd, 0xf1, 0xd2, 0x13, 0x5c, 0x83, 0x38, 0x46, 0x40,
 | 
			
		||||
        0x1e, 0x42, 0xb6, 0xa3, 0xc3, 0x48, 0x7e, 0x6e, 0x6b, 0x3a, 0x28, 0x54, 0xfa, 0x85, 0xba, 0x3d,
 | 
			
		||||
        0xca, 0x5e, 0x9b, 0x9f, 0x0a, 0x15, 0x79, 0x2b, 0x4e, 0xd4, 0xe5, 0xac, 0x73, 0xf3, 0xa7, 0x57,
 | 
			
		||||
        0x07, 0x70, 0xc0, 0xf7, 0x8c, 0x80, 0x63, 0x0d, 0x67, 0x4a, 0xde, 0xed, 0x31, 0xc5, 0xfe, 0x18,
 | 
			
		||||
        0xe3, 0xa5, 0x99, 0x77, 0x26, 0xb8, 0xb4, 0x7c, 0x11, 0x44, 0x92, 0xd9, 0x23, 0x20, 0x89, 0x2e,
 | 
			
		||||
        0x37, 0x3f, 0xd1, 0x5b, 0x95, 0xbc, 0xcf, 0xcd, 0x90, 0x87, 0x97, 0xb2, 0xdc, 0xfc, 0xbe, 0x61,
 | 
			
		||||
        0xf2, 0x56, 0xd3, 0xab, 0x14, 0x2a, 0x5d, 0x9e, 0x84, 0x3c, 0x39, 0x53, 0x47, 0x6d, 0x41, 0xa2,
 | 
			
		||||
        0x1f, 0x2d, 0x43, 0xd8, 0xb7, 0x7b, 0xa4, 0x76, 0xc4, 0x17, 0x49, 0xec, 0x7f, 0x0c, 0x6f, 0xf6,
 | 
			
		||||
        0x6c, 0xa1, 0x3b, 0x52, 0x29, 0x9d, 0x55, 0xaa, 0xfb, 0x60, 0x86, 0xb1, 0xbb, 0xcc, 0x3e, 0x5a,
 | 
			
		||||
        0xcb, 0x59, 0x5f, 0xb0, 0x9c, 0xa9, 0xa0, 0x51, 0x0b, 0xf5, 0x16, 0xeb, 0x7a, 0x75, 0x2c, 0xd7,
 | 
			
		||||
        0x4f, 0xae, 0xd5, 0xe9, 0xe6, 0xe7, 0xad, 0xe8, 0x74, 0xd6, 0xf4, 0xea, 0xa8, 0x50, 0x58, 0xaf
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    // Galios field exponent table
 | 
			
		||||
    gexp = [
 | 
			
		||||
        0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26,
 | 
			
		||||
        0x4c, 0x98, 0x2d, 0x5a, 0xb4, 0x75, 0xea, 0xc9, 0x8f, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0,
 | 
			
		||||
        0x9d, 0x27, 0x4e, 0x9c, 0x25, 0x4a, 0x94, 0x35, 0x6a, 0xd4, 0xb5, 0x77, 0xee, 0xc1, 0x9f, 0x23,
 | 
			
		||||
        0x46, 0x8c, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, 0x5d, 0xba, 0x69, 0xd2, 0xb9, 0x6f, 0xde, 0xa1,
 | 
			
		||||
        0x5f, 0xbe, 0x61, 0xc2, 0x99, 0x2f, 0x5e, 0xbc, 0x65, 0xca, 0x89, 0x0f, 0x1e, 0x3c, 0x78, 0xf0,
 | 
			
		||||
        0xfd, 0xe7, 0xd3, 0xbb, 0x6b, 0xd6, 0xb1, 0x7f, 0xfe, 0xe1, 0xdf, 0xa3, 0x5b, 0xb6, 0x71, 0xe2,
 | 
			
		||||
        0xd9, 0xaf, 0x43, 0x86, 0x11, 0x22, 0x44, 0x88, 0x0d, 0x1a, 0x34, 0x68, 0xd0, 0xbd, 0x67, 0xce,
 | 
			
		||||
        0x81, 0x1f, 0x3e, 0x7c, 0xf8, 0xed, 0xc7, 0x93, 0x3b, 0x76, 0xec, 0xc5, 0x97, 0x33, 0x66, 0xcc,
 | 
			
		||||
        0x85, 0x17, 0x2e, 0x5c, 0xb8, 0x6d, 0xda, 0xa9, 0x4f, 0x9e, 0x21, 0x42, 0x84, 0x15, 0x2a, 0x54,
 | 
			
		||||
        0xa8, 0x4d, 0x9a, 0x29, 0x52, 0xa4, 0x55, 0xaa, 0x49, 0x92, 0x39, 0x72, 0xe4, 0xd5, 0xb7, 0x73,
 | 
			
		||||
        0xe6, 0xd1, 0xbf, 0x63, 0xc6, 0x91, 0x3f, 0x7e, 0xfc, 0xe5, 0xd7, 0xb3, 0x7b, 0xf6, 0xf1, 0xff,
 | 
			
		||||
        0xe3, 0xdb, 0xab, 0x4b, 0x96, 0x31, 0x62, 0xc4, 0x95, 0x37, 0x6e, 0xdc, 0xa5, 0x57, 0xae, 0x41,
 | 
			
		||||
        0x82, 0x19, 0x32, 0x64, 0xc8, 0x8d, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xdd, 0xa7, 0x53, 0xa6,
 | 
			
		||||
        0x51, 0xa2, 0x59, 0xb2, 0x79, 0xf2, 0xf9, 0xef, 0xc3, 0x9b, 0x2b, 0x56, 0xac, 0x45, 0x8a, 0x09,
 | 
			
		||||
        0x12, 0x24, 0x48, 0x90, 0x3d, 0x7a, 0xf4, 0xf5, 0xf7, 0xf3, 0xfb, 0xeb, 0xcb, 0x8b, 0x0b, 0x16,
 | 
			
		||||
        0x2c, 0x58, 0xb0, 0x7d, 0xfa, 0xe9, 0xcf, 0x83, 0x1b, 0x36, 0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x00
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    // Working buffers:
 | 
			
		||||
    // data input and ecc append, image working buffer, fixed part of image, run lengths for badness
 | 
			
		||||
    var strinbuf=[], eccbuf=[], qrframe=[], framask=[], rlens=[]; 
 | 
			
		||||
    // Control values - width is based on version, last 4 are from table.
 | 
			
		||||
    var version, width, neccblk1, neccblk2, datablkw, eccblkwid;
 | 
			
		||||
    var ecclevel = 2;
 | 
			
		||||
    // set bit to indicate cell in qrframe is immutable.  symmetric around diagonal
 | 
			
		||||
    function setmask(x, y)
 | 
			
		||||
    {
 | 
			
		||||
        var bt;
 | 
			
		||||
        if (x > y) {
 | 
			
		||||
            bt = x;
 | 
			
		||||
            x = y;
 | 
			
		||||
            y = bt;
 | 
			
		||||
        }
 | 
			
		||||
        // y*y = 1+3+5...
 | 
			
		||||
        bt = y;
 | 
			
		||||
        bt *= y;
 | 
			
		||||
        bt += y;
 | 
			
		||||
        bt >>= 1;
 | 
			
		||||
        bt += x;
 | 
			
		||||
        framask[bt] = 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // enter alignment pattern - black to qrframe, white to mask (later black frame merged to mask)
 | 
			
		||||
    function putalign(x, y)
 | 
			
		||||
    {
 | 
			
		||||
        var j;
 | 
			
		||||
 | 
			
		||||
        qrframe[x + width * y] = 1;
 | 
			
		||||
        for (j = -2; j < 2; j++) {
 | 
			
		||||
            qrframe[(x + j) + width * (y - 2)] = 1;
 | 
			
		||||
            qrframe[(x - 2) + width * (y + j + 1)] = 1;
 | 
			
		||||
            qrframe[(x + 2) + width * (y + j)] = 1;
 | 
			
		||||
            qrframe[(x + j + 1) + width * (y + 2)] = 1;
 | 
			
		||||
        }
 | 
			
		||||
        for (j = 0; j < 2; j++) {
 | 
			
		||||
            setmask(x - 1, y + j);
 | 
			
		||||
            setmask(x + 1, y - j);
 | 
			
		||||
            setmask(x - j, y - 1);
 | 
			
		||||
            setmask(x + j, y + 1);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //========================================================================
 | 
			
		||||
    // Reed Solomon error correction
 | 
			
		||||
    // exponentiation mod N
 | 
			
		||||
    function modnn(x)
 | 
			
		||||
    {
 | 
			
		||||
        while (x >= 255) {
 | 
			
		||||
            x -= 255;
 | 
			
		||||
            x = (x >> 8) + (x & 255);
 | 
			
		||||
        }
 | 
			
		||||
        return x;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var genpoly = [];
 | 
			
		||||
 | 
			
		||||
    // Calculate and append ECC data to data block.  Block is in strinbuf, indexes to buffers given.
 | 
			
		||||
    function appendrs(data, dlen, ecbuf, eclen)
 | 
			
		||||
    {
 | 
			
		||||
        var i, j, fb;
 | 
			
		||||
 | 
			
		||||
        for (i = 0; i < eclen; i++)
 | 
			
		||||
            strinbuf[ecbuf + i] = 0;
 | 
			
		||||
        for (i = 0; i < dlen; i++) {
 | 
			
		||||
            fb = glog[strinbuf[data + i] ^ strinbuf[ecbuf]];
 | 
			
		||||
            if (fb != 255)     /* fb term is non-zero */
 | 
			
		||||
                for (j = 1; j < eclen; j++)
 | 
			
		||||
                    strinbuf[ecbuf + j - 1] = strinbuf[ecbuf + j] ^ gexp[modnn(fb + genpoly[eclen - j])];
 | 
			
		||||
            else
 | 
			
		||||
                for( j = ecbuf ; j < ecbuf + eclen; j++ )
 | 
			
		||||
                    strinbuf[j] = strinbuf[j + 1];
 | 
			
		||||
            strinbuf[ ecbuf + eclen - 1] = fb == 255 ? 0 : gexp[modnn(fb + genpoly[0])];
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //========================================================================
 | 
			
		||||
    // Frame data insert following the path rules
 | 
			
		||||
 | 
			
		||||
    // check mask - since symmetrical use half.
 | 
			
		||||
    function ismasked(x, y)
 | 
			
		||||
    {
 | 
			
		||||
        var bt;
 | 
			
		||||
        if (x > y) {
 | 
			
		||||
            bt = x;
 | 
			
		||||
            x = y;
 | 
			
		||||
            y = bt;
 | 
			
		||||
        }
 | 
			
		||||
        bt = y;
 | 
			
		||||
        bt += y * y;
 | 
			
		||||
        bt >>= 1;
 | 
			
		||||
        bt += x;
 | 
			
		||||
        return framask[bt];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //========================================================================
 | 
			
		||||
    //  Apply the selected mask out of the 8.
 | 
			
		||||
    function  applymask(m)
 | 
			
		||||
    {
 | 
			
		||||
        var x, y, r3x, r3y;
 | 
			
		||||
 | 
			
		||||
        switch (m) {
 | 
			
		||||
        case 0:
 | 
			
		||||
            for (y = 0; y < width; y++)
 | 
			
		||||
                for (x = 0; x < width; x++)
 | 
			
		||||
                    if (!((x + y) & 1) && !ismasked(x, y))
 | 
			
		||||
                        qrframe[x + y * width] ^= 1;
 | 
			
		||||
            break;
 | 
			
		||||
        case 1:
 | 
			
		||||
            for (y = 0; y < width; y++)
 | 
			
		||||
                for (x = 0; x < width; x++)
 | 
			
		||||
                    if (!(y & 1) && !ismasked(x, y))
 | 
			
		||||
                        qrframe[x + y * width] ^= 1;
 | 
			
		||||
            break;
 | 
			
		||||
        case 2:
 | 
			
		||||
            for (y = 0; y < width; y++)
 | 
			
		||||
                for (r3x = 0, x = 0; x < width; x++, r3x++) {
 | 
			
		||||
                    if (r3x == 3)
 | 
			
		||||
                        r3x = 0;
 | 
			
		||||
                    if (!r3x && !ismasked(x, y))
 | 
			
		||||
                        qrframe[x + y * width] ^= 1;
 | 
			
		||||
                }
 | 
			
		||||
            break;
 | 
			
		||||
        case 3:
 | 
			
		||||
            for (r3y = 0, y = 0; y < width; y++, r3y++) {
 | 
			
		||||
                if (r3y == 3)
 | 
			
		||||
                    r3y = 0;
 | 
			
		||||
                for (r3x = r3y, x = 0; x < width; x++, r3x++) {
 | 
			
		||||
                    if (r3x == 3)
 | 
			
		||||
                        r3x = 0;
 | 
			
		||||
                    if (!r3x && !ismasked(x, y))
 | 
			
		||||
                        qrframe[x + y * width] ^= 1;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        case 4:
 | 
			
		||||
            for (y = 0; y < width; y++)
 | 
			
		||||
                for (r3x = 0, r3y = ((y >> 1) & 1), x = 0; x < width; x++, r3x++) {
 | 
			
		||||
                    if (r3x == 3) {
 | 
			
		||||
                        r3x = 0;
 | 
			
		||||
                        r3y = !r3y;
 | 
			
		||||
                    }
 | 
			
		||||
                    if (!r3y && !ismasked(x, y))
 | 
			
		||||
                        qrframe[x + y * width] ^= 1;
 | 
			
		||||
                }
 | 
			
		||||
            break;
 | 
			
		||||
        case 5:
 | 
			
		||||
            for (r3y = 0, y = 0; y < width; y++, r3y++) {
 | 
			
		||||
                if (r3y == 3)
 | 
			
		||||
                    r3y = 0;
 | 
			
		||||
                for (r3x = 0, x = 0; x < width; x++, r3x++) {
 | 
			
		||||
                    if (r3x == 3)
 | 
			
		||||
                        r3x = 0;
 | 
			
		||||
                    if (!((x & y & 1) + !(!r3x | !r3y)) && !ismasked(x, y))
 | 
			
		||||
                        qrframe[x + y * width] ^= 1;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        case 6:
 | 
			
		||||
            for (r3y = 0, y = 0; y < width; y++, r3y++) {
 | 
			
		||||
                if (r3y == 3)
 | 
			
		||||
                    r3y = 0;
 | 
			
		||||
                for (r3x = 0, x = 0; x < width; x++, r3x++) {
 | 
			
		||||
                    if (r3x == 3)
 | 
			
		||||
                        r3x = 0;
 | 
			
		||||
                    if (!(((x & y & 1) + (r3x && (r3x == r3y))) & 1) && !ismasked(x, y))
 | 
			
		||||
                        qrframe[x + y * width] ^= 1;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        case 7:
 | 
			
		||||
            for (r3y = 0, y = 0; y < width; y++, r3y++) {
 | 
			
		||||
                if (r3y == 3)
 | 
			
		||||
                    r3y = 0;
 | 
			
		||||
                for (r3x = 0, x = 0; x < width; x++, r3x++) {
 | 
			
		||||
                    if (r3x == 3)
 | 
			
		||||
                        r3x = 0;
 | 
			
		||||
                    if (!(((r3x && (r3x == r3y)) + ((x + y) & 1)) & 1) && !ismasked(x, y))
 | 
			
		||||
                        qrframe[x + y * width] ^= 1;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Badness coefficients.
 | 
			
		||||
    var N1 = 3, N2 = 3, N3 = 40, N4 = 10;
 | 
			
		||||
 | 
			
		||||
    // Using the table of the length of each run, calculate the amount of bad image 
 | 
			
		||||
    // - long runs or those that look like finders; called twice, once each for X and Y
 | 
			
		||||
    function badruns(length)
 | 
			
		||||
    {
 | 
			
		||||
        var i;
 | 
			
		||||
        var runsbad = 0;
 | 
			
		||||
        for (i = 0; i <= length; i++)
 | 
			
		||||
            if (rlens[i] >= 5)
 | 
			
		||||
                runsbad += N1 + rlens[i] - 5;
 | 
			
		||||
        // BwBBBwB as in finder
 | 
			
		||||
        for (i = 3; i < length - 1; i += 2)
 | 
			
		||||
            if (rlens[i - 2] == rlens[i + 2]
 | 
			
		||||
                && rlens[i + 2] == rlens[i - 1]
 | 
			
		||||
                && rlens[i - 1] == rlens[i + 1]
 | 
			
		||||
                && rlens[i - 1] * 3 == rlens[i]
 | 
			
		||||
                // white around the black pattern? Not part of spec
 | 
			
		||||
                && (rlens[i - 3] == 0 // beginning
 | 
			
		||||
                    || i + 3 > length  // end
 | 
			
		||||
                    || rlens[i - 3] * 3 >= rlens[i] * 4 || rlens[i + 3] * 3 >= rlens[i] * 4)
 | 
			
		||||
               )
 | 
			
		||||
                runsbad += N3;
 | 
			
		||||
        return runsbad;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Calculate how bad the masked image is - blocks, imbalance, runs, or finders.
 | 
			
		||||
    function badcheck()
 | 
			
		||||
    {
 | 
			
		||||
        var x, y, h, b, b1;
 | 
			
		||||
        var thisbad = 0;
 | 
			
		||||
        var bw = 0;
 | 
			
		||||
 | 
			
		||||
        // blocks of same color.
 | 
			
		||||
        for (y = 0; y < width - 1; y++)
 | 
			
		||||
            for (x = 0; x < width - 1; x++)
 | 
			
		||||
                if ((qrframe[x + width * y] && qrframe[(x + 1) + width * y]
 | 
			
		||||
                     && qrframe[x + width * (y + 1)] && qrframe[(x + 1) + width * (y + 1)]) // all black
 | 
			
		||||
                    || !(qrframe[x + width * y] || qrframe[(x + 1) + width * y]
 | 
			
		||||
                         || qrframe[x + width * (y + 1)] || qrframe[(x + 1) + width * (y + 1)])) // all white
 | 
			
		||||
                    thisbad += N2;
 | 
			
		||||
 | 
			
		||||
        // X runs
 | 
			
		||||
        for (y = 0; y < width; y++) {
 | 
			
		||||
            rlens[0] = 0;
 | 
			
		||||
            for (h = b = x = 0; x < width; x++) {
 | 
			
		||||
                if ((b1 = qrframe[x + width * y]) == b)
 | 
			
		||||
                    rlens[h]++;
 | 
			
		||||
                else
 | 
			
		||||
                    rlens[++h] = 1;
 | 
			
		||||
                b = b1;
 | 
			
		||||
                bw += b ? 1 : -1;
 | 
			
		||||
            }
 | 
			
		||||
            thisbad += badruns(h);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // black/white imbalance
 | 
			
		||||
        if (bw < 0)
 | 
			
		||||
            bw = -bw;
 | 
			
		||||
 | 
			
		||||
        var big = bw;
 | 
			
		||||
        count = 0;
 | 
			
		||||
        big += big << 2;
 | 
			
		||||
        big <<= 1;
 | 
			
		||||
        while (big > width * width)
 | 
			
		||||
            big -= width * width, count++;
 | 
			
		||||
        thisbad += count * N4;
 | 
			
		||||
 | 
			
		||||
        // Y runs
 | 
			
		||||
        for (x = 0; x < width; x++) {
 | 
			
		||||
            rlens[0] = 0;
 | 
			
		||||
            for (h = b = y = 0; y < width; y++) {
 | 
			
		||||
                if ((b1 = qrframe[x + width * y]) == b)
 | 
			
		||||
                    rlens[h]++;
 | 
			
		||||
                else
 | 
			
		||||
                    rlens[++h] = 1;
 | 
			
		||||
                b = b1;
 | 
			
		||||
            }
 | 
			
		||||
            thisbad += badruns(h);
 | 
			
		||||
        }
 | 
			
		||||
        return thisbad;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function genframe(instring)
 | 
			
		||||
    {
 | 
			
		||||
        var x, y, k, t, v, i, j, m;
 | 
			
		||||
 | 
			
		||||
        instring = instring || ''
 | 
			
		||||
 | 
			
		||||
    // find the smallest version that fits the string
 | 
			
		||||
        t = instring.length;
 | 
			
		||||
        version = 0;
 | 
			
		||||
        do {
 | 
			
		||||
            version++;
 | 
			
		||||
            k = (ecclevel - 1) * 4 + (version - 1) * 16;
 | 
			
		||||
            neccblk1 = eccblocks[k++];
 | 
			
		||||
            neccblk2 = eccblocks[k++];
 | 
			
		||||
            datablkw = eccblocks[k++];
 | 
			
		||||
            eccblkwid = eccblocks[k];
 | 
			
		||||
            k = datablkw * (neccblk1 + neccblk2) + neccblk2 - 3 + (version <= 9);
 | 
			
		||||
            if (t <= k)
 | 
			
		||||
                break;
 | 
			
		||||
        } while (version < 40);
 | 
			
		||||
 | 
			
		||||
    // FIXME - insure that it fits insted of being truncated
 | 
			
		||||
        width = 17 + 4 * version;
 | 
			
		||||
 | 
			
		||||
    // allocate, clear and setup data structures
 | 
			
		||||
        v = datablkw + (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2;
 | 
			
		||||
        for( t = 0; t < v; t++ )
 | 
			
		||||
            eccbuf[t] = 0;
 | 
			
		||||
        strinbuf = instring.slice(0);
 | 
			
		||||
 | 
			
		||||
        for( t = 0; t < width * width; t++ )
 | 
			
		||||
            qrframe[t] = 0;
 | 
			
		||||
 | 
			
		||||
        for( t = 0 ; t < (width * (width + 1) + 1) / 2; t++)
 | 
			
		||||
            framask[t] = 0;
 | 
			
		||||
 | 
			
		||||
    // insert finders - black to frame, white to mask
 | 
			
		||||
        for (t = 0; t < 3; t++) {
 | 
			
		||||
            k = 0;
 | 
			
		||||
            y = 0;
 | 
			
		||||
            if (t == 1)
 | 
			
		||||
                k = (width - 7);
 | 
			
		||||
            if (t == 2)
 | 
			
		||||
                y = (width - 7);
 | 
			
		||||
            qrframe[(y + 3) + width * (k + 3)] = 1;
 | 
			
		||||
            for (x = 0; x < 6; x++) {
 | 
			
		||||
                qrframe[(y + x) + width * k] = 1;
 | 
			
		||||
                qrframe[y + width * (k + x + 1)] = 1;
 | 
			
		||||
                qrframe[(y + 6) + width * (k + x)] = 1;
 | 
			
		||||
                qrframe[(y + x + 1) + width * (k + 6)] = 1;
 | 
			
		||||
            }
 | 
			
		||||
            for (x = 1; x < 5; x++) {
 | 
			
		||||
                setmask(y + x, k + 1);
 | 
			
		||||
                setmask(y + 1, k + x + 1);
 | 
			
		||||
                setmask(y + 5, k + x);
 | 
			
		||||
                setmask(y + x + 1, k + 5);
 | 
			
		||||
            }
 | 
			
		||||
            for (x = 2; x < 4; x++) {
 | 
			
		||||
                qrframe[(y + x) + width * (k + 2)] = 1;
 | 
			
		||||
                qrframe[(y + 2) + width * (k + x + 1)] = 1;
 | 
			
		||||
                qrframe[(y + 4) + width * (k + x)] = 1;
 | 
			
		||||
                qrframe[(y + x + 1) + width * (k + 4)] = 1;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    // alignment blocks
 | 
			
		||||
        if (version > 1) {
 | 
			
		||||
            t = adelta[version];
 | 
			
		||||
            y = width - 7;
 | 
			
		||||
            for (;;) {
 | 
			
		||||
                x = width - 7;
 | 
			
		||||
                while (x > t - 3) {
 | 
			
		||||
                    putalign(x, y);
 | 
			
		||||
                    if (x < t)
 | 
			
		||||
                        break;
 | 
			
		||||
                    x -= t;
 | 
			
		||||
                }
 | 
			
		||||
                if (y <= t + 9)
 | 
			
		||||
                    break;
 | 
			
		||||
                y -= t;
 | 
			
		||||
                putalign(6, y);
 | 
			
		||||
                putalign(y, 6);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    // single black
 | 
			
		||||
        qrframe[8 + width * (width - 8)] = 1;
 | 
			
		||||
 | 
			
		||||
    // timing gap - mask only
 | 
			
		||||
        for (y = 0; y < 7; y++) {
 | 
			
		||||
            setmask(7, y);
 | 
			
		||||
            setmask(width - 8, y);
 | 
			
		||||
            setmask(7, y + width - 7);
 | 
			
		||||
        }
 | 
			
		||||
        for (x = 0; x < 8; x++) {
 | 
			
		||||
            setmask(x, 7);
 | 
			
		||||
            setmask(x + width - 8, 7);
 | 
			
		||||
            setmask(x, width - 8);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    // reserve mask-format area
 | 
			
		||||
        for (x = 0; x < 9; x++)
 | 
			
		||||
            setmask(x, 8);
 | 
			
		||||
        for (x = 0; x < 8; x++) {
 | 
			
		||||
            setmask(x + width - 8, 8);
 | 
			
		||||
            setmask(8, x);
 | 
			
		||||
        }
 | 
			
		||||
        for (y = 0; y < 7; y++)
 | 
			
		||||
            setmask(8, y + width - 7);
 | 
			
		||||
 | 
			
		||||
    // timing row/col
 | 
			
		||||
        for (x = 0; x < width - 14; x++)
 | 
			
		||||
            if (x & 1) {
 | 
			
		||||
                setmask(8 + x, 6);
 | 
			
		||||
                setmask(6, 8 + x);
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                qrframe[(8 + x) + width * 6] = 1;
 | 
			
		||||
                qrframe[6 + width * (8 + x)] = 1;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
    // version block
 | 
			
		||||
        if (version > 6) {
 | 
			
		||||
            t = vpat[version - 7];
 | 
			
		||||
            k = 17;
 | 
			
		||||
            for (x = 0; x < 6; x++)
 | 
			
		||||
                for (y = 0; y < 3; y++, k--)
 | 
			
		||||
                    if (1 & (k > 11 ? version >> (k - 12) : t >> k)) {
 | 
			
		||||
                        qrframe[(5 - x) + width * (2 - y + width - 11)] = 1;
 | 
			
		||||
                        qrframe[(2 - y + width - 11) + width * (5 - x)] = 1;
 | 
			
		||||
                    }
 | 
			
		||||
            else {
 | 
			
		||||
                setmask(5 - x, 2 - y + width - 11);
 | 
			
		||||
                setmask(2 - y + width - 11, 5 - x);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    // sync mask bits - only set above for white spaces, so add in black bits
 | 
			
		||||
        for (y = 0; y < width; y++)
 | 
			
		||||
            for (x = 0; x <= y; x++)
 | 
			
		||||
                if (qrframe[x + width * y])
 | 
			
		||||
                    setmask(x, y);
 | 
			
		||||
 | 
			
		||||
    // convert string to bitstream
 | 
			
		||||
    // 8 bit data to QR-coded 8 bit data (numeric or alphanum, or kanji not supported)
 | 
			
		||||
        v = strinbuf.length;
 | 
			
		||||
 | 
			
		||||
    // string to array
 | 
			
		||||
        for( i = 0 ; i < v; i++ )
 | 
			
		||||
            eccbuf[i] = strinbuf.charCodeAt(i);
 | 
			
		||||
        strinbuf = eccbuf.slice(0);
 | 
			
		||||
 | 
			
		||||
    // calculate max string length
 | 
			
		||||
        x = datablkw * (neccblk1 + neccblk2) + neccblk2;
 | 
			
		||||
        if (v >= x - 2) {
 | 
			
		||||
            v = x - 2;
 | 
			
		||||
            if (version > 9)
 | 
			
		||||
                v--;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    // shift and repack to insert length prefix
 | 
			
		||||
        i = v;
 | 
			
		||||
        if (version > 9) {
 | 
			
		||||
            strinbuf[i + 2] = 0;
 | 
			
		||||
            strinbuf[i + 3] = 0;
 | 
			
		||||
            while (i--) {
 | 
			
		||||
                t = strinbuf[i];
 | 
			
		||||
                strinbuf[i + 3] |= 255 & (t << 4);
 | 
			
		||||
                strinbuf[i + 2] = t >> 4;
 | 
			
		||||
            }
 | 
			
		||||
            strinbuf[2] |= 255 & (v << 4);
 | 
			
		||||
            strinbuf[1] = v >> 4;
 | 
			
		||||
            strinbuf[0] = 0x40 | (v >> 12);
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            strinbuf[i + 1] = 0;
 | 
			
		||||
            strinbuf[i + 2] = 0;
 | 
			
		||||
            while (i--) {
 | 
			
		||||
                t = strinbuf[i];
 | 
			
		||||
                strinbuf[i + 2] |= 255 & (t << 4);
 | 
			
		||||
                strinbuf[i + 1] = t >> 4;
 | 
			
		||||
            }
 | 
			
		||||
            strinbuf[1] |= 255 & (v << 4);
 | 
			
		||||
            strinbuf[0] = 0x40 | (v >> 4);
 | 
			
		||||
        }
 | 
			
		||||
    // fill to end with pad pattern
 | 
			
		||||
        i = v + 3 - (version < 10);
 | 
			
		||||
        while (i < x) {
 | 
			
		||||
            strinbuf[i++] = 0xec;
 | 
			
		||||
            // buffer has room    if (i == x)      break;
 | 
			
		||||
            strinbuf[i++] = 0x11;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    // calculate and append ECC
 | 
			
		||||
 | 
			
		||||
    // calculate generator polynomial
 | 
			
		||||
        genpoly[0] = 1;
 | 
			
		||||
        for (i = 0; i < eccblkwid; i++) {
 | 
			
		||||
            genpoly[i + 1] = 1;
 | 
			
		||||
            for (j = i; j > 0; j--)
 | 
			
		||||
                genpoly[j] = genpoly[j]
 | 
			
		||||
                ? genpoly[j - 1] ^ gexp[modnn(glog[genpoly[j]] + i)] : genpoly[j - 1];
 | 
			
		||||
            genpoly[0] = gexp[modnn(glog[genpoly[0]] + i)];
 | 
			
		||||
        }
 | 
			
		||||
        for (i = 0; i <= eccblkwid; i++)
 | 
			
		||||
            genpoly[i] = glog[genpoly[i]]; // use logs for genpoly[] to save calc step
 | 
			
		||||
 | 
			
		||||
    // append ecc to data buffer
 | 
			
		||||
        k = x;
 | 
			
		||||
        y = 0;
 | 
			
		||||
        for (i = 0; i < neccblk1; i++) {
 | 
			
		||||
            appendrs(y, datablkw, k, eccblkwid);
 | 
			
		||||
            y += datablkw;
 | 
			
		||||
            k += eccblkwid;
 | 
			
		||||
        }
 | 
			
		||||
        for (i = 0; i < neccblk2; i++) {
 | 
			
		||||
            appendrs(y, datablkw + 1, k, eccblkwid);
 | 
			
		||||
            y += datablkw + 1;
 | 
			
		||||
            k += eccblkwid;
 | 
			
		||||
        }
 | 
			
		||||
    // interleave blocks
 | 
			
		||||
        y = 0;
 | 
			
		||||
        for (i = 0; i < datablkw; i++) {
 | 
			
		||||
            for (j = 0; j < neccblk1; j++)
 | 
			
		||||
                eccbuf[y++] = strinbuf[i + j * datablkw];
 | 
			
		||||
            for (j = 0; j < neccblk2; j++)
 | 
			
		||||
                eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))];
 | 
			
		||||
        }
 | 
			
		||||
        for (j = 0; j < neccblk2; j++)
 | 
			
		||||
            eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))];
 | 
			
		||||
        for (i = 0; i < eccblkwid; i++)
 | 
			
		||||
            for (j = 0; j < neccblk1 + neccblk2; j++)
 | 
			
		||||
                eccbuf[y++] = strinbuf[x + i + j * eccblkwid];
 | 
			
		||||
        strinbuf = eccbuf;
 | 
			
		||||
 | 
			
		||||
    // pack bits into frame avoiding masked area.
 | 
			
		||||
        x = y = width - 1;
 | 
			
		||||
        k = v = 1;         // up, minus
 | 
			
		||||
        /* inteleaved data and ecc codes */
 | 
			
		||||
        m = (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2;
 | 
			
		||||
        for (i = 0; i < m; i++) {
 | 
			
		||||
            t = strinbuf[i];
 | 
			
		||||
            for (j = 0; j < 8; j++, t <<= 1) {
 | 
			
		||||
                if (0x80 & t)
 | 
			
		||||
                    qrframe[x + width * y] = 1;
 | 
			
		||||
                do {        // find next fill position
 | 
			
		||||
                    if (v)
 | 
			
		||||
                        x--;
 | 
			
		||||
                    else {
 | 
			
		||||
                        x++;
 | 
			
		||||
                        if (k) {
 | 
			
		||||
                            if (y != 0)
 | 
			
		||||
                                y--;
 | 
			
		||||
                            else {
 | 
			
		||||
                                x -= 2;
 | 
			
		||||
                                k = !k;
 | 
			
		||||
                                if (x == 6) {
 | 
			
		||||
                                    x--;
 | 
			
		||||
                                    y = 9;
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        else {
 | 
			
		||||
                            if (y != width - 1)
 | 
			
		||||
                                y++;
 | 
			
		||||
                            else {
 | 
			
		||||
                                x -= 2;
 | 
			
		||||
                                k = !k;
 | 
			
		||||
                                if (x == 6) {
 | 
			
		||||
                                    x--;
 | 
			
		||||
                                    y -= 8;
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    v = !v;
 | 
			
		||||
                } while (ismasked(x, y));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    // save pre-mask copy of frame
 | 
			
		||||
        strinbuf = qrframe.slice(0);
 | 
			
		||||
        t = 0;           // best
 | 
			
		||||
        y = 30000;         // demerit
 | 
			
		||||
    // for instead of while since in original arduino code
 | 
			
		||||
    // if an early mask was "good enough" it wouldn't try for a better one
 | 
			
		||||
    // since they get more complex and take longer.
 | 
			
		||||
        for (k = 0; k < 8; k++) {
 | 
			
		||||
            applymask(k);      // returns black-white imbalance
 | 
			
		||||
            x = badcheck();
 | 
			
		||||
            if (x < y) { // current mask better than previous best?
 | 
			
		||||
                y = x;
 | 
			
		||||
                t = k;
 | 
			
		||||
            }
 | 
			
		||||
            if (t == 7)
 | 
			
		||||
                break;       // don't increment i to a void redoing mask
 | 
			
		||||
            qrframe = strinbuf.slice(0); // reset for next pass
 | 
			
		||||
        }
 | 
			
		||||
        if (t != k)         // redo best mask - none good enough, last wasn't t
 | 
			
		||||
            applymask(t);
 | 
			
		||||
 | 
			
		||||
    // add in final mask/ecclevel bytes
 | 
			
		||||
        y = fmtword[t + ((ecclevel - 1) << 3)];
 | 
			
		||||
        // low byte
 | 
			
		||||
        for (k = 0; k < 8; k++, y >>= 1)
 | 
			
		||||
            if (y & 1) {
 | 
			
		||||
                qrframe[(width - 1 - k) + width * 8] = 1;
 | 
			
		||||
                if (k < 6)
 | 
			
		||||
                    qrframe[8 + width * k] = 1;
 | 
			
		||||
                else
 | 
			
		||||
                    qrframe[8 + width * (k + 1)] = 1;
 | 
			
		||||
            }
 | 
			
		||||
        // high byte
 | 
			
		||||
        for (k = 0; k < 7; k++, y >>= 1)
 | 
			
		||||
            if (y & 1) {
 | 
			
		||||
                qrframe[8 + width * (width - 7 + k)] = 1;
 | 
			
		||||
                if (k)
 | 
			
		||||
                    qrframe[(6 - k) + width * 8] = 1;
 | 
			
		||||
                else
 | 
			
		||||
                    qrframe[7 + width * 8] = 1;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
    // return image
 | 
			
		||||
        return qrframe;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var _canvas = null,
 | 
			
		||||
        _size = null;
 | 
			
		||||
 | 
			
		||||
    var api = {
 | 
			
		||||
 | 
			
		||||
        get ecclevel () {
 | 
			
		||||
            return ecclevel;
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        set ecclevel (val) {
 | 
			
		||||
            ecclevel = val;
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        get size () {
 | 
			
		||||
            return _size;
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        set size (val) {
 | 
			
		||||
            _size = val
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        get canvas () {
 | 
			
		||||
            return _canvas;
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        set canvas (el) {
 | 
			
		||||
            _canvas = el;
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        getFrame: function (string) {
 | 
			
		||||
            return genframe(string);
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        draw: function (string, canvas, size, ecc) {
 | 
			
		||||
            
 | 
			
		||||
            ecclevel = ecc || ecclevel;
 | 
			
		||||
            canvas = canvas || _canvas;
 | 
			
		||||
 | 
			
		||||
            if (!canvas) {
 | 
			
		||||
                console.warn('No canvas provided to draw QR code in!')
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            size = size || _size || Math.min(canvas.width, canvas.height);
 | 
			
		||||
 | 
			
		||||
            var frame = genframe(string),
 | 
			
		||||
                ctx = canvas.getContext('2d'),
 | 
			
		||||
                px = Math.round(size / (width + 8));
 | 
			
		||||
 | 
			
		||||
            var roundedSize = px * (width + 8),
 | 
			
		||||
                offset = Math.floor((size - roundedSize) / 2);
 | 
			
		||||
 | 
			
		||||
            size = roundedSize;
 | 
			
		||||
 | 
			
		||||
            ctx.clearRect(0, 0, canvas.width, canvas.height);
 | 
			
		||||
            ctx.fillStyle = '#fff';
 | 
			
		||||
            ctx.fillRect(0, 0, size, size);
 | 
			
		||||
            ctx.fillStyle = '#000';
 | 
			
		||||
            for (var i = 0; i < width; i++) {
 | 
			
		||||
                for (var j = 0; j < width; j++) {
 | 
			
		||||
                    if (frame[j * width + i]) {
 | 
			
		||||
                        ctx.fillRect(px * (4 + i) + offset, px * (4 + j) + offset, px, px);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        toDataURL: function (string, size, ecc) {
 | 
			
		||||
            var canvas = document.createElement('canvas');
 | 
			
		||||
            canvas.width = size || _size || 300;
 | 
			
		||||
            canvas.height = canvas.width;
 | 
			
		||||
            api.draw(string, canvas, canvas.width, ecc);
 | 
			
		||||
            return canvas.toDataURL();
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        makeImage: function (string, size, ecc) {
 | 
			
		||||
            var img = new Image();
 | 
			
		||||
            img.src = api.toDataURL(string, size, ecc);
 | 
			
		||||
 | 
			
		||||
            return img;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return api;
 | 
			
		||||
 | 
			
		||||
})()
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								example/assets/logo.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 94 KiB  | 
							
								
								
									
										262
									
								
								example/assets/logo.svg
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,262 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 | 
			
		||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
 | 
			
		||||
 | 
			
		||||
<svg
 | 
			
		||||
   width="128.27411mm"
 | 
			
		||||
   height="145.65482mm"
 | 
			
		||||
   viewBox="0 0 128.27411 145.65482"
 | 
			
		||||
   version="1.1"
 | 
			
		||||
   id="svg5"
 | 
			
		||||
   xml:space="preserve"
 | 
			
		||||
   xmlns:xlink="http://www.w3.org/1999/xlink"
 | 
			
		||||
   xmlns="http://www.w3.org/2000/svg"
 | 
			
		||||
   xmlns:svg="http://www.w3.org/2000/svg"><defs
 | 
			
		||||
     id="defs2"><linearGradient
 | 
			
		||||
       id="linearGradient12286"><stop
 | 
			
		||||
         style="stop-color:#ea0bfe;stop-opacity:0.11569338;"
 | 
			
		||||
         offset="0"
 | 
			
		||||
         id="stop12282" /><stop
 | 
			
		||||
         style="stop-color:#ffffff;stop-opacity:0;"
 | 
			
		||||
         offset="1"
 | 
			
		||||
         id="stop12284" /></linearGradient><linearGradient
 | 
			
		||||
       id="linearGradient12159"><stop
 | 
			
		||||
         style="stop-color:#fe83ff;stop-opacity:0.35045233;"
 | 
			
		||||
         offset="0"
 | 
			
		||||
         id="stop12155" /><stop
 | 
			
		||||
         style="stop-color:#3c9cff;stop-opacity:0.32712477;"
 | 
			
		||||
         offset="1"
 | 
			
		||||
         id="stop12157" /></linearGradient><linearGradient
 | 
			
		||||
       id="linearGradient12153"><stop
 | 
			
		||||
         style="stop-color:#fe83ff;stop-opacity:0.29342434;"
 | 
			
		||||
         offset="0"
 | 
			
		||||
         id="stop12149" /><stop
 | 
			
		||||
         style="stop-color:#3c9cff;stop-opacity:0.31577286;"
 | 
			
		||||
         offset="1"
 | 
			
		||||
         id="stop12151" /></linearGradient><linearGradient
 | 
			
		||||
       id="linearGradient12139"><stop
 | 
			
		||||
         style="stop-color:#ea0bfe;stop-opacity:0.50826901;"
 | 
			
		||||
         offset="0"
 | 
			
		||||
         id="stop12135" /><stop
 | 
			
		||||
         style="stop-color:#ffffff;stop-opacity:0;"
 | 
			
		||||
         offset="1"
 | 
			
		||||
         id="stop12137" /></linearGradient><linearGradient
 | 
			
		||||
       id="linearGradient12102"><stop
 | 
			
		||||
         style="stop-color:#fe83ff;stop-opacity:1;"
 | 
			
		||||
         offset="0"
 | 
			
		||||
         id="stop12098" /><stop
 | 
			
		||||
         style="stop-color:#3c9cff;stop-opacity:0.81848603;"
 | 
			
		||||
         offset="1"
 | 
			
		||||
         id="stop12100" /></linearGradient><linearGradient
 | 
			
		||||
       id="linearGradient7688"><stop
 | 
			
		||||
         style="stop-color:#ffffff;stop-opacity:1;"
 | 
			
		||||
         offset="0"
 | 
			
		||||
         id="stop7684" /><stop
 | 
			
		||||
         style="stop-color:#ff13f3;stop-opacity:0;"
 | 
			
		||||
         offset="1"
 | 
			
		||||
         id="stop7686" /></linearGradient><linearGradient
 | 
			
		||||
       id="linearGradient6742"><stop
 | 
			
		||||
         style="stop-color:#276fff;stop-opacity:1"
 | 
			
		||||
         offset="0"
 | 
			
		||||
         id="stop6738" /><stop
 | 
			
		||||
         style="stop-color:#ff16bc;stop-opacity:1"
 | 
			
		||||
         offset="1"
 | 
			
		||||
         id="stop6740" /></linearGradient><linearGradient
 | 
			
		||||
       xlink:href="#linearGradient6742"
 | 
			
		||||
       id="linearGradient8637"
 | 
			
		||||
       x1="154.78049"
 | 
			
		||||
       y1="24.048252"
 | 
			
		||||
       x2="273.12695"
 | 
			
		||||
       y2="24.048252"
 | 
			
		||||
       gradientUnits="userSpaceOnUse" /><linearGradient
 | 
			
		||||
       xlink:href="#linearGradient7688"
 | 
			
		||||
       id="linearGradient7692"
 | 
			
		||||
       x1="115.42191"
 | 
			
		||||
       y1="-2.709012"
 | 
			
		||||
       x2="117.16759"
 | 
			
		||||
       y2="131.87457"
 | 
			
		||||
       gradientUnits="userSpaceOnUse" /><linearGradient
 | 
			
		||||
       xlink:href="#linearGradient12102"
 | 
			
		||||
       id="linearGradient12104"
 | 
			
		||||
       x1="54.029213"
 | 
			
		||||
       y1="71.733955"
 | 
			
		||||
       x2="176.85757"
 | 
			
		||||
       y2="71.733955"
 | 
			
		||||
       gradientUnits="userSpaceOnUse" /><linearGradient
 | 
			
		||||
       xlink:href="#linearGradient12159"
 | 
			
		||||
       id="linearGradient12108"
 | 
			
		||||
       gradientUnits="userSpaceOnUse"
 | 
			
		||||
       x1="54.029213"
 | 
			
		||||
       y1="71.733955"
 | 
			
		||||
       x2="176.85757"
 | 
			
		||||
       y2="71.733955"
 | 
			
		||||
       gradientTransform="translate(0,4.7625002)" /><linearGradient
 | 
			
		||||
       xlink:href="#linearGradient12153"
 | 
			
		||||
       id="linearGradient12112"
 | 
			
		||||
       gradientUnits="userSpaceOnUse"
 | 
			
		||||
       gradientTransform="translate(0,19.579173)"
 | 
			
		||||
       x1="54.029213"
 | 
			
		||||
       y1="71.733955"
 | 
			
		||||
       x2="176.85757"
 | 
			
		||||
       y2="71.733955" /><linearGradient
 | 
			
		||||
       xlink:href="#linearGradient12286"
 | 
			
		||||
       id="linearGradient12141"
 | 
			
		||||
       x1="137.33427"
 | 
			
		||||
       y1="88.766113"
 | 
			
		||||
       x2="177.37935"
 | 
			
		||||
       y2="88.766113"
 | 
			
		||||
       gradientUnits="userSpaceOnUse"
 | 
			
		||||
       gradientTransform="matrix(1.2850723,0,0,1.2367478,-50.791853,-16.999519)" /><linearGradient
 | 
			
		||||
       xlink:href="#linearGradient12139"
 | 
			
		||||
       id="linearGradient12239"
 | 
			
		||||
       gradientUnits="userSpaceOnUse"
 | 
			
		||||
       x1="137.33427"
 | 
			
		||||
       y1="88.766113"
 | 
			
		||||
       x2="177.37935"
 | 
			
		||||
       y2="88.766113"
 | 
			
		||||
       gradientTransform="matrix(-1.2669282,0,0,1.2603766,278.3952,-19.18513)" /><filter
 | 
			
		||||
       style="color-interpolation-filters:sRGB"
 | 
			
		||||
       id="filter12743"
 | 
			
		||||
       x="-0.079006463"
 | 
			
		||||
       y="-0.2479955"
 | 
			
		||||
       width="1.1580434"
 | 
			
		||||
       height="1.4959902"><feFlood
 | 
			
		||||
         flood-opacity="1"
 | 
			
		||||
         flood-color="rgb(204,26,255)"
 | 
			
		||||
         result="flood"
 | 
			
		||||
         id="feFlood12733" /><feComposite
 | 
			
		||||
         in="flood"
 | 
			
		||||
         in2="SourceGraphic"
 | 
			
		||||
         operator="in"
 | 
			
		||||
         result="composite1"
 | 
			
		||||
         id="feComposite12735" /><feGaussianBlur
 | 
			
		||||
         in="composite1"
 | 
			
		||||
         stdDeviation="1.1"
 | 
			
		||||
         result="blur"
 | 
			
		||||
         id="feGaussianBlur12737" /><feOffset
 | 
			
		||||
         dx="0"
 | 
			
		||||
         dy="0"
 | 
			
		||||
         result="offset"
 | 
			
		||||
         id="feOffset12739" /><feComposite
 | 
			
		||||
         in="SourceGraphic"
 | 
			
		||||
         in2="offset"
 | 
			
		||||
         operator="over"
 | 
			
		||||
         result="composite2"
 | 
			
		||||
         id="feComposite12741" /></filter><filter
 | 
			
		||||
       style="color-interpolation-filters:sRGB"
 | 
			
		||||
       id="filter13745"
 | 
			
		||||
       x="-0.13709185"
 | 
			
		||||
       y="-1.2090968"
 | 
			
		||||
       width="1.2741838"
 | 
			
		||||
       height="3.4181938"><feFlood
 | 
			
		||||
         flood-opacity="1"
 | 
			
		||||
         flood-color="rgb(26,135,255)"
 | 
			
		||||
         result="flood"
 | 
			
		||||
         id="feFlood13735" /><feComposite
 | 
			
		||||
         in="flood"
 | 
			
		||||
         in2="SourceGraphic"
 | 
			
		||||
         operator="in"
 | 
			
		||||
         result="composite1"
 | 
			
		||||
         id="feComposite13737" /><feGaussianBlur
 | 
			
		||||
         in="composite1"
 | 
			
		||||
         stdDeviation="4.48865"
 | 
			
		||||
         result="blur"
 | 
			
		||||
         id="feGaussianBlur13739" /><feOffset
 | 
			
		||||
         dx="0"
 | 
			
		||||
         dy="0"
 | 
			
		||||
         result="offset"
 | 
			
		||||
         id="feOffset13741" /><feComposite
 | 
			
		||||
         in="SourceGraphic"
 | 
			
		||||
         in2="offset"
 | 
			
		||||
         operator="over"
 | 
			
		||||
         result="composite2"
 | 
			
		||||
         id="feComposite13743" /></filter><linearGradient
 | 
			
		||||
       xlink:href="#linearGradient12286"
 | 
			
		||||
       id="linearGradient14475"
 | 
			
		||||
       gradientUnits="userSpaceOnUse"
 | 
			
		||||
       gradientTransform="matrix(1.2850723,0,0,1.2367478,-50.791853,-16.999519)"
 | 
			
		||||
       x1="137.33427"
 | 
			
		||||
       y1="88.766113"
 | 
			
		||||
       x2="177.37935"
 | 
			
		||||
       y2="88.766113" /></defs><g
 | 
			
		||||
     id="layer1"
 | 
			
		||||
     transform="translate(-51.358538,-4.8451999)"><path
 | 
			
		||||
       style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:2.3;stroke-dasharray:none"
 | 
			
		||||
       id="path1638-3"
 | 
			
		||||
       d="m 78.134029,228.41853 60.622131,-35.00021 60.62214,35.0002 0,70.00042 -60.62213,35.0002 -60.62214,-35.0002 z"
 | 
			
		||||
       transform="matrix(1.0382846,0,0,1.0210168,-28.572793,-191.28234)" /><g
 | 
			
		||||
       id="g12126"><path
 | 
			
		||||
         style="fill:none;fill-opacity:1;stroke:url(#linearGradient12104);stroke-width:0.5;stroke-dasharray:none;stroke-opacity:1"
 | 
			
		||||
         d="M 54.029427,71.745371 176.85736,71.722537"
 | 
			
		||||
         id="path12042" /><path
 | 
			
		||||
         style="fill:none;fill-opacity:1;stroke:url(#linearGradient12108);stroke-width:0.6;stroke-dasharray:none;stroke-opacity:1"
 | 
			
		||||
         d="M 54.029427,76.507874 176.85736,76.48504"
 | 
			
		||||
         id="path12106" /><path
 | 
			
		||||
         style="fill:none;fill-opacity:1;stroke:url(#linearGradient12112);stroke-width:0.8;stroke-dasharray:none;stroke-opacity:1"
 | 
			
		||||
         d="M 54.029427,91.32455 176.85736,91.301716"
 | 
			
		||||
         id="path12110" /><path
 | 
			
		||||
         style="fill:url(#linearGradient12239);fill-opacity:1;stroke:none;stroke-width:2.416;stroke-dasharray:none;stroke-opacity:1"
 | 
			
		||||
         d="M 104.40252,71.315371 53.668551,108.90527 v 5.16648 z"
 | 
			
		||||
         id="path12133-5" /><path
 | 
			
		||||
         style="fill:url(#linearGradient14475);fill-opacity:1;stroke:none;stroke-width:2.41042;stroke-dasharray:none;stroke-opacity:1"
 | 
			
		||||
         d="m 125.69256,71.804339 51.46081,36.885251 v 5.06963 z"
 | 
			
		||||
         id="path12133" /><path
 | 
			
		||||
         style="fill:url(#linearGradient12141);fill-opacity:1;stroke:none;stroke-width:2.41042;stroke-dasharray:none;stroke-opacity:1"
 | 
			
		||||
         d="m 115.37951,70.94784 5.14781,74.3852 c 0,0 -4.42958,5.94658 -10.22727,-0.9757 z"
 | 
			
		||||
         id="path12280" /></g><path
 | 
			
		||||
       style="fill:url(#linearGradient7692);fill-opacity:1;stroke:none;stroke-width:2.3;stroke-dasharray:none;stroke-opacity:1"
 | 
			
		||||
       d="M 53.906377,71.659657 H 177.09207 l 0.24519,40.701533 -61.93861,35.18517 -61.54407,-35.3442 z"
 | 
			
		||||
       id="path7625" /><g
 | 
			
		||||
       id="g4494"
 | 
			
		||||
       transform="matrix(2.7825702,0,0,3.2095953,58.857189,44.497537)"
 | 
			
		||||
       style="filter:url(#filter12743)"><g
 | 
			
		||||
         transform="translate(-47.668322,-15.505759)"
 | 
			
		||||
         id="g113"><g
 | 
			
		||||
           transform="scale(0.26458)"
 | 
			
		||||
           style="font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal"
 | 
			
		||||
           aria-label="SEARXR"
 | 
			
		||||
           id="g111"><path
 | 
			
		||||
             id="path105"
 | 
			
		||||
             style="font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;opacity:1;fill:#f7f7f7;fill-opacity:0.996078;stroke:url(#linearGradient8637);stroke-width:3.77953;stroke-miterlimit:4;stroke-dasharray:none"
 | 
			
		||||
             d="m 158.51953,0.12890625 c -1.12928,0.0104375 -2.33343,0.0380832 -3.58789,0.09375 -0.30457,-0.13399831 -0.0547,13.73632775 -0.0547,13.73632775 2.81897,0.06348 6.79437,-0.315067 8.33985,1.041016 3.97475,3.093961 3.19147,2.418039 5.77734,5.003906 2.58587,2.585868 5.23601,5.171945 7.95117,7.757813 l -21.2931,18.782442 c -1.29339,1.292984 -2.45529,1.570562 8.42537,1.302881 9.59316,-0.08935 8.19237,0.720755 10.73745,-1.137203 7.83955,-6.121602 9.61287,-7.470425 12.32804,-10.185491 3.0599,2.434819 5.75483,4.092804 10.43494,7.218213 0,0 4.56752,2.32698 9.03546,3.466611 5.1614,0.869711 19.0651,0.856505 19.62872,0.659979 h 4.7207 c 0,0 0.0977,-8.957996 0.16992,-16.066407 0.12771,-10.909788 2.17195,-13.091574 4.75781,-15.80664 2.71507,-2.715066 6.01188,-2.072266 9.89063,-2.072266 h 21.3457 V 0.15429688 h -21.3457 c -7.6279,0 -14.15766,2.71429962 -19.58789,8.14453122 -5.30093,5.3009329 -7.95117,11.7666269 -7.95117,19.3945309 v 9.097657 c -2.05016,0.03977 -4.12643,0.0029 -5.92969,-0.160157 -1.85798,-0.167898 -4.68413,-1.320736 -8.3076,-3.088808 0,0 -4.88583,-3.065166 -7.4717,-5.780332 l 15.00318,-15.777875 c 1.25994,-1.325002 3.90091,-4.6189385 8.52807,-9.5834534 1.63566,-1.75491056 0.84973,-2.31134101 -4.04101,-2.19531248 -2.41247,0.00862 -6.69149,0.0175781 -8.63086,0.0175781 -1.81008,0 -3.42548,0.71063042 -4.84766,2.13281258 L 186.83594,18.064453 c -2.71507,-2.585867 -5.36541,-5.171945 -7.95117,-7.757812 l -7.95118,-7.9511722 c -1.42218,-1.42217213 -3.03953,-2.13281255 -4.84961,-2.13281255 -1.45453,0 -4.17661,-0.12506257 -7.56445,-0.09375 z"
 | 
			
		||||
             transform="matrix(1.0000126,0,0,1.0000126,27.273414,60.371154)" /><path
 | 
			
		||||
             d="m 267.38547,88.252296 c 0,-7.665647 2.6505,-14.161997 7.9515,-19.48895 5.4303,-5.456886 11.96,-8.185379 19.588,-8.185379 h 37.34533 v 13.837416 h -37.34533 c -3.8788,0 -7.1758,1.364246 -9.8909,4.092639 -2.5859,2.728493 -3.8788,5.976618 -3.8788,9.744475 v 19.634563 h -13.77 z"
 | 
			
		||||
             style="font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;fill:#f7f7f7;fill-opacity:0.997356;stroke:#54438e;stroke-width:3.78882;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
 | 
			
		||||
             id="path103" /><rect
 | 
			
		||||
             style="fill:#f7f7f7;fill-opacity:0.996078;stroke:none;stroke-width:3.77958"
 | 
			
		||||
             id="rect1105"
 | 
			
		||||
             width="29.440615"
 | 
			
		||||
             height="9.8188734"
 | 
			
		||||
             x="269.93423"
 | 
			
		||||
             y="62.516171" /></g></g><path
 | 
			
		||||
         d="m 40.243755,6.8720423 -9.0863,-0.04493 c 0,0 -1.8872,0.04494 -1.8423,1.5727 0.04493,1.5277999 1.8772,1.4827999 1.8772,1.4827999 h 9.0514 z"
 | 
			
		||||
         stroke="#000000"
 | 
			
		||||
         stroke-width="0.26458px"
 | 
			
		||||
         id="path117"
 | 
			
		||||
         style="fill:#fefefe;fill-opacity:1;stroke:#54438e;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /></g><text
 | 
			
		||||
       xml:space="preserve"
 | 
			
		||||
       style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:19.7556px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Bold';text-align:center;text-anchor:middle;fill:#ffffff;stroke:#ffffff;stroke-width:0.5;stroke-dasharray:none"
 | 
			
		||||
       x="69.809654"
 | 
			
		||||
       y="107.18471"
 | 
			
		||||
       id="text1004"><tspan
 | 
			
		||||
         id="tspan1002"
 | 
			
		||||
         style="font-style:normal;font-variant:normal;font-weight:100;font-stretch:normal;font-size:19.7556px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Thin';stroke-width:0.5;stroke-dasharray:none"
 | 
			
		||||
         x="69.809654"
 | 
			
		||||
         y="107.18471">[</tspan></text><text
 | 
			
		||||
       xml:space="preserve"
 | 
			
		||||
       style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:19.7556px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Bold';text-align:center;text-anchor:middle;fill:#ffffff;stroke:#ffffff;stroke-width:0.5;stroke-dasharray:none"
 | 
			
		||||
       x="160.00148"
 | 
			
		||||
       y="107.33738"
 | 
			
		||||
       id="text1004-3"><tspan
 | 
			
		||||
         id="tspan1002-6"
 | 
			
		||||
         style="font-style:normal;font-variant:normal;font-weight:100;font-stretch:normal;font-size:19.7556px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Thin';stroke-width:0.5;stroke-dasharray:none"
 | 
			
		||||
         x="160.00148"
 | 
			
		||||
         y="107.33738">]</tspan></text><text
 | 
			
		||||
       xml:space="preserve"
 | 
			
		||||
       style="font-weight:100;font-size:9.87778px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Thin';text-align:center;letter-spacing:0.529167px;writing-mode:tb-rl;text-orientation:upright;text-anchor:middle;fill:#020202;fill-opacity:1;stroke:#000000;stroke-width:2.3;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter13745)"
 | 
			
		||||
       x="81.083984"
 | 
			
		||||
       y="95.681953"
 | 
			
		||||
       id="text3268"><tspan
 | 
			
		||||
         id="tspan3266"
 | 
			
		||||
         style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:9.87778px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Bold';text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2.3;stroke-opacity:1"
 | 
			
		||||
         x="81.083984"
 | 
			
		||||
         y="95.681953">XR Fragments</tspan></text></g></svg>
 | 
			
		||||
| 
		 After Width: | Height: | Size: 14 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								example/assets/other.glb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										18
									
								
								example/assets/shader.frag
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
precision mediump float;
 | 
			
		||||
precision mediump int;
 | 
			
		||||
 | 
			
		||||
uniform float time;
 | 
			
		||||
 | 
			
		||||
varying vec3 vPosition;
 | 
			
		||||
varying vec4 vColor;
 | 
			
		||||
 | 
			
		||||
void main()	{
 | 
			
		||||
 | 
			
		||||
  vec4 color = vec4( vColor );
 | 
			
		||||
  color.r += sin( vPosition.x * 10.0 + time ) * 0.5;
 | 
			
		||||
  color.g = 0.0;
 | 
			
		||||
  color.b += cos( vPosition.x * 10.0 + time ) * 0.5;
 | 
			
		||||
 | 
			
		||||
  gl_FragColor = color;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										20
									
								
								example/assets/shader.vert
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
precision mediump float;
 | 
			
		||||
precision mediump int;
 | 
			
		||||
 | 
			
		||||
uniform mat4 modelViewMatrix; // optional
 | 
			
		||||
uniform mat4 projectionMatrix; // optional
 | 
			
		||||
 | 
			
		||||
attribute vec3 position;
 | 
			
		||||
attribute vec4 color;
 | 
			
		||||
 | 
			
		||||
varying vec3 vPosition;
 | 
			
		||||
varying vec4 vColor;
 | 
			
		||||
 | 
			
		||||
void main()	{
 | 
			
		||||
 | 
			
		||||
  vPosition = position;
 | 
			
		||||
  vColor = color;
 | 
			
		||||
 | 
			
		||||
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								example/assets/telescopic.glb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								example/assets/victory-garden-cdrom.glb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										107
									
								
								example/explorer.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,107 @@
 | 
			
		|||
<html>
 | 
			
		||||
  <head>
 | 
			
		||||
    <link rel="stylesheet" href="./assets/css/axist.min.css" />
 | 
			
		||||
    <link rel="stylesheet" href="./assets/css/style.css" />
 | 
			
		||||
  </head>
 | 
			
		||||
  <body>
 | 
			
		||||
    <script src="./../dist/xrfragment.js"></script>
 | 
			
		||||
		<script>
 | 
			
		||||
		  var DOMReady = function(a,b,c){b=document,c='addEventListener';b[c]?b[c]('DOMContentLoaded',a):window.attachEvent('onload',a)}
 | 
			
		||||
 | 
			
		||||
		  DOMReady(function () {
 | 
			
		||||
 | 
			
		||||
				let XRF = xrfragment;
 | 
			
		||||
				let $   = (e) => document.querySelector(e)
 | 
			
		||||
				
 | 
			
		||||
				log = (str) => {
 | 
			
		||||
					$("#console").innerHTML    =  JSON.stringify(str, null, 2)
 | 
			
		||||
					$("#console").style.border = "10px solid #"+ ((1 << 24) * Math.random() | 0).toString(16).padStart(6, "0")+"66";
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				let update = () => {
 | 
			
		||||
				  let result = {}
 | 
			
		||||
					XRF.Parser.parse( $('#fragment').value, $('#value').value, result );
 | 
			
		||||
					log(result)	
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				$("#fragment").addEventListener("change", (e) => {
 | 
			
		||||
					let opt = e.target.options[ e.target.selectedIndex ]
 | 
			
		||||
					$('#value').value = opt.getAttribute("x")
 | 
			
		||||
					update()
 | 
			
		||||
			  })
 | 
			
		||||
				
 | 
			
		||||
				$('#value').addEventListener("change", update )
 | 
			
		||||
				$('#value').addEventListener("keyup", update )
 | 
			
		||||
				
 | 
			
		||||
				addEventListener("hashchange", (e) => log( XRF.URI.parse( document.location.href, true ) ) );
 | 
			
		||||
 | 
			
		||||
				if( document.location.hash.length < 2 ) document.location.hash = "#t=1,100"
 | 
			
		||||
 | 
			
		||||
		 	})
 | 
			
		||||
 | 
			
		||||
		</script>
 | 
			
		||||
		<section id="forms">
 | 
			
		||||
       <form>
 | 
			
		||||
         <fieldset>
 | 
			
		||||
           <p>
 | 
			
		||||
		 				<table>
 | 
			
		||||
		 					<tr>
 | 
			
		||||
		 						<td width="200">
 | 
			
		||||
		 							<label for="fragment">Property in 3D file</label>
 | 
			
		||||
		 							<br><br>
 | 
			
		||||
		 							<select id="fragment" class="w-100">
 | 
			
		||||
                    <optgroup label="default / predefined view">
 | 
			
		||||
		 									<option x="pos=0,0,1&fov=2">#</option>
 | 
			
		||||
		 									<option x="">#mypredefinedview</option>
 | 
			
		||||
                    </optgroup>
 | 
			
		||||
                    <optgroup label="tagging / lazyloading content">
 | 
			
		||||
		 									<option x="foo">tag</option>
 | 
			
		||||
		 									<option x="./2.gtlf">src</option>
 | 
			
		||||
		 								</optgroup>
 | 
			
		||||
		 								<optgroup label="href navigation / portals / teleporting">
 | 
			
		||||
		 									<option x="1,2,0">pos</option>
 | 
			
		||||
		 									<option x="1,2,3">rot</option>
 | 
			
		||||
		 									<option x="3.gltf#q=.kitchen">href</option>
 | 
			
		||||
		 								</optgroup>
 | 
			
		||||
		 								<optgroup label="animation">
 | 
			
		||||
		 									<option x="1,200">t</option>
 | 
			
		||||
		 								</optgroup>
 | 
			
		||||
		 								<optgroup label="device / viewport settings">
 | 
			
		||||
		 									<option x="1,100">clip</option>
 | 
			
		||||
		 									<option x="45">fov</option>
 | 
			
		||||
		 								</optgroup>
 | 
			
		||||
		 								<optgroup label="author / metadata">
 | 
			
		||||
		 									<option x="XXX">namespace</option>
 | 
			
		||||
		 									<option x="GPL-3.0-or-later">SPFX</option>
 | 
			
		||||
		 									<option x="1m">unit</option>
 | 
			
		||||
		 									<option x="this is an example scene">description</option>
 | 
			
		||||
		 								</optgroup>
 | 
			
		||||
		 								<optgroup label="multiparty">
 | 
			
		||||
		 									<option x="matrix://matrix.org/#myroom&room.key=123">src_session</option>
 | 
			
		||||
		 								</optgroup>
 | 
			
		||||
		 							</select>
 | 
			
		||||
		 						</td>
 | 
			
		||||
		 						<td style="text-align:left">
 | 
			
		||||
		 							<label for="value">Value</label>
 | 
			
		||||
		 							<br><br>
 | 
			
		||||
		 							<input id="value" class="w-100" type="text" value=".summer -.winter cube" placeholder="" >
 | 
			
		||||
		 						</td>
 | 
			
		||||
		 					</tr>
 | 
			
		||||
		 					<tr>
 | 
			
		||||
		 						<td colspan="2" style="border=bottom:none;" class="small">
 | 
			
		||||
		 							<br><br>
 | 
			
		||||
                  You can test 👩 NAVIGATOR-enabled fragments (<i>#t=1,200</i> or <i>#fog=2m|FFAABB</i>) by updating the url.<br> For more info see <a href="https://coderofsalvation.github.io/xrfragment/#List%20of%20fragments" target="_blank">the docs</a><br><br>
 | 
			
		||||
		 						</td>
 | 
			
		||||
		 					</tr>
 | 
			
		||||
		 				</table>
 | 
			
		||||
           </p>
 | 
			
		||||
		 			<p>
 | 
			
		||||
             <label for="console">parser output:</label>
 | 
			
		||||
		 				<br><br>
 | 
			
		||||
             <textarea id="console" style="width:100%;height:50vh;" placeholder="" class="w-100"></textarea>
 | 
			
		||||
           </p>
 | 
			
		||||
         </fieldset>
 | 
			
		||||
       </form>
 | 
			
		||||
     </section>
 | 
			
		||||
  </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										1
									
								
								example/godot
									
										
									
									
									
										Submodule
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
Subproject commit 4354ca93987dde9a20efb880b0be9e17b3761a3e
 | 
			
		||||
							
								
								
									
										2
									
								
								example/matrix/dist/matrix-crtd.js
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										37
									
								
								example/matrix/dist/matrix-crtd.js.LICENSE.txt
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
/*!
 | 
			
		||||
 * The buffer module from node.js, for the browser.
 | 
			
		||||
 *
 | 
			
		||||
 * @author   Feross Aboukhadijeh <https://feross.org>
 | 
			
		||||
 * @license  MIT
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * content-type
 | 
			
		||||
 * Copyright(c) 2015 Douglas Christopher Wilson
 | 
			
		||||
 * MIT Licensed
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/*! *****************************************************************************
 | 
			
		||||
Copyright (c) Microsoft Corporation.
 | 
			
		||||
 | 
			
		||||
Permission to use, copy, modify, and/or distribute this software for any
 | 
			
		||||
purpose with or without fee is hereby granted.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
 | 
			
		||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 | 
			
		||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
 | 
			
		||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 | 
			
		||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
 | 
			
		||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 | 
			
		||||
PERFORMANCE OF THIS SOFTWARE.
 | 
			
		||||
***************************************************************************** */
 | 
			
		||||
 | 
			
		||||
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
 | 
			
		||||
 | 
			
		||||
/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
 | 
			
		||||
 | 
			
		||||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
 | 
			
		||||
 | 
			
		||||
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
 | 
			
		||||
 | 
			
		||||
/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
 | 
			
		||||
							
								
								
									
										6
									
								
								example/matrix/make
									
										
									
									
									
										Executable file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
version=v30.3.0
 | 
			
		||||
 | 
			
		||||
test -f ${version}.zip || wget https://github.com/matrix-org/matrix-js-sdk/archive/refs/tags/${version}.zip
 | 
			
		||||
test -d node_modules   || npm install
 | 
			
		||||
cat 
 | 
			
		||||
							
								
								
									
										28
									
								
								example/model-viewer/index.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
  <head>
 | 
			
		||||
    <title><model-viewer> template</title>
 | 
			
		||||
    <meta charset="utf-8" />
 | 
			
		||||
    <meta name="description" content="<model-viewer> template" />
 | 
			
		||||
    <meta name="viewport" content="width=device-width, initial-scale=1" />
 | 
			
		||||
  </head>
 | 
			
		||||
  <body style="overflow:hidden; padding:10%">
 | 
			
		||||
 | 
			
		||||
    <h1><model-viewer> example</h1>
 | 
			
		||||
    <br><br>
 | 
			
		||||
 | 
			
		||||
    <model-viewer
 | 
			
		||||
      src="./../assets/index.glb"
 | 
			
		||||
      ar alt="XR Fragments demo scene"camera-controls touch-action="none" disable-tap
 | 
			
		||||
      field-of-view="80deg" min-field-of-view="25deg" max-field-of-view="100deg" 
 | 
			
		||||
      interpolation-decay="200" camera-target="0m 0m 0m" min-camera-orbit="0.1% 0.1% 0.1%" 
 | 
			
		||||
      style="width:66vw; height: 66vh; border-radius:5px; border:1px solid #CCC"
 | 
			
		||||
    >
 | 
			
		||||
    </model-viewer>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <script src="./../../dist/xrfragment.model-viewer.js"></script>
 | 
			
		||||
    <script src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.4.0/model-viewer.min.js" type="module"></script>
 | 
			
		||||
 | 
			
		||||
  </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										266
									
								
								example/three/parser_only/index.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,266 @@
 | 
			
		|||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
	<head>
 | 
			
		||||
		<title>three.js vr - sandbox</title>
 | 
			
		||||
		<meta charset="utf-8">
 | 
			
		||||
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
 | 
			
		||||
    <link rel="stylesheet" href="./../../assets/axist.min.css" />
 | 
			
		||||
		<link type="text/css" rel="stylesheet" href="main.css">
 | 
			
		||||
    <link type="text/css" rel="stylesheet" href="./../../assets/style.css"/>
 | 
			
		||||
	</head>
 | 
			
		||||
	<body>
 | 
			
		||||
    <div id="overlay">
 | 
			
		||||
      <img src="./../../assets/logo.png" class="logo"/>
 | 
			
		||||
			<input type="submit" value="load 3D asset"></input>
 | 
			
		||||
			<input type="text" list="urls" value="./example/asset/example1.gltf"/>
 | 
			
		||||
			<datalist id="urls" x-data="{ urls: ['./example/asset/example1.gltf'] }" >
 | 
			
		||||
				 <template x-for="url in urls">
 | 
			
		||||
						<option x-text="url"></option>
 | 
			
		||||
				</template>
 | 
			
		||||
			</datalist>
 | 
			
		||||
    </div>
 | 
			
		||||
		<textarea style="display:none"></textarea>
 | 
			
		||||
		
 | 
			
		||||
		<script async src="./../../assets/alpine.min.js"></script>
 | 
			
		||||
		<!-- Import maps polyfill -->
 | 
			
		||||
		<!-- Remove this when import maps will be widely supported -->
 | 
			
		||||
		<script async src="https://unpkg.com/es-module-shims@1.6.3/dist/es-module-shims.js"></script>
 | 
			
		||||
		<script type="importmap">
 | 
			
		||||
			{
 | 
			
		||||
				"imports": {
 | 
			
		||||
					"three": "https://unpkg.com/three@0.151.3/build/three.module.js",
 | 
			
		||||
					"three/addons/": "https://unpkg.com/three@0.151.3/examples/jsm/"
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		</script>
 | 
			
		||||
 | 
			
		||||
		<script type="module">
 | 
			
		||||
			import * as THREE from 'three';
 | 
			
		||||
 | 
			
		||||
			import xrfragment from './../../../dist/xrfragment.module.js';
 | 
			
		||||
			import { loadFile, setupConsole }   from './../../assets/utils.js';
 | 
			
		||||
			import { RGBELoader } from 'three/addons/loaders/RGBELoader.js';
 | 
			
		||||
			import { Lensflare, LensflareElement } from 'three/addons/objects/Lensflare.js';
 | 
			
		||||
			import { BoxLineGeometry } from 'three/addons/geometries/BoxLineGeometry.js';
 | 
			
		||||
			import { Reflector } from 'three/addons/objects/Reflector.js';
 | 
			
		||||
			import { VRButton } from 'three/addons/webxr/VRButton.js';
 | 
			
		||||
			import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
 | 
			
		||||
			import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js';
 | 
			
		||||
			import { InteractiveGroup } from 'three/addons/interactive/InteractiveGroup.js';
 | 
			
		||||
			import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js';
 | 
			
		||||
			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 | 
			
		||||
			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 | 
			
		||||
			import Stats from 'three/addons/libs/stats.module.js';
 | 
			
		||||
 | 
			
		||||
			let camera, scene, renderer, controls;
 | 
			
		||||
			let reflector;
 | 
			
		||||
			let stats, statsMesh;
 | 
			
		||||
 | 
			
		||||
			const parameters = {
 | 
			
		||||
				env: 1.0,
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			init();
 | 
			
		||||
			animate();
 | 
			
		||||
 | 
			
		||||
			function init() {
 | 
			
		||||
 | 
			
		||||
				scene = new THREE.Scene();
 | 
			
		||||
				scene.background = new THREE.Color( 0xcccccc );
 | 
			
		||||
 | 
			
		||||
				camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 0.1, 2000 );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
				let model;
 | 
			
		||||
				const loader = new GLTFLoader().setPath( './../../assets/')
 | 
			
		||||
				let loadGLTF = function ( gltf ) {
 | 
			
		||||
					if( model ){ 
 | 
			
		||||
						scene.remove(model)
 | 
			
		||||
						//model.dispose()
 | 
			
		||||
					}
 | 
			
		||||
					gltf.scene.position.y = 1.5
 | 
			
		||||
					gltf.scene.position.z = -4
 | 
			
		||||
					gltf.scene.rotation.y = -0.5
 | 
			
		||||
					gltf.scene.scale.x = gltf.scene.scale.y = gltf.scene.scale.z = 1;
 | 
			
		||||
 | 
			
		||||
					const maxAnisotropy = renderer.capabilities.getMaxAnisotropy();
 | 
			
		||||
					function recursivelySetChildrenUnlit(mesh,cb) {
 | 
			
		||||
							cb(mesh)
 | 
			
		||||
							if (mesh.children) {
 | 
			
		||||
									for (var i = 0; i < mesh.children.length; i++) {
 | 
			
		||||
											recursivelySetChildrenUnlit(mesh.children[i],cb);
 | 
			
		||||
									}
 | 
			
		||||
							}
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					let XRF = xrfragment;
 | 
			
		||||
          XRF.Parser.debug= true;
 | 
			
		||||
 | 
			
		||||
					gltf.scene.traverse( (mesh) => {
 | 
			
		||||
						if( mesh.userData ){
 | 
			
		||||
							let frag = {}
 | 
			
		||||
							for( let k in mesh.userData ) XRF.Parser.parse( k, mesh.userData[k], frag )
 | 
			
		||||
							if( Object.keys(frag).length > 0 ){
 | 
			
		||||
								for( let k in frag ){
 | 
			
		||||
									if( k == "env" ){
 | 
			
		||||
										console.dir(frag[k])
 | 
			
		||||
										let env = mesh.getObjectByName(frag[k].string)
 | 
			
		||||
										env.material.map.mapping = THREE.EquirectangularReflectionMapping;
 | 
			
		||||
										scene.environment = env.material.map
 | 
			
		||||
										scene.texture = env.material.map
 | 
			
		||||
										renderer.toneMapping = THREE.ACESFilmicToneMapping;
 | 
			
		||||
										renderer.toneMappingExposure = 1;
 | 
			
		||||
									}
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						if (mesh instanceof THREE.Mesh) {
 | 
			
		||||
						  if (mesh.material && mesh.material.map) {
 | 
			
		||||
								// turn unlit
 | 
			
		||||
						  	//mesh.material = new THREE.MeshBasicMaterial({ map: mesh.material.map });
 | 
			
		||||
						  	//mesh.material.dithering = true
 | 
			
		||||
						  	//mesh.material.map.anisotropy = maxAnisotropy;
 | 
			
		||||
						  }
 | 
			
		||||
						}
 | 
			
		||||
					})
 | 
			
		||||
 | 
			
		||||
					scene.add( model = gltf.scene );
 | 
			
		||||
 | 
			
		||||
					render();
 | 
			
		||||
 | 
			
		||||
				};
 | 
			
		||||
				loader.load( 'example1.gltf', loadGLTF ); 
 | 
			
		||||
 | 
			
		||||
				//const torusGeometry = new THREE.TorusKnotGeometry( ...Object.values( parameters ) );
 | 
			
		||||
 | 
			
		||||
				renderer = new THREE.WebGLRenderer( { antialias: true } );
 | 
			
		||||
				renderer.autoClear = false;
 | 
			
		||||
				renderer.setPixelRatio( window.devicePixelRatio );
 | 
			
		||||
				renderer.setSize( window.innerWidth, window.innerHeight );
 | 
			
		||||
				renderer.outputEncoding = THREE.sRGBEncoding;
 | 
			
		||||
				renderer.xr.enabled = true;
 | 
			
		||||
        renderer.domElement.className = "render"
 | 
			
		||||
				document.body.appendChild( renderer.domElement );
 | 
			
		||||
 | 
			
		||||
				document.body.appendChild( VRButton.createButton( renderer ) );
 | 
			
		||||
 | 
			
		||||
				window.addEventListener( 'resize', onWindowResize );
 | 
			
		||||
 | 
			
		||||
				// setup mouse controls
 | 
			
		||||
				controls = new OrbitControls( camera, renderer.domElement );
 | 
			
		||||
				controls.listenToKeyEvents( window ); // optional
 | 
			
		||||
				controls.enableDamping = true; // an animation loop is required when either damping or auto-rotation are enabled
 | 
			
		||||
				controls.dampingFactor = 0.1;
 | 
			
		||||
 | 
			
		||||
				controls.screenSpacePanning = false;
 | 
			
		||||
 | 
			
		||||
				controls.minDistance = 0.1;
 | 
			
		||||
				controls.maxDistance = 5000;
 | 
			
		||||
				controls.maxPolarAngle = Math.PI / 2;
 | 
			
		||||
				controls.target = new THREE.Vector3(0,1.6,0)
 | 
			
		||||
 | 
			
		||||
				camera.position.set( 0, 1.6, 1.5 );
 | 
			
		||||
				controls.update()
 | 
			
		||||
 | 
			
		||||
				const geometry = new THREE.BufferGeometry();
 | 
			
		||||
				geometry.setFromPoints( [ new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 0, - 5 ) ] );
 | 
			
		||||
 | 
			
		||||
				const controller1 = renderer.xr.getController( 0 );
 | 
			
		||||
				controller1.add( new THREE.Line( geometry ) );
 | 
			
		||||
				scene.add( controller1 );
 | 
			
		||||
 | 
			
		||||
				const controller2 = renderer.xr.getController( 1 );
 | 
			
		||||
				controller2.add( new THREE.Line( geometry ) );
 | 
			
		||||
				scene.add( controller2 );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
				const controllerModelFactory = new XRControllerModelFactory();
 | 
			
		||||
 | 
			
		||||
				const controllerGrip1 = renderer.xr.getControllerGrip( 0 );
 | 
			
		||||
				controllerGrip1.add( controllerModelFactory.createControllerModel( controllerGrip1 ) );
 | 
			
		||||
				scene.add( controllerGrip1 );
 | 
			
		||||
 | 
			
		||||
				const controllerGrip2 = renderer.xr.getControllerGrip( 1 );
 | 
			
		||||
				controllerGrip2.add( controllerModelFactory.createControllerModel( controllerGrip2 ) );
 | 
			
		||||
				scene.add( controllerGrip2 );
 | 
			
		||||
 | 
			
		||||
        setupConsole( document.querySelector('textarea') )
 | 
			
		||||
 | 
			
		||||
				// GUI
 | 
			
		||||
 | 
			
		||||
				function onChange() {
 | 
			
		||||
						renderer.toneMappingExposure = parameters.env;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				const gui = new GUI( { width: 300 } );
 | 
			
		||||
				gui.add( parameters, 'env', 0.2, 3.0, 0.1 ).onChange( onChange );
 | 
			
		||||
				gui.domElement.style.visibility = 'hidden';
 | 
			
		||||
 | 
			
		||||
				const group = new InteractiveGroup( renderer, camera );
 | 
			
		||||
				scene.add( group );
 | 
			
		||||
 | 
			
		||||
				const mesh = new HTMLMesh( gui.domElement );
 | 
			
		||||
				mesh.position.x = - 0.75;
 | 
			
		||||
				mesh.position.y = 1.5;
 | 
			
		||||
				mesh.position.z = 0.3;
 | 
			
		||||
				mesh.rotation.y = Math.PI / 4;
 | 
			
		||||
				mesh.scale.setScalar( 2 );
 | 
			
		||||
				group.add( mesh );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
				// Add stats.js
 | 
			
		||||
				stats = new Stats();
 | 
			
		||||
				stats.dom.style.width = '80px';
 | 
			
		||||
				stats.dom.style.height = '48px';
 | 
			
		||||
				document.body.appendChild( stats.dom );
 | 
			
		||||
 | 
			
		||||
				statsMesh = new HTMLMesh( stats.dom );
 | 
			
		||||
				statsMesh.position.x = - 0.75;
 | 
			
		||||
				statsMesh.position.y = 2;
 | 
			
		||||
				statsMesh.position.z = 0.3;
 | 
			
		||||
				statsMesh.rotation.y = Math.PI / 4;
 | 
			
		||||
				statsMesh.scale.setScalar( 2.5 );
 | 
			
		||||
				group.add( statsMesh );
 | 
			
		||||
 | 
			
		||||
				let fileLoaders = loadFile({
 | 
			
		||||
					".gltf": (file) => file.arrayBuffer().then( (data) => loader.parse( data, '', loadGLTF, console.error ) ),
 | 
			
		||||
					".glb":  (file) => file.arrayBuffer().then( (data) => loader.parse( data, '', loadGLTF, console.error ) )
 | 
			
		||||
				})
 | 
			
		||||
				document.querySelector("#overlay > input[type=submit]").addEventListener("click", fileLoaders )
 | 
			
		||||
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			function onWindowResize() {
 | 
			
		||||
 | 
			
		||||
				camera.aspect = window.innerWidth / window.innerHeight;
 | 
			
		||||
				camera.updateProjectionMatrix();
 | 
			
		||||
 | 
			
		||||
				renderer.setSize( window.innerWidth, window.innerHeight );
 | 
			
		||||
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			function animate() {
 | 
			
		||||
 | 
			
		||||
				renderer.setAnimationLoop( render );
 | 
			
		||||
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			function render() {
 | 
			
		||||
 | 
			
		||||
				const time = performance.now() * 0.0002;
 | 
			
		||||
				//const torus = scene.getObjectByName( 'torus' );
 | 
			
		||||
				//torus.rotation.x = time * 0.4;
 | 
			
		||||
				//torus.rotation.y = time;
 | 
			
		||||
 | 
			
		||||
				controls.update()
 | 
			
		||||
				renderer.render( scene, camera );
 | 
			
		||||
				stats.update();
 | 
			
		||||
 | 
			
		||||
				// Canvas elements doesn't trigger DOM updates, so we have to update the texture
 | 
			
		||||
				statsMesh.material.map.update();
 | 
			
		||||
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		</script>
 | 
			
		||||
	</body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										91
									
								
								example/three/parser_only/main.css
									
										
									
									
									
										Normal file
									
								
							
							
						
						| 
						 | 
				
			
			@ -0,0 +1,91 @@
 | 
			
		|||
body {
 | 
			
		||||
	margin: 0;
 | 
			
		||||
	background-color: #000;
 | 
			
		||||
	color: #fff;
 | 
			
		||||
	font-family: Monospace;
 | 
			
		||||
	font-size: 13px;
 | 
			
		||||
	line-height: 24px;
 | 
			
		||||
	overscroll-behavior: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
a {
 | 
			
		||||
	color: #ff0;
 | 
			
		||||
	text-decoration: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
a:hover {
 | 
			
		||||
	text-decoration: underline;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button {
 | 
			
		||||
	cursor: pointer;
 | 
			
		||||
	text-transform: uppercase;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#info {
 | 
			
		||||
	position: absolute;
 | 
			
		||||
	top: 0px;
 | 
			
		||||
	width: 100%;
 | 
			
		||||
	padding: 10px;
 | 
			
		||||
	box-sizing: border-box;
 | 
			
		||||
	text-align: center;
 | 
			
		||||
	-moz-user-select: none;
 | 
			
		||||
	-webkit-user-select: none;
 | 
			
		||||
	-ms-user-select: none;
 | 
			
		||||
	user-select: none;
 | 
			
		||||
	pointer-events: none;
 | 
			
		||||
	z-index: 1; /* TODO Solve this in HTML */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
a, button, input, select {
 | 
			
		||||
	pointer-events: auto;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.lil-gui {
 | 
			
		||||
	z-index: 2 !important; /* TODO Solve this in HTML */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@media all and ( max-width: 640px ) {
 | 
			
		||||
	.lil-gui.root { 
 | 
			
		||||
		right: auto;
 | 
			
		||||
		top: auto;
 | 
			
		||||
		max-height: 50%;
 | 
			
		||||
		max-width: 80%;
 | 
			
		||||
		bottom: 0;
 | 
			
		||||
		left: 0;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#overlay {
 | 
			
		||||
	position: absolute;
 | 
			
		||||
	font-size: 16px;
 | 
			
		||||
	z-index: 2;
 | 
			
		||||
	top: 0;
 | 
			
		||||
	left: 0;
 | 
			
		||||
	width: 100%;
 | 
			
		||||
	height: 100%;
 | 
			
		||||
	display: flex;
 | 
			
		||||
	align-items: center;
 | 
			
		||||
	justify-content: center;
 | 
			
		||||
	flex-direction: column;
 | 
			
		||||
	background: rgba(0,0,0,0.7);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
	#overlay button {
 | 
			
		||||
		background: transparent;
 | 
			
		||||
		border: 0;
 | 
			
		||||
		border: 1px solid rgb(255, 255, 255);
 | 
			
		||||
		border-radius: 4px;
 | 
			
		||||
		color: #ffffff;
 | 
			
		||||
		padding: 12px 18px;
 | 
			
		||||
		text-transform: uppercase;
 | 
			
		||||
		cursor: pointer;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#notSupported {
 | 
			
		||||
	width: 50%;
 | 
			
		||||
	margin: auto;
 | 
			
		||||
	background-color: #f00;
 | 
			
		||||
	margin-top: 20px;
 | 
			
		||||
	padding: 10px;
 | 
			
		||||
}
 | 
			
		||||