├── .gitignore ├── LICENSE.txt ├── README.md ├── dist ├── README.md ├── RiverTrail.js └── RiverTrail.min.js ├── examples ├── Bugs │ ├── LICENSE.txt │ ├── animations │ │ ├── butterfly │ │ │ ├── butterflyfly01.png │ │ │ ├── butterflyfly02.png │ │ │ ├── butterflyfly03.png │ │ │ ├── butterflyfly04.png │ │ │ ├── butterflyfly05.png │ │ │ ├── butterflyfly06.png │ │ │ ├── butterflysitting01.png │ │ │ ├── butterflysitting02.png │ │ │ ├── butterflysitting03.png │ │ │ ├── butterflysitting04.png │ │ │ ├── butterflysitting05.png │ │ │ └── butterflysitting06.png │ │ ├── flyAndSpiderweb │ │ │ ├── fly01.png │ │ │ ├── fly02.png │ │ │ └── spiderweb.png │ │ ├── frogAndLadybug │ │ │ ├── frogeat201.png │ │ │ ├── frogeat202.png │ │ │ ├── frogeat203.png │ │ │ ├── frogeat204.png │ │ │ ├── frogeat205.png │ │ │ ├── frogeat206.png │ │ │ ├── frogeat207.png │ │ │ ├── frogeat208.png │ │ │ ├── frogeat209.png │ │ │ ├── frogeat210.png │ │ │ ├── frogeat211.png │ │ │ ├── frogeat212.png │ │ │ ├── frogsitting01.png │ │ │ ├── frogsitting02.png │ │ │ ├── frogsitting03.png │ │ │ ├── frogsitting04.png │ │ │ ├── frogsitting05.png │ │ │ ├── frogsitting06.png │ │ │ ├── frogsitting07.png │ │ │ ├── frogsitting08.png │ │ │ └── frogsitting09.png │ │ ├── frogLadybugButterfly0814 │ │ │ ├── butterflycheering01.png │ │ │ ├── butterflycheering02.png │ │ │ ├── butterflycheering03.png │ │ │ ├── butterflycheering04.png │ │ │ ├── butterflycheering05.png │ │ │ ├── butterflycheering06.png │ │ │ ├── froggoofy01.png │ │ │ ├── froggoofy02.png │ │ │ ├── froggoofy03.png │ │ │ ├── froggoofy04.png │ │ │ ├── froggoofy05.png │ │ │ ├── froggoofy06.png │ │ │ ├── froggoofy07.png │ │ │ ├── froggoofy08.png │ │ │ ├── froggoofy09.png │ │ │ ├── ladybugcheering01.png │ │ │ ├── ladybugcheering02.png │ │ │ ├── ladybugcheering03.png │ │ │ ├── ladybugcheering04.png │ │ │ ├── ladybugcheering05.png │ │ │ ├── ladybugcheering06.png │ │ │ ├── ladybugtopview01.png │ │ │ ├── ladybugtopview02.png │ │ │ ├── ladybugtopview03.png │ │ │ ├── ladybugtopview04.png │ │ │ ├── ladybugtopview05.png │ │ │ └── ladybugtopview06.png │ │ ├── frogeat01.png │ │ ├── frogeat02.png │ │ ├── frogeat03.png │ │ ├── frogeat04.png │ │ ├── frogeat05.png │ │ ├── frogeat06.png │ │ ├── frogeat07.png │ │ ├── frogeat08.png │ │ ├── frogeat09.png │ │ ├── frogeat10.png │ │ ├── frogeat11.png │ │ ├── frogeat12.png │ │ ├── green_hornet_T.png │ │ ├── jungleframe.png │ │ ├── ladybugfly01.png │ │ ├── ladybugfly02.png │ │ ├── ladybugfly03.png │ │ ├── ladybugfly04.png │ │ ├── ladybugfly05.png │ │ ├── ladybugfly06.png │ │ ├── ladybughome.png │ │ ├── spidercrawl01.png │ │ ├── spidercrawl02.png │ │ ├── spidercrawl03.png │ │ ├── spidercrawl04.png │ │ ├── spidercrawl05.png │ │ ├── spidercrawl06.png │ │ ├── tongue.png │ │ └── tongue2.png │ ├── index.html │ ├── pjs │ │ ├── game │ │ │ ├── Butterfly.js │ │ │ ├── Critter.js │ │ │ ├── Flower.js │ │ │ ├── Fly.js │ │ │ ├── Frog.js │ │ │ ├── GameUtils.js │ │ │ ├── Lady.js │ │ │ ├── Leaderboard.js │ │ │ ├── List.js │ │ │ ├── Primitives.js │ │ │ ├── Render.js │ │ │ ├── Sound.js │ │ │ ├── Spider.js │ │ │ ├── Vector.js │ │ │ ├── logo.png │ │ │ ├── main.js │ │ │ └── utils.js │ │ └── lib │ │ │ ├── cv │ │ │ ├── DenseOpticalFlowManager.js │ │ │ ├── DenseOpticalFlowManagerSeq.js │ │ │ ├── DotsManager.js │ │ │ ├── EdgeManager.js │ │ │ ├── ImageManager.js │ │ │ ├── JSArray.js │ │ │ ├── OpticalFlowFarneback.js │ │ │ ├── OpticalFlowFarnebackSeq.js │ │ │ ├── PAUtils.js │ │ │ ├── ScalingEdgeManager.js │ │ │ ├── convertColor.js │ │ │ ├── convertColorSeq.js │ │ │ ├── convolution-vec.js │ │ │ ├── convolution.js │ │ │ ├── convolutionSeq.js │ │ │ ├── dots.js │ │ │ ├── resizeImage.js │ │ │ ├── resizeImageSeq.js │ │ │ └── timer.js │ │ │ ├── cvincludes.sh │ │ │ └── pjsincludes.sh │ └── sounds │ │ └── new │ │ ├── .LICENSE.txt.swp │ │ ├── LICENSE.txt │ │ ├── aww.wav │ │ ├── cheer.wav │ │ ├── eat.wav │ │ ├── giggles.wav │ │ ├── smallcrowd.wav │ │ └── squelch.wav ├── ProceduralTerrain │ ├── README.txt │ ├── index.html │ └── renderWorld.js ├── idf-demo │ ├── Config.js │ ├── Index.html │ ├── NBody.js │ ├── README.txt │ ├── Render.js │ ├── Setup.js │ ├── contrib │ │ ├── Three.js │ │ └── glMatrix-0.9.5.js │ ├── images │ │ ├── jupiter.jpg │ │ ├── moon.jpg │ │ ├── particle.png │ │ ├── ship-back.png │ │ ├── ship-down.png │ │ ├── ship-front.png │ │ ├── ship-left.png │ │ ├── ship-right.png │ │ ├── ship-up.png │ │ ├── tunnel_gradient.png │ │ ├── tunnel_gradient_tall.png │ │ └── tunnel_gradient_wide.png │ └── nbodyGLDisplay.js ├── liquid-resize │ ├── resize-compute-dp.js │ ├── resize-compute-js.js │ ├── resize-control.js │ ├── resize-demo.html │ ├── tower.jpg │ └── towerImageLicense.txt ├── mandelbrot-explore │ ├── mandelbrot.html │ └── mandelbrot.js ├── mandelbrot │ ├── mandelbrot.html │ └── mandelbrot.js └── nbody-webgl │ ├── NBody.html │ ├── NBody.js │ ├── contrib │ └── glMatrix-0.9.5.js │ └── nbodyGLDisplay.js ├── extension ├── README.md ├── data │ ├── prefs.html │ └── prefs.js ├── lib │ ├── CLTypes.js │ ├── Constants.js │ ├── Debug.js │ ├── OpenCL.js │ ├── Platforms.js │ ├── RiverTrailInterface.js │ └── main.js ├── package.json └── test │ └── test-main.js ├── jslib ├── Gruntfile.js ├── ParallelArray.js ├── README.md ├── jit │ ├── compiler │ │ ├── definitions.js │ │ ├── dotviz.js │ │ ├── driver.js │ │ ├── genOCL.js │ │ ├── helper.js │ │ ├── inferblockflow.js │ │ ├── infermem.js │ │ ├── rangeanalysis.js │ │ ├── runOCL.js │ │ ├── runtimes.js │ │ └── typeinference.js │ └── narcissus │ │ ├── jsdecomp.js │ │ ├── jsdefs.js │ │ ├── jslex.js │ │ └── jsparse.js ├── package.json ├── pre-commit ├── test.html └── tests.js └── tutorial ├── css ├── pygment_trac.css ├── shCoreDefault.css ├── shThemeDefault.css └── stylesheet.css ├── images ├── 3d1.png ├── 3d42-all.png ├── 42.png ├── bg_hr.png ├── blacktocat.png ├── convolution2.png ├── convolution4.png ├── ed1.png ├── gray-play-license.txt ├── gray-play.svg ├── imgdata.png ├── pacanvas1.png ├── se1.png ├── se2.png └── skeleton3.png ├── index.html ├── js ├── MIT-LICENSE ├── XRegExp.js ├── licenses.txt ├── shBrushJScript.js └── shCore.js └── src ├── complete ├── filters.js ├── index.html └── main.js ├── css ├── Jquery-ui-LICENSE.txt └── ui-darkness │ ├── images │ ├── ui-bg_flat_30_cccccc_40x100.png │ ├── ui-bg_flat_50_5c5c5c_40x100.png │ ├── ui-bg_glass_20_555555_1x400.png │ ├── ui-bg_glass_40_0078a3_1x400.png │ ├── ui-bg_glass_40_ffc73d_1x400.png │ ├── ui-bg_gloss-wave_25_333333_500x100.png │ ├── ui-bg_highlight-soft_80_eeeeee_1x100.png │ ├── ui-bg_inset-soft_25_000000_1x100.png │ ├── ui-bg_inset-soft_30_f58400_1x100.png │ ├── ui-icons_222222_256x240.png │ ├── ui-icons_4b8e0b_256x240.png │ ├── ui-icons_a83300_256x240.png │ ├── ui-icons_cccccc_256x240.png │ └── ui-icons_ffffff_256x240.png │ └── jquery-ui-1.8.22.custom.css ├── filters-skeleton.js ├── index.html ├── js ├── JQuery-LICENSE.txt ├── Jquery-ui-LICENSE.txt ├── jquery-1.7.2.min.js └── jquery-ui-1.8.22.custom.min.js ├── main-skeleton.js └── media ├── 3d.png ├── LICENSES.txt ├── README.md └── img7.jpg /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The files found in the directory .\jslib\jit\Narcissus, 2 | .\examples\nbody-webgl\contrib and .\examples\idf-demo\contrib 3 | are included as a convenience and are provided under the licenses 4 | contained in their respective files. 5 | 6 | Other files found below this directory are provided under the following 7 | license. 8 | 9 | Copyright (c) 2011-2014, Intel Corporation 10 | All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | - Redistributions of source code must retain the above copyright notice, 15 | this list of conditions and the following disclaimer. 16 | - Redistributions in binary form must reproduce the above copyright notice, 17 | this list of conditions and the following disclaimer in the documentation 18 | and/or other materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 24 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 | THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > :warning: **DISCONTINUATION OF PROJECT** - *This project will no longer be maintained by Intel. This project has been identified as having known security escapes. Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project.* **Intel no longer accepts patches to this project.** 2 | 3 | River Trail 4 | =========== 5 | 6 | River Trail is a JavaScript library and a Firefox add-on that together provide support for **data-parallel programming in JavaScript**, targeting multi-core CPUs, GPUs and vector SSE/AVX instructions. 7 | 8 | Please see the [project wiki](https://github.com/IntelLabs/RiverTrail/wiki) or the [FAQs](https://github.com/IntelLabs/RiverTrail/wiki/Frequently-Asked-Questions) for more details. 9 | 10 | ## Quick Start 11 | 12 | 1. Install [OpenCL](http://www.intel.com/go/opencl). (Mac OS X users can skip this step, since OpenCL is already part of the system.) 13 | 2. Install or open [Firefox](https://www.mozilla.org/en-US/firefox/new/). Important: see the below note about Firefox version requirements. 14 | 3. Install the [River Trail Firefox add-on](https://github.com/IntelLabs/RiverTrail/releases/). 15 | 4. Using Firefox with the River Trail add-on enabled, try one of our [live demos](https://github.com/IntelLabs/RiverTrail/wiki#sample-applications), or the [interactive shell](http://intellabs.github.io/RiverTrail-interactive/)! 16 | 5. A good way to get started with programming with the River Trail API is to go through our [tutorial](http://intellabs.github.io/RiverTrail/tutorial/). 17 | 18 | ## Firefox version requirements 19 | 20 | The final release of River Trail ([v0.35.0](https://github.com/IntelLabs/RiverTrail/releases)) is known to work with Firefox versions 33, 34, and 35. It may work with newer versions of Firefox, but has not been tested. 21 | 22 | Note that River Trail is an unsigned extension. Beginning with Firefox 42, Mozilla began to change their extension security model to require extensions to be [signed through addons.mozilla.org](https://wiki.mozilla.org/Add-ons/Extension_Signing). Extension signing is now mandatory and cannot be overridden for Firefox release and beta channels, but [may be overridden in Firefox nightly and Firefox Developer Edition](https://wiki.mozilla.org/Add-ons/Extension_Signing) by setting the `xpinstall.signatures.required` preference to "false". 23 | -------------------------------------------------------------------------------- /dist/README.md: -------------------------------------------------------------------------------- 1 | # River Trail library distribution files 2 | 3 | The files in this directory are generated from the code in `../jslib`, and are intended to be included in user code, not edited directly. See the `README.md` file in the `../jslib` directory for more information. 4 | -------------------------------------------------------------------------------- /examples/Bugs/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The files in sounds/new/ are redistributed under their respective 2 | licenses as a convenience. See the LICENSE.TXT file in that folder 3 | for their licenses. 4 | 5 | 6 | All other files in this application are distributed under 7 | the following license: 8 | 9 | Copyright (c) 2011-2015, Intel Corporation 10 | All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | - Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | - Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation 19 | and/or other materials provided with the distribution. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 | THE POSSIBILITY OF SUCH DAMAGE. 32 | -------------------------------------------------------------------------------- /examples/Bugs/animations/butterfly/butterflyfly01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/butterfly/butterflyfly01.png -------------------------------------------------------------------------------- /examples/Bugs/animations/butterfly/butterflyfly02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/butterfly/butterflyfly02.png -------------------------------------------------------------------------------- /examples/Bugs/animations/butterfly/butterflyfly03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/butterfly/butterflyfly03.png -------------------------------------------------------------------------------- /examples/Bugs/animations/butterfly/butterflyfly04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/butterfly/butterflyfly04.png -------------------------------------------------------------------------------- /examples/Bugs/animations/butterfly/butterflyfly05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/butterfly/butterflyfly05.png -------------------------------------------------------------------------------- /examples/Bugs/animations/butterfly/butterflyfly06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/butterfly/butterflyfly06.png -------------------------------------------------------------------------------- /examples/Bugs/animations/butterfly/butterflysitting01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/butterfly/butterflysitting01.png -------------------------------------------------------------------------------- /examples/Bugs/animations/butterfly/butterflysitting02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/butterfly/butterflysitting02.png -------------------------------------------------------------------------------- /examples/Bugs/animations/butterfly/butterflysitting03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/butterfly/butterflysitting03.png -------------------------------------------------------------------------------- /examples/Bugs/animations/butterfly/butterflysitting04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/butterfly/butterflysitting04.png -------------------------------------------------------------------------------- /examples/Bugs/animations/butterfly/butterflysitting05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/butterfly/butterflysitting05.png -------------------------------------------------------------------------------- /examples/Bugs/animations/butterfly/butterflysitting06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/butterfly/butterflysitting06.png -------------------------------------------------------------------------------- /examples/Bugs/animations/flyAndSpiderweb/fly01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/flyAndSpiderweb/fly01.png -------------------------------------------------------------------------------- /examples/Bugs/animations/flyAndSpiderweb/fly02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/flyAndSpiderweb/fly02.png -------------------------------------------------------------------------------- /examples/Bugs/animations/flyAndSpiderweb/spiderweb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/flyAndSpiderweb/spiderweb.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogeat201.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogeat201.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogeat202.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogeat202.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogeat203.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogeat203.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogeat204.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogeat204.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogeat205.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogeat205.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogeat206.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogeat206.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogeat207.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogeat207.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogeat208.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogeat208.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogeat209.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogeat209.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogeat210.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogeat210.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogeat211.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogeat211.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogeat212.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogeat212.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogsitting01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogsitting01.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogsitting02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogsitting02.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogsitting03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogsitting03.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogsitting04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogsitting04.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogsitting05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogsitting05.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogsitting06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogsitting06.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogsitting07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogsitting07.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogsitting08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogsitting08.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogAndLadybug/frogsitting09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogAndLadybug/frogsitting09.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/butterflycheering01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/butterflycheering01.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/butterflycheering02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/butterflycheering02.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/butterflycheering03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/butterflycheering03.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/butterflycheering04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/butterflycheering04.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/butterflycheering05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/butterflycheering05.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/butterflycheering06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/butterflycheering06.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/froggoofy01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/froggoofy01.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/froggoofy02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/froggoofy02.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/froggoofy03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/froggoofy03.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/froggoofy04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/froggoofy04.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/froggoofy05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/froggoofy05.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/froggoofy06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/froggoofy06.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/froggoofy07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/froggoofy07.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/froggoofy08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/froggoofy08.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/froggoofy09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/froggoofy09.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/ladybugcheering01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/ladybugcheering01.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/ladybugcheering02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/ladybugcheering02.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/ladybugcheering03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/ladybugcheering03.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/ladybugcheering04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/ladybugcheering04.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/ladybugcheering05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/ladybugcheering05.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/ladybugcheering06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/ladybugcheering06.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/ladybugtopview01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/ladybugtopview01.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/ladybugtopview02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/ladybugtopview02.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/ladybugtopview03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/ladybugtopview03.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/ladybugtopview04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/ladybugtopview04.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/ladybugtopview05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/ladybugtopview05.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogLadybugButterfly0814/ladybugtopview06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogLadybugButterfly0814/ladybugtopview06.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogeat01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogeat01.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogeat02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogeat02.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogeat03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogeat03.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogeat04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogeat04.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogeat05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogeat05.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogeat06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogeat06.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogeat07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogeat07.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogeat08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogeat08.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogeat09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogeat09.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogeat10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogeat10.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogeat11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogeat11.png -------------------------------------------------------------------------------- /examples/Bugs/animations/frogeat12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/frogeat12.png -------------------------------------------------------------------------------- /examples/Bugs/animations/green_hornet_T.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/green_hornet_T.png -------------------------------------------------------------------------------- /examples/Bugs/animations/jungleframe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/jungleframe.png -------------------------------------------------------------------------------- /examples/Bugs/animations/ladybugfly01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/ladybugfly01.png -------------------------------------------------------------------------------- /examples/Bugs/animations/ladybugfly02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/ladybugfly02.png -------------------------------------------------------------------------------- /examples/Bugs/animations/ladybugfly03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/ladybugfly03.png -------------------------------------------------------------------------------- /examples/Bugs/animations/ladybugfly04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/ladybugfly04.png -------------------------------------------------------------------------------- /examples/Bugs/animations/ladybugfly05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/ladybugfly05.png -------------------------------------------------------------------------------- /examples/Bugs/animations/ladybugfly06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/ladybugfly06.png -------------------------------------------------------------------------------- /examples/Bugs/animations/ladybughome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/ladybughome.png -------------------------------------------------------------------------------- /examples/Bugs/animations/spidercrawl01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/spidercrawl01.png -------------------------------------------------------------------------------- /examples/Bugs/animations/spidercrawl02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/spidercrawl02.png -------------------------------------------------------------------------------- /examples/Bugs/animations/spidercrawl03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/spidercrawl03.png -------------------------------------------------------------------------------- /examples/Bugs/animations/spidercrawl04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/spidercrawl04.png -------------------------------------------------------------------------------- /examples/Bugs/animations/spidercrawl05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/spidercrawl05.png -------------------------------------------------------------------------------- /examples/Bugs/animations/spidercrawl06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/spidercrawl06.png -------------------------------------------------------------------------------- /examples/Bugs/animations/tongue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/tongue.png -------------------------------------------------------------------------------- /examples/Bugs/animations/tongue2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/animations/tongue2.png -------------------------------------------------------------------------------- /examples/Bugs/pjs/game/Butterfly.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function ButterflyFly(id) { 4 | var o = new CritterAction(id); 5 | o.tag = "ButterflyFly"; 6 | o.frames = 7 | [ 8 | 'animations/butterfly/butterflyfly01.png', 9 | 'animations/butterfly/butterflyfly02.png', 10 | 'animations/butterfly/butterflyfly03.png', 11 | 'animations/butterfly/butterflyfly04.png', 12 | 'animations/butterfly/butterflyfly05.png', 13 | 'animations/butterfly/butterflyfly06.png', 14 | ]; 15 | o.heli = true; 16 | o.vel = 5*Config.scale; 17 | o.angVel = toRadians(60); 18 | o.move = function(pose) { 19 | pose.theta += getRandom(-this.angVel, this.angVel); 20 | pose.x += this.vel * Math.cos(pose.theta); 21 | pose.y += this.vel * Math.sin(pose.theta); 22 | }; 23 | return o; 24 | } 25 | function ButterflySit(id) { 26 | var o = new CritterAction(id); 27 | o.tag = "ButterflySit"; 28 | o.frames = [ 29 | 'animations/butterfly/butterflysitting01.png', 30 | 'animations/butterfly/butterflysitting01.png', 31 | 'animations/butterfly/butterflysitting01.png', 32 | 'animations/butterfly/butterflysitting01.png', 33 | 'animations/butterfly/butterflysitting02.png', 34 | 'animations/butterfly/butterflysitting02.png', 35 | 'animations/butterfly/butterflysitting02.png', 36 | 'animations/butterfly/butterflysitting02.png', 37 | 'animations/butterfly/butterflysitting03.png', 38 | 'animations/butterfly/butterflysitting03.png', 39 | 'animations/butterfly/butterflysitting03.png', 40 | 'animations/butterfly/butterflysitting03.png', 41 | 'animations/butterfly/butterflysitting02.png', 42 | 'animations/butterfly/butterflysitting02.png', 43 | 'animations/butterfly/butterflysitting02.png', 44 | 'animations/butterfly/butterflysitting02.png', 45 | // '../../animations/butterfly/butterflysitting05.png', 46 | // '../../animations/butterfly/butterflysitting05.png', 47 | // '../../animations/butterfly/butterflysitting05.png', 48 | // '../../animations/butterfly/butterflysitting05.png', 49 | // '../../animations/butterfly/butterflysitting06.png', 50 | // '../../animations/butterfly/butterflysitting06.png', 51 | // '../../animations/butterfly/butterflysitting06.png', 52 | // '../../animations/butterfly/butterflysitting06.png', 53 | ]; 54 | o.vel = 0; 55 | o.heli = true; 56 | return o; 57 | } 58 | function ButterflyCheer(id) { 59 | var o = new CritterAction(id); 60 | o.tag = "ButterflyCheer"; 61 | o.frames = [ 62 | 'animations/frogLadybugButterfly0814/butterflycheering01.png', 63 | 'animations/frogLadybugButterfly0814/butterflycheering02.png', 64 | 'animations/frogLadybugButterfly0814/butterflycheering03.png', 65 | 'animations/frogLadybugButterfly0814/butterflycheering04.png', 66 | 'animations/frogLadybugButterfly0814/butterflycheering05.png', 67 | 'animations/frogLadybugButterfly0814/butterflycheering06.png', 68 | ]; 69 | o.heli = true; 70 | return o; 71 | } 72 | 73 | 74 | function Butterfly(id, x, y) { 75 | var o = new CheeringCritter(id, x, y, 0, 80, 80); 76 | o.actions = { fly: new ButterflyFly(id), sit: new ButterflySit(id), cheer: new ButterflyCheer(id) }; 77 | o.curAction = 'fly'; 78 | o.pose.xOff = -12*Config.scale; 79 | o.pose.yOff = -35*Config.scale; 80 | o.update = function() { 81 | if (this.reachedHome()) return; 82 | if (this.isStuck) return; 83 | 84 | var lastPos = this.pose.getPos(); 85 | var flowPos = new Vec(flowManager.pointMoveTo(lastPos)); 86 | var flowVec = flowPos.minus(lastPos); //TODO: cap flow length? 87 | var newPos = flowPos.clone(); 88 | if (this.curAction == 'fly'){ 89 | this.setPos(newPos); 90 | this.actions.fly.move(this.pose); 91 | newPos = this.pose.getPos(); 92 | } 93 | var onEdge = adjustEdgePos(newPos); 94 | this.setPos(newPos); 95 | if (this.curAction == 'fly') { 96 | var motion = newPos.minus(lastPos); 97 | this.pose.theta = Math.atan2(motion[1], motion[0]); 98 | } 99 | this.curAction = onEdge ? 'sit' : 'fly'; 100 | this.checkBoundaries(); 101 | }; 102 | return o; 103 | } 104 | -------------------------------------------------------------------------------- /examples/Bugs/pjs/game/Critter.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | function CritterAction(id) { 3 | var o = new Object(); 4 | o.tag = 'baseAction'; 5 | o.id = id; 6 | o.frames = []; 7 | o.theta0 = 0; 8 | o.curFrame = 0; 9 | o.heli = false; 10 | o.render = function(pose) { 11 | if (this.heli) { 12 | pose.renderTheta = pose.theta0; 13 | pose.flipX = (Math.cos(pose.theta) < 0); 14 | } else { 15 | pose.flipX = false; 16 | pose.renderTheta = pose.theta + pose.theta0; 17 | } 18 | var img = new Image() 19 | img.src = this.frames[this.curFrame++]; 20 | img.id = this.id; 21 | if (this.curFrame >= this.frames.length) this.curFrame = 0; 22 | renderImage(img, pose); 23 | }; 24 | return o; 25 | }; 26 | function Critter(id, x, y, theta, w, h) { 27 | var o = new Object(); 28 | o.id = id; 29 | o.pose = new Pose(x*Config.scaleX, y*Config.scaleY, theta, w*Config.scale, h*Config.scale); 30 | var defaultAction = new CritterAction(id); 31 | o.actions = [ defaultAction ]; 32 | o.curAction = 0; 33 | o.visible = true; 34 | o.isStuck = false; 35 | o.update = function() {} 36 | o.render = function() { 37 | if (!this.visible) return; 38 | var action = this.actions[this.curAction]; 39 | if (action == undefined) { 40 | console.log("action undefined for "+this.id); 41 | return; 42 | } 43 | action.render(this.pose); 44 | }; 45 | o.setXY = function(x,y) { this.setXYAbs(x*Config.scaleX, y*Config.scaleY); } 46 | o.setXYAbs = function(x,y) { 47 | this.pose.x = x; 48 | this.pose.y = y; 49 | } 50 | o.setPos = function(v) { 51 | this.pose.x = v[0]; 52 | this.pose.y = v[1]; 53 | } 54 | o.setSize = function(size) { this.setSizeAbs(size*Config.scale); } 55 | o.setSizeAbs = function(size) { 56 | this.pose.w = size; 57 | this.pose.h = size; 58 | } 59 | o.setPose = function(pose) { this.pose = cloneObj(pose); } 60 | o.checkBoundaries = function() { 61 | // console.log(this.id, this.pose.getPos()); 62 | // if (this.pose.x > 0 && this.pose.x < 1280 && this.pose.y > 0 && this.pose.y < 720) return; 63 | if (this.pose.x < Config.bounds.minX) { this.pose.x = Config.bounds.minX; this.pose.theta = 0; } 64 | if (this.pose.x > Config.bounds.maxX) { this.pose.x = Config.bounds.maxX; this.pose.theta = toRadians(180); } 65 | if (this.pose.y < Config.bounds.minY) { this.pose.y = Config.bounds.minY; this.pose.theta = toRadians(90); } 66 | if (this.pose.y > Config.bounds.maxY) { this.pose.y = Config.bounds.maxY; this.pose.theta = toRadians(-90); } 67 | // this.pose.theta = -this.pose.theta; 68 | // console.log('adjusted pose'); 69 | } 70 | o.move = function(pose) { 71 | this.pose.x = pose.x; 72 | this.pose.y = pose.y; 73 | } 74 | o.setPixel = function(pixelSrc) { defaultAction.frames = [ pixelSrc ]; } 75 | o.addFrame = function(frameSrc) { defaultAction.frames.push(frameSrc); } 76 | o.moveToGoal = function() { 77 | if (this.goal == undefined) { 78 | console.log("undefined move goal"); //TODO: should throw 79 | return false; 80 | } 81 | var pos = this.pose.getPos(); 82 | var v = this.goal.minus(pos); 83 | var d = v.len(); 84 | if (d<1) return false; //already there 85 | v.normalize(); 86 | this.pose.theta = Math.atan2(v[1], v[0]); 87 | if (d>this.vel) d=this.vel; 88 | this.pose.x += d*v[0]; 89 | this.pose.y += d*v[1]; 90 | return true; 91 | } 92 | return o; 93 | }; 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /examples/Bugs/pjs/game/Flower.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function Flower(id, x, y) { 4 | var o = new Critter(id, x, y, 0, 250, 250); 5 | // o.setPixel('../../animations/flower1.png'); 6 | o.setPixel('animations/ladybughome.png'); 7 | o.anchor = o.pose.getPos().plus(new Vec(0,80*Config.scale)); 8 | o.radius = 150*Config.scale; 9 | return o; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /examples/Bugs/pjs/game/Fly.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function Fly(id, x, y) { //id x y theta w h 4 | var o = new Critter(id, x, y, 0, 40, 40); 5 | // o.setPixel('../../animations/bug_eyed_bee_T.png'); 6 | o.setPixel('animations/flyAndSpiderweb/fly01.png'); 7 | o.addFrame('animations/flyAndSpiderweb/fly02.png'); 8 | o.actions[0].heli = true; 9 | o.vel = 10*Config.scale; 10 | o.angVel = toRadians(30); 11 | o.update = function() { 12 | if (this.isStuck) return; 13 | 14 | var lastPos = this.pose.getPos(); 15 | var flowPos = new Vec(flowManager.pointMoveTo(lastPos)); 16 | var flowVec = flowPos.minus(lastPos); //TODO: cap flow length? 17 | var newPos = flowPos.clone(); 18 | 19 | this.pose.theta += getRandom(-this.angVel, this.angVel); 20 | var flyVec = new Vec(Math.cos(this.pose.theta), Math.sin(this.pose.theta)); 21 | flyVec.scale(this.vel); 22 | newPos.add(flyVec); 23 | this.setPos(newPos); 24 | var motion = newPos.minus(lastPos); 25 | this.pose.theta = Math.atan2(motion[1], motion[0]); 26 | 27 | this.checkBoundaries(); 28 | } 29 | return o; 30 | } 31 | 32 | function Mosquito(id, x, y) { 33 | var o = new Fly(id, x, y); 34 | o.setPixel('animations/green_hornet_T.png'); 35 | return o; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /examples/Bugs/pjs/game/Frog.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | function Frog(id, x, y) { 3 | var scale = 1.2; 4 | var o = new Critter(id, x, y, 0, 150*scale, 150*scale); 5 | o.actions = { sit: new FrogSit(id), eat: new FrogEat(id) }; 6 | o.curAction = 'sit'; 7 | o.eating = false; 8 | o.bugToEat = {}; 9 | var playSound = true; 10 | o.update = function() { 11 | if (!this.eating) this.findClosestBug(); 12 | if (!this.eating) return; 13 | if (playSound) { 14 | Sounds.frogEat.playSound(); 15 | playSound = false; 16 | } 17 | var v = this.pose.makeVec(this.bugToEat.pose); 18 | var d = lengthOfVec(v); 19 | var vel = 50*Config.scale; 20 | if (d > vel && d < vel*2) this.actions.eat.curFrame = 6; //open mouth 21 | if (d < vel) { //done eating 22 | this.eating = false; 23 | this.curAction = 'sit'; 24 | resetBug(this.bugToEat); 25 | this.hideTongue(); 26 | frogAte++; 27 | playSound = true; 28 | return; 29 | } 30 | normalizeVec(v); 31 | this.bugToEat.pose.x += v[0]*vel; 32 | this.bugToEat.pose.y += v[1]*vel; 33 | this.updateTongue(); 34 | }; 35 | o.findClosestBug = function() { 36 | var minD = 10000; 37 | var bugToEat = {}; 38 | for(var b=0; b 200*Config.scale) return; 46 | this.eating = true; 47 | this.curAction = 'eat'; 48 | this.bugToEat = bugToEat; 49 | bugToEat.isStuck = true; 50 | this.showTongue(); 51 | }; 52 | o.hideTongue=function() { 53 | removeDrawObj(this.tongue.id); 54 | removeUpdateObj(this.tongue.id); 55 | }; 56 | o.showTongue=function() { 57 | addDrawObj(this.tongue); 58 | addUpdateObj(this.tongue); 59 | }; 60 | o.updateTongue=function() { 61 | this.tongue.setToPos(this.bugToEat.pose.getPos()); 62 | }; 63 | o.tongueOri = new Vec(x,y-20*scale*Config.scale); 64 | o.tongue = new DrawLine(o.id+'Tongue', o.tongueOri, o.tongueOri, 5); //TODO: does tongue width need to scale? 65 | return o; 66 | } 67 | 68 | function FrogEat(id) { 69 | var o = new CritterAction(id); 70 | o.frames = 71 | [ 72 | 'animations/frogAndLadybug/frogeat201.png', 73 | 'animations/frogAndLadybug/frogeat202.png', 74 | 'animations/frogAndLadybug/frogeat203.png', 75 | 'animations/frogAndLadybug/frogeat204.png', 76 | 'animations/frogAndLadybug/frogeat205.png', 77 | 'animations/frogAndLadybug/frogeat206.png', 78 | 'animations/frogAndLadybug/frogeat207.png', 79 | 'animations/frogAndLadybug/frogeat208.png', 80 | 'animations/frogAndLadybug/frogeat209.png', 81 | 'animations/frogAndLadybug/frogeat210.png', 82 | 'animations/frogAndLadybug/frogeat211.png', 83 | 'animations/frogAndLadybug/frogeat212.png', 84 | ]; 85 | o.heli = true; 86 | return o; 87 | } 88 | 89 | function FrogSit(id) { 90 | var o = new CritterAction(id); 91 | var repeatFrame=2; 92 | var f=0; 93 | for (var n=0;n<4;n++) { 94 | for (var i=1;i<=9;i++) { 95 | for (var j=0;j flower1.radius) return false; 62 | 63 | // close to home: fly to the door 64 | this.goal = goalPos; 65 | this.vel = this.actions.fly.vel; 66 | this.curAction = 'fly'; 67 | if (!this.isCheering && this.moveToGoal()) return true; 68 | 69 | // at the door: cheer 70 | this.isCheering = true; 71 | this.curAction = 'cheer'; 72 | var numCheers = 3; 73 | this.doACheer(); 74 | if (this.cheerCnt == 0 && cheer.curFrame == 0) Sounds.cheer.playSound(); 75 | if (cheer.curFrame == cheer.frames.length - 1) this.cheerCnt++; 76 | if (this.cheerCnt < numCheers) return true; 77 | 78 | // done cheering: reset 79 | cheer.curFrame = 0; 80 | this.cheerCnt = 0; 81 | this.isCheering = false; 82 | happyBugs++; 83 | resetBug(this); 84 | return true; 85 | } 86 | o.doACheer = function() { 87 | var vel = 5 * Config.scale; 88 | var curFrame = this.actions.cheer.curFrame; 89 | var pose = this.pose; 90 | if (curFrame == 1) pose.y += vel; 91 | if (curFrame == 2) pose.y += vel; 92 | if (curFrame == 3) pose.y -= vel; 93 | if (curFrame == 4) pose.y -= vel; 94 | } 95 | return o; 96 | } 97 | 98 | function LadyCheer(id) { 99 | var o = new CritterAction(id); 100 | o.tag = "LadyCheer"; 101 | o.frames = [ 102 | 'animations/frogLadybugButterfly0814/ladybugcheering01.png', 103 | 'animations/frogLadybugButterfly0814/ladybugcheering02.png', 104 | 'animations/frogLadybugButterfly0814/ladybugcheering03.png', 105 | 'animations/frogLadybugButterfly0814/ladybugcheering04.png', 106 | 'animations/frogLadybugButterfly0814/ladybugcheering05.png', 107 | 'animations/frogLadybugButterfly0814/ladybugcheering06.png', 108 | ]; 109 | o.heli = true; 110 | return o; 111 | } 112 | 113 | 114 | function Lady(id, x, y) { 115 | var o = new CheeringCritter(id, x, y, 0, 40, 40); 116 | o.actions = { fly: new LadyFly(id), crawl: new LadyCrawl(id), cheer: new LadyCheer(id) }; 117 | o.curAction = 'fly'; 118 | o.update = function() { 119 | if (this.reachedHome()) return; 120 | if (this.isStuck) return; 121 | 122 | var lastPos = this.pose.getPos(); 123 | var flowPos = new Vec(flowManager.pointMoveTo(lastPos)); 124 | var flowVec = flowPos.minus(lastPos); //TODO: cap flow length? 125 | var newPos = flowPos.clone(); 126 | if (this.curAction == 'crawl') { 127 | var crawlVec = new Vec(Math.cos(this.pose.theta), Math.sin(this.pose.theta)); 128 | crawlVec.scale(this.actions.crawl.vel); 129 | newPos.add(crawlVec); 130 | } else { 131 | this.setPos(newPos); 132 | this.actions.fly.move(this.pose); 133 | newPos = this.pose.getPos(); 134 | } 135 | var onEdge = adjustEdgePos(newPos); 136 | this.setPos(newPos); 137 | var motion = this.curAction == 'crawl' ? newPos.minus(flowPos) : newPos.minus(lastPos); 138 | this.pose.theta = Math.atan2(motion[1], motion[0]); 139 | this.curAction = onEdge ? 'crawl' : 'fly'; 140 | this.checkBoundaries(); 141 | }; 142 | return o; 143 | } 144 | 145 | -------------------------------------------------------------------------------- /examples/Bugs/pjs/game/Leaderboard.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var leaders = []; 3 | function Leader(img, s) { 4 | var o = {}; 5 | if (arguments.length>0) { 6 | o.img = img; 7 | o.score = s; 8 | } else { 9 | o.img = captureCanvas.toDataURL(); 10 | o.score = score; 11 | } 12 | return o; 13 | } 14 | var startTime = 0, endTime = 0; 15 | function resetCounters() { 16 | happyBugs = 0; 17 | frogAte = 0; 18 | spiderAte = 0; 19 | score = 0; 20 | startTime = Date.now(); 21 | endTime = startTime + Config.gameDuration*1000; 22 | } 23 | function redrawCounters() { 24 | document.getElementById('happyBugs').innerHTML=happyBugs; 25 | document.getElementById('frogAte').innerHTML=frogAte; 26 | document.getElementById('spiderAte').innerHTML=spiderAte; 27 | score = 10*happyBugs + frogAte + spiderAte; 28 | document.getElementById('score').innerHTML = score; 29 | var remaining = (endTime - Date.now())/1000; 30 | if (remaining < 0) remaining = 0; 31 | document.getElementById('remaining').innerHTML = remaining.toFixed(0); 32 | } 33 | 34 | function playGame() { 35 | if (captureActive) return; 36 | populateConfigAndOptions(); 37 | initialized = false; 38 | setTimeout(function(){gameOver();},Config.gameDuration*1000); 39 | resetCounters(); 40 | document.getElementById('gameOverMsg').style.visibility='hidden'; 41 | startCapture(); 42 | } 43 | function gameOver() { 44 | if (!captureActive) return; 45 | stopCapture(); 46 | var newLeader = new Leader(); 47 | var idx = 0; 48 | while (idx < leaders.length && leaders[idx].score >= newLeader.score) idx++; 49 | if (idx < Config.maxLeaders) { 50 | leaders.splice(idx, 0, newLeader); 51 | if (leaders.length > Config.maxLeaders) leaders.pop(); 52 | } 53 | renderLeaderBoard(); 54 | if (idx == 0) Sounds.topChart.playSound(); 55 | else if (idx < Config.maxLeaders) Sounds.chart.playSound(); 56 | else Sounds.gameOver.playSound(); 57 | document.getElementById('gameOverMsg').style.visibility='visible'; 58 | if (loopGameFlag()) setTimeout(function(){playGame();},Config.loopRestartDuration*1000); 59 | } 60 | 61 | function renderLeaderBoard(){ 62 | for(var i=0; i= 0) return; 12 | list.push(obj); 13 | } 14 | function addObjToListBefore(obj, list, id) { 15 | var objIndex = findObjInList(obj.id, list); 16 | if (objIndex >= 0) return; 17 | var targetIndex = findObjInList(id, list); 18 | if (targetIndex < 0) return; //TODO: die here? 19 | // console.log('add before: '+id+' ind: '+targetIndex); 20 | list.splice(targetIndex, 0, obj); 21 | // console.log('added at: '+findObjInList(obj.id, list)+' targ at: '+findObjInList(id, list)); 22 | } 23 | function removeObjFromList(id, list) { //note: only removes 1 occurence 24 | var objIndex = findObjInList(id, list); 25 | if (objIndex < 0) return; 26 | list.splice(objIndex, 1); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /examples/Bugs/pjs/game/Primitives.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | function Marker(id) { 3 | var o = new Critter(id, 0, 0, 0, 10, 10); 4 | o.setPixel('animations/frogeat01.png') 5 | return o; 6 | } 7 | 8 | 9 | function DrawLine(id, p1, p2, width) { // p1 and p2 are Vec's 10 | var o = new Critter(id, 0, 0, 0, 10, 10); 11 | // o.visible = false; 12 | o.setPixel('animations/tongue2.png'); 13 | o.line = new Line(p1, p2); 14 | o.width = width; 15 | o.update = function() { 16 | // this.visible = true; 17 | var pos = this.line.center(); 18 | this.pose.x = pos[0]; 19 | this.pose.y = pos[1]; 20 | var v = this.line.p2.minus(this.line.p1); 21 | var d = v.len(); 22 | if (d<1) { this.removeLine(); return; } 23 | v.normalize(); 24 | this.pose.theta = Math.atan2(v[1], v[0]); 25 | this.pose.w = d; 26 | this.pose.h = this.width; 27 | } 28 | o.removeLine = function() { 29 | removeImage(this.id); 30 | this.visible = false; 31 | } 32 | o.setFromPos = function(pos) { this.line.p1 = pos.clone(); } 33 | o.setToPos = function(pos) { this.line.p2 = pos.clone(); } 34 | return o; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /examples/Bugs/pjs/game/Render.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | function renderImageCanvas(img, x, y, w, h) { 3 | var canvas = document.getElementById('canvas0'); 4 | if (!canvas.getContext) return; 5 | var ctx = canvas.getContext('2d'); 6 | ctx.drawImage(img, x, y, w, h); 7 | } 8 | 9 | var renderedObjects = []; 10 | function removeImage(id) { 11 | var imgElt = document.getElementById(id); 12 | if (imgElt == null) return; 13 | drawArea.removeChild(imgElt); 14 | removeObjFromList(id, renderedObjects); 15 | } 16 | function clearRenderedObjects() { 17 | for(var i=0; i 0) { 37 | this.curAction = 'crawl'; 38 | var bug = this.closestBug; 39 | this.goal = bug.pose.getPos(); 40 | if (!this.moveToGoal()) { //reached the bug 41 | removeObjFromList(bug.id, this.bugsToEat); 42 | bug.isStuck = false; 43 | resetBug(bug); 44 | spiderAte++; 45 | } 46 | var goalDist = this.goal.dist(this.pose.getPos()); 47 | if (goalDist <= 4*this.vel && goalDist > 3*this.vel) { 48 | Sounds.spiderEat.playSound(); 49 | } 50 | } else { 51 | // console.log('moving to web center'); 52 | this.goal = this.webCenter; 53 | if (this.moveToGoal()) this.curAction = 'crawl'; 54 | else this.curAction = 'sit'; 55 | } 56 | } 57 | o.closestBug = undefined; 58 | o.checkForBugs = function() { 59 | var minD = 10000; 60 | this.closestBug = undefined; 61 | for(var i=0; i this.webRadius) continue; 65 | addObjToList(bugs[i], this.bugsToEat); 66 | bugs[i].isStuck = true; 67 | d = bugs[i].pose.dist(this.pose); 68 | if (dthis.vel) d=this.vel; 107 | // this.pose.x += d*v[0]; 108 | // this.pose.y += d*v[1]; 109 | // return true; 110 | // }; 111 | 112 | // /* old web construction */ 113 | // o.strandId = 0; 114 | // o.strandWidth = 3; 115 | // o.addSupportStrand = function(p1,p2) { 116 | // this.addStrand(p1,p2); 117 | // this.supports.push(new Line(p1, p2)); 118 | // } 119 | // o.webAnchor = [450,600]; 120 | // o.web = []; 121 | // o.supports = []; 122 | // o.constructWeb2 = function() { 123 | // var numLayers = 9; 124 | // var center = new Vec(700,100+50); 125 | // var anchor1 = new Vec(500,0+50); 126 | // var anchor2 = new Vec(900,0+50); 127 | // var anchor3 = new Vec(center[0],center[1]+anchor1.minus(center).len()); 128 | // this.addSupportStrand(center, anchor1); 129 | // this.webCenter = center; 130 | // this.webRadius = this.supports[0].len()*0.7; 131 | //// console.log(this.webCenter, this.webRadius); 132 | // this.addIntermediateSupport(anchor1, anchor2, center); 133 | // this.addSupportStrand(center, anchor2); 134 | // this.addIntermediateSupport(anchor2, anchor3, center); 135 | // this.addSupportStrand(center, anchor3); 136 | // this.addIntermediateSupport(anchor3, anchor1, center); 137 | // for(var i=1; i0) { 11 | v[0] /= len; 12 | v[1] /= len; 13 | } 14 | } 15 | 16 | function Vec() { // empty args, another vector, or list of numbers 17 | var o = []; 18 | if (arguments.length == 0) { 19 | o[0] = 0; 20 | o[1] = 0; 21 | } else { 22 | if (typeof arguments[0] == 'object') { // or Array.isArray(arguments[0]) 23 | o = cloneArray(arguments[0]); 24 | } else { 25 | for(var i=0; i1) return undefined; 122 | 123 | var tI=this.perp2(u,w)/d; 124 | if (tI<0 || tI>1) return undefined; 125 | 126 | console.log(d, sI, tI); 127 | return this.p1.plus(u.mult(sI)); 128 | } 129 | o.perp2 = function(v1, v2) { 130 | var cv2 = new Vec(v2[1],-v2[0]); 131 | return v1.dot(cv2); 132 | } 133 | o.getPoint = function(s) { 134 | var v = this.p2.minus(this.p1); 135 | v.scale(s); 136 | return v.plus(this.p1); 137 | } 138 | o.len = function() { 139 | var v = this.p2.minus(this.p1); 140 | return v.len(); 141 | } 142 | return o; 143 | } 144 | 145 | function testLine() { 146 | var l1 = new Line(new Vec(0,0), new Vec(1,1)); 147 | var l2 = new Line(new Vec(0,1), new Vec(1,0)); 148 | var p = l1.intersectionWith(l2); 149 | console.log(p); 150 | } 151 | 152 | -------------------------------------------------------------------------------- /examples/Bugs/pjs/game/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/pjs/game/logo.png -------------------------------------------------------------------------------- /examples/Bugs/pjs/game/utils.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | function appendLog(msg) { 3 | var l = document.createElement("li"); 4 | l.innerHTML = msg; 5 | document.getElementById("log").appendChild(l); 6 | } 7 | 8 | function toRadians(a) { 9 | return Math.PI*a/180; 10 | } 11 | 12 | //o is modified 13 | function addDefaultsToObj(o,defaults) { 14 | for (var i in defaults) { 15 | if (!(i in o)) { 16 | o[i]=defaults[i]; 17 | } 18 | } 19 | } 20 | 21 | function overrideObj(o,overrides) { 22 | for (var i in overrides) if (overrides.hasOwnProperty(i)) { 23 | o[i]=overrides[i]; 24 | } 25 | } 26 | 27 | function cloneObj(obj) { 28 | var o = new Object(); 29 | for (var i in obj) { 30 | if (!(i in o)) { 31 | o[i]=obj[i]; 32 | } 33 | } 34 | return o; 35 | } 36 | 37 | function cloneArray(obj) { 38 | var o = []; 39 | for (var i in obj) { 40 | if (!(i in o)) { 41 | o[i]=obj[i]; 42 | } 43 | } 44 | return o; 45 | } 46 | 47 | function getRandom(a, b) { 48 | var r = Math.random(); 49 | return a + (b-a)*r; 50 | } 51 | -------------------------------------------------------------------------------- /examples/Bugs/pjs/lib/cv/DenseOpticalFlowManager.js: -------------------------------------------------------------------------------- 1 | function DenseOpticalFlowManager(configuration) { 2 | var defaultConfiguration={ 3 | flowWidth:160, 4 | flowHeight:90, 5 | imageWidth:1280, 6 | imageHeight:720, 7 | flipImage:true, 8 | padBorder:true, 9 | calculateFlow:CalculateOpticalFlowFarneback, 10 | polyN:5, 11 | polySigma:1.2, 12 | levels:0, 13 | winSize:15, 14 | flowPad:15, 15 | resizeRefineXNum:2, 16 | resizeRefineYNum:2, 17 | sigma:undefined, 18 | iterations:3, 19 | flowFactorIterations:1.0, 20 | flowFactorFinal:1.0, 21 | grayFactor:1.0, 22 | useTimer:true, 23 | debugTime:false, 24 | }; 25 | for (var i in defaultConfiguration) { 26 | if (!(i in configuration)) { 27 | configuration[i]=defaultConfiguration[i]; 28 | } 29 | } 30 | this.configuration=configuration; 31 | } 32 | function resizeRefinePaddingVEF(ind,src,innerWidth,innerHeight,refineXNum,refineYNum,refinePad,outerPad,refineXStep,refineYStep,stepX,stepY) { 33 | var srcShape=src.getShape(); 34 | var refineWidth=innerWidth+(2*refinePad); 35 | var refineHeight=innerHeight+(2*refinePad); 36 | //figure out rn, refineX and refineY 37 | var sy=ind[0]; 38 | sy-=outerPad; 39 | if (sy<0) sy=0; 40 | if (sy>refineHeight*refineXNum*refineYNum-1) sy=refineHeight*refineXNum*refineYNum-1; 41 | var rn=Math.floor(sy/refineHeight); 42 | var sy=sy%refineHeight; 43 | var refineY=Math.floor(rn/refineXNum); 44 | var refineX=rn%refineXNum; 45 | sy-=refinePad; 46 | if (sy<0) sy=0; 47 | //figure out starting x&y positions in src 48 | sy*=stepY; 49 | sy+=refineY*refineYStep; 50 | if (sy>srcShape[0]-stepY) sy=srcShape[0]-stepY; 51 | var sx=ind[1]-outerPad-refinePad; 52 | if (sx<0) sx=0; 53 | sx*=stepX; 54 | sx+=refineX*refineXStep; 55 | if (sx>srcShape[1]-stepX) sx=srcShape[1]-stepX; 56 | //compute 57 | var total = 0; 58 | for ( var yOffset = 0; yOffset < stepY; yOffset++) { 59 | for ( var xOffset = 0; xOffset < stepX; xOffset++) { 60 | total += src.get(sy + yOffset, sx + xOffset); 61 | } 62 | } 63 | return total; 64 | } 65 | function resizeRefineGrayscalePaddingV(src,innerWidth,innerHeight,refineXNum,refineYNum,refinePad,outerPad) { 66 | var gsShape=[innerHeight*refineYNum,innerWidth*refineXNum]; 67 | timer.start("computeFlow-refine-resize1"); 68 | src=grayscaleResizeMultImage(src,gsShape,1/(refineXNum*refineYNum)); 69 | timer.end("computeFlow-refine-resize1"); 70 | 71 | var srcShape=src.getShape(); 72 | var stepY=srcShape[0]/innerHeight; 73 | var stepX=srcShape[1]/innerWidth; 74 | if (stepX%1!=0||stepY%1!=0) throw "interpolation not implemented, can only resize to smaller size that is 1/int of the original"; 75 | var refineXStep=stepX/refineXNum; 76 | var refineYStep=stepY/refineYNum; 77 | var scale=1/(stepX*stepY); 78 | if (stepX!=refineXNum||refineYNum!=stepY) throw "something is wrong: stepX "+stepX+" refineXNum "+refineXNum; 79 | var shape=[(innerHeight+(refinePad*2))*refineXNum*refineYNum+(outerPad*2),innerWidth+(refinePad*2)+(outerPad*2)]; 80 | return new ParallelArray(shape,resizeRefinePaddingVEF,src,innerWidth,innerHeight,refineXNum,refineYNum,refinePad,outerPad,refineXStep,refineYStep,stepX,stepY); 81 | } 82 | DenseOpticalFlowManager.prototype={ 83 | computeFlow:function(currentFrame) { 84 | if (this.configuration.useTimer) timer.start("computeFlow"); 85 | var conf=this.configuration; 86 | if (this.configuration.useTimer) timer.start("computeFlow-resizeRefineGrayscalePaddingV2"); 87 | var flowFrame=resizeRefineGrayscalePaddingV(currentFrame,conf.flowWidth,conf.flowHeight,conf.resizeRefineXNum,conf.resizeRefineYNum,conf.flowPad,conf.polyN); 88 | if (this.configuration.useTimer) timer.end("computeFlow-resizeRefineGrayscalePaddingV2"); 89 | var destDim=[this.configuration.flowHeight,this.configuration.flowWidth]; 90 | this.imageSize=[this.configuration.imageWidth,this.configuration.imageHeight]; 91 | if (this.previousFrame2===undefined) { 92 | this.previousFrame2=flowFrame; 93 | } 94 | this.flow2=this.configuration.calculateFlow(this.previousFrame2,flowFrame,this.configuration); 95 | this.previousFrame2=flowFrame; 96 | 97 | var flowDim=destDim.slice(0); 98 | this.flowScale=[0,0]; 99 | this.offsetFlow=[0,0]; 100 | this.imageBorder=[0,0]; 101 | for (var i=0;i<2;i++) { 102 | this.flowScale[1-i]=this.imageSize[1-i]/destDim[i]; 103 | this.offsetFlow[1-i]=(destDim[i]-flowDim[i])/2; 104 | } 105 | for (var i=0;i<2;i++) { 106 | this.imageBorder[i]=this.offsetFlow[i]*this.flowScale[i]; 107 | } 108 | if (this.configuration.flipImage) { 109 | this.flowScale[0]*=-1; 110 | this.offsetFlow[0]-=destDim[1]; 111 | } 112 | if (this.configuration.useTimer) timer.end("computeFlow"); 113 | }, 114 | pointMoveTo:function(point) { 115 | var flowPos2=[0,0]; 116 | flowPos2[0]=(point[1]/this.flowScale[1]-this.offsetFlow[1])*this.configuration.resizeRefineYNum; 117 | flowPos2[1]=(point[0]/this.flowScale[0]-this.offsetFlow[0])*this.configuration.resizeRefineXNum; 118 | flowPos2[0]=Math.round(flowPos2[0]-1); 119 | flowPos2[1]=Math.round(flowPos2[1]-1); 120 | if (flowPos2[0]<0) flowPos2[0]=0; 121 | if (flowPos2[1]<0) flowPos2[1]=0; 122 | var refineY=flowPos2[0]%this.configuration.resizeRefineYNum; 123 | var refineX=flowPos2[1]%this.configuration.resizeRefineXNum; 124 | var rn=refineY*this.configuration.resizeRefineXNum+refineX; 125 | flowPos2[0]-=refineY; 126 | flowPos2[1]-=refineX; 127 | flowPos2[0]/=this.configuration.resizeRefineYNum; 128 | flowPos2[1]/=this.configuration.resizeRefineXNum; 129 | flowPos2[0]+=rn*(this.configuration.flowHeight+(this.configuration.flowPad*2)); 130 | flowPos2[0]+=this.configuration.flowPad; 131 | flowPos2[1]+=this.configuration.flowPad; 132 | var pointFlow2=[0,0]; 133 | /* 134 | for (var i=0;i<2;i++) { 135 | pointFlow2[i]=this.flow2.get(flowPos2).get(i)*this.flowScale[i]; 136 | } 137 | */ 138 | //pointFlow2[0]=this.flow2.get(flowPos2,0)*this.flowScale[0]; 139 | var shape = this.flow2.getShape(); 140 | pointFlow2[0] = this.flow2.data[flowPos2[0]*shape[1]*shape[2] + flowPos2[1]*shape[2]]*this.flowScale[0]; 141 | //pointFlow2[1]=this.flow2.get(flowPos2,1)*this.flowScale[1]; 142 | pointFlow2[1] = this.flow2.data[flowPos2[0]*shape[1]*shape[2] + flowPos2[1]*shape[2]+1]*this.flowScale[1] 143 | var moveTo=point.slice(0); 144 | for (var i=0;i<2;i++) { 145 | moveTo[i]+=pointFlow2[i]; 146 | } 147 | return moveTo; 148 | }, 149 | }; 150 | -------------------------------------------------------------------------------- /examples/Bugs/pjs/lib/cv/DotsManager.js: -------------------------------------------------------------------------------- 1 | function DotsManager(flowManager,numDots,dotImage) { 2 | this.flowManager=flowManager; 3 | this.numDots=numDots; 4 | this.initialized=false; 5 | this.dotImage=dotImage; 6 | } 7 | DotsManager.prototype={ 8 | init:function() { 9 | this.randomize(); 10 | this.initialized=true; 11 | }, 12 | getRandomPose:function() { 13 | var pose=[0,0]; 14 | for (var i=0;i<2;i++) { 15 | var l=this.flowManager.imageBorder[i]; 16 | var h=this.flowManager.imageSize[i]-l; 17 | pose[i]=(Math.random()*(h-l))+l; 18 | } 19 | return pose; 20 | }, 21 | isPoseInBounds:function(pose) { 22 | for (var i=0;i<2;i++) { 23 | //TODO: not fully correct due to rounding 24 | var l=this.flowManager.imageBorder[i]+2; 25 | var h=this.flowManager.imageSize[i]-l; 26 | if (pose[i]h) { return false; } 27 | } 28 | return true; 29 | }, 30 | randomize:function() { 31 | this.dots=[]; 32 | for (var i=0;i=0;i--) { 40 | this.dots[i]=this.flowManager.pointMoveTo(this.dots[i]); 41 | if (!this.isPoseInBounds(this.dots[i])) { 42 | //this.dots[i]=this.getRandomPose(); 43 | this.dots.splice(i,1); 44 | } 45 | } 46 | timer.end("moveDots"); 47 | }, 48 | drawDots:function() { 49 | timer.start("drawDots"); 50 | for (var i=0;i0) xi=true; 51 | var yi=false; 52 | if ((v-vyn)*(vyp-v)>0) yi=true; 53 | if (xi&&yi) v=0; 54 | if (vthis.src.width-searchArea-3||posPix[1]>this.src.height-searchArea-3) return false; 71 | var areaStart=[posPix[0]-searchArea,posPix[1]-searchArea]; 72 | 73 | var edgeArea=this.computeAreaEdges(areaStart,[searchArea*2+1,searchArea*2+1]); 74 | 75 | var nearEdge = false; 76 | var minDist = 10000; 77 | for (var y=0;y3) throw "Can only emulate 2D or 3D PA Arrays as JSArrays"; 35 | var v=shape.slice(0); 36 | for (var i=0;i=dim[i]) { inBounds=false; } 13 | } 14 | return inBounds; 15 | } 16 | -------------------------------------------------------------------------------- /examples/Bugs/pjs/lib/cv/ScalingEdgeManager.js: -------------------------------------------------------------------------------- 1 | function ScalingEdgeManager(options) { 2 | var o=new EdgeManager(options); 3 | o.scale=[options.imageWidth/options.captureWidth,options.imageHeight/options.captureHeight]; 4 | if (o.scale[0]!=1||o.scale[1]!=1) { 5 | o.findClosestEdge=function(pos,searchArea) { 6 | var scaledSearchArea=[0,0]; 7 | var scaledPos=[0,0]; 8 | for (var i=0;i<2;i++) { 9 | scaledSearchArea[i]=Math.ceil(searchArea/this.scale[i]); 10 | scaledPos[i]=pos[i]/this.scale[i]; 11 | } 12 | var posPix=[Math.floor(scaledPos[0]),Math.floor(scaledPos[1])]; 13 | if (posPix[0]this.src.width-scaledSearchArea[0]-3||posPix[1]>this.src.height-scaledSearchArea[1]-3) return false; 14 | var scaledAreaStart=[posPix[0]-scaledSearchArea[0],posPix[1]-scaledSearchArea[1]]; 15 | var areaStart=[scaledAreaStart[0]*this.scale[0],scaledAreaStart[1]*this.scale[1]]; 16 | 17 | var edgeArea=this.computeAreaEdges(scaledAreaStart,[scaledSearchArea[0]*2+1,scaledSearchArea[1]*2+1]); 18 | 19 | var nearEdge = false; 20 | var minDist = 10000; 21 | for (var yOff=-searchArea;yOff<=searchArea;yOff++) { 22 | for (var xOff=-searchArea;xOff<=searchArea;xOff++) { 23 | var edgePos=new Vec(pos[0]+xOff,pos[1]+yOff); 24 | var x=Math.floor((edgePos[0]-areaStart[0])/this.scale[0]); 25 | if (x<0||x>=edgeArea.width) console.log("ScaledEdgeManager.findClosestEdge: x out of bounds "+x+" width: "+edgeArea.width); 26 | var y=Math.floor((edgePos[1]-areaStart[1])/this.scale[1]); 27 | if (y<0||y>=edgeArea.height) console.log("ScaledEdgeManager.findClosestEdge: y out of bounds "+y+" height: "+edgeArea.height); 28 | if (edgeArea.data[y*edgeArea.width+x]<1) continue; 29 | var d=pos.dist(edgePos); 30 | if (d=srcHeight) { y=srcHeight-1; } 91 | if (x<0) { x=0; } 92 | if (x>=srcWidth) { x=srcWidth-1; } 93 | return src.get(y,x); 94 | } 95 | function padBorder3DEF(ind,src,borderC,srcHeightC,srcWidthC) { 96 | var border=borderC.length-1;//GetSpecializedConst(borderC); 97 | var srcHeight=srcHeightC.length-1;//GetSpecializedConst(srcHeightC); 98 | var srcWidth=srcWidthC.length-1;//GetSpecializedConst(srcWidthC); 99 | var y=ind[0]; 100 | var x=ind[1]; 101 | var z=ind[2]; 102 | y-=border; 103 | x-=border; 104 | if (y<0) { y=0; } 105 | if (y>=srcHeight) { y=srcHeight-1; } 106 | if (x<0) { x=0; } 107 | if (x>=srcWidth) { x=srcWidth-1; } 108 | return src.get(y,x,z); 109 | } 110 | //adds border on 4 sides, copies first&last row&col to the border 111 | function padBorder(src,border) { 112 | var dim=src.getShape(); 113 | var destDim=dim.slice(0); 114 | destDim[0]+=2*border; 115 | destDim[1]+=2*border; 116 | if (dim.length==2) { 117 | return new ParallelArray(destDim,padBorderEF,src,SpecializeConst(border),SpecializeConst(dim[0]),SpecializeConst(dim[1])); 118 | } else if (dim.length==3) { 119 | return new ParallelArray(destDim,padBorder3DEF,src,SpecializeConst(border),SpecializeConst(dim[0]),SpecializeConst(dim[1])); 120 | } else { 121 | throw "padBorder can only support 2D and 3D arrays"; 122 | } 123 | } 124 | 125 | function padPAEF(ind,src,srcDim,val) { 126 | var inbound=1; 127 | for (var d=0;d=srcDim[d]) { inbound=0; } 129 | } 130 | if (inbound==1) { return src.get(ind); } 131 | return val; 132 | } 133 | function padPA(src,dim,val) { 134 | return new ParallelArray(dim,padPAEF,src,src.getShape(),val); 135 | } 136 | -------------------------------------------------------------------------------- /examples/Bugs/pjs/lib/cv/convolutionSeq.js: -------------------------------------------------------------------------------- 1 | function horizontalFilter2DInnerSeq(src,k,dest) { 2 | var w=src.width-k.length+1; 3 | if (dest.width!=w) throw "horizontalFilterInnerSeq: dest must have width of src-k+1"; 4 | if (dest.height!=src.height) throw "horizontalFilterInnerSeq: dest must have height of src"; 5 | for (var yd=0;yd=src.height) ys=src.height-1; 89 | for (var xd=0;xd=src.width) xs=src.width-1; 93 | dest.data[yd*dest.width+xd]=src.data[ys*src.width+xs]; 94 | } 95 | } 96 | } 97 | 98 | function padBorder3DSeq(src,dest) { 99 | var border=(dest.width-src.width)/2; 100 | if (border%1!=0) throw "padBorder: dest must be 2*i wider than src"; 101 | if (border!=(dest.height-src.height)/2) throw "padBorder: border must be uniform on all sides"; 102 | if (dest.depth!=src.depth) throw "padBorder: dest must have same depth as src"; 103 | for (var yd=0;yd=src.height) ys=src.height-1; 107 | for (var xd=0;xd=src.width) xs=src.width-1; 111 | for (var d=0;d"; 45 | } 46 | document.getElementById(reportElementId).innerHTML=data; 47 | this.startInfo={}; 48 | this.curInfo={}; 49 | } 50 | }; 51 | -------------------------------------------------------------------------------- /examples/Bugs/pjs/lib/cvincludes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | d=$1 3 | cat < 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | EOF 21 | -------------------------------------------------------------------------------- /examples/Bugs/pjs/lib/pjsincludes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | d=$1 3 | cat < 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | EOF 20 | -------------------------------------------------------------------------------- /examples/Bugs/sounds/new/.LICENSE.txt.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/sounds/new/.LICENSE.txt.swp -------------------------------------------------------------------------------- /examples/Bugs/sounds/new/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The sounds files in this folder are redistributed under their respective license. 2 | 3 | The following files are licensed under CC0 1.0 Universal (published at http://creativecommons.org/publicdomain/zero/1.0/): 4 | 5 | giggles.wav (available at http://www.freesound.org/people/martian/sounds/19260/) 6 | aww.wav (available at http://www.freesound.org/people/phmiller42/sounds/124996/) 7 | smallcrowd.wav (available at http://www.freesound.org/people/sagetyrtle/sounds/32260/) 8 | squelch.wav (available at http://www.freesound.org/people/Adam_N/sounds/148974/) 9 | 10 | The following files are licensed under CC By 3.0 Unported (available at http://creativecommons.org/licenses/by/3.0/) 11 | 12 | cheer.wav by Lonemonk (available at http://www.freesound.org/people/lonemonk/sounds/72836/) 13 | eat.way by Bender (available at http://www.freesound.org/people/--Bender--/sounds/160980/) 14 | -------------------------------------------------------------------------------- /examples/Bugs/sounds/new/aww.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/sounds/new/aww.wav -------------------------------------------------------------------------------- /examples/Bugs/sounds/new/cheer.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/sounds/new/cheer.wav -------------------------------------------------------------------------------- /examples/Bugs/sounds/new/eat.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/sounds/new/eat.wav -------------------------------------------------------------------------------- /examples/Bugs/sounds/new/giggles.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/sounds/new/giggles.wav -------------------------------------------------------------------------------- /examples/Bugs/sounds/new/smallcrowd.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/sounds/new/smallcrowd.wav -------------------------------------------------------------------------------- /examples/Bugs/sounds/new/squelch.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/Bugs/sounds/new/squelch.wav -------------------------------------------------------------------------------- /examples/ProceduralTerrain/README.txt: -------------------------------------------------------------------------------- 1 | This demo is based on Notch's "Minecraft in JavaScript" code. -------------------------------------------------------------------------------- /examples/ProceduralTerrain/index.html: -------------------------------------------------------------------------------- 1 | 2 | 27 | 28 | 29 | Procedural Map Rendering 30 | 31 | 32 | 44 | 45 | 46 | 47 |

FPS

48 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /examples/idf-demo/Config.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 | * THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | */ 27 | 28 | /* 29 | * River Trail Demo Configuration 30 | * 31 | * Feel free to edit the variables below. 32 | */ 33 | 34 | // Note: Particle counts must match the dropdown list. Suggestted value is 4000 35 | 36 | // debug 37 | var diagnose_keycode = false; 38 | 39 | // keynote settings 40 | var swap_implementation_key_code = 32; //spacebar=32. For a full list: http://www.expandinghead.net/keycode.html 41 | 42 | 43 | // text layout 44 | var showfloor_titles_fontsize = "50px"; // set to 0px to hide titles 45 | var showfloor_fps_fontsize = "50px"; 46 | 47 | // demo settings 48 | var showfloor_default_particle_count = 4000; 49 | 50 | // camera control 51 | var demo_camera_mouse_power = 3; // good setting is 3 52 | 53 | // imagery settings 54 | var particle_color = 0xff4a1a; // use hexidecimal 55 | var particle_color_b = 0xfcfcaa; 56 | var show_planet = true; 57 | var show_moon = true; 58 | 59 | 60 | // playback and controls 61 | var play_pause_button = 80; // 80 for 'p' 62 | var show_hide_controls = 67; // 67 for 'c' 63 | 64 | 65 | /* 66 | * These are the settings used when Intel CTO Justin Rattner delivered his IDF Keynote speech. 67 | * Kept for posterity, and in case you want to demo it with a nicer look. 68 | */ 69 | 70 | var is_keynote = true; 71 | 72 | var display_linebreak = false; 73 | var keynote_titles_fontsize = "60px"; // must be in unit px or pt 74 | var keynote_fps_fontsize = "60px"; 75 | 76 | var keynote_sequential_name = "Sequential"; 77 | var keynote_sequential_name_line_2 = "
"; // to leave line 2 blank, use
to fill the empty space 78 | var keynote_paralell_name = "River Trail"; 79 | var keynote_paralell_name_line_2 = "
"; 80 | var keynote_camera_mouse_power = 1; // good setting is 1 because of auto camera movement 81 | 82 | 83 | var keynote_default_implementation = "parallel"; // options are parallel or sequential 84 | var keynote_particle_count = 4000; 85 | 86 | 87 | var keynote_camera_speed = .005; // good value is .001 88 | -------------------------------------------------------------------------------- /examples/idf-demo/Index.html: -------------------------------------------------------------------------------- 1 | 2 | 27 | 28 | 29 | 30 | River Trail Particle Demo 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 |
120 | 121 | 122 |
123 |

124 | 125 | 126 | 127 | 128 | 141 | 142 |

143 |
144 |
145 |
146 | 147 |
148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 |
156 | 157 |
--
158 |
159 | 160 |
161 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /examples/idf-demo/README.txt: -------------------------------------------------------------------------------- 1 | August 2011 2 | 3 | 3D Particle Flocking Demo developed by Vance Feldman under the 4 | supervision of Fashionbuddha Studio for Intel Corporation. 5 | 3D Artwork Created entirely by Vance Feldman. vance@fashionbuddha.com 6 | 7 | ---- INSTRUCTIONS ---- 8 | 9 | To run this demo, it needs to be hosted on an http server. 10 | This is because loading local assets, e.g. image textures, 11 | is prohibited by javascript on filesytems due to security reasons. 12 | 13 | You can run it on a local machine with a small webserver such as Apache running. 14 | Or you could upload it to an http server for testing. 15 | 16 | - To run the demo, use particles/index.html 17 | 18 | - contrib contains 3rD party libraries such as Three.js (mrdoob) 19 | https://github.com/mrdoob 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /examples/idf-demo/Setup.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 | * THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | */ 27 | 28 | /* 29 | * Setup.js 30 | * 31 | * @description performs actions based on config.js to customize the look, 32 | * feel and controls of the demo. 33 | * 34 | * @author vance@fashionbuddha.com 35 | * 36 | */ 37 | 38 | 39 | function runConfig() { 40 | 41 | document.getElementById("keynote-display").innerHTML = 42 | 43 | "
" + keynote_sequential_name + "
" + keynote_sequential_name_line_2 + "
" + 44 | 45 | "
 " + keynote_paralell_name + "
" + keynote_paralell_name_line_2 + "
"; 46 | 47 | if (display_linebreak == true) { 48 | document.getElementById("sequential-display").style.display = "inherit"; 49 | document.getElementById("parallel-display").style.display = "inherit"; 50 | } 51 | 52 | 53 | if (is_keynote == true) { 54 | 55 | selectOption(keynote_particle_count); 56 | document.getElementById("fps-display").style.fontSize = "120px"; 57 | implementation = keynote_default_implementation; 58 | 59 | 60 | // hide the controls 61 | document.getElementById("controls").style.display = "none"; 62 | 63 | // start everything up automagically 64 | NBody.init(keynote_default_implementation); 65 | 66 | document.getElementById("sequential-display").style.fontSize = keynote_titles_fontsize; 67 | document.getElementById("parallel-display").style.fontSize = keynote_titles_fontsize; 68 | document.getElementById("fps-display").style.fontSize = keynote_fps_fontsize; 69 | 70 | 71 | camXPower = keynote_camera_mouse_power; 72 | 73 | } else { 74 | 75 | selectOption(showfloor_default_particle_count); 76 | camXPower = demo_camera_mouse_power; 77 | 78 | document.getElementById("sequential-display").style.marginTop = "60px"; 79 | document.getElementById("sequential-display").style.fontSize = showfloor_titles_fontsize; 80 | 81 | document.getElementById("sequential-display").style.fontSize = showfloor_titles_fontsize; 82 | document.getElementById("parallel-display").style.fontSize = showfloor_titles_fontsize; 83 | document.getElementById("fps-display").style.fontSize = showfloor_fps_fontsize; 84 | } 85 | 86 | 87 | 88 | 89 | toggleImplementationDisplay(); 90 | } 91 | 92 | 93 | function goSequential() { 94 | toggleImplementation("sequential"); 95 | toggleImplementationDisplay(); 96 | } 97 | 98 | function goParallel() { 99 | 100 | toggleImplementation("parallel"); 101 | toggleImplementationDisplay(); 102 | } 103 | 104 | 105 | function selectOption(num) { 106 | var dropdown = document.getElementById('bodies'); 107 | 108 | for (var i = 0; i < dropdown.options.length; i++) { 109 | 110 | if (dropdown.options[i].text == String(num)) 111 | dropdown.selectedIndex = i; 112 | } 113 | 114 | } 115 | 116 | 117 | window.onkeydown = function (e) { 118 | 119 | var code; 120 | if (!e) var e = window.event; 121 | 122 | if (e.keyCode) code = e.keyCode; 123 | else if (e.which) code = e.which; 124 | 125 | if (code == Number(swap_implementation_key_code)) { 126 | 127 | toggleImplementation(); 128 | toggleImplementationDisplay(); 129 | } 130 | 131 | if (code == play_pause_button) 132 | if (NBody.private.stop == true) NBody.resume(); else NBody.pause(); 133 | 134 | if (code == show_hide_controls) 135 | if (document.getElementById("controls").style.display == "none") 136 | document.getElementById("controls").style.display = "inline-block"; 137 | else 138 | document.getElementById("controls").style.display = "none"; 139 | 140 | if (diagnose_keycode == true) 141 | alert("keycode: " + code); 142 | 143 | } 144 | 145 | function toggleImplementationDisplay() { 146 | 147 | 148 | if (implementation == "parallel") { 149 | 150 | document.getElementById("sequential-display").style.opacity = .4; 151 | document.getElementById("parallel-display").style.opacity = 1; 152 | } else { 153 | document.getElementById("sequential-display").style.opacity = 1; 154 | document.getElementById("parallel-display").style.opacity = .4; 155 | } 156 | 157 | 158 | } 159 | 160 | 161 | function toggleImplementation(imp) { 162 | 163 | 164 | if (imp) 165 | implementation = imp; 166 | else if (implementation == "parallel") 167 | implementation = "sequential"; 168 | else if (implementation == "sequential") 169 | implementation = "parallel"; 170 | 171 | NBody.init(implementation); 172 | } 173 | 174 | -------------------------------------------------------------------------------- /examples/idf-demo/images/jupiter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/idf-demo/images/jupiter.jpg -------------------------------------------------------------------------------- /examples/idf-demo/images/moon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/idf-demo/images/moon.jpg -------------------------------------------------------------------------------- /examples/idf-demo/images/particle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/idf-demo/images/particle.png -------------------------------------------------------------------------------- /examples/idf-demo/images/ship-back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/idf-demo/images/ship-back.png -------------------------------------------------------------------------------- /examples/idf-demo/images/ship-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/idf-demo/images/ship-down.png -------------------------------------------------------------------------------- /examples/idf-demo/images/ship-front.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/idf-demo/images/ship-front.png -------------------------------------------------------------------------------- /examples/idf-demo/images/ship-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/idf-demo/images/ship-left.png -------------------------------------------------------------------------------- /examples/idf-demo/images/ship-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/idf-demo/images/ship-right.png -------------------------------------------------------------------------------- /examples/idf-demo/images/ship-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/idf-demo/images/ship-up.png -------------------------------------------------------------------------------- /examples/idf-demo/images/tunnel_gradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/idf-demo/images/tunnel_gradient.png -------------------------------------------------------------------------------- /examples/idf-demo/images/tunnel_gradient_tall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/idf-demo/images/tunnel_gradient_tall.png -------------------------------------------------------------------------------- /examples/idf-demo/images/tunnel_gradient_wide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/idf-demo/images/tunnel_gradient_wide.png -------------------------------------------------------------------------------- /examples/liquid-resize/resize-demo.html: -------------------------------------------------------------------------------- 1 | 26 | 33 | 34 | 35 | River Trail Context Aware Image Resizing Demo 36 | 37 | 38 | 39 | 40 |
41 | 42 | using 43 | 47 | , or 48 | 49 | . You can 50 | 51 | the image, as well. 52 |
53 |
54 |
55 |

56 | 57 |
58 |

Scoreboard[reset]

59 |

Last Sequential Runtimes

60 | 61 | 62 | 63 |
Full--
Parallel Component--
64 |

Last Parallel Runtimes

65 | 66 | 67 | 68 |
Full--
Parallel Component--
69 |

Speedup

70 | 71 | 72 | 73 |
Full--
Parallel Component--
74 |
75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /examples/liquid-resize/tower.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/examples/liquid-resize/tower.jpg -------------------------------------------------------------------------------- /examples/liquid-resize/towerImageLicense.txt: -------------------------------------------------------------------------------- 1 | The tower.jpg image is licensed under the Creative Commons Attribution 2.5 Generic license. 2 | See http://commons.wikimedia.org/wiki/File:Broadway_tower_edit.jpg for more details. 3 | 4 | -------------------------------------------------------------------------------- /examples/mandelbrot-explore/mandelbrot.html: -------------------------------------------------------------------------------- 1 | 26 | 27 | 28 | RiverTrail Mandelbrot Set Demo 29 | 30 | 31 | 32 | 33 |

RiverTrail Mandelbrot Set Demo

34 |

35 | 36 | 37 |

FPS

38 |

The Mandelbrot Set Kernel in JavaScript using River Trail: 39 |

function computeSet(iv, scale) {
40 |     var x = iv[1];
41 |     var y = iv[0];
42 |     var Cr = (x - 256) / scale + 0.407476;
43 |     var Ci = (y - 256) / scale + 0.234204;
44 |     var I = 0, R = 0, I2 = 0, R2 = 0;
45 |     var n = 0;
46 |     while ((R2+I2 < 2.0) && (n < 512)) {
47 |        I = (R+R)*I+Ci;
48 |        R = R2-I2+Cr;
49 |        R2 = R*R;
50 |        I2 = I*I;
51 |        n++;
52 |     } 
53 |     return n;
54 | }
55 | Based on the Evgeny Demidov's WebCL example.

56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /examples/mandelbrot/mandelbrot.html: -------------------------------------------------------------------------------- 1 | 26 | 27 | 28 | RiverTrail Mandelbrot Set Demo 29 | 30 | 31 | 32 | 33 |

RiverTrail Mandelbrot Set Demo

34 |

35 |

The Mandelbrot Set Kernel in JavaScript using River Trail: 36 |

function computeSet(iv, scale) {
37 |     var x = iv[1];
38 |     var y = iv[0];
39 |     var Cr = (x - 256) / scale + 0.407476;
40 |     var Ci = (y - 256) / scale + 0.234204;
41 |     var I = 0, R = 0, I2 = 0, R2 = 0;
42 |     var n = 0;
43 |     while ((R2+I2 < 2.0) && (n < 512)) {
44 |        I = (R+R)*I+Ci;
45 |        R = R2-I2+Cr;
46 |        R2 = R*R;
47 |        I2 = I*I;
48 |        n++;
49 |     } 
50 |     return n;
51 | }
52 | Based on the Evgeny Demidov's WebCL example.

53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /examples/mandelbrot/mandelbrot.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 | * THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | */ 27 | 28 | // the below code is based on a WebCL implementation available at 29 | // http://www.ibiblio.org/e-notes/webcl/mandelbrot.html 30 | 31 | var nc = 30, maxCol = nc*3, cr,cg,cb; 32 | 33 | // initialises the color map for translating Mandelbrot iterations 34 | // into nice colors 35 | function computeColorMap() { 36 | var st = 255/nc; 37 | cr = new Array(maxCol); cg = new Array(maxCol); cb = new Array(maxCol); 38 | for (var i = 0; i < nc; i++){ 39 | var d = Math.floor(st*i); 40 | cr[i] = 255 - d; cr[i+nc] = 0; cr[i+2*nc] = d; 41 | cg[i] = d; cg[i+nc] = 255 - d; cg[i+2*nc] = 0; 42 | cb[i] = 0; cb[i+nc] = d; cb[i+2*nc] = 255 - d; 43 | } 44 | cr[maxCol] = cg[maxCol] = cb[maxCol] = 0; 45 | } 46 | 47 | // this is the actual mandelbrot computation, ported to JavaScript 48 | // from the WebCL / OpenCL example at 49 | // http://www.ibiblio.org/e-notes/webcl/mandelbrot.html 50 | function computeSet(iv, scale) { 51 | var x = iv[1]; 52 | var y = iv[0]; 53 | var Cr = (x - 256) / scale + 0.407476; 54 | var Ci = (y - 256) / scale + 0.234204; 55 | var I = 0, R = 0, I2 = 0, R2 = 0; 56 | var n = 0; 57 | while ((R2+I2 < 2.0) && (n < 512)) { 58 | I = (R+R)*I+Ci; 59 | R = R2-I2+Cr; 60 | R2 = R*R; 61 | I2 = I*I; 62 | n++; 63 | } 64 | return n; 65 | } 66 | 67 | // helper function to write the result of computing the mandelbrot 68 | // set to a canvas 69 | function writeResult (canvas, mandelbrot) { 70 | var context = canvas.getContext("2d"); 71 | var image = context.createImageData(512, 512); 72 | var pix = image.data, c = 0, ic; 73 | var mbrot = mandelbrot.flatten(); 74 | var outBuffer = mbrot.getArray(); 75 | for (var t = 0; t < 512*512; t++) { 76 | var i = outBuffer[t]; 77 | if (i == 512) ic = maxCol; 78 | else ic = i % maxCol; 79 | pix[c++] = cr[ic]; 80 | pix[c++] = cg[ic]; 81 | pix[c++] = cb[ic]; 82 | pix[c++] = 255; 83 | } 84 | context.putImageData(image, 0, 0); 85 | } 86 | 87 | function render () { 88 | var canvas = document.getElementById("canvas"); 89 | var scale = 10000*300; 90 | computeColorMap(); 91 | var mandelbrot = new ParallelArray([512,512], computeSet, scale); 92 | writeResult(canvas, mandelbrot); 93 | } 94 | 95 | 96 | -------------------------------------------------------------------------------- /extension/README.md: -------------------------------------------------------------------------------- 1 | Building the Firefox River Trail Extension 2 | ========================================== 3 | 4 | **This README is for extension developers.** If you just want to install the River Trail extension, you can [install a pre-built version](https://github.com/IntelLabs/RiverTrail/releases). 5 | 6 | Preliminaries: OpenCL SDK 7 | ------------------------- 8 | 9 | MacOS X 10.6 and later already provide the required OpenCL stack as part of the operating system. On Windows and Linux, you will need to install [the Intel OpenCL SDK] for the extension to work. 10 | 11 | [the Intel OpenCL SDK]: https://software.intel.com/en-us/intel-opencl 12 | 13 | Building the extension 14 | ---------------------- 15 | 16 | This extension is based on the [Firefox Add-on SDK](https://developer.mozilla.org/en-US/Add-ons/SDK). In order to build and test the extension, first install the Add-on SDK and activate it in the Add-on SDK's directory. For example, on Linux, Mac OS and MinGW on Windows: 17 | ```bash 18 | cd addon-sdk 19 | source bin/activate 20 | ``` 21 | On Windows with the native shell: 22 | ```bash 23 | cd addon-sdk 24 | bin\activate 25 | ``` 26 | You can then test, run, and package the extension using the [cfx](https://developer.mozilla.org/en-US/Add-ons/SDK/Tools/cfx) tool that comes with the Add-on SDK. (Note: as of this writing, cfx is due to be replaced with [jpm](https://www.npmjs.com/package/jpm) in the near future.) 27 | 28 | ```bash 29 | cd RiverTrail/extension 30 | cfx run # launches an instance of Firefox with the extension 31 | cfx xpi # creates an installable XPI file 32 | ``` 33 | Once you have the extension up and running, test it out with one of our [demos](https://github.com/IntelLabs/RiverTrail/wiki#sample-applications). 34 | -------------------------------------------------------------------------------- /extension/data/prefs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 |
13 |
14 | Default OpenCL Platform 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
 NameVersionVendor
24 |
25 | 26 |
27 | Default OpenCL Device 28 | 29 | 30 |
31 |
32 | 33 |

34 |
35 | 36 | 37 | -------------------------------------------------------------------------------- /extension/data/prefs.js: -------------------------------------------------------------------------------- 1 | // Content script for prefs. 2 | 3 | "use strict"; 4 | 5 | self.port.on("platform-data", function(platforms) { 6 | for (let i = 0; i < platforms.length; i++) { 7 | let name = platforms[i].name; 8 | let version = platforms[i].version; 9 | let vendor = platforms[i].vendor; 10 | let devices = platforms[i].deviceNames; 11 | let platformTable = document.getElementById("platforms"); 12 | let platformRow = platformTable.insertRow(1); // insert first row after header row 13 | let buttonCell = platformRow.insertCell(0); 14 | let input = document.createElement("input"); 15 | input.type = "radio"; 16 | input.name = "platform"; 17 | input.id = "platform_" + i; 18 | input.value = i; 19 | // Select the first item 20 | if (i == 0) { 21 | input.checked = "checked"; 22 | } 23 | buttonCell.appendChild(input); 24 | let nameCell = platformRow.insertCell(1); 25 | let nameLabel = document.createElement("label"); 26 | nameLabel.setAttribute("for", input.id); 27 | nameLabel.innerHTML = name; 28 | nameCell.appendChild(nameLabel); 29 | let versionCell = platformRow.insertCell(2); 30 | let versionLabel = document.createElement("label"); 31 | versionLabel.setAttribute("for", input.id); 32 | versionLabel.innerHTML = version; 33 | versionCell.appendChild(versionLabel); 34 | let vendorCell = platformRow.insertCell(3); 35 | let vendorLabel = document.createElement("label"); 36 | vendorLabel.setAttribute("for", input.id); 37 | vendorLabel.innerHTML = vendor; 38 | vendorCell.appendChild(vendorLabel); 39 | 40 | // Create an event listener that will repopulate device info 41 | // when a new platform is selected. Device stuff gets 42 | // populated individually, per platform. 43 | platformRow.addEventListener('click', function onclick(event) { 44 | // If the clicked row isn't already selected... 45 | let input = platformRow.cells[0].getElementsByTagName("input")[0]; 46 | if (!input.checked) { 47 | populateDevices(devices); 48 | } 49 | }, false); 50 | 51 | // Pre-populate device info for the currently selected platform. 52 | if (i == 0) { 53 | populateDevices(devices); 54 | } 55 | }; 56 | }); 57 | 58 | let button = document.getElementById("done"); 59 | button.addEventListener('click', function onclick(event) { 60 | 61 | // Send a message to hide the prefs panel. 62 | self.port.emit("button-clicked"); 63 | 64 | let platforms = document.getElementsByName("platform"); 65 | let devices = document.getElementsByName("device"); 66 | 67 | // Send messages saying which platform and device were selected. 68 | for (let i = 0; i < platforms.length; i++) { 69 | if (platforms[i].checked) { 70 | self.port.emit("platform-selected", platforms[i].value); 71 | } 72 | } 73 | 74 | for (let i = 0; i < devices.length; i++) { 75 | if (devices[i].checked) { 76 | self.port.emit("device-selected", devices[i].value); 77 | } 78 | } 79 | 80 | }, false); 81 | 82 | function populateDevices(devices) { 83 | 84 | // First, get rid of any devices that are there. 85 | let deviceTable = document.getElementById("devices"); 86 | for (let i = 0; i < deviceTable.rows.length; i++) { 87 | deviceTable.deleteRow(i); 88 | } 89 | 90 | // Now add the devices that should be there. 91 | for (let i = 0; i < devices.length; i++) { 92 | let type = devices[i].trim(); 93 | if (devices[i] === "Unknown Device" || devices[i] === "") { 94 | continue; 95 | } 96 | let deviceRow = deviceTable.insertRow(0); 97 | let buttonCell = deviceRow.insertCell(0); 98 | let input = document.createElement("input"); 99 | input.type = "radio"; 100 | input.name = "device"; 101 | input.id = "device_" + i; 102 | input.value = i; 103 | // Select the first item 104 | if (i == 0) { 105 | input.checked = "checked"; 106 | } 107 | buttonCell.appendChild(input); 108 | let typeCell = deviceRow.insertCell(1); 109 | let label = document.createElement("label"); 110 | label.setAttribute("for", input.id); 111 | label.innerHTML = type; 112 | typeCell.appendChild(label); 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /extension/lib/CLTypes.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 | * THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | */ 27 | 28 | let { Cu } = require("chrome"); 29 | Cu.import("resource://gre/modules/ctypes.jsm"); 30 | 31 | // OpenCL "abstract data types" (see 32 | // https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/abstractDataTypes.html). 33 | // We have no choice but to represent these as ctypes.voidptr_t, since 34 | // we don't know know how OpenCL represents them internally. 35 | 36 | let cl_platform_id = ctypes.voidptr_t; // The ID for a platform. 37 | let cl_device_id = ctypes.voidptr_t; // The ID for a device. 38 | let cl_context = ctypes.voidptr_t; // A context. 39 | let cl_command_queue = ctypes.voidptr_t; // A command queue. 40 | let cl_mem = ctypes.voidptr_t; // A memory object. 41 | let cl_program = ctypes.voidptr_t; // A program. 42 | let cl_kernel = ctypes.voidptr_t; // A kernel. 43 | let cl_event = ctypes.voidptr_t; // An event. 44 | 45 | // Types that have existing ctypes counterparts: 46 | 47 | // As defined in cl_platform.h. 48 | let cl_int = ctypes.int32_t; 49 | let cl_uint = ctypes.uint32_t; 50 | let cl_ulong = ctypes.uint64_t; 51 | 52 | // As defined in cl.h. 53 | let cl_bool = cl_uint; 54 | let cl_bitfield = cl_ulong; 55 | let cl_device_type = cl_bitfield; 56 | let cl_platform_info = cl_uint; 57 | let cl_device_info = cl_uint; 58 | let cl_command_queue_properties = cl_bitfield; 59 | 60 | let cl_context_properties = ctypes.int.ptr; // N.B.: in cl.h, cl_context_properties is typedef'd to intptr_t, even though it's an enum type. 61 | let cl_context_info = cl_uint; 62 | let cl_mem_flags = cl_bitfield; 63 | let cl_map_flags = cl_bitfield; 64 | let cl_program_info = cl_bitfield; 65 | let cl_program_build_info = cl_uint; 66 | 67 | exports.CLTypes = { 68 | cl_platform_id: cl_platform_id, 69 | cl_device_id: cl_device_id, 70 | cl_context: cl_context, 71 | cl_command_queue: cl_command_queue, 72 | cl_mem: cl_mem, 73 | cl_program: cl_program, 74 | cl_kernel: cl_kernel, 75 | cl_event: cl_event, 76 | 77 | cl_int: cl_int, 78 | cl_uint: cl_uint, 79 | cl_ulong: cl_ulong, 80 | 81 | cl_bool: cl_bool, 82 | cl_bitfield: cl_bitfield, 83 | cl_device_type: cl_device_type, 84 | cl_platform_info: cl_platform_info, 85 | cl_device_info: cl_device_info, 86 | cl_command_queue_properties: cl_command_queue_properties, 87 | 88 | cl_context_properties: cl_context_properties, 89 | cl_context_info: cl_context_info, 90 | cl_mem_flags: cl_mem_flags, 91 | cl_map_flags: cl_map_flags, 92 | cl_program_info: cl_program_info, 93 | cl_program_build_info: cl_program_build_info, 94 | }; 95 | -------------------------------------------------------------------------------- /extension/lib/Constants.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 | * THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | */ 27 | 28 | // Various constants from cl.h: 29 | 30 | // Error codes: 31 | const CL_SUCCESS = 0; 32 | const CL_MEM_OBJECT_ALLOCATION_FAILURE = -4; 33 | const CL_OUT_OF_RESOURCES = -5; 34 | const CL_OUT_OF_HOST_MEMORY = -6; 35 | 36 | // cl_bool variants: 37 | const CL_FALSE = 0; 38 | const CL_TRUE = 1; 39 | 40 | // cl_context_info variants (for specifying to `clGetContextInfo` what 41 | // we're asking for info about): 42 | const CL_CONTEXT_NUM_DEVICES = 0x1083; 43 | 44 | // cl_device_info variants (for specifying to `clGetDeviceInfo` what 45 | // we're asking for info about): 46 | const CL_DEVICE_AVAILABLE = 0x1027; 47 | const CL_DEVICE_NAME = 0x102B; 48 | 49 | // cl_platform_info variants (for specifying to `clGetPlatformInfo` 50 | // what we're asking for info about): 51 | const CL_PLATFORM_PROFILE = 0x0900; 52 | const CL_PLATFORM_VERSION = 0x0901; 53 | const CL_PLATFORM_NAME = 0x0902; 54 | const CL_PLATFORM_VENDOR = 0x0903; 55 | const CL_PLATFORM_EXTENSIONS = 0x0904; 56 | 57 | // cl_program_info variants (for specifying to `clGetProgramInfo` 58 | // what we're asking for info about): 59 | const CL_PROGRAM_NUM_DEVICES = 0x1162; 60 | const CL_PROGRAM_DEVICES = 0x1163; 61 | 62 | // cl_program_build_info variants (for specifying to 63 | // `clGetProgramBuildInfo` what we're asking for info about): 64 | const CL_PROGRAM_BUILD_LOG = 0x1183; 65 | 66 | // cl_context_properties variants: 67 | const CL_CONTEXT_PLATFORM = 0x1084; 68 | 69 | // cl_device_type bitfield bits (for specifying to `clGetDeviceIDs` 70 | // which devices we want to query): 71 | const CL_DEVICE_TYPE_DEFAULT = (1 << 0); 72 | const CL_DEVICE_TYPE_CPU = (1 << 1); 73 | const CL_DEVICE_TYPE_GPU = (1 << 2); 74 | const CL_DEVICE_TYPE_ACCELERATOR = (1 << 3); 75 | const CL_DEVICE_TYPE_CUSTOM = (1 << 4); 76 | const CL_DEVICE_TYPE_ALL = 0xFFFFFFFF; 77 | 78 | // cl_mem_flags bitfield bits: 79 | const CL_MEM_READ_WRITE = (1 << 0); 80 | const CL_MEM_READ_ONLY = (1 << 2); 81 | const CL_MEM_USE_HOST_PTR = (1 << 3); 82 | const CL_MEM_COPY_HOST_PTR = (1 << 5); 83 | 84 | // cl_command_queue_properties bitfield bits: 85 | const CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE = (1 << 0); 86 | const CL_QUEUE_PROFILING_ENABLE = (1 << 1); 87 | 88 | // cl_map_flags bitfield bits: 89 | const CL_MAP_READ = (1 << 0); 90 | 91 | // Other constants, not specific to OpenCL. 92 | const RIVERTRAIL_MAX_DEVICE_NAME_LENGTH = 64; 93 | const RIVERTRAIL_NUMBER_OF_ARTIFICIAL_ARGS = 1; 94 | 95 | exports.Constants = { 96 | CL_SUCCESS: CL_SUCCESS, 97 | CL_MEM_OBJECT_ALLOCATION_FAILURE: CL_MEM_OBJECT_ALLOCATION_FAILURE, 98 | CL_OUT_OF_RESOURCES: CL_OUT_OF_RESOURCES, 99 | CL_OUT_OF_HOST_MEMORY: CL_OUT_OF_HOST_MEMORY, 100 | 101 | CL_FALSE: CL_FALSE, 102 | CL_TRUE: CL_TRUE, 103 | 104 | CL_CONTEXT_NUM_DEVICES: CL_CONTEXT_NUM_DEVICES, 105 | 106 | CL_DEVICE_AVAILABLE: CL_DEVICE_AVAILABLE, 107 | CL_DEVICE_NAME: CL_DEVICE_NAME, 108 | 109 | CL_PLATFORM_PROFILE: CL_PLATFORM_PROFILE, 110 | CL_PLATFORM_VERSION: CL_PLATFORM_VERSION, 111 | CL_PLATFORM_NAME: CL_PLATFORM_NAME, 112 | CL_PLATFORM_VENDOR: CL_PLATFORM_VENDOR, 113 | CL_PLATFORM_EXTENSIONS: CL_PLATFORM_EXTENSIONS, 114 | 115 | CL_PROGRAM_NUM_DEVICES: CL_PROGRAM_NUM_DEVICES, 116 | CL_PROGRAM_DEVICES: CL_PROGRAM_DEVICES, 117 | 118 | CL_PROGRAM_BUILD_LOG: CL_PROGRAM_BUILD_LOG, 119 | 120 | CL_CONTEXT_PLATFORM: CL_CONTEXT_PLATFORM, 121 | 122 | CL_DEVICE_TYPE_DEFAULT: CL_DEVICE_TYPE_DEFAULT, 123 | CL_DEVICE_TYPE_CPU: CL_DEVICE_TYPE_CPU, 124 | CL_DEVICE_TYPE_GPU: CL_DEVICE_TYPE_GPU, 125 | CL_DEVICE_TYPE_ACCELERATOR: CL_DEVICE_TYPE_ACCELERATOR, 126 | CL_DEVICE_TYPE_CUSTOM: CL_DEVICE_TYPE_CUSTOM, 127 | CL_DEVICE_TYPE_ALL: CL_DEVICE_TYPE_ALL, 128 | 129 | CL_MEM_READ_WRITE: CL_MEM_READ_WRITE, 130 | CL_MEM_READ_ONLY: CL_MEM_READ_ONLY, 131 | CL_MEM_USE_HOST_PTR: CL_MEM_USE_HOST_PTR, 132 | CL_MEM_COPY_HOST_PTR: CL_MEM_COPY_HOST_PTR, 133 | 134 | CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE: CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, 135 | CL_QUEUE_PROFILING_ENABLE: CL_QUEUE_PROFILING_ENABLE, 136 | 137 | CL_MAP_READ: CL_MAP_READ, 138 | 139 | RIVERTRAIL_MAX_DEVICE_NAME_LENGTH: RIVERTRAIL_MAX_DEVICE_NAME_LENGTH, 140 | RIVERTRAIL_NUMBER_OF_ARTIFICIAL_ARGS: RIVERTRAIL_NUMBER_OF_ARTIFICIAL_ARGS, 141 | }; 142 | -------------------------------------------------------------------------------- /extension/lib/Debug.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 | * THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | */ 27 | 28 | let { Cu } = require("chrome"); 29 | Cu.import("resource://gre/modules/devtools/Console.jsm"); 30 | 31 | let { Constants } = require("Constants.js"); 32 | 33 | // This can be set to true or false to enable or disable logging. 34 | let gDebug = true; 35 | let gPrefix = "River Trail extension: "; 36 | 37 | function log(x) { 38 | if (gDebug) { 39 | console.log(gPrefix + x); 40 | } 41 | } 42 | 43 | // Checks for non-CL_SUCCESS error codes. 44 | // errorCode should be a cl_int. 45 | function check(errorCode, calledFunction) { 46 | if (gDebug) { 47 | if (errorCode.value != Constants.CL_SUCCESS) { 48 | errorString = calledFunction + 49 | " returned with error code " + 50 | errorCode.value; 51 | log(errorString); 52 | 53 | throw errorString; 54 | } 55 | } 56 | } 57 | 58 | exports.Debug = { 59 | log: log, 60 | check: check, 61 | } 62 | -------------------------------------------------------------------------------- /extension/lib/main.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 | * THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | */ 27 | 28 | let { Cu } = require("chrome"); 29 | 30 | let events = require("sdk/system/events"); 31 | let prefs = require("sdk/simple-prefs"); 32 | let panels = require("sdk/panel"); 33 | let self = require("sdk/self"); 34 | 35 | let { OpenCL } = require("OpenCL.js"); 36 | let { RiverTrailInterface } = require("RiverTrailInterface.js"); 37 | let { Debug } = require("Debug.js"); 38 | let { Platforms } = require("Platforms.js"); 39 | 40 | function injectFunctions(event) { 41 | // event.subject is an nsIDOMWindow 42 | // event.data is a string representing the origin 43 | Debug.log("injecting functions for origin " + event.data); 44 | let domWindow = event.subject; 45 | 46 | // Add to window all the functions we want user-side code to be able to call. 47 | Cu.exportFunction(RiverTrailInterface.riverTrailExtensionIsInstalled, domWindow, 48 | {defineAs: "riverTrailExtensionIsInstalled"}); 49 | 50 | Cu.exportFunction(RiverTrailInterface.is64BitFloatingPointEnabled, domWindow, 51 | {defineAs: "is64BitFloatingPointEnabled"}); 52 | 53 | Cu.exportFunction(RiverTrailInterface.initContext, domWindow, 54 | {defineAs: "initContext"}); 55 | 56 | Cu.exportFunction(RiverTrailInterface.canBeMapped, domWindow, 57 | {defineAs: "canBeMapped"}); 58 | 59 | Cu.exportFunction(RiverTrailInterface.compileKernel, domWindow, 60 | {defineAs: "compileKernel"}); 61 | 62 | Cu.exportFunction(RiverTrailInterface.getBuildLog, domWindow, 63 | {defineAs: "getBuildLog"}); 64 | 65 | Cu.exportFunction(RiverTrailInterface.mapData, domWindow, 66 | {defineAs: "mapData"}); 67 | 68 | Cu.exportFunction(RiverTrailInterface.setArgument, domWindow, 69 | {defineAs: "setArgument"}); 70 | 71 | Cu.exportFunction(RiverTrailInterface.setScalarArgument, domWindow, 72 | {defineAs: "setScalarArgument"}); 73 | 74 | Cu.exportFunction(RiverTrailInterface.run, domWindow, 75 | {defineAs: "run"}); 76 | 77 | Cu.exportFunction(RiverTrailInterface.getValue, domWindow, 78 | {defineAs: "getValue", 79 | allowCallbacks: true}); 80 | 81 | Debug.log("finished injecting functions"); 82 | } 83 | 84 | let gInitialized = false; 85 | 86 | // This function is called whenever the add-on is loaded. 87 | exports.main = function(options, callbacks) { 88 | if (!gInitialized && 89 | (options.loadReason == "startup" || 90 | options.loadReason == "install" || 91 | options.loadReason == "enable")) { 92 | Debug.log("initializing"); 93 | OpenCL.init(); 94 | events.on("content-document-global-created", injectFunctions); 95 | gInitialized = true; 96 | populatePrefs(); 97 | } 98 | }; 99 | 100 | // This function is called whenever the add-on is unloaded. 101 | exports.onUnload = function(reason) { 102 | Debug.log("onUnload: " + reason); 103 | if (gInitialized && (reason == "shutdown" || reason == "disable")) { 104 | Debug.log("deinitializing"); 105 | events.off("content-document-global-created", injectFunctions); 106 | OpenCL.shutdown(); 107 | gInitialized = false; 108 | } 109 | }; 110 | 111 | // This code handles populating and collecting user input from the 112 | // preferences panel. 113 | prefs.on("prefsButton", function() { 114 | panel.show(); 115 | }); 116 | 117 | let panel = panels.Panel({ 118 | width: 600, 119 | height: 350, 120 | contentURL: self.data.url("prefs.html"), 121 | contentScriptFile: self.data.url("prefs.js") 122 | }); 123 | 124 | panel.port.on("platform-selected", function(prefString) { 125 | prefs.prefs.defaultPlatform = parseInt(prefString); 126 | }); 127 | 128 | panel.port.on("device-selected", function(prefString) { 129 | prefs.prefs.defaultDeviceType = parseInt(prefString); 130 | }); 131 | 132 | // Hide the panel when the "OK" button is clicked. 133 | panel.port.on("button-clicked", function() { 134 | panel.hide(); 135 | }); 136 | 137 | function populatePrefs() { 138 | Platforms.init(); 139 | panel.port.emit("platform-data", Platforms.jsPlatforms); 140 | } 141 | -------------------------------------------------------------------------------- /extension/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "river-trail-for-firefox", 3 | "title": "River Trail for Firefox", 4 | "id": "jid1-bDmQztb2AgWrHQ", 5 | "description": "Used by River Trail to interface with OpenCL from JavaScript", 6 | "author": "Intel Labs", 7 | "version": "0.35.0", 8 | "preferences": [{ 9 | "type": "control", 10 | "label": "OpenCL Preferences...", 11 | "name": "prefsButton", 12 | "title": "OpenCL Preferences" 13 | }, 14 | { 15 | "name": "defaultPlatform", 16 | "title": "Default OpenCL platform", 17 | "type": "integer", 18 | "value": 0, 19 | "hidden": true 20 | }, 21 | { 22 | "name": "defaultDeviceType", 23 | "title": "Default OpenCL device type", 24 | "type": "integer", 25 | "value": 0, 26 | "hidden": true 27 | }] 28 | } 29 | -------------------------------------------------------------------------------- /extension/test/test-main.js: -------------------------------------------------------------------------------- 1 | var main = require("./main"); 2 | 3 | exports["test main"] = function(assert) { 4 | assert.pass("Unit test running!"); 5 | }; 6 | 7 | exports["test main async"] = function(assert, done) { 8 | assert.pass("async Unit test running!"); 9 | done(); 10 | }; 11 | 12 | require("sdk/test").run(exports); 13 | -------------------------------------------------------------------------------- /jslib/Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | grunt.initConfig({ 4 | pkg: grunt.file.readJSON('package.json'), 5 | concat: { 6 | options: { 7 | process: function(src, filepath) { 8 | return '/* File ' + filepath + '*/\n' + src; 9 | } 10 | }, 11 | dist: { 12 | // the files to concatenate 13 | src: [ 14 | 'jit/narcissus/jsdefs.js', 15 | 'jit/narcissus/jslex.js', 16 | 'jit/narcissus/jsparse.js', 17 | 'jit/narcissus/jsdecomp.js', 18 | 'jit/compiler/definitions.js', 19 | 'jit/compiler/helper.js', 20 | 'jit/compiler/runtimes.js', 21 | 'ParallelArray.js', 22 | 'jit/compiler/driver.js', 23 | 'jit/compiler/dotviz.js', 24 | 'jit/compiler/typeinference.js', 25 | 'jit/compiler/rangeanalysis.js', 26 | 'jit/compiler/inferblockflow.js', 27 | 'jit/compiler/infermem.js', 28 | 'jit/compiler/genOCL.js', 29 | 'jit/compiler/runOCL.js'], 30 | // the location of the resulting JS file 31 | dest: '../dist/<%= pkg.name %>.js' 32 | } 33 | }, 34 | uglify: { 35 | options: { 36 | banner: '/*! <%= pkg.name %> <%= grunt.template.today("mm-dd-yyyy") %> */\n' 37 | }, 38 | dist: { 39 | files: { 40 | '../dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>'] 41 | } 42 | } 43 | } 44 | }); 45 | 46 | 47 | grunt.loadNpmTasks('grunt-contrib-concat'); 48 | grunt.loadNpmTasks('grunt-contrib-uglify'); 49 | grunt.registerTask('default', ['concat', 'uglify']); 50 | 51 | }; 52 | -------------------------------------------------------------------------------- /jslib/README.md: -------------------------------------------------------------------------------- 1 | # River Trail library source code 2 | 3 | This directory contains source files for the River Trail library. **Don't include these files in your web page. Instead, use `RiverTrail.js` or `RiverTrail.min.js` from the `../dist/` directory.** 4 | 5 | The `Gruntfile.js` and `package.json` files in this directory are intended for use with the [Grunt](http://gruntjs.com) JavaScript task runner. In order to use them: 6 | 7 | * Install [Node.js](http://nodejs.org/) and `npm`, the Node.js package manager. 8 | * In this directory, run `npm install`. This will install Grunt and two Grunt plugins, `grunt-contrib-concat` and `grunt-contrib-uglify`. 9 | * Install the Grunt command-line interface: `npm install -g grunt-cli`. (You may need to do this with `sudo` or administrator privileges.) 10 | * Finally, run `grunt` in this directory. Doing so will concatenate the River Trail library source files into a single file, `../dist/RiverTrail.js`. It will also create a minified version, `../dist/RiverTrail.min.js`. 11 | -------------------------------------------------------------------------------- /jslib/jit/compiler/definitions.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, Intel Corporation 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * - Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 | * THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | */ 27 | 28 | if (RiverTrail === undefined) { 29 | var RiverTrail = {}; 30 | } 31 | 32 | RiverTrail.definitions = function () { 33 | var tokens= [ "CAST", "TOINT32", "FLATTEN" ]; 34 | const offset = Narcissus.definitions.tokens.length; 35 | 36 | var consts = "const "; 37 | for (var idx = 0; idx < tokens.length; idx++) { 38 | consts += tokens[idx] + "=" + (offset + idx); 39 | if (idx < tokens.length - 1) { 40 | consts += ","; 41 | } 42 | } 43 | consts += ";"; 44 | 45 | // add all tokens into a single array 46 | tokens = Narcissus.definitions.tokens.concat(tokens); 47 | 48 | return {"consts" : consts, "tokens" : tokens}; 49 | }(); 50 | 51 | 52 | -------------------------------------------------------------------------------- /jslib/jit/compiler/rangeanalysis.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/jslib/jit/compiler/rangeanalysis.js -------------------------------------------------------------------------------- /jslib/jit/compiler/typeinference.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/jslib/jit/compiler/typeinference.js -------------------------------------------------------------------------------- /jslib/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RiverTrail", 3 | "version": "0.35.0", 4 | "devDependencies": { 5 | "grunt": "~0.4.5", 6 | "grunt-contrib-concat": "~0.5.0", 7 | "grunt-contrib-uglify": "~0.7.0", 8 | "nodeunit": "~0.9.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /jslib/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This is a pre-commit hook script to run `grunt` and add the 4 | # resulting generated files to the repo. To run this script as a 5 | # pre-commit hook, save a file containing 6 | # 7 | # #!/bin/bash 8 | # 9 | # ./jslib/pre-commit 10 | # 11 | # as ./git/hooks/pre-commit, ensuring that both that file and this one 12 | # are executable. 13 | 14 | cd jslib 15 | grunt && git --git-dir=../.git --work-tree=.. add ../dist/RiverTrail.js ../dist/RiverTrail.min.js -------------------------------------------------------------------------------- /jslib/test.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 31 | River Trail Test Suite 32 | 33 | 34 | 35 | 36 | 37 | 38 |

River Trail Test Suite

39 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /tutorial/css/pygment_trac.css: -------------------------------------------------------------------------------- 1 | .highlight .hll { background-color: #ffffcc } 2 | .highlight { background: #f0f3f3; } 3 | .highlight .c { color: #0099FF; font-style: italic } /* Comment */ 4 | .highlight .err { color: #AA0000; background-color: #FFAAAA } /* Error */ 5 | .highlight .k { color: #006699; font-weight: bold } /* Keyword */ 6 | .highlight .o { color: #555555 } /* Operator */ 7 | .highlight .cm { color: #0099FF; font-style: italic } /* Comment.Multiline */ 8 | .highlight .cp { color: #009999 } /* Comment.Preproc */ 9 | .highlight .c1 { color: #0099FF; font-style: italic } /* Comment.Single */ 10 | .highlight .cs { color: #0099FF; font-weight: bold; font-style: italic } /* Comment.Special */ 11 | .highlight .gd { background-color: #FFCCCC; border: 1px solid #CC0000 } /* Generic.Deleted */ 12 | .highlight .ge { font-style: italic } /* Generic.Emph */ 13 | .highlight .gr { color: #FF0000 } /* Generic.Error */ 14 | .highlight .gh { color: #003300; font-weight: bold } /* Generic.Heading */ 15 | .highlight .gi { background-color: #CCFFCC; border: 1px solid #00CC00 } /* Generic.Inserted */ 16 | .highlight .go { color: #AAAAAA } /* Generic.Output */ 17 | .highlight .gp { color: #000099; font-weight: bold } /* Generic.Prompt */ 18 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 19 | .highlight .gu { color: #003300; font-weight: bold } /* Generic.Subheading */ 20 | .highlight .gt { color: #99CC66 } /* Generic.Traceback */ 21 | .highlight .kc { color: #006699; font-weight: bold } /* Keyword.Constant */ 22 | .highlight .kd { color: #006699; font-weight: bold } /* Keyword.Declaration */ 23 | .highlight .kn { color: #006699; font-weight: bold } /* Keyword.Namespace */ 24 | .highlight .kp { color: #006699 } /* Keyword.Pseudo */ 25 | .highlight .kr { color: #006699; font-weight: bold } /* Keyword.Reserved */ 26 | .highlight .kt { color: #007788; font-weight: bold } /* Keyword.Type */ 27 | .highlight .m { color: #FF6600 } /* Literal.Number */ 28 | .highlight .s { color: #CC3300 } /* Literal.String */ 29 | .highlight .na { color: #330099 } /* Name.Attribute */ 30 | .highlight .nb { color: #336666 } /* Name.Builtin */ 31 | .highlight .nc { color: #00AA88; font-weight: bold } /* Name.Class */ 32 | .highlight .no { color: #336600 } /* Name.Constant */ 33 | .highlight .nd { color: #9999FF } /* Name.Decorator */ 34 | .highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */ 35 | .highlight .ne { color: #CC0000; font-weight: bold } /* Name.Exception */ 36 | .highlight .nf { color: #CC00FF } /* Name.Function */ 37 | .highlight .nl { color: #9999FF } /* Name.Label */ 38 | .highlight .nn { color: #00CCFF; font-weight: bold } /* Name.Namespace */ 39 | .highlight .nt { color: #330099; font-weight: bold } /* Name.Tag */ 40 | .highlight .nv { color: #003333 } /* Name.Variable */ 41 | .highlight .ow { color: #000000; font-weight: bold } /* Operator.Word */ 42 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 43 | .highlight .mf { color: #FF6600 } /* Literal.Number.Float */ 44 | .highlight .mh { color: #FF6600 } /* Literal.Number.Hex */ 45 | .highlight .mi { color: #FF6600 } /* Literal.Number.Integer */ 46 | .highlight .mo { color: #FF6600 } /* Literal.Number.Oct */ 47 | .highlight .sb { color: #CC3300 } /* Literal.String.Backtick */ 48 | .highlight .sc { color: #CC3300 } /* Literal.String.Char */ 49 | .highlight .sd { color: #CC3300; font-style: italic } /* Literal.String.Doc */ 50 | .highlight .s2 { color: #CC3300 } /* Literal.String.Double */ 51 | .highlight .se { color: #CC3300; font-weight: bold } /* Literal.String.Escape */ 52 | .highlight .sh { color: #CC3300 } /* Literal.String.Heredoc */ 53 | .highlight .si { color: #AA0000 } /* Literal.String.Interpol */ 54 | .highlight .sx { color: #CC3300 } /* Literal.String.Other */ 55 | .highlight .sr { color: #33AAAA } /* Literal.String.Regex */ 56 | .highlight .s1 { color: #CC3300 } /* Literal.String.Single */ 57 | .highlight .ss { color: #FFCC33 } /* Literal.String.Symbol */ 58 | .highlight .bp { color: #336666 } /* Name.Builtin.Pseudo */ 59 | .highlight .vc { color: #003333 } /* Name.Variable.Class */ 60 | .highlight .vg { color: #003333 } /* Name.Variable.Global */ 61 | .highlight .vi { color: #003333 } /* Name.Variable.Instance */ 62 | .highlight .il { color: #FF6600 } /* Literal.Number.Integer.Long */ 63 | 64 | .type-csharp .highlight .k { color: #0000FF } 65 | .type-csharp .highlight .kt { color: #0000FF } 66 | .type-csharp .highlight .nf { color: #000000; font-weight: normal } 67 | .type-csharp .highlight .nc { color: #2B91AF } 68 | .type-csharp .highlight .nn { color: #000000 } 69 | .type-csharp .highlight .s { color: #A31515 } 70 | .type-csharp .highlight .sc { color: #A31515 } 71 | -------------------------------------------------------------------------------- /tutorial/css/shThemeDefault.css: -------------------------------------------------------------------------------- 1 | .syntaxhighlighter { 2 | background-color: white !important; 3 | } 4 | .syntaxhighlighter .line.alt1 { 5 | background-color: white !important; 6 | } 7 | .syntaxhighlighter .line.alt2 { 8 | background-color: white !important; 9 | } 10 | .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 { 11 | background-color: #e0e0e0 !important; 12 | } 13 | .syntaxhighlighter .line.highlighted.number { 14 | color: black !important; 15 | } 16 | .syntaxhighlighter table caption { 17 | color: black !important; 18 | } 19 | .syntaxhighlighter .gutter { 20 | color: #afafaf !important; 21 | } 22 | .syntaxhighlighter .gutter .line { 23 | border-right: 3px solid #6ce26c !important; 24 | } 25 | .syntaxhighlighter .gutter .line.highlighted { 26 | background-color: #6ce26c !important; 27 | color: white !important; 28 | } 29 | .syntaxhighlighter.printing .line .content { 30 | border: none !important; 31 | } 32 | .syntaxhighlighter.collapsed { 33 | overflow: visible !important; 34 | } 35 | .syntaxhighlighter.collapsed .toolbar { 36 | color: blue !important; 37 | background: white !important; 38 | border: 1px solid #6ce26c !important; 39 | } 40 | .syntaxhighlighter.collapsed .toolbar a { 41 | color: blue !important; 42 | } 43 | .syntaxhighlighter.collapsed .toolbar a:hover { 44 | color: red !important; 45 | } 46 | .syntaxhighlighter .toolbar { 47 | color: white !important; 48 | background: #6ce26c !important; 49 | border: none !important; 50 | } 51 | .syntaxhighlighter .toolbar a { 52 | color: white !important; 53 | } 54 | .syntaxhighlighter .toolbar a:hover { 55 | color: black !important; 56 | } 57 | .syntaxhighlighter .plain, .syntaxhighlighter .plain a { 58 | color: black !important; 59 | } 60 | .syntaxhighlighter .comments, .syntaxhighlighter .comments a { 61 | color: #008200 !important; 62 | } 63 | .syntaxhighlighter .string, .syntaxhighlighter .string a { 64 | color: blue !important; 65 | } 66 | .syntaxhighlighter .keyword { 67 | color: #006699 !important; 68 | } 69 | .syntaxhighlighter .preprocessor { 70 | color: gray !important; 71 | } 72 | .syntaxhighlighter .variable { 73 | color: #aa7700 !important; 74 | } 75 | .syntaxhighlighter .value { 76 | color: #009900 !important; 77 | } 78 | .syntaxhighlighter .functions { 79 | color: #ff1493 !important; 80 | } 81 | .syntaxhighlighter .constants { 82 | color: #0066cc !important; 83 | } 84 | .syntaxhighlighter .script { 85 | font-weight: bold !important; 86 | color: #006699 !important; 87 | background-color: none !important; 88 | } 89 | .syntaxhighlighter .color1, .syntaxhighlighter .color1 a { 90 | color: gray !important; 91 | } 92 | .syntaxhighlighter .color2, .syntaxhighlighter .color2 a { 93 | color: #ff1493 !important; 94 | } 95 | .syntaxhighlighter .color3, .syntaxhighlighter .color3 a { 96 | color: red !important; 97 | } 98 | 99 | .syntaxhighlighter .keyword { 100 | font-weight: bold !important; 101 | } 102 | -------------------------------------------------------------------------------- /tutorial/images/3d1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/images/3d1.png -------------------------------------------------------------------------------- /tutorial/images/3d42-all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/images/3d42-all.png -------------------------------------------------------------------------------- /tutorial/images/42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/images/42.png -------------------------------------------------------------------------------- /tutorial/images/bg_hr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/images/bg_hr.png -------------------------------------------------------------------------------- /tutorial/images/blacktocat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/images/blacktocat.png -------------------------------------------------------------------------------- /tutorial/images/convolution2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/images/convolution2.png -------------------------------------------------------------------------------- /tutorial/images/convolution4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/images/convolution4.png -------------------------------------------------------------------------------- /tutorial/images/ed1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/images/ed1.png -------------------------------------------------------------------------------- /tutorial/images/gray-play-license.txt: -------------------------------------------------------------------------------- 1 | The play button is from the Open Clip Art Library (openclipart/detail/25575), 2 | drawn by Andrew Fitzsimon. 3 | -------------------------------------------------------------------------------- /tutorial/images/imgdata.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/images/imgdata.png -------------------------------------------------------------------------------- /tutorial/images/pacanvas1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/images/pacanvas1.png -------------------------------------------------------------------------------- /tutorial/images/se1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/images/se1.png -------------------------------------------------------------------------------- /tutorial/images/se2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/images/se2.png -------------------------------------------------------------------------------- /tutorial/images/skeleton3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/images/skeleton3.png -------------------------------------------------------------------------------- /tutorial/js/MIT-LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2003, 2004 Jim Weirich 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /tutorial/js/licenses.txt: -------------------------------------------------------------------------------- 1 | The Syntax Highlighter tool is licensed under the terms of the MIT license 2 | contained in the files MIT-LICENSE. The home page for this tool is at https://github.com/alexgorbatchev/SyntaxHighlighter 3 | -------------------------------------------------------------------------------- /tutorial/js/shBrushJScript.js: -------------------------------------------------------------------------------- 1 | ;(function() 2 | { 3 | // CommonJS 4 | SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null); 5 | 6 | function Brush() 7 | { 8 | var keywords = 'break case catch continue ' + 9 | 'default delete do else false ' + 10 | 'for function if in instanceof ' + 11 | 'new null return super switch ' + 12 | 'this throw true try typeof var while with' 13 | ; 14 | 15 | var r = SyntaxHighlighter.regexLib; 16 | 17 | this.regexList = [ 18 | { regex: r.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings 19 | { regex: r.multiLineSingleQuotedString, css: 'string' }, // single quoted strings 20 | { regex: r.singleLineCComments, css: 'comments' }, // one line comments 21 | { regex: r.multiLineCComments, css: 'comments' }, // multiline comments 22 | { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 23 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords 24 | ]; 25 | 26 | this.forHtmlScript(r.scriptScriptTags); 27 | }; 28 | 29 | Brush.prototype = new SyntaxHighlighter.Highlighter(); 30 | Brush.aliases = ['js', 'jscript', 'javascript']; 31 | 32 | SyntaxHighlighter.brushes.JScript = Brush; 33 | 34 | // CommonJS 35 | typeof(exports) != 'undefined' ? exports.Brush = Brush : null; 36 | })(); 37 | -------------------------------------------------------------------------------- /tutorial/src/css/Jquery-ui-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Paul Bakaus, http://jqueryui.com/ 2 | 3 | This software consists of voluntary contributions made by many 4 | individuals (AUTHORS.txt, http://jqueryui.com/about) For exact 5 | contribution history, see the revision history and logs, available 6 | at http://jquery-ui.googlecode.com/svn/ 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining 9 | a copy of this software and associated documentation files (the 10 | "Software"), to deal in the Software without restriction, including 11 | without limitation the rights to use, copy, modify, merge, publish, 12 | distribute, sublicense, and/or sell copies of the Software, and to 13 | permit persons to whom the Software is furnished to do so, subject to 14 | the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be 17 | included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 23 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 25 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | -------------------------------------------------------------------------------- /tutorial/src/css/ui-darkness/images/ui-bg_flat_30_cccccc_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/src/css/ui-darkness/images/ui-bg_flat_30_cccccc_40x100.png -------------------------------------------------------------------------------- /tutorial/src/css/ui-darkness/images/ui-bg_flat_50_5c5c5c_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/src/css/ui-darkness/images/ui-bg_flat_50_5c5c5c_40x100.png -------------------------------------------------------------------------------- /tutorial/src/css/ui-darkness/images/ui-bg_glass_20_555555_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/src/css/ui-darkness/images/ui-bg_glass_20_555555_1x400.png -------------------------------------------------------------------------------- /tutorial/src/css/ui-darkness/images/ui-bg_glass_40_0078a3_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/src/css/ui-darkness/images/ui-bg_glass_40_0078a3_1x400.png -------------------------------------------------------------------------------- /tutorial/src/css/ui-darkness/images/ui-bg_glass_40_ffc73d_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/src/css/ui-darkness/images/ui-bg_glass_40_ffc73d_1x400.png -------------------------------------------------------------------------------- /tutorial/src/css/ui-darkness/images/ui-bg_gloss-wave_25_333333_500x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/src/css/ui-darkness/images/ui-bg_gloss-wave_25_333333_500x100.png -------------------------------------------------------------------------------- /tutorial/src/css/ui-darkness/images/ui-bg_highlight-soft_80_eeeeee_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/src/css/ui-darkness/images/ui-bg_highlight-soft_80_eeeeee_1x100.png -------------------------------------------------------------------------------- /tutorial/src/css/ui-darkness/images/ui-bg_inset-soft_25_000000_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/src/css/ui-darkness/images/ui-bg_inset-soft_25_000000_1x100.png -------------------------------------------------------------------------------- /tutorial/src/css/ui-darkness/images/ui-bg_inset-soft_30_f58400_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/src/css/ui-darkness/images/ui-bg_inset-soft_30_f58400_1x100.png -------------------------------------------------------------------------------- /tutorial/src/css/ui-darkness/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/src/css/ui-darkness/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /tutorial/src/css/ui-darkness/images/ui-icons_4b8e0b_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/src/css/ui-darkness/images/ui-icons_4b8e0b_256x240.png -------------------------------------------------------------------------------- /tutorial/src/css/ui-darkness/images/ui-icons_a83300_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/src/css/ui-darkness/images/ui-icons_a83300_256x240.png -------------------------------------------------------------------------------- /tutorial/src/css/ui-darkness/images/ui-icons_cccccc_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/src/css/ui-darkness/images/ui-icons_cccccc_256x240.png -------------------------------------------------------------------------------- /tutorial/src/css/ui-darkness/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/src/css/ui-darkness/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /tutorial/src/js/JQuery-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2012 jQuery Foundation and other contributors 2 | http://jquery.com/ 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /tutorial/src/js/Jquery-ui-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Paul Bakaus, http://jqueryui.com/ 2 | 3 | This software consists of voluntary contributions made by many 4 | individuals (AUTHORS.txt, http://jqueryui.com/about) For exact 5 | contribution history, see the revision history and logs, available 6 | at http://jquery-ui.googlecode.com/svn/ 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining 9 | a copy of this software and associated documentation files (the 10 | "Software"), to deal in the Software without restriction, including 11 | without limitation the rights to use, copy, modify, merge, publish, 12 | distribute, sublicense, and/or sell copies of the Software, and to 13 | permit persons to whom the Software is furnished to do so, subject to 14 | the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be 17 | included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 23 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 25 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | -------------------------------------------------------------------------------- /tutorial/src/media/3d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/src/media/3d.png -------------------------------------------------------------------------------- /tutorial/src/media/LICENSES.txt: -------------------------------------------------------------------------------- 1 | The file Big_Buck_Bunny_medium.ogv ("Big Buck Bunny") is (c) copyright 2008, Blender Foundation / www.bigbuckbunny.org 2 | 3 | The file "3d.png" is from http://www.fatcow.com/free-icons under a Creative 4 | Commons Attribution 3.0 License. See 5 | http://creativecommons.org/licenses/by/3.0/us/ for more details about this 6 | license. 7 | -------------------------------------------------------------------------------- /tutorial/src/media/README.md: -------------------------------------------------------------------------------- 1 | The video file used in the application is to be placed here. 2 | 3 | We will use the movie "Big Buck Bunny" for the tutorial. Download the file from the following link and place it in this directory. 4 | 5 | "Big Buck Bunny" via Wikimedia Commons, Copyright Blender Foundation | www.bigbuckbunny.org 6 | 7 | File URL: http://upload.wikimedia.org/wikipedia/commons/4/41/Big_Buck_Bunny_medium.ogv 8 | -------------------------------------------------------------------------------- /tutorial/src/media/img7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IntelLabs/RiverTrail/370e6de0ec05303335733a8abaa2377e78012bbb/tutorial/src/media/img7.jpg --------------------------------------------------------------------------------