├── .gitignore ├── LICENSE ├── README.md ├── chrome-extension ├── background.html ├── background │ ├── backend.js │ ├── message_routing.js │ ├── root.js │ ├── tabs.js │ └── test.js ├── chrome.js ├── content_script │ ├── depthose.js │ ├── event_handlers.js │ ├── event_link.js │ ├── init.js │ ├── panner.js │ ├── root.js │ └── selector_box.js ├── css │ └── selectorBox.css ├── images │ ├── logo_128x128.png │ └── logo_16x16.png ├── init_plugin.js ├── logo_128x128.png ├── manifest.json ├── manifest.json.LINUX ├── manifest.json.MACOSX ├── manifest.json.WIN32 ├── plugin │ └── DepthJSPlugin.plugin │ │ └── Contents │ │ ├── Info.plist │ │ ├── MacOS │ │ └── DepthJSPlugin │ │ └── Resources │ │ ├── English.lproj │ │ ├── InfoPlist.strings │ │ └── Localized.rsrc │ │ └── Sample-Tracking.xml ├── popup.html ├── popup.js └── third_party │ ├── jquery-1.4.4.min.js │ ├── jquery.idle-timer.js │ ├── underscore-min.js │ └── vfx │ └── zflow │ ├── zflow.css │ └── zflow.js ├── developer-api ├── BasicDemo.html └── depth.js ├── extension-common ├── README.mk ├── background │ ├── backend.js │ ├── message_routing.js │ ├── root.js │ ├── tabs.js │ └── test.js ├── background_template.html ├── content_script │ ├── depthose.js │ ├── event_handlers.js │ ├── event_link.js │ ├── init.js │ ├── panner.js │ ├── root.js │ └── selector_box.js ├── css │ └── selectorBox.css ├── images │ ├── logo_128x128.png │ └── logo_16x16.png └── third_party │ ├── jquery-1.4.4.min.js │ ├── jquery.idle-timer.js │ ├── underscore-min.js │ └── vfx │ └── zflow │ ├── zflow.css │ └── zflow.js ├── firebreath-plugin ├── CMakeLists.txt ├── Factory.cpp ├── HandMessageListener.cpp ├── HandMessageListener.h ├── Mac │ ├── ResourceRecovery.mm │ ├── bundle_template │ │ ├── Info.plist │ │ ├── InfoPlist.strings │ │ └── Localized.r │ └── projectDef.cmake ├── PluginConfig.cmake ├── ResourceRecovery.h ├── Sample-Tracking.xml ├── Win │ ├── ResourceRecovery.cpp │ ├── WiX │ │ └── depthjspluginInstaller.wxs │ └── projectDef.cmake ├── X11 │ └── projectDef.cmake ├── cmake │ └── Modules │ │ ├── FindNITE.cmake │ │ ├── FindOpenNI.cmake │ │ └── LibFindMacros.cmake ├── copy_binary_win32.bat ├── depthjsplugin.cpp ├── depthjsplugin.h ├── depthjspluginAPI.cpp ├── depthjspluginAPI.h ├── openni_backend.cpp ├── openni_backend.hpp └── simple_templater.cpp ├── new_cv └── NewCV │ ├── FreenectDevice.h │ └── main.cpp ├── npapi_plugin ├── Info.plist ├── bg_fg_blobs.cpp ├── bg_fg_blobs.h ├── build-linux.sh ├── build-mac.sh ├── depthjs.cc ├── depthjs.h ├── depthjs.mm ├── depthjs.plugin │ └── Contents │ │ ├── Info.plist │ │ └── MacOS │ │ └── depthjs ├── depthjs.so ├── mac_native_libs │ ├── libfreenect.a │ ├── libfreenect_sync.a │ ├── libusb-1.0.a │ └── opencv │ │ ├── libopencv_calib3d.a │ │ ├── libopencv_calib3d_pch_dephelp.a │ │ ├── libopencv_contrib.a │ │ ├── libopencv_contrib_pch_dephelp.a │ │ ├── libopencv_core.a │ │ ├── libopencv_core_pch_dephelp.a │ │ ├── libopencv_features2d.a │ │ ├── libopencv_features2d_pch_dephelp.a │ │ ├── libopencv_flann.a │ │ ├── libopencv_flann_pch_dephelp.a │ │ ├── libopencv_gpu.a │ │ ├── libopencv_gpu_pch_dephelp.a │ │ ├── libopencv_haartraining_engine.a │ │ ├── libopencv_highgui.a │ │ ├── libopencv_highgui_pch_dephelp.a │ │ ├── libopencv_imgproc.a │ │ ├── libopencv_imgproc_pch_dephelp.a │ │ ├── libopencv_legacy.a │ │ ├── libopencv_legacy_pch_dephelp.a │ │ ├── libopencv_ml.a │ │ ├── libopencv_ml_pch_dephelp.a │ │ ├── libopencv_objdetect.a │ │ ├── libopencv_objdetect_pch_dephelp.a │ │ ├── libopencv_video.a │ │ └── libopencv_video_pch_dephelp.a ├── np_entry.cc ├── npapi.h ├── npfunctions.h ├── npp_entry.cc ├── npruntime.h ├── nptypes.h ├── ocv_freenect.cpp ├── ocv_freenect.h ├── plugin.cc └── plugin.h ├── safari-extension-mac └── DepthJS.safariextension │ ├── Info.plist │ ├── Settings.plist │ ├── background.html │ ├── createHardLinks.sh │ └── safari.js ├── site ├── css │ ├── helvetica1 │ │ ├── stylesheet.css │ │ ├── texgyreadventor-bold-cufon.js │ │ ├── texgyreadventor-bold-webfont.eot │ │ ├── texgyreadventor-bold-webfont.svg │ │ ├── texgyreadventor-bold-webfont.ttf │ │ ├── texgyreadventor-bold-webfont.woff │ │ ├── texgyreadventor-bolditalic-cufon.js │ │ ├── texgyreadventor-bolditalic-webfont.eot │ │ ├── texgyreadventor-bolditalic-webfont.svg │ │ ├── texgyreadventor-bolditalic-webfont.ttf │ │ ├── texgyreadventor-bolditalic-webfont.woff │ │ ├── texgyreadventor-italic-cufon.js │ │ ├── texgyreadventor-italic-webfont.eot │ │ ├── texgyreadventor-italic-webfont.svg │ │ ├── texgyreadventor-italic-webfont.ttf │ │ ├── texgyreadventor-italic-webfont.woff │ │ ├── texgyreadventor-regular-cufon.js │ │ ├── texgyreadventor-regular-webfont.eot │ │ ├── texgyreadventor-regular-webfont.svg │ │ ├── texgyreadventor-regular-webfont.ttf │ │ └── texgyreadventor-regular-webfont.woff │ ├── helvetica2 │ │ ├── GUST e-foundry License.txt │ │ ├── stylesheet.css │ │ ├── texgyreheros-bold-cufon.js │ │ ├── texgyreheros-bold-webfont.eot │ │ ├── texgyreheros-bold-webfont.svg │ │ ├── texgyreheros-bold-webfont.ttf │ │ ├── texgyreheros-bold-webfont.woff │ │ ├── texgyreheros-bolditalic-cufon.js │ │ ├── texgyreheros-bolditalic-webfont.eot │ │ ├── texgyreheros-bolditalic-webfont.svg │ │ ├── texgyreheros-bolditalic-webfont.ttf │ │ ├── texgyreheros-bolditalic-webfont.woff │ │ ├── texgyreheros-italic-cufon.js │ │ ├── texgyreheros-italic-webfont.eot │ │ ├── texgyreheros-italic-webfont.svg │ │ ├── texgyreheros-italic-webfont.ttf │ │ ├── texgyreheros-italic-webfont.woff │ │ ├── texgyreheros-regular-cufon.js │ │ ├── texgyreheros-regular-webfont.eot │ │ ├── texgyreheros-regular-webfont.svg │ │ ├── texgyreheros-regular-webfont.ttf │ │ ├── texgyreheros-regular-webfont.woff │ │ ├── texgyreheroscn-bold-cufon.js │ │ ├── texgyreheroscn-bold-webfont.eot │ │ ├── texgyreheroscn-bold-webfont.svg │ │ ├── texgyreheroscn-bold-webfont.ttf │ │ ├── texgyreheroscn-bold-webfont.woff │ │ ├── texgyreheroscn-bolditalic-cufon.js │ │ ├── texgyreheroscn-bolditalic-webfont.eot │ │ ├── texgyreheroscn-bolditalic-webfont.svg │ │ ├── texgyreheroscn-bolditalic-webfont.ttf │ │ ├── texgyreheroscn-bolditalic-webfont.woff │ │ ├── texgyreheroscn-italic-cufon.js │ │ ├── texgyreheroscn-italic-webfont.eot │ │ ├── texgyreheroscn-italic-webfont.svg │ │ ├── texgyreheroscn-italic-webfont.ttf │ │ ├── texgyreheroscn-italic-webfont.woff │ │ ├── texgyreheroscn-regular-cufon.js │ │ ├── texgyreheroscn-regular-webfont.eot │ │ ├── texgyreheroscn-regular-webfont.svg │ │ ├── texgyreheroscn-regular-webfont.ttf │ │ └── texgyreheroscn-regular-webfont.woff │ └── screen.css ├── images │ ├── addIcon.png │ ├── callout-long.png │ ├── callout.png │ └── pattern.png └── index.html └── webkit-plugin-mac ├── CMakeLists.txt ├── DLog.h ├── DLog.mm ├── English.lproj └── InfoPlist.strings ├── HandMessageListener.cpp ├── HandMessageListener.h ├── Info.plist ├── build └── Debug │ └── webkit-plugin-mac.webplugin │ └── Contents │ ├── Info.plist │ ├── MacOS │ └── webkit-plugin-mac │ └── Resources │ ├── English.lproj │ └── InfoPlist.strings │ ├── Info.plist │ └── data-samples-labels.yaml ├── include ├── libfreenect.hpp ├── libfreenect │ ├── libfreenect.h │ └── libfreenect_sync.h ├── libusb-1.0 │ └── libusb.h ├── opencv │ ├── cv.h │ ├── cv.hpp │ ├── cvaux.h │ ├── cvaux.hpp │ ├── cvwimage.h │ ├── cxcore.h │ ├── cxcore.hpp │ ├── cxeigen.hpp │ ├── cxmisc.h │ ├── highgui.h │ └── ml.h └── opencv2 │ ├── calib3d │ └── calib3d.hpp │ ├── contrib │ └── contrib.hpp │ ├── core │ ├── core.hpp │ ├── core_c.h │ ├── eigen.hpp │ ├── internal.hpp │ ├── mat.hpp │ ├── operations.hpp │ ├── types_c.h │ ├── version.hpp │ └── wimage.hpp │ ├── features2d │ └── features2d.hpp │ ├── flann │ ├── all_indices.h │ ├── allocator.h │ ├── autotuned_index.h │ ├── composite_index.h │ ├── dist.h │ ├── flann.hpp │ ├── flann_base.hpp │ ├── general.h │ ├── ground_truth.h │ ├── hdf5.h │ ├── heap.h │ ├── index_testing.h │ ├── kdtree_index.h │ ├── kmeans_index.h │ ├── linear_index.h │ ├── logger.h │ ├── matrix.h │ ├── nn_index.h │ ├── object_factory.h │ ├── random.h │ ├── result_set.h │ ├── sampling.h │ ├── saving.h │ ├── simplex_downhill.h │ └── timer.h │ ├── gpu │ ├── devmem2d.hpp │ ├── gpu.hpp │ ├── matrix_operations.hpp │ └── stream_accessor.hpp │ ├── highgui │ ├── highgui.hpp │ └── highgui_c.h │ ├── imgproc │ ├── imgproc.hpp │ ├── imgproc_c.h │ └── types_c.h │ ├── legacy │ ├── blobtrack.hpp │ ├── compat.hpp │ ├── legacy.hpp │ └── streams.hpp │ ├── ml │ └── ml.hpp │ ├── objdetect │ └── objdetect.hpp │ ├── opencv.hpp │ └── video │ ├── background_segm.hpp │ └── tracking.hpp ├── lib ├── libfreenect.a ├── libfreenect_sync.a ├── libusb-1.0.a └── opencv │ ├── libopencv_calib3d.a │ ├── libopencv_calib3d_pch_dephelp.a │ ├── libopencv_contrib.a │ ├── libopencv_contrib_pch_dephelp.a │ ├── libopencv_core.a │ ├── libopencv_core_pch_dephelp.a │ ├── libopencv_features2d.a │ ├── libopencv_features2d_pch_dephelp.a │ ├── libopencv_flann.a │ ├── libopencv_flann_pch_dephelp.a │ ├── libopencv_gpu.a │ ├── libopencv_gpu_pch_dephelp.a │ ├── libopencv_haartraining_engine.a │ ├── libopencv_highgui.a │ ├── libopencv_highgui_pch_dephelp.a │ ├── libopencv_imgproc.a │ ├── libopencv_imgproc_pch_dephelp.a │ ├── libopencv_legacy.a │ ├── libopencv_legacy_pch_dephelp.a │ ├── libopencv_ml.a │ ├── libopencv_ml_pch_dephelp.a │ ├── libopencv_objdetect.a │ ├── libopencv_objdetect_pch_dephelp.a │ ├── libopencv_video.a │ └── libopencv_video_pch_dephelp.a ├── openni_backend.cpp ├── openni_backend.hpp ├── webkit-plugin-mac.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── aaron.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── aaron.xcuserdatad │ └── xcschemes │ ├── webkit-plugin-mac.xcscheme │ └── xcschememanagement.plist ├── webkit-plugin-mac_Prefix.pch ├── webkit_plugin_macView.h └── webkit_plugin_macView.mm /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.o 3 | *.d 4 | *.tmp 5 | *.swp 6 | app/bin/* 7 | *.pyc 8 | new_cv/* 9 | cv/* 10 | 11 | # xcode noise 12 | build/* 13 | *.pbxuser 14 | *.mode1v3 15 | *.perspectivev3 16 | # webkit-plugin-mac/build # precompiled version should be up at the repo 17 | firebreath-plugin/build/* 18 | firebreath-plugin/Debug/* 19 | firebreath-plugin/FireBreath.build/* 20 | webkit-plugin-mac/build/* 21 | 22 | # old skool 23 | .svn 24 | 25 | # osx noise 26 | .DS_Store 27 | profile 28 | 29 | # common extension hard links 30 | safari-extension-mac/DepthJS.safariextension/extension-common 31 | -------------------------------------------------------------------------------- /chrome-extension/background.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /chrome-extension/background/message_routing.js: -------------------------------------------------------------------------------- 1 | console.log("Initing background.html message handling"); 2 | DepthJS.background.handleMessage = function(action, data, reply) { 3 | var handlers = { 4 | connect: DepthJS.backend.connect, 5 | 6 | disconnect: DepthJS.backend.disconnect, 7 | 8 | getConnectState: function() { 9 | if (DepthJS.backend.connecting) { 10 | reply("connectState", {state: "connecting", mode: DepthJS.registerMode}); 11 | } else { 12 | var state = DepthJS.backend.connected ? "connected" : "disconnected"; 13 | reply("connectState", {state: state, mode: DepthJS.registerMode}); 14 | } 15 | }, 16 | 17 | depthoseTest: DepthJS.test.depthoseTest, 18 | 19 | pannerTest: DepthJS.test.pannerTest, 20 | 21 | selectorBoxTest: DepthJS.test.selectorBoxTest, 22 | 23 | getThumbnails: function() { 24 | DepthJS.tabs.populateActiveWindowCache(function(tabs) { 25 | tabs = _.map(tabs, DepthJS.tabs.sanitizeTabObject); 26 | if (DepthJS.verbose) console.log(["sending thumbnails", tabs]); 27 | reply("thumbnails", {tabs: tabs}); 28 | }); 29 | }, 30 | 31 | selectTab: function() { 32 | var tabId = data.tabId; 33 | DepthJS.tabs.selectTab(tabId); 34 | }, 35 | 36 | depthoseMode: function() { 37 | DepthJS.registerMode = "depthose"; 38 | DepthJS.test.sendTestEvent({type: "DepthoseMode", data:{}}); 39 | }, 40 | 41 | pannerMode: function() { 42 | DepthJS.registerMode = "panner"; 43 | DepthJS.test.sendTestEvent({type: "PannerMode", data:{}}); 44 | }, 45 | 46 | selectorBoxMode: function() { 47 | DepthJS.registerMode = "selectorBox"; 48 | DepthJS.test.sendTestEvent({type: "SelectorBoxMode", data:{}}); 49 | } 50 | }; 51 | handlers[action](data); 52 | }; 53 | -------------------------------------------------------------------------------- /chrome-extension/background/root.js: -------------------------------------------------------------------------------- 1 | /* 2 | DepthJS 3 | Copyright (C) 2010 Aaron Zinman, Doug Fritz, Roy Shilkrot, and Greg Elliott 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as 7 | published by the Free Software Foundation, either version 3 of the 8 | License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | 20 | console.log('background.html Starting DepthJS'); 21 | var DepthJS = { 22 | __VERSION__: '0.3', 23 | verbose: true, 24 | backend: {}, 25 | eventHandlers: {}, 26 | cv: {}, 27 | tools: {}, 28 | portsByTabId: {}, 29 | tabs: {}, 30 | test: {}, 31 | toolbar: {}, 32 | browser: {}, 33 | background: {}, 34 | registerMode: "selectorBox", 35 | pluginObj: null 36 | }; 37 | 38 | DepthJS.init = function (pluginObj) { 39 | console.log("Initing DepthJS background"); 40 | DepthJS.pluginObj = pluginObj; 41 | DepthJS.initBrowserBackground(); 42 | DepthJS.browser.addBackgroundListener(DepthJS.background.handleMessage); 43 | if (DepthJS.verbose) console.log("Connecting to Backend"); 44 | if (!DepthJS.backend.connect()) { 45 | if (DepthJS.verbose) console.log("Couldn't connect... aborting"); 46 | return false; 47 | } 48 | console.log("Init complete"); 49 | return true; 50 | }; 51 | 52 | 53 | (function() { 54 | var lastMessages = []; 55 | DepthJS.logSortaVerbose = function(type, fullMessage) { 56 | lastMessages.push({type: type, data:fullMessage}); 57 | }; 58 | 59 | function print() { 60 | setTimeout(print, 1000); 61 | if (lastMessages.length == 0) return; 62 | var counts = {}; 63 | var lastByType = {}; 64 | _.each(lastMessages, function(msg) { 65 | if (counts[msg.type] == null) counts[msg.type] = 0; 66 | counts[msg.type] = counts[msg.type] + 1; 67 | lastByType[msg.type] = msg.data; 68 | }); 69 | 70 | var alphabeticalKeys = _.keys(counts).sort(); 71 | console.log("------" + (new Date() + "")); 72 | _.each(alphabeticalKeys, function(type) { 73 | console.log([" " + counts[type] + " " + type + "; last = ", lastByType[type]]); 74 | }); 75 | 76 | lastMessages = []; 77 | } 78 | setTimeout(print, 1000); 79 | 80 | })(); 81 | -------------------------------------------------------------------------------- /chrome-extension/background/tabs.js: -------------------------------------------------------------------------------- 1 | DepthJS.tabs.activeWindowTabCache = null; 2 | 3 | DepthJS.tabs.populateActiveWindowCache = function(callback) { 4 | DepthJS.browser.populateActiveWindowCache(callback); 5 | }; 6 | 7 | DepthJS.tabs.sanitizeTabObject = function(tab) { 8 | if (tab == null) { 9 | console.log("Cannot sanitize null tab"); 10 | return undefined; 11 | } 12 | return { 13 | tabId: tab.tabId, 14 | dataUrl: tab.dataUrl, 15 | title: tab.title, 16 | url: tab.url 17 | }; 18 | }; -------------------------------------------------------------------------------- /chrome-extension/background/test.js: -------------------------------------------------------------------------------- 1 | DepthJS.test.depthoseTest = function () { 2 | DepthJS.test.runTestSequence([ 3 | {type:"DepthoseMode", data:{}}, 4 | {type:"Register", data:{}}, 5 | {type:"Pull", data:{}}, 6 | {type:"Move", data:{x: 15, y: 15}}, 7 | {type:"HandClick", data:{}}, 8 | {type:"Unregister", data:{}} 9 | //{type:"Register", data:{}}, 10 | //{type:"Pull", data:{}}, 11 | //{type:"Move", data:{x: -15, y: 15}}, 12 | //{type:"Move", data:{x: 40, y: 80}}, 13 | //{type:"Push", data:{}} 14 | ].reverse()); 15 | }; 16 | 17 | DepthJS.test.pannerTest = function () { 18 | DepthJS.test.runTestSequence([ 19 | {type:"PannerMode", data:{}}, 20 | {type:"Register", data:{}}, 21 | {type:"Move", data:{x: 60, y: 0}}, 22 | {type:"Move", data:{x: 60, y: 15}}, 23 | {type:"Move", data:{x: 60, y: 25}}, 24 | {type:"Move", data:{x: 25, y: 25}}, 25 | {type:"Unregister", data:{}} 26 | ].reverse()); 27 | }; 28 | 29 | DepthJS.test.selectorBoxTest = function () { 30 | DepthJS.test.runTestSequence([ 31 | {type:"SelectorBoxMode", data:{}}, 32 | {type:"Register", data:{}}, 33 | {type:"Move", data:{x: 50, y: 50}}, 34 | {type:"HandClick", data:{}}, 35 | {type:"Move", data:{x: 60, y: 0}}, 36 | {type:"Move", data:{x: 60, y: 15}}, 37 | {type:"Move", data:{x: 60, y: 25}}, 38 | {type:"Move", data:{x: 60, y: 35}}, 39 | {type:"Move", data:{x: 60, y: 45}}, 40 | {type:"Move", data:{x: 60, y: 55}}, 41 | {type:"Move", data:{x: 60, y: 65}}, 42 | {type:"Move", data:{x: 60, y: 75}}, 43 | {type:"Move", data:{x: 60, y: 85}}, 44 | {type:"Move", data:{x: 60, y: 95}}, 45 | {type:"Move", data:{x: 60, y: 100}}, 46 | {type: "SwipeLeft", data: {}}, 47 | {type:"Unregister", data:{}} 48 | ].reverse()); 49 | }; 50 | 51 | DepthJS.test.gestureTest = function() { 52 | DepthJS.test.runTestSequence([ 53 | {type:"SwipeDown", data: {}}, 54 | {type:"SwipeUp", data: {}}, 55 | {type:"SwipeRight", data: {}}, 56 | {type:"SwipeLeft", data: {}} 57 | ].reverse()); 58 | }; 59 | 60 | DepthJS.test.runTestSequence = function (testEvents) { 61 | if (DepthJS.verbose) console.log("Starting new test sequence"); 62 | // Cancel all other ones 63 | for (var i = 0; i < 20; i++) { DepthJS.test.currentTest.pop(); } 64 | // Make new test with closure 65 | DepthJS.test.currentTest = testEvents; 66 | function next() { 67 | var event = testEvents.pop(); 68 | if (event != undefined) { 69 | DepthJS.test.sendTestEvent(event, function() { 70 | setTimeout(next, 1000); 71 | }); 72 | } 73 | } 74 | next(); 75 | }; 76 | 77 | DepthJS.test.currentTest = []; 78 | 79 | DepthJS.test.sendTestEvent = function(msg, callback) { 80 | if (DepthJS.verbose) console.log("Sending out test event " + msg.type); 81 | msg.jsonRep = JSON.stringify(msg); 82 | DepthJS.browser.sendMessageToActiveTab(msg); 83 | if (callback != null) callback(); 84 | }; 85 | -------------------------------------------------------------------------------- /chrome-extension/content_script/event_link.js: -------------------------------------------------------------------------------- 1 | // EVENT LINK -------------------------------------------------------------------------------------- 2 | if (window.top === window) { 3 | console.log("DepthJS: Loading Event Link"); 4 | 5 | DepthJS.eventLink.initPort = function() { 6 | if (DepthJS.verbose) console.log("DepthJS: Event link init"); 7 | DepthJS.eventLink.domPort = null; 8 | var checkForEventPort = function() { 9 | var $eventPort = $("#DepthJS_eventPort") 10 | if ($eventPort.length > 0 ) { 11 | console.log("DepthJS: Registering eventPort on DepthJS supported web page"); 12 | DepthJS.eventLink.domPort = $eventPort; 13 | DepthJS.eventLink.onEvent({type: "KinectInit", data:{}}); 14 | return true; 15 | } 16 | return false; 17 | }; 18 | $(function() { 19 | if (!checkForEventPort()) { 20 | // try again in 300msec 21 | setTimeout(checkForEventPort, 300); 22 | } 23 | }); 24 | DepthJS.browser.addContentScriptListener("event", DepthJS.eventLink.onEvent); 25 | }; 26 | 27 | DepthJS.eventLink.onEvent = function (msg) { 28 | DepthJS.logSortaVerbose(msg.type, "DepthJS: event " + msg.type); 29 | if (DepthJS.eventLink.domPort != null) { 30 | // jQuery's trigger doesn't seem to work here for some reason 31 | var e = document.createEvent("Event"); 32 | e.initEvent("DepthJSEvent", false, false); 33 | if (msg.jsonRep == null) { 34 | msg.jsonRep = JSON.stringify(msg); 35 | }; 36 | DepthJS.eventLink.domPort.text(msg.jsonRep); 37 | DepthJS.eventLink.domPort.get(0).dispatchEvent(e); 38 | } else { 39 | var handler = DepthJS.eventHandlers["on"+msg.type]; 40 | if (handler != null) { 41 | handler(msg.data); 42 | } 43 | } 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /chrome-extension/content_script/init.js: -------------------------------------------------------------------------------- 1 | // Do the initialization 2 | $(function() { 3 | if (window.top === window) { 4 | // The parent frame is the top-level frame, not an iframe. 5 | console.log(["Initing DepthJS", DepthJS]); 6 | DepthJS.selectorBox.init(); 7 | DepthJS.eventLink.initPort(); 8 | DepthJS.depthose.init(); 9 | 10 | // Let us know its running 11 | console.log("Finished initing, sticking in logo"); 12 | $("").css({ 13 | position: "fixed", 14 | width: "32px", 15 | height: "32px", 16 | bottom: "20px", 17 | left: "20px" 18 | }).appendTo("body"); 19 | console.log($("img")); 20 | 21 | 22 | var lastTime = null; 23 | function reloadChecker() { 24 | setTimeout(reloadChecker, 1000); 25 | if (lastTime == null) { 26 | lastTime = new Date(); 27 | } else if ((new Date()) - lastTime > 1300) { 28 | console.log("I think I reloaded, redoing init."); 29 | DepthJS.browser.readdContentScriptListeners(); 30 | } 31 | lastTime = new Date(); 32 | } 33 | setTimeout(reloadChecker, 1000); 34 | } 35 | }); 36 | -------------------------------------------------------------------------------- /chrome-extension/content_script/panner.js: -------------------------------------------------------------------------------- 1 | // PANNER ------------------------------------------------------------------------------------------ 2 | if (window.top === window) { 3 | console.log("DepthJS: Loading Panner"); 4 | 5 | DepthJS.panner.initTransform = null; 6 | DepthJS.panner.initTransition = null; 7 | DepthJS.panner.firstMove = null; 8 | DepthJS.panner.midTransition = false; 9 | 10 | DepthJS.panner.show = function() { 11 | if (DepthJS.panner.initTransform == null) { 12 | DepthJS.panner.initTransform = $("body").css("-webkit-transform"); 13 | } 14 | if (DepthJS.panner.initTransition == null) { 15 | DepthJS.panner.initTransition = $("body").css("-webkit-transition-duration"); 16 | } 17 | var centerPoint = $(window).height()/2 + $(window).scrollTop(); 18 | // $("body").css({"-webkit-transform":"scale(1.55) translate(0px,0px)", 19 | // "-webkit-transition-duration":"1s", 20 | // "-webkit-transform-origin":"50% " + centerPoint + "px"}); 21 | DepthJS.panner.firstMove = null; 22 | }; 23 | 24 | DepthJS.panner.hide = function() { 25 | if ($("body").css("-webkit-transform") == "none") return; 26 | $("body").css({"-webkit-transform":"scale(1)","-webkit-transition-duration":"1s"}); 27 | // Reset it to whatever the page had before 28 | setTimeout(function() { 29 | $("body").css({"-webkit-transform": DepthJS.panner.initTransform, 30 | "-webkit-transition-duration": DepthJS.panner.initTransition}); 31 | }, 1000); 32 | DepthJS.panner.firstMove = null; 33 | }; 34 | 35 | DepthJS.panner.move = function(x, y, z) { 36 | if (DepthJS.panner.firstMove == null) { 37 | DepthJS.panner.firstMove = [x, y, z]; 38 | console.log("first move, x=" + x + " y=" + y); 39 | return; 40 | } 41 | //if (DepthJS.panner.midTransition) return; 42 | DepthJS.panner.midTransition = true; 43 | 44 | var centerPoint = $(window).height()/2 + $(window).scrollTop(); 45 | // use firstMove here 46 | 47 | x = DepthJS.panner.firstMove[0] - x; 48 | y = DepthJS.panner.firstMove[1] - y; 49 | var scale = 1.3 - ((z - 50) / 50); 50 | 51 | // Make the whole bounding box (which is -50, 50) really out of 10 52 | 53 | //console.log("rel x = " + x + ", y = " + y + ", scale=" + scale); 54 | 55 | x = x * $(document).width() / 75; 56 | y = y * $(document).height() / 75; 57 | $("body").css({"-webkit-transform":"scale(" + scale + ") translate(" + x + "px, " + y + "px)", 58 | "-webkit-transition-timing-function": "ease-in-out", 59 | "-webkit-transition-duration":".25s", 60 | "-webkit-transform-style":"preserve-3d", 61 | "-webkit-transform-origin":"50% " + centerPoint + "px"}); 62 | setTimeout(function() { 63 | DepthJS.panner.midTransition = false; 64 | }, 100); 65 | }; 66 | } -------------------------------------------------------------------------------- /chrome-extension/content_script/root.js: -------------------------------------------------------------------------------- 1 | /* 2 | DepthJS 3 | Copyright (C) 2010 Aaron Zinman, Doug Fritz, Roy Shilkrot, Greg Elliott 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as 7 | published by the Free Software Foundation, either version 3 of the 8 | License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see . 17 | */ 18 | if (window.top === window) { 19 | console.log("DepthJS: Loading Root"); 20 | 21 | var NOT_VERBOSE = 0; 22 | var VERBOSE = 1; 23 | var STUPID_VERBOSE = 2; 24 | 25 | var DepthJS = { 26 | verbose: VERBOSE, 27 | registerMode: "selectorBox", 28 | eventHandlers: {}, 29 | eventLink: {}, 30 | selectorBox: {}, 31 | selectorBoxPopup: {}, 32 | panner: {}, 33 | depthose: {}, 34 | browser: {}, 35 | MAX_HANDPLANE_WIDTH: 100, 36 | MAX_HANDPLANE_HEIGHT: 100 37 | }; 38 | 39 | (function() { 40 | var lastMessages = []; 41 | DepthJS.logSortaVerbose = function(type, fullMessage) { 42 | lastMessages.push({type: type, data:fullMessage}); 43 | }; 44 | 45 | function print() { 46 | setTimeout(print, 1000); 47 | if (lastMessages.length == 0) return; 48 | var counts = {}; 49 | var lastByType = {}; 50 | _.each(lastMessages, function(msg) { 51 | if (counts[msg.type] == null) counts[msg.type] = 0; 52 | counts[msg.type] = counts[msg.type] + 1; 53 | lastByType[msg.type] = msg.data; 54 | }); 55 | 56 | var alphabeticalKeys = _.keys(counts).sort(); 57 | console.log("------" + (new Date() + "")); 58 | _.each(alphabeticalKeys, function(type) { 59 | console.log([" " + counts[type] + " " + type + "; last = ", lastByType[type]]); 60 | }); 61 | 62 | lastMessages = []; 63 | } 64 | setTimeout(print, 1000); 65 | 66 | })(); 67 | } -------------------------------------------------------------------------------- /chrome-extension/css/selectorBox.css: -------------------------------------------------------------------------------- 1 | #DepthJS_selectorBox{ 2 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5170f7', endColorstr='#264ef3'); /* for IE */ 3 | background: -webkit-gradient(linear, left top, left bottom, from(#5170f7), to(#264ef3)); /* for webkit browsers */ 4 | background: -moz-linear-gradient(top, #5170f7, #264ef3); /* for firefox 3.6+ */ 5 | 6 | height:150px; 7 | width:150px; 8 | opacity:.75; 9 | z-index:100000; 10 | position:fixed; 11 | left:0; 12 | top:0; 13 | -moz-border-radius:35px; 14 | -webkit-border-radius:35px; 15 | border-radius:75px; 16 | 17 | -moz-box-shadow: 0px 8px 35px #666; 18 | -webkit-box-shadow: 0px 8px 35px #666; 19 | box-shadow: 0px 8px 35px #666; 20 | } 21 | 22 | 23 | #DepthJS_selectorBoxPopup{ 24 | position:absolute; 25 | z-index:100; 26 | width:400px; 27 | padding:10px; 28 | line-height:2em; 29 | 30 | -moz-border-radius: 15px; 31 | -webkit-border-radius: 15px; 32 | border-radius: 15px; 33 | 34 | background: #999; /* for non-css3 browsers */ 35 | 36 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cccccc', endColorstr='#000000'); /* for IE */ 37 | background: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#eceaea)); /* for webkit browsers */ 38 | background: -moz-linear-gradient(top, #fefefe, #eceaea); /* for firefox 3.6+ */ 39 | 40 | -moz-box-shadow: 0px 8px 35px #888; 41 | -webkit-box-shadow: 0px 8px 35px #888; 42 | box-shadow: 0px 8px 35px #888; 43 | -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000')"; 44 | filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000'); 45 | } 46 | 47 | .DepthJS_selectorBoxPopupItem{ 48 | font-size:15px; 49 | font-weight:bold; 50 | padding:10px; 51 | padding:10px; 52 | border-bottom:1px solid #e3e3e3; 53 | } 54 | 55 | .DepthJS_selectorBoxPopupItemHighlight{ 56 | color:#fff; 57 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5170f7', endColorstr='#264ef3'); /* for IE */ 58 | background: -webkit-gradient(linear, left top, left bottom, from(#5170f7), to(#264ef3)); /* for webkit browsers */ 59 | background: -moz-linear-gradient(top, #5170f7, #264ef3); /* for firefox 3.6+ */ 60 | } 61 | 62 | #DepthJS_selectorBoxPopup a:link{color:#666; font-weight:bold;} 63 | #DepthJS_selectorBoxPopup a:visited{color:#888; font-weight:bold;} 64 | #DepthJS_selectorBoxPopup a:hover{color:orange; font-weight:bold;} 65 | 66 | -------------------------------------------------------------------------------- /chrome-extension/images/logo_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doug/depthjs/aff8d6fcfa06e5c16ca55856808a96e1ccb06aeb/chrome-extension/images/logo_128x128.png -------------------------------------------------------------------------------- /chrome-extension/images/logo_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doug/depthjs/aff8d6fcfa06e5c16ca55856808a96e1ccb06aeb/chrome-extension/images/logo_16x16.png -------------------------------------------------------------------------------- /chrome-extension/init_plugin.js: -------------------------------------------------------------------------------- 1 | function main() { 2 | var pluginObj = document.getElementById('pluginObj'); 3 | setTimeout(function() { 4 | console.log('Starting DepthJS...'); 5 | if (!DepthJS.init(pluginObj)) { 6 | console.log("Could not init DepthJS"); 7 | } 8 | }, 1000); 9 | } 10 | 11 | document.addEventListener('DOMContentLoaded', function () { 12 | main(); 13 | }); -------------------------------------------------------------------------------- /chrome-extension/logo_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doug/depthjs/aff8d6fcfa06e5c16ca55856808a96e1ccb06aeb/chrome-extension/logo_128x128.png -------------------------------------------------------------------------------- /chrome-extension/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.0", 3 | 4 | "name": "DepthJS", 5 | 6 | "description": "Connecting depth-aware cameras to Javascript", 7 | 8 | "manifest_version": 2, 9 | 10 | "background": { 11 | "page": "background.html" 12 | }, 13 | 14 | "icons": { 15 | "16": "images/logo_16x16.png", 16 | "128": "images/logo_128x128.png" 17 | }, 18 | 19 | "permissions": ["tabs", "http://*/*", "https://*/*","notifications"], 20 | 21 | "plugins": [ 22 | { "path": "plugin/DepthJSPlugin.plugin" } 23 | ], 24 | 25 | "browser_action": { 26 | "default_icon": "images/logo_128x128.png", 27 | "popup": "popup.html", 28 | "default_title": "DepthJS" 29 | }, 30 | 31 | "content_scripts": [ 32 | { "matches": ["http://*/*"], 33 | "css": ["third_party/vfx/zflow/zflow.css", 34 | "css/selectorBox.css"], 35 | "js": ["third_party/jquery-1.4.4.min.js", 36 | "third_party/underscore-min.js", 37 | "content_script/root.js", 38 | "content_script/depthose.js", 39 | "third_party/vfx/zflow/zflow.js", 40 | "content_script/panner.js", 41 | "content_script/selector_box.js", 42 | "content_script/event_handlers.js", 43 | "content_script/event_link.js", 44 | "chrome.js", 45 | "content_script/init.js"], 46 | "run_at": "document_end" } 47 | ] 48 | } 49 | 50 | -------------------------------------------------------------------------------- /chrome-extension/manifest.json.LINUX: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.0", 3 | 4 | "name": "DepthJS", 5 | 6 | "description": "Connecting depth-aware cameras to Javascript", 7 | 8 | "manifest_version": 2, 9 | 10 | "background": { 11 | "page": "background.html" 12 | }, 13 | 14 | "icons": { 15 | "16": "images/logo_16x16.png", 16 | "128": "images/logo_128x128.png" 17 | }, 18 | 19 | "permissions": ["tabs", "http://*/*", "https://*/*","notifications"], 20 | 21 | "plugins": [ 22 | { "path": "plugin/depthjsplugin.so" } 23 | ], 24 | 25 | "browser_action": { 26 | "default_icon": "images/logo_128x128.png", 27 | "popup": "popup.html", 28 | "default_title": "DepthJS" 29 | }, 30 | 31 | "content_scripts": [ 32 | { "matches": ["http://*/*"], 33 | "css": ["third_party/vfx/zflow/zflow.css", 34 | "css/selectorBox.css"], 35 | "js": ["third_party/jquery-1.4.4.min.js", 36 | "third_party/underscore-min.js", 37 | "content_script/root.js", 38 | "content_script/depthose.js", 39 | "third_party/vfx/zflow/zflow.js", 40 | "content_script/panner.js", 41 | "content_script/selector_box.js", 42 | "content_script/event_handlers.js", 43 | "content_script/event_link.js", 44 | "chrome.js", 45 | "content_script/init.js"], 46 | "run_at": "document_end" } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /chrome-extension/manifest.json.MACOSX: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.0", 3 | 4 | "name": "DepthJS", 5 | 6 | "description": "Connecting depth-aware cameras to Javascript", 7 | 8 | "manifest_version": 2, 9 | 10 | "background": { 11 | "page": "background.html" 12 | }, 13 | 14 | "icons": { 15 | "16": "images/logo_16x16.png", 16 | "128": "images/logo_128x128.png" 17 | }, 18 | 19 | "permissions": ["tabs", "http://*/*", "https://*/*","notifications"], 20 | 21 | "plugins": [ 22 | { "path": "plugin/!!PRODUCT_NAME!!.plugin" } 23 | ], 24 | 25 | "browser_action": { 26 | "default_icon": "images/logo_128x128.png", 27 | "popup": "popup.html", 28 | "default_title": "DepthJS" 29 | }, 30 | 31 | "content_scripts": [ 32 | { "matches": ["http://*/*"], 33 | "css": ["third_party/vfx/zflow/zflow.css", 34 | "css/selectorBox.css"], 35 | "js": ["third_party/jquery-1.4.4.min.js", 36 | "third_party/underscore-min.js", 37 | "content_script/root.js", 38 | "content_script/depthose.js", 39 | "third_party/vfx/zflow/zflow.js", 40 | "content_script/panner.js", 41 | "content_script/selector_box.js", 42 | "content_script/event_handlers.js", 43 | "content_script/event_link.js", 44 | "chrome.js", 45 | "content_script/init.js"], 46 | "run_at": "document_end" } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /chrome-extension/manifest.json.WIN32: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.0", 3 | 4 | "name": "DepthJS", 5 | 6 | "description": "Connecting depth-aware cameras to Javascript", 7 | 8 | "manifest_version": 2, 9 | 10 | "background": { 11 | "page": "background.html" 12 | }, 13 | 14 | "icons": { 15 | "16": "images/logo_16x16.png", 16 | "128": "images/logo_128x128.png" 17 | }, 18 | 19 | "permissions": ["tabs", "http://*/*", "https://*/*","notifications"], 20 | 21 | "plugins": [ 22 | { "path": "plugin/npdepthjsplugin.dll" } 23 | ], 24 | 25 | "browser_action": { 26 | "default_icon": "images/logo_128x128.png", 27 | "popup": "popup.html", 28 | "default_title": "DepthJS" 29 | }, 30 | 31 | "content_scripts": [ 32 | { "matches": ["http://*/*"], 33 | "css": ["third_party/vfx/zflow/zflow.css", 34 | "css/selectorBox.css"], 35 | "js": ["third_party/jquery-1.4.4.min.js", 36 | "third_party/underscore-min.js", 37 | "content_script/root.js", 38 | "content_script/depthose.js", 39 | "third_party/vfx/zflow/zflow.js", 40 | "content_script/panner.js", 41 | "content_script/selector_box.js", 42 | "content_script/event_handlers.js", 43 | "content_script/event_link.js", 44 | "chrome.js", 45 | "content_script/init.js"], 46 | "run_at": "document_end" } 47 | ] 48 | } 49 | 50 | -------------------------------------------------------------------------------- /chrome-extension/plugin/DepthJSPlugin.plugin/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 11G63b 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | depthjsplugin 11 | CFBundleGetInfoString 12 | depthjsplugin 1.0.0.0, Copyright 2012 MIT Media Lab 13 | CFBundleIdentifier 14 | com.depthjspluginLib.DepthJSPlugin 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundlePackageType 18 | BRPL 19 | CFBundleShortVersionString 20 | depthjsplugin 1.0.0.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0.0.0 25 | CFPlugInDynamicRegisterFunction 26 | 27 | CFPlugInDynamicRegistration 28 | NO 29 | CFPlugInFactories 30 | 31 | 00000000-0000-0000-0000-000000000000 32 | MyFactoryFunction 33 | 34 | CFPlugInTypes 35 | 36 | 00000000-0000-0000-0000-000000000000 37 | 38 | 00000000-0000-0000-0000-000000000000 39 | 40 | 41 | CFPlugInUnloadFunction 42 | 43 | DTCompiler 44 | 45 | DTPlatformBuild 46 | 4H127 47 | DTPlatformVersion 48 | GM 49 | DTSDKBuild 50 | 11E52 51 | DTSDKName 52 | macosx10.7 53 | DTXcode 54 | 0460 55 | DTXcodeBuild 56 | 4H127 57 | WebPluginDescription 58 | The native plugin part of the DepthJS project 59 | WebPluginMIMETypes 60 | 61 | application/x-depthjsplugin 62 | 63 | WebPluginExtensions 64 | 65 | 66 | 67 | WebPluginTypeDescription 68 | The native plugin part of the DepthJS project 69 | 70 | 71 | WebPluginName 72 | DepthJSPlugin 73 | 74 | 75 | -------------------------------------------------------------------------------- /chrome-extension/plugin/DepthJSPlugin.plugin/Contents/MacOS/DepthJSPlugin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doug/depthjs/aff8d6fcfa06e5c16ca55856808a96e1ccb06aeb/chrome-extension/plugin/DepthJSPlugin.plugin/Contents/MacOS/DepthJSPlugin -------------------------------------------------------------------------------- /chrome-extension/plugin/DepthJSPlugin.plugin/Contents/Resources/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "depthjsplugin.plugin"; 4 | NSHumanReadableCopyright = "Copyright 2012 MIT Media Lab"; 5 | -------------------------------------------------------------------------------- /chrome-extension/plugin/DepthJSPlugin.plugin/Contents/Resources/English.lproj/Localized.rsrc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doug/depthjs/aff8d6fcfa06e5c16ca55856808a96e1ccb06aeb/chrome-extension/plugin/DepthJSPlugin.plugin/Contents/Resources/English.lproj/Localized.rsrc -------------------------------------------------------------------------------- /chrome-extension/plugin/DepthJSPlugin.plugin/Contents/Resources/Sample-Tracking.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /chrome-extension/popup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 45 | 46 | 47 | 48 | 49 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /chrome-extension/popup.js: -------------------------------------------------------------------------------- 1 | function connected() { 2 | $("#disconnect").removeClass("disabled") 3 | .addClass("enabled"); 4 | $("#connect").removeClass("enabled") 5 | .addClass("disabled"); 6 | } 7 | 8 | function disconnected() { 9 | $("#connect").removeClass("disabled") 10 | .addClass("enabled"); 11 | $("#disconnect").removeClass("enabled") 12 | .addClass("disabled"); 13 | } 14 | 15 | function connecting() { 16 | $("li.server").removeClass("enabled") 17 | .addClass("disabled"); 18 | } 19 | 20 | function updateMessage(msg) { 21 | var state = msg.action || msg.state; 22 | if (state == "connected") { 23 | connected(); 24 | } else if (state == "disconnected") { 25 | disconnected(); 26 | } else if (state == "connecting") { 27 | connecting(); 28 | } 29 | 30 | if (msg.mode != null) { 31 | $(".mode").removeClass("disabled") 32 | .addClass("enabled"); 33 | $("#" + msg.mode + "Mode").removeClass("enabled") 34 | .addClass("disabled"); 35 | } 36 | } 37 | 38 | jQuery(function() { 39 | $(".enabled").live("click", function() { 40 | chrome.extension.sendMessage({action: $(this).attr("id")}); 41 | window.close(); 42 | }); 43 | 44 | chrome.extension.sendMessage({action: "getConnectState"}, updateMessage); 45 | }); 46 | 47 | chrome.extension.onRequest.addListener(updateMessage); 48 | -------------------------------------------------------------------------------- /chrome-extension/third_party/vfx/zflow/zflow.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2008, 2009 Charles Ying. All Rights Reserved. 3 | 4 | This distribution is released under the BSD license. 5 | 6 | http://css-vfx.googlecode.com/ 7 | 8 | See the README for documentation and license. 9 | */ 10 | 11 | .zflow 12 | { 13 | -webkit-touch-callout: none; 14 | -webkit-text-size-adjust: none; 15 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 16 | } 17 | 18 | .zflow div.centering 19 | { 20 | /* 21 | position: absolute; 22 | */ 23 | -webkit-perspective: 600; 24 | -webkit-transform-style: preserve-3d; 25 | -webkit-transform: translate3d(0, 0, 0); 26 | height: 100%; 27 | } 28 | 29 | .zflow div.tray 30 | { 31 | position: absolute; 32 | left: 50%; 33 | top: 50%; 34 | 35 | -webkit-transform-style: preserve-3d; 36 | -webkit-transform: translate3d(0, 0, 0); 37 | 38 | -webkit-transition-property: -webkit-transform; 39 | -webkit-transition-duration: 0.4s; 40 | -webkit-transition-timing-function: ease-out; 41 | } 42 | 43 | .zflow div.cell 44 | { 45 | position: absolute; 46 | -webkit-transform-style: preserve-3d; 47 | -webkit-transform: translate3d(0, 0, 0); 48 | 49 | -webkit-transition-property: -webkit-transform opacity; 50 | -webkit-transition-duration: 0.4s; 51 | -webkit-transition-timing-function: ease-out; 52 | } 53 | 54 | .zflow div.cell img 55 | { 56 | position: absolute; 57 | } 58 | 59 | .zflow div.cell canvas 60 | { 61 | position: absolute; 62 | } 63 | -------------------------------------------------------------------------------- /developer-api/depth.js: -------------------------------------------------------------------------------- 1 | /* 2 | DepthJS 3 | Copyright (C) 2010 Aaron Zinman, Doug Fritz, Roy Shilkrot, Greg Elliott 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as 7 | published by the Free Software Foundation, either version 3 of the 8 | License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | /** 20 | * Include this file in your HTML pages to access the Kinect via DepthJS plugins. 21 | * If the user has the DepthJS plugin installed in their browser, then your webpage will be 22 | * able to get high-level events through this simple API. 23 | * 24 | * Just override the definition of the event handlers in the global DepthJS object with your own 25 | * functions. 26 | * 27 | * See BasicDemo.html or our "interesting" CatBucket game. 28 | * 29 | * NOTE: depth.js requires jQuery. You can use it in noConflict mode. 30 | */ 31 | 32 | // Override window.DepthJS 33 | window.DepthJS = { 34 | onKinectInit: function() {}, 35 | onRegister: function(x, y, z, data) {}, 36 | onUnregister: function() {}, 37 | onMove: function(x, y, z) {}, 38 | onSwipeLeft: function() {}, 39 | onSwipeRight: function() {}, 40 | onSwipeDown: function() {}, 41 | onSwipeUp: function() {}, 42 | onPush: function() {}, 43 | onPull: function() {} 44 | }; 45 | 46 | // Requires jQuery 47 | (function($){ 48 | $(function() { 49 | var $domPort = $(""); 50 | $domPort.appendTo("body"); 51 | $domPort.bind("DepthJSEvent", function() { 52 | var json = $domPort.text(); 53 | var eventObj = JSON.parse(json); 54 | var type = eventObj.type; 55 | if (type == null) { 56 | console.log("DepthJS: No type found in event; ignoring"); 57 | return; 58 | } 59 | if (DepthJS["on" + type] == null) { 60 | console.log("DepthJS: Could not find handler for event type " + type + "; ignoring"); 61 | return; 62 | } 63 | var data = eventObj.data; 64 | if (type == "Register") DepthJS.onRegister(data.x, data.y, data.z, data.data); 65 | else if (type == "Move") DepthJS.onMove(data.x, data.y, data.z); 66 | else DepthJS["on" + type](data.data); 67 | }); 68 | }); // wait until body is ready 69 | })(jQuery); // no conflict 70 | -------------------------------------------------------------------------------- /extension-common/README.mk: -------------------------------------------------------------------------------- 1 | This is the Safari Extension that is in progress. IT IS NOT READY YET. 2 | -------------------------------------------------------------------------------- /extension-common/background/message_routing.js: -------------------------------------------------------------------------------- 1 | console.log("Initing background.html message handling"); 2 | DepthJS.background.handleMessage = function(action, data, reply) { 3 | var handlers = { 4 | connect: DepthJS.backend.connect, 5 | 6 | disconnect: DepthJS.backend.disconnect, 7 | 8 | getConnectState: function() { 9 | if (DepthJS.backend.connecting) { 10 | reply("connectState", {state: "connecting", mode: DepthJS.registerMode}); 11 | } else { 12 | var state = DepthJS.backend.connected ? "connected" : "disconnected"; 13 | reply("connectState", {state: state, mode: DepthJS.registerMode}); 14 | } 15 | }, 16 | 17 | depthoseTest: DepthJS.test.depthoseTest, 18 | 19 | pannerTest: DepthJS.test.pannerTest, 20 | 21 | selectorBoxTest: DepthJS.test.selectorBoxTest, 22 | 23 | getThumbnails: function() { 24 | DepthJS.tabs.populateActiveWindowCache(function(tabs) { 25 | tabs = _.map(tabs, DepthJS.tabs.sanitizeTabObject); 26 | if (DepthJS.verbose) console.log(["sending thumbnails", tabs]); 27 | reply("thumbnails", {tabs: tabs}); 28 | }); 29 | }, 30 | 31 | selectTab: function() { 32 | var tabId = data.tabId; 33 | DepthJS.tabs.selectTab(tabId); 34 | }, 35 | 36 | depthoseMode: function() { 37 | DepthJS.registerMode = "depthose"; 38 | DepthJS.test.sendTestEvent({type: "DepthoseMode", data:{}}); 39 | }, 40 | 41 | pannerMode: function() { 42 | DepthJS.registerMode = "panner"; 43 | DepthJS.test.sendTestEvent({type: "PannerMode", data:{}}); 44 | }, 45 | 46 | selectorBoxMode: function() { 47 | DepthJS.registerMode = "selectorBox"; 48 | DepthJS.test.sendTestEvent({type: "SelectorBoxMode", data:{}}); 49 | } 50 | }; 51 | handlers[action](data); 52 | }; 53 | -------------------------------------------------------------------------------- /extension-common/background/root.js: -------------------------------------------------------------------------------- 1 | /* 2 | DepthJS 3 | Copyright (C) 2010 Aaron Zinman, Doug Fritz, Roy Shilkrot, and Greg Elliott 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as 7 | published by the Free Software Foundation, either version 3 of the 8 | License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | 20 | console.log('background.html Starting DepthJS'); 21 | var DepthJS = { 22 | __VERSION__: '0.3', 23 | verbose: true, 24 | backend: {}, 25 | eventHandlers: {}, 26 | cv: {}, 27 | tools: {}, 28 | portsByTabId: {}, 29 | tabs: {}, 30 | test: {}, 31 | toolbar: {}, 32 | browser: {}, 33 | background: {}, 34 | registerMode: "selectorBox", 35 | pluginObj: null 36 | }; 37 | 38 | DepthJS.init = function (pluginObj) { 39 | console.log("Initing DepthJS background"); 40 | DepthJS.pluginObj = pluginObj; 41 | DepthJS.initBrowserBackground(); 42 | DepthJS.browser.addBackgroundListener(DepthJS.background.handleMessage); 43 | if (DepthJS.verbose) console.log("Connecting to Backend"); 44 | if (!DepthJS.backend.connect()) { 45 | if (DepthJS.verbose) console.log("Couldn't connect... aborting"); 46 | return false; 47 | } 48 | console.log("Init complete"); 49 | return true; 50 | }; 51 | 52 | 53 | (function() { 54 | var lastMessages = []; 55 | DepthJS.logSortaVerbose = function(type, fullMessage) { 56 | lastMessages.push({type: type, data:fullMessage}); 57 | }; 58 | 59 | function print() { 60 | setTimeout(print, 1000); 61 | if (lastMessages.length == 0) return; 62 | var counts = {}; 63 | var lastByType = {}; 64 | _.each(lastMessages, function(msg) { 65 | if (counts[msg.type] == null) counts[msg.type] = 0; 66 | counts[msg.type] = counts[msg.type] + 1; 67 | lastByType[msg.type] = msg.data; 68 | }); 69 | 70 | var alphabeticalKeys = _.keys(counts).sort(); 71 | console.log("------" + (new Date() + "")); 72 | _.each(alphabeticalKeys, function(type) { 73 | console.log([" " + counts[type] + " " + type + "; last = ", lastByType[type]]); 74 | }); 75 | 76 | lastMessages = []; 77 | } 78 | setTimeout(print, 1000); 79 | 80 | })(); 81 | -------------------------------------------------------------------------------- /extension-common/background/tabs.js: -------------------------------------------------------------------------------- 1 | DepthJS.tabs.activeWindowTabCache = null; 2 | 3 | DepthJS.tabs.populateActiveWindowCache = function(callback) { 4 | DepthJS.browser.populateActiveWindowCache(callback); 5 | }; 6 | 7 | DepthJS.tabs.sanitizeTabObject = function(tab) { 8 | if (tab == null) { 9 | console.log("Cannot sanitize null tab"); 10 | return undefined; 11 | } 12 | return { 13 | tabId: tab.tabId, 14 | dataUrl: tab.dataUrl, 15 | title: tab.title, 16 | url: tab.url 17 | }; 18 | }; -------------------------------------------------------------------------------- /extension-common/background/test.js: -------------------------------------------------------------------------------- 1 | DepthJS.test.depthoseTest = function () { 2 | DepthJS.test.runTestSequence([ 3 | {type:"DepthoseMode", data:{}}, 4 | {type:"Register", data:{}}, 5 | {type:"Pull", data:{}}, 6 | {type:"Move", data:{x: 15, y: 15}}, 7 | {type:"HandClick", data:{}}, 8 | {type:"Unregister", data:{}} 9 | //{type:"Register", data:{}}, 10 | //{type:"Pull", data:{}}, 11 | //{type:"Move", data:{x: -15, y: 15}}, 12 | //{type:"Move", data:{x: 40, y: 80}}, 13 | //{type:"Push", data:{}} 14 | ].reverse()); 15 | }; 16 | 17 | DepthJS.test.pannerTest = function () { 18 | DepthJS.test.runTestSequence([ 19 | {type:"PannerMode", data:{}}, 20 | {type:"Register", data:{}}, 21 | {type:"Move", data:{x: 60, y: 0}}, 22 | {type:"Move", data:{x: 60, y: 15}}, 23 | {type:"Move", data:{x: 60, y: 25}}, 24 | {type:"Move", data:{x: 25, y: 25}}, 25 | {type:"Unregister", data:{}} 26 | ].reverse()); 27 | }; 28 | 29 | DepthJS.test.selectorBoxTest = function () { 30 | DepthJS.test.runTestSequence([ 31 | {type:"SelectorBoxMode", data:{}}, 32 | {type:"Register", data:{}}, 33 | {type:"Move", data:{x: 50, y: 50}}, 34 | {type:"HandClick", data:{}}, 35 | {type:"Move", data:{x: 60, y: 0}}, 36 | {type:"Move", data:{x: 60, y: 15}}, 37 | {type:"Move", data:{x: 60, y: 25}}, 38 | {type:"Move", data:{x: 60, y: 35}}, 39 | {type:"Move", data:{x: 60, y: 45}}, 40 | {type:"Move", data:{x: 60, y: 55}}, 41 | {type:"Move", data:{x: 60, y: 65}}, 42 | {type:"Move", data:{x: 60, y: 75}}, 43 | {type:"Move", data:{x: 60, y: 85}}, 44 | {type:"Move", data:{x: 60, y: 95}}, 45 | {type:"Move", data:{x: 60, y: 100}}, 46 | {type: "SwipeLeft", data: {}}, 47 | {type:"Unregister", data:{}} 48 | ].reverse()); 49 | }; 50 | 51 | DepthJS.test.gestureTest = function() { 52 | DepthJS.test.runTestSequence([ 53 | {type:"SwipeDown", data: {}}, 54 | {type:"SwipeUp", data: {}}, 55 | {type:"SwipeRight", data: {}}, 56 | {type:"SwipeLeft", data: {}} 57 | ].reverse()); 58 | }; 59 | 60 | DepthJS.test.runTestSequence = function (testEvents) { 61 | if (DepthJS.verbose) console.log("Starting new test sequence"); 62 | // Cancel all other ones 63 | for (var i = 0; i < 20; i++) { DepthJS.test.currentTest.pop(); } 64 | // Make new test with closure 65 | DepthJS.test.currentTest = testEvents; 66 | function next() { 67 | var event = testEvents.pop(); 68 | if (event != undefined) { 69 | DepthJS.test.sendTestEvent(event, function() { 70 | setTimeout(next, 1000); 71 | }); 72 | } 73 | } 74 | next(); 75 | }; 76 | 77 | DepthJS.test.currentTest = []; 78 | 79 | DepthJS.test.sendTestEvent = function(msg, callback) { 80 | if (DepthJS.verbose) console.log("Sending out test event " + msg.type); 81 | msg.jsonRep = JSON.stringify(msg); 82 | DepthJS.browser.sendMessageToActiveTab(msg); 83 | if (callback != null) callback(); 84 | }; 85 | -------------------------------------------------------------------------------- /extension-common/background_template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /extension-common/content_script/event_link.js: -------------------------------------------------------------------------------- 1 | // EVENT LINK -------------------------------------------------------------------------------------- 2 | if (window.top === window) { 3 | console.log("DepthJS: Loading Event Link"); 4 | 5 | DepthJS.eventLink.initPort = function() { 6 | if (DepthJS.verbose) console.log("DepthJS: Event link init"); 7 | DepthJS.eventLink.domPort = null; 8 | var checkForEventPort = function() { 9 | var $eventPort = $("#DepthJS_eventPort") 10 | if ($eventPort.length > 0 ) { 11 | console.log("DepthJS: Registering eventPort on DepthJS supported web page"); 12 | DepthJS.eventLink.domPort = $eventPort; 13 | DepthJS.eventLink.onEvent({type: "KinectInit", data:{}}); 14 | return true; 15 | } 16 | return false; 17 | }; 18 | $(function() { 19 | if (!checkForEventPort()) { 20 | // try again in 300msec 21 | setTimeout(checkForEventPort, 300); 22 | } 23 | }); 24 | DepthJS.browser.addContentScriptListener("event", DepthJS.eventLink.onEvent); 25 | }; 26 | 27 | DepthJS.eventLink.onEvent = function (msg) { 28 | DepthJS.logSortaVerbose(msg.type, "DepthJS: event " + msg.type); 29 | if (DepthJS.eventLink.domPort != null) { 30 | // jQuery's trigger doesn't seem to work here for some reason 31 | var e = document.createEvent("Event"); 32 | e.initEvent("DepthJSEvent", false, false); 33 | if (msg.jsonRep == null) { 34 | msg.jsonRep = JSON.stringify(msg); 35 | }; 36 | DepthJS.eventLink.domPort.text(msg.jsonRep); 37 | DepthJS.eventLink.domPort.get(0).dispatchEvent(e); 38 | } else { 39 | var handler = DepthJS.eventHandlers["on"+msg.type]; 40 | if (handler != null) { 41 | handler(msg.data); 42 | } 43 | } 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /extension-common/content_script/init.js: -------------------------------------------------------------------------------- 1 | // Do the initialization 2 | $(function() { 3 | if (window.top === window) { 4 | // The parent frame is the top-level frame, not an iframe. 5 | console.log(["Initing DepthJS", DepthJS]); 6 | DepthJS.eventLink.initPort(); 7 | DepthJS.selectorBox.init(); 8 | DepthJS.depthose.init(); 9 | 10 | // Let us know its running 11 | console.log("Finished initing, sticking in logo"); 12 | $("").css({ 13 | position: "fixed", 14 | width: "32px", 15 | height: "32px", 16 | bottom: "20px", 17 | left: "20px" 18 | }).appendTo("body"); 19 | console.log($("img")); 20 | 21 | 22 | var lastTime = null; 23 | function reloadChecker() { 24 | setTimeout(reloadChecker, 1000); 25 | if (lastTime == null) { 26 | lastTime = new Date(); 27 | } else if ((new Date()) - lastTime > 1300) { 28 | console.log("I think I reloaded, redoing init."); 29 | DepthJS.browser.readdContentScriptListeners(); 30 | } 31 | lastTime = new Date(); 32 | } 33 | setTimeout(reloadChecker, 1000); 34 | } 35 | }); 36 | -------------------------------------------------------------------------------- /extension-common/content_script/panner.js: -------------------------------------------------------------------------------- 1 | // PANNER ------------------------------------------------------------------------------------------ 2 | if (window.top === window) { 3 | console.log("DepthJS: Loading Panner"); 4 | 5 | DepthJS.panner.initTransform = null; 6 | DepthJS.panner.initTransition = null; 7 | DepthJS.panner.firstMove = null; 8 | DepthJS.panner.midTransition = false; 9 | 10 | DepthJS.panner.show = function() { 11 | if (DepthJS.panner.initTransform == null) { 12 | DepthJS.panner.initTransform = $("body").css("-webkit-transform"); 13 | } 14 | if (DepthJS.panner.initTransition == null) { 15 | DepthJS.panner.initTransition = $("body").css("-webkit-transition-duration"); 16 | } 17 | var centerPoint = $(window).height()/2 + $(window).scrollTop(); 18 | // $("body").css({"-webkit-transform":"scale(1.55) translate(0px,0px)", 19 | // "-webkit-transition-duration":"1s", 20 | // "-webkit-transform-origin":"50% " + centerPoint + "px"}); 21 | DepthJS.panner.firstMove = null; 22 | }; 23 | 24 | DepthJS.panner.hide = function() { 25 | if ($("body").css("-webkit-transform") == "none") return; 26 | $("body").css({"-webkit-transform":"scale(1)","-webkit-transition-duration":"1s"}); 27 | // Reset it to whatever the page had before 28 | setTimeout(function() { 29 | $("body").css({"-webkit-transform": DepthJS.panner.initTransform, 30 | "-webkit-transition-duration": DepthJS.panner.initTransition}); 31 | }, 1000); 32 | DepthJS.panner.firstMove = null; 33 | }; 34 | 35 | DepthJS.panner.move = function(x, y, z) { 36 | if (DepthJS.panner.firstMove == null) { 37 | DepthJS.panner.firstMove = [x, y, z]; 38 | console.log("first move, x=" + x + " y=" + y); 39 | return; 40 | } 41 | //if (DepthJS.panner.midTransition) return; 42 | DepthJS.panner.midTransition = true; 43 | 44 | var centerPoint = $(window).height()/2 + $(window).scrollTop(); 45 | // use firstMove here 46 | 47 | x = DepthJS.panner.firstMove[0] - x; 48 | y = DepthJS.panner.firstMove[1] - y; 49 | var scale = 1.3 - ((z - 50) / 50); 50 | 51 | // Make the whole bounding box (which is -50, 50) really out of 10 52 | 53 | //console.log("rel x = " + x + ", y = " + y + ", scale=" + scale); 54 | 55 | x = x * $(document).width() / 75; 56 | y = y * $(document).height() / 75; 57 | $("body").css({"-webkit-transform":"scale(" + scale + ") translate(" + x + "px, " + y + "px)", 58 | "-webkit-transition-timing-function": "ease-in-out", 59 | "-webkit-transition-duration":".25s", 60 | "-webkit-transform-style":"preserve-3d", 61 | "-webkit-transform-origin":"50% " + centerPoint + "px"}); 62 | setTimeout(function() { 63 | DepthJS.panner.midTransition = false; 64 | }, 100); 65 | }; 66 | } -------------------------------------------------------------------------------- /extension-common/content_script/root.js: -------------------------------------------------------------------------------- 1 | /* 2 | DepthJS 3 | Copyright (C) 2010 Aaron Zinman, Doug Fritz, Roy Shilkrot, Greg Elliott 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Affero General Public License as 7 | published by the Free Software Foundation, either version 3 of the 8 | License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU Affero General Public License for more details. 14 | 15 | You should have received a copy of the GNU Affero General Public License 16 | along with this program. If not, see . 17 | */ 18 | if (window.top === window) { 19 | console.log("DepthJS: Loading Root"); 20 | 21 | var NOT_VERBOSE = 0; 22 | var VERBOSE = 1; 23 | var STUPID_VERBOSE = 2; 24 | 25 | var DepthJS = { 26 | verbose: VERBOSE, 27 | registerMode: "selectorBox", 28 | eventHandlers: {}, 29 | eventLink: {}, 30 | selectorBox: {}, 31 | selectorBoxPopup: {}, 32 | panner: {}, 33 | depthose: {}, 34 | browser: {}, 35 | tabs: {}, 36 | MAX_HANDPLANE_WIDTH: 100, 37 | MAX_HANDPLANE_HEIGHT: 100 38 | }; 39 | 40 | (function() { 41 | var lastMessages = []; 42 | DepthJS.logSortaVerbose = function(type, fullMessage) { 43 | lastMessages.push({type: type, data:fullMessage}); 44 | }; 45 | 46 | function print() { 47 | setTimeout(print, 1000); 48 | if (lastMessages.length == 0) return; 49 | var counts = {}; 50 | var lastByType = {}; 51 | _.each(lastMessages, function(msg) { 52 | if (counts[msg.type] == null) counts[msg.type] = 0; 53 | counts[msg.type] = counts[msg.type] + 1; 54 | lastByType[msg.type] = msg.data; 55 | }); 56 | 57 | var alphabeticalKeys = _.keys(counts).sort(); 58 | console.log("------" + (new Date() + "")); 59 | _.each(alphabeticalKeys, function(type) { 60 | console.log([" " + counts[type] + " " + type + "; last = ", lastByType[type]]); 61 | }); 62 | 63 | lastMessages = []; 64 | } 65 | setTimeout(print, 1000); 66 | 67 | })(); 68 | } 69 | -------------------------------------------------------------------------------- /extension-common/css/selectorBox.css: -------------------------------------------------------------------------------- 1 | #DepthJS_selectorBox{ 2 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5170f7', endColorstr='#264ef3'); /* for IE */ 3 | background: -webkit-gradient(linear, left top, left bottom, from(#5170f7), to(#264ef3)); /* for webkit browsers */ 4 | background: -moz-linear-gradient(top, #5170f7, #264ef3); /* for firefox 3.6+ */ 5 | 6 | height:150px; 7 | width:150px; 8 | opacity:.75; 9 | z-index:100000; 10 | position:fixed; 11 | left:0; 12 | top:0; 13 | -moz-border-radius:35px; 14 | -webkit-border-radius:35px; 15 | border-radius:75px; 16 | 17 | -moz-box-shadow: 0px 8px 35px #666; 18 | -webkit-box-shadow: 0px 8px 35px #666; 19 | box-shadow: 0px 8px 35px #666; 20 | } 21 | 22 | 23 | #DepthJS_selectorBoxPopup{ 24 | position:absolute; 25 | z-index:100; 26 | width:400px; 27 | padding:10px; 28 | line-height:2em; 29 | 30 | -moz-border-radius: 15px; 31 | -webkit-border-radius: 15px; 32 | border-radius: 15px; 33 | 34 | background: #999; /* for non-css3 browsers */ 35 | 36 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cccccc', endColorstr='#000000'); /* for IE */ 37 | background: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#eceaea)); /* for webkit browsers */ 38 | background: -moz-linear-gradient(top, #fefefe, #eceaea); /* for firefox 3.6+ */ 39 | 40 | -moz-box-shadow: 0px 8px 35px #888; 41 | -webkit-box-shadow: 0px 8px 35px #888; 42 | box-shadow: 0px 8px 35px #888; 43 | -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000')"; 44 | filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000'); 45 | } 46 | 47 | .DepthJS_selectorBoxPopupItem{ 48 | font-size:15px; 49 | font-weight:bold; 50 | padding:10px; 51 | padding:10px; 52 | border-bottom:1px solid #e3e3e3; 53 | } 54 | 55 | .DepthJS_selectorBoxPopupItemHighlight{ 56 | color:#fff; 57 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5170f7', endColorstr='#264ef3'); /* for IE */ 58 | background: -webkit-gradient(linear, left top, left bottom, from(#5170f7), to(#264ef3)); /* for webkit browsers */ 59 | background: -moz-linear-gradient(top, #5170f7, #264ef3); /* for firefox 3.6+ */ 60 | } 61 | 62 | #DepthJS_selectorBoxPopup a:link{color:#666; font-weight:bold;} 63 | #DepthJS_selectorBoxPopup a:visited{color:#888; font-weight:bold;} 64 | #DepthJS_selectorBoxPopup a:hover{color:orange; font-weight:bold;} 65 | 66 | -------------------------------------------------------------------------------- /extension-common/images/logo_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doug/depthjs/aff8d6fcfa06e5c16ca55856808a96e1ccb06aeb/extension-common/images/logo_128x128.png -------------------------------------------------------------------------------- /extension-common/images/logo_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/doug/depthjs/aff8d6fcfa06e5c16ca55856808a96e1ccb06aeb/extension-common/images/logo_16x16.png -------------------------------------------------------------------------------- /extension-common/third_party/vfx/zflow/zflow.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2008, 2009 Charles Ying. All Rights Reserved. 3 | 4 | This distribution is released under the BSD license. 5 | 6 | http://css-vfx.googlecode.com/ 7 | 8 | See the README for documentation and license. 9 | */ 10 | 11 | .zflow 12 | { 13 | -webkit-touch-callout: none; 14 | -webkit-text-size-adjust: none; 15 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 16 | } 17 | 18 | .zflow div.centering 19 | { 20 | /* 21 | position: absolute; 22 | */ 23 | -webkit-perspective: 600; 24 | -webkit-transform-style: preserve-3d; 25 | -webkit-transform: translate3d(0, 0, 0); 26 | height: 100%; 27 | } 28 | 29 | .zflow div.tray 30 | { 31 | position: absolute; 32 | left: 50%; 33 | top: 50%; 34 | 35 | -webkit-transform-style: preserve-3d; 36 | -webkit-transform: translate3d(0, 0, 0); 37 | 38 | -webkit-transition-property: -webkit-transform; 39 | -webkit-transition-duration: 0.4s; 40 | -webkit-transition-timing-function: ease-out; 41 | } 42 | 43 | .zflow div.cell 44 | { 45 | position: absolute; 46 | -webkit-transform-style: preserve-3d; 47 | -webkit-transform: translate3d(0, 0, 0); 48 | 49 | -webkit-transition-property: -webkit-transform opacity; 50 | -webkit-transition-duration: 0.4s; 51 | -webkit-transition-timing-function: ease-out; 52 | } 53 | 54 | .zflow div.cell img 55 | { 56 | position: absolute; 57 | } 58 | 59 | .zflow div.cell canvas 60 | { 61 | position: absolute; 62 | } 63 | -------------------------------------------------------------------------------- /firebreath-plugin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # 3 | # Auto-generated CMakeLists.txt for the DepthJS Plugin project 4 | # 5 | #\**********************************************************/ 6 | 7 | # Written to work with cmake 2.6 8 | cmake_minimum_required (VERSION 2.6) 9 | set (CMAKE_BACKWARDS_COMPATIBILITY 2.6) 10 | 11 | Project(${PLUGIN_NAME}) 12 | 13 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") 14 | 15 | file (GLOB GENERAL RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 16 | [^.]*.cpp 17 | [^.]*.h 18 | [^.]*.hpp 19 | [^.]*.cmake 20 | ${CMAKE_MODULE_PATH}/* 21 | ) 22 | 23 | include_directories(${PLUGIN_INCLUDE_DIRS}) 24 | 25 | # Generated files are stored in ${GENERATED} by the project configuration 26 | SET_SOURCE_FILES_PROPERTIES( 27 | ${GENERATED} 28 | PROPERTIES 29 | GENERATED 1 30 | ) 31 | 32 | SOURCE_GROUP(Generated FILES 33 | ${GENERATED} 34 | ) 35 | 36 | SET( SOURCES 37 | ${GENERAL} 38 | ${GENERATED} 39 | ) 40 | 41 | find_package(OpenNI) 42 | if(NOT OPENNI_FOUND) 43 | message(STATUS "Can't find OpenNI!") 44 | else() 45 | message(STATUS "OpenNI found in ${OpenNI_INCLUDE_DIRS}") 46 | endif() 47 | include_directories(${OpenNI_INCLUDE_DIRS}) 48 | 49 | 50 | find_package(NITE) 51 | if(NOT NITE_FOUND) 52 | message(STATUS "Can't find NITE!") 53 | else() 54 | message(STATUS "NITE found in ${NITE_INCLUDE_DIRS}") 55 | endif() 56 | include_directories(${NITE_INCLUDE_DIRS}) 57 | 58 | 59 | add_executable(simple_templater simple_templater.cpp) 60 | 61 | get_target_property(SIMPLE_TEMPLATER_OUTPUT simple_templater RUNTIME_OUTPUT_DIRECTORY_DEBUG) 62 | message(STATUS "former output name for simple_templater: ${SIMPLE_TEMPLATER_OUTPUT}") 63 | 64 | set_target_properties(simple_templater PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") 65 | set_target_properties(simple_templater PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}") 66 | set_target_properties(simple_templater PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}") 67 | get_target_property(SIMPLE_TEMPLATER_OUTPUT simple_templater RUNTIME_OUTPUT_DIRECTORY) 68 | 69 | message(STATUS "setting output directory for simple_templater to ${SIMPLE_TEMPLATER_OUTPUT}") 70 | 71 | # This will include Win/projectDef.cmake, X11/projectDef.cmake, Mac/projectDef 72 | # depending on the platform 73 | include_platform() 74 | -------------------------------------------------------------------------------- /firebreath-plugin/Factory.cpp: -------------------------------------------------------------------------------- 1 | /**********************************************************\ 2 | 3 | Auto-generated Factory.cpp 4 | 5 | This file contains the auto-generated factory methods 6 | for the depthjsplugin project 7 | 8 | \**********************************************************/ 9 | 10 | #include "FactoryBase.h" 11 | #include "depthjsplugin.h" 12 | #include 13 | 14 | class PluginFactory : public FB::FactoryBase 15 | { 16 | public: 17 | /////////////////////////////////////////////////////////////////////////////// 18 | /// @fn FB::PluginCorePtr createPlugin(const std::string& mimetype) 19 | /// 20 | /// @brief Creates a plugin object matching the provided mimetype 21 | /// If mimetype is empty, returns the default plugin 22 | /////////////////////////////////////////////////////////////////////////////// 23 | FB::PluginCorePtr createPlugin(const std::string& mimetype) 24 | { 25 | return boost::make_shared(); 26 | } 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | /// @see FB::FactoryBase::globalPluginInitialize 30 | /////////////////////////////////////////////////////////////////////////////// 31 | void globalPluginInitialize() 32 | { 33 | depthjsplugin::StaticInitialize(); 34 | } 35 | 36 | /////////////////////////////////////////////////////////////////////////////// 37 | /// @see FB::FactoryBase::globalPluginDeinitialize 38 | /////////////////////////////////////////////////////////////////////////////// 39 | void globalPluginDeinitialize() 40 | { 41 | depthjsplugin::StaticDeinitialize(); 42 | } 43 | }; 44 | 45 | /////////////////////////////////////////////////////////////////////////////// 46 | /// @fn getFactoryInstance() 47 | /// 48 | /// @brief Returns the factory instance for this plugin module 49 | /////////////////////////////////////////////////////////////////////////////// 50 | FB::FactoryBasePtr getFactoryInstance() 51 | { 52 | static boost::shared_ptr factory = boost::make_shared(); 53 | return factory; 54 | } 55 | 56 | -------------------------------------------------------------------------------- /firebreath-plugin/HandMessageListener.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * HandMessageListener.cpp 3 | * OpenniTry 4 | * 5 | * Created by Roy Shilkrot on 9/30/11. 6 | * Copyright 2011 MIT. All rights reserved. 7 | * 8 | */ 9 | 10 | #include "HandMessageListener.h" 11 | 12 | -------------------------------------------------------------------------------- /firebreath-plugin/Mac/ResourceRecovery.mm: -------------------------------------------------------------------------------- 1 | #include 2 | #include "../gen/global/config.h" 3 | #include 4 | 5 | std::string getResourcesDirectory() { 6 | // Get the XML file for OpenNI from the resources directory of the plugin bundle 7 | CFBundleRef bundleRef = CFBundleGetBundleWithIdentifier(CFSTR("com.depthjspluginLib.DepthJSPlugin")); 8 | CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(bundleRef); 9 | UInt8 cbuf[1024] = {0}; 10 | CFURLGetFileSystemRepresentation(resourcesURL,true,cbuf,1024); 11 | return std::string((char*)cbuf); 12 | } -------------------------------------------------------------------------------- /firebreath-plugin/Mac/bundle_template/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${PLUGIN_NAME} 9 | CFBundleGetInfoString 10 | ${PLUGIN_NAME} ${FBSTRING_PLUGIN_VERSION}, ${FBSTRING_LegalCopyright} 11 | CFBundleIdentifier 12 | com.${FBTYPELIB_NAME}.${FBSTRING_PluginName} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | BRPL 17 | CFBundleShortVersionString 18 | ${PLUGIN_NAME} ${FBSTRING_PLUGIN_VERSION} 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${FBSTRING_PLUGIN_VERSION} 23 | CFPlugInDynamicRegisterFunction 24 | 25 | CFPlugInDynamicRegistration 26 | NO 27 | CFPlugInFactories 28 | 29 | 00000000-0000-0000-0000-000000000000 30 | MyFactoryFunction 31 | 32 | CFPlugInTypes 33 | 34 | 00000000-0000-0000-0000-000000000000 35 | 36 | 00000000-0000-0000-0000-000000000000 37 | 38 | 39 | CFPlugInUnloadFunction 40 | 41 | WebPluginName 42 | ${FBSTRING_ProductName} 43 | WebPluginDescription 44 | ${FBSTRING_FileDescription} 45 | WebPluginMIMETypes 46 | 47 | @foreach (FBSTRING_MIMEType CUR_MIMETYPE FBSTRING_FileDescription CUR_DESC) 48 | ${CUR_MIMETYPE} 49 | 50 | WebPluginExtensions 51 | 52 | 53 | 54 | WebPluginTypeDescription 55 | ${CUR_DESC} 56 | 57 | @endforeach 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /firebreath-plugin/Mac/bundle_template/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | CFBundleName = "${PLUGIN_NAME}.plugin"; 4 | NSHumanReadableCopyright = "${FBSTRING_LegalCopyright}"; 5 | -------------------------------------------------------------------------------- /firebreath-plugin/Mac/bundle_template/Localized.r: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | resource 'STR#' (126) 4 | { { 5 | "${FBSTRING_LegalCopyright}", 6 | "${FBSTRING_ProductName}" 7 | } }; 8 | 9 | resource 'STR#' (127) 10 | { { 11 | "", 12 | } }; 13 | 14 | resource 'STR#' (128) 15 | { { 16 | @foreach (FBSTRING_MIMEType CUR_MIMETYPE FBSTRING_FileExtents CUR_EXTENT) 17 | "${CUR_MIMETYPE}", 18 | "${CUR_EXTENT}", 19 | @endforeach 20 | } }; 21 | -------------------------------------------------------------------------------- /firebreath-plugin/Mac/projectDef.cmake: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # Auto-generated Mac project definition file for the 3 | # DepthJS Plugin project 4 | #\**********************************************************/ 5 | 6 | # Mac template platform definition CMake file 7 | # Included from ../CMakeLists.txt 8 | 9 | # remember that the current source dir is the project root; this file is in Mac/ 10 | file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 11 | Mac/[^.]*.cpp 12 | Mac/[^.]*.h 13 | Mac/[^.]*.cmake 14 | Mac/[^.]*.mm 15 | ) 16 | 17 | # use this to add preprocessor definitions 18 | add_definitions( 19 | 20 | ) 21 | 22 | find_library(OPENGL_FRAMEWORK OpenGL) 23 | find_library(QUARTZ_CORE_FRAMEWORK QuartzCore) 24 | find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation) 25 | 26 | include_directories(${CORE_FOUNDATION_FRAMEWORK}) 27 | 28 | set(OPENNI_XML_FILE "Sample-Tracking.xml") 29 | set_source_files_properties( 30 | ${OPENNI_XML_FILE} 31 | PROPERTIES 32 | MACOSX_PACKAGE_LOCATION "Resources" 33 | ) 34 | 35 | SOURCE_GROUP(Mac FILES ${PLATFORM}) 36 | 37 | set (SOURCES 38 | ${SOURCES} 39 | ${PLATFORM} 40 | ${OPENNI_XML_FILE} 41 | ) 42 | 43 | set(PLIST "Mac/bundle_template/Info.plist") 44 | set(STRINGS "Mac/bundle_template/InfoPlist.strings") 45 | set(LOCALIZED "Mac/bundle_template/Localized.r") 46 | 47 | add_mac_plugin(${PROJECT_NAME} ${PLIST} ${STRINGS} ${LOCALIZED} SOURCES) 48 | 49 | add_custom_command(TARGET ${PROJECT_NAME} 50 | POST_BUILD 51 | COMMAND simple_templater ../chrome-extension/manifest.json.MACOSX "!!PRODUCT_NAME!!" "${FBSTRING_ProductName}" ../chrome-extension/manifest.json 52 | COMMAND cp -R "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${FBSTRING_ProductName}.plugin" ../chrome-extension/plugin/ 53 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 54 | ) 55 | 56 | # add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing! 57 | target_link_libraries(${PROJECT_NAME} 58 | ${PLUGIN_INTERNAL_DEPS} 59 | ${OPENGL_FRAMEWORK} 60 | ${QUARTZ_CORE_FRAMEWORK} 61 | ${CORE_FOUNDATION_FRAMEWORK} 62 | ${OpenNI_LIBS} 63 | ${NITE_LIBS} 64 | ) 65 | -------------------------------------------------------------------------------- /firebreath-plugin/PluginConfig.cmake: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # 3 | # Auto-Generated Plugin Configuration file 4 | # for DepthJS Plugin 5 | # 6 | #\**********************************************************/ 7 | 8 | set(PLUGIN_NAME "depthjsplugin") 9 | set(PLUGIN_PREFIX "DJP") 10 | set(COMPANY_NAME "mitmedialab") 11 | 12 | # ActiveX constants: 13 | set(FBTYPELIB_NAME depthjspluginLib) 14 | set(FBTYPELIB_DESC "depthjsplugin 1.0 Type Library") 15 | set(IFBControl_DESC "depthjsplugin Control Interface") 16 | set(FBControl_DESC "depthjsplugin Control Class") 17 | set(IFBComJavascriptObject_DESC "depthjsplugin IComJavascriptObject Interface") 18 | set(FBComJavascriptObject_DESC "depthjsplugin ComJavascriptObject Class") 19 | set(IFBComEventSource_DESC "depthjsplugin IFBComEventSource Interface") 20 | set(AXVERSION_NUM "1") 21 | 22 | # NOTE: THESE GUIDS *MUST* BE UNIQUE TO YOUR PLUGIN/ACTIVEX CONTROL! YES, ALL OF THEM! 23 | set(FBTYPELIB_GUID a2420d9e-3906-547c-b726-b2dad0aefee9) 24 | set(IFBControl_GUID df2aaf09-8562-53b9-90eb-9b1bc920d6e9) 25 | set(FBControl_GUID d76e88da-5167-551c-9608-ace40abf22d4) 26 | set(IFBComJavascriptObject_GUID 5ff9b773-f7e9-50e3-b62a-e39c2933d46e) 27 | set(FBComJavascriptObject_GUID be9a7083-405b-5562-8a69-b166312230bf) 28 | set(IFBComEventSource_GUID 0344798c-8962-508e-9331-f9285d69a83d) 29 | 30 | # these are the pieces that are relevant to using it from Javascript 31 | set(ACTIVEX_PROGID "mitmedialab.depthjsplugin") 32 | set(MOZILLA_PLUGINID "depthjs.media.mit.edu/depthjsplugin") 33 | 34 | # strings 35 | set(FBSTRING_CompanyName "MIT Media Lab") 36 | set(FBSTRING_FileDescription "The native plugin part of the DepthJS project") 37 | set(FBSTRING_PLUGIN_VERSION "1.0.0.0") 38 | set(FBSTRING_LegalCopyright "Copyright 2012 MIT Media Lab") 39 | set(FBSTRING_PluginFileName "np${PLUGIN_NAME}.dll") 40 | set(FBSTRING_ProductName "DepthJSPlugin") 41 | set(FBSTRING_FileExtents "") 42 | set(FBSTRING_PluginName "DepthJSPlugin") 43 | set(FBSTRING_MIMEType "application/x-depthjsplugin") 44 | 45 | # Uncomment this next line if you're not planning on your plugin doing 46 | # any drawing: 47 | 48 | #set (FB_GUI_DISABLED 1) 49 | 50 | # Mac plugin settings. If your plugin does not draw, set these all to 0 51 | set(FBMAC_USE_QUICKDRAW 0) 52 | set(FBMAC_USE_CARBON 1) 53 | set(FBMAC_USE_COCOA 1) 54 | set(FBMAC_USE_COREGRAPHICS 1) 55 | set(FBMAC_USE_COREANIMATION 0) 56 | set(FBMAC_USE_INVALIDATINGCOREANIMATION 0) 57 | 58 | # If you want to register per-machine on Windows, uncomment this line 59 | #set (FB_ATLREG_MACHINEWIDE 1) 60 | -------------------------------------------------------------------------------- /firebreath-plugin/ResourceRecovery.h: -------------------------------------------------------------------------------- 1 | std::string getResourcesDirectory(); -------------------------------------------------------------------------------- /firebreath-plugin/Sample-Tracking.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /firebreath-plugin/Win/ResourceRecovery.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "ResourceRecoveryWin.h" 3 | 4 | std::string getResourcesDirectory() { 5 | return _NITE_DIR; 6 | } -------------------------------------------------------------------------------- /firebreath-plugin/X11/projectDef.cmake: -------------------------------------------------------------------------------- 1 | #/**********************************************************\ 2 | # Auto-generated X11 project definition file for the 3 | # DepthJS Plugin project 4 | #\**********************************************************/ 5 | 6 | # X11 template platform definition CMake file 7 | # Included from ../CMakeLists.txt 8 | 9 | # remember that the current source dir is the project root; this file is in X11/ 10 | file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 11 | X11/[^.]*.cpp 12 | X11/[^.]*.h 13 | X11/[^.]*.cmake 14 | ) 15 | 16 | SOURCE_GROUP(X11 FILES ${PLATFORM}) 17 | 18 | # use this to add preprocessor definitions 19 | add_definitions( 20 | ) 21 | 22 | set (SOURCES 23 | ${SOURCES} 24 | ${PLATFORM} 25 | ) 26 | 27 | add_x11_plugin(${PROJECT_NAME} SOURCES) 28 | 29 | # add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing! 30 | target_link_libraries(${PROJECT_NAME} 31 | ${PLUGIN_INTERNAL_DEPS} 32 | ) 33 | -------------------------------------------------------------------------------- /firebreath-plugin/cmake/Modules/FindNITE.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find NITE 2 | # Once done, this will define 3 | # 4 | # NITE_FOUND - system has NITE 5 | # NITE_INCLUDE_DIRS - the NITE include directories 6 | # NITE_LIBRARIES - link these to use NITE 7 | 8 | #include(LibFindMacros) 9 | 10 | # Dependencies 11 | 12 | # Use pkg-config to get hints about paths 13 | find_package(PkgConfig) 14 | pkg_check_modules(NITE_PKGCONF NITE) 15 | 16 | SET(NITE_INCLUDE_SEARCH_PATHS ${NITE_PKGCONF_INCLUDE_DIRS}) 17 | SET(NITE_LIB_SEARCH_PATHS ${NITE_PKGCONF_LIBRARY_DIRS}) 18 | 19 | IF(WIN32) 20 | # this is where NITE msi installers usually put the files 21 | SET(NITE_INCLUDE_SEARCH_PATHS "C:/Program Files/NITE/Include/" "D:/Program Files/NITE/Include/") 22 | SET(NITE_LIB_SEARCH_PATHS "C:/Program Files/NITE/Lib/" "D:/Program Files/NITE/Lib/") 23 | ELSE(WIN32) 24 | SET(NITE_INCLUDE_SEARCH_PATHS ${NITE_INCLUDE_SEARCH_PATHS} "/usr/local/include" "/usr/include") 25 | set(NITE_LIB_SEARCH_PATHS "${NITE_LIB_SEARCH_PATHS}" "/usr/local/lib" "/usr/lib") 26 | ENDIF(WIN32) 27 | 28 | MESSAGE(STATUS "Try to look here: ${NITE_INCLUDE_SEARCH_PATHS}") 29 | 30 | # Include dir 31 | find_path(NITE_INCLUDE_DIR 32 | NAMES XnVNite.h 33 | HINTS ${NITE_INCLUDE_SEARCH_PATHS} 34 | PATH_SUFFIXES "nite" 35 | ) 36 | 37 | if(NITE_INCLUDE_DIR STREQUAL "NITE_INCLUDE_DIR-NOTFOUND") 38 | message(STATUS "Looking for NITE in default dirs") 39 | find_path(NITE_INCLUDE_DIR NAMES XnVNite.h 40 | PATH_SUFFIXES "nite" 41 | ) 42 | endif() 43 | 44 | # Finally the library itself 45 | find_library(NITE_LIBRARY 46 | NAMES XnVNITE 47 | PATHS ${NITE_LIB_SEARCH_PATHS} 48 | ) 49 | 50 | if(NITE_LIBRARY STREQUAL "NITE_LIBRARY-NOTFOUND") 51 | message(STATUS "can't find NITE library, looking more aggressively") 52 | foreach(NITE_LOOKUP_PATH ${NITE_LIB_SEARCH_PATHS}) 53 | file(GLOB NITE_LIBRARY "${NITE_LOOKUP_PATH}/*XnV*") 54 | message(STATUS "looking in ${NITE_LOOKUP_PATH} resulted in ${NITE_LIBRARY}") 55 | if(NITE_LIBRARY) 56 | # #found NITE library 57 | # #but there may be many files found.. 58 | if(WIN32) 59 | foreach(NITE_LIBRARY_FOUND ${NITE_LIBRARY}) 60 | message(STATUS "checking ${NITE_LIBRARY_FOUND}") 61 | string(REGEX MATCH "lib" FOUND_LIB_IN_FILE ${NITE_LIBRARY_FOUND}) 62 | if(FOUND_LIB_IN_FILE) 63 | set(NITE_LIBRARY_TMP ${NITE_LIBRARY_TMP} ${NITE_LIBRARY_FOUND}) 64 | endif() 65 | endforeach() 66 | set(NITE_LIBRARY ${NITE_LIBRARY_TMP}) 67 | endif(WIN32) 68 | break() 69 | endif() 70 | endforeach() 71 | endif() 72 | 73 | # Set the include dir variables and the libraries and let libfind_process do the rest. 74 | # NOTE: Singular variables for this library, plural for libraries this this lib depends on. 75 | #set(NITE_PROCESS_INCLUDES NITE_INCLUDE_DIR NITE_INCLUDE_DIRS) 76 | #set(NITE_PROCESS_LIBS NITE_LIBRARY NITE_LIBRARIES) 77 | #libfind_process(NITE) 78 | 79 | set(NITE_LIBRARIES ${NITE_LIBRARY} ) 80 | set(NITE_LIBS ${NITE_LIBRARY} ) 81 | set(NITE_INCLUDE_DIRS ${NITE_INCLUDE_DIR} ) 82 | set(NITE_DIR "${NITE_INCLUDE_DIR}/../" ) 83 | 84 | include(FindPackageHandleStandardArgs) 85 | # handle the QUIETLY and REQUIRED arguments and set ???_FOUND to TRUE 86 | # if all listed variables are TRUE 87 | find_package_handle_standard_args(NITE DEFAULT_MSG 88 | NITE_LIBRARY NITE_INCLUDE_DIR) 89 | 90 | mark_as_advanced(NITE_INCLUDE_DIR NITE_LIBRARY ) 91 | -------------------------------------------------------------------------------- /firebreath-plugin/cmake/Modules/FindOpenNI.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find OpenNI 2 | # Once done, this will define 3 | # 4 | # OpenNI_FOUND - system has OpenNI 5 | # OpenNI_INCLUDE_DIRS - the OpenNI include directories 6 | # OpenNI_LIBRARIES - link these to use OpenNI 7 | 8 | #include(LibFindMacros) 9 | 10 | # Dependencies 11 | 12 | # Use pkg-config to get hints about paths 13 | find_package(PkgConfig) 14 | pkg_check_modules(OpenNI_PKGCONF OpenNI) 15 | 16 | SET(OPENNI_INCLUDE_SEARCH_PATHS ${OpenNI_PKGCONF_INCLUDE_DIRS}) 17 | SET(OPENNI_LIB_SEARCH_PATHS ${OpenNI_PKGCONF_LIBRARY_DIRS}) 18 | 19 | IF(WIN32) 20 | SET(OPENNI_INCLUDE_SEARCH_PATHS "C:/Program Files/OpenNI/Include/" "D:/Program Files/OpenNI/Include/") 21 | SET(OPENNI_LIB_SEARCH_PATHS "C:/Program Files/OpenNI/Lib/" "D:/Program Files/OpenNI/Lib/") 22 | ENDIF(WIN32) 23 | 24 | MESSAGE(STATUS "Try to look here: ${OPENNI_INCLUDE_SEARCH_PATHS}") 25 | 26 | # Include dir 27 | find_path(OpenNI_INCLUDE_DIR 28 | NAMES XnOpenNI.h 29 | HINTS ${OPENNI_INCLUDE_SEARCH_PATHS} 30 | PATH_SUFFIXES "ni" 31 | ) 32 | 33 | if(OpenNI_INCLUDE_DIR STREQUAL "OpenNI_INCLUDE_DIR-NOTFOUND") 34 | message(STATUS "Looking for OpenNI in default dirs") 35 | find_path(OpenNI_INCLUDE_DIR NAMES XnOpenNI.h 36 | PATH_SUFFIXES "ni" 37 | ) 38 | endif() 39 | 40 | # Finally the library itself 41 | find_library(OpenNI_LIBRARY 42 | NAMES OpenNI 43 | PATHS ${OPENNI_LIB_SEARCH_PATHS} 44 | ) 45 | 46 | # Set the include dir variables and the libraries and let libfind_process do the rest. 47 | # NOTE: Singular variables for this library, plural for libraries this this lib depends on. 48 | #set(OpenNI_PROCESS_INCLUDES OpenNI_INCLUDE_DIR OpenNI_INCLUDE_DIRS) 49 | #set(OpenNI_PROCESS_LIBS OpenNI_LIBRARY OpenNI_LIBRARIES) 50 | #libfind_process(OpenNI) 51 | 52 | set(OpenNI_LIBRARIES ${OpenNI_LIBRARY} ) 53 | set(OpenNI_LIBS ${OpenNI_LIBRARY} ) 54 | set(OpenNI_INCLUDE_DIRS ${OpenNI_INCLUDE_DIR} ) 55 | 56 | include(FindPackageHandleStandardArgs) 57 | # handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE 58 | # if all listed variables are TRUE 59 | find_package_handle_standard_args(OpenNI DEFAULT_MSG 60 | OpenNI_LIBRARY OpenNI_INCLUDE_DIR) 61 | 62 | mark_as_advanced(OpenNI_INCLUDE_DIR OpenNI_LIBRARY ) -------------------------------------------------------------------------------- /firebreath-plugin/copy_binary_win32.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | del /F /Q "..\chrome-extension\plugin" 4 | rmdir /S /Q "..\chrome-extension\plugin" 5 | mkdir "..\chrome-extension\plugin" 6 | copy build\bin\depthjsplugin\%1\npdepthjsplugin.dll "..\chrome-extension\plugin\" 7 | 8 | del /F /Q ..\chrome-extension\manifest.json 9 | REM %1\simple_templater.exe ..\chrome-extension\manifest.json.template $PLUGIN_PATH "{ ""path"": ""plugin/npdepthjsplugin.dll"" }" ..\chrome-extension\manifest.json 10 | copy ..\chrome-extension\manifest.json.WIN32 ..\chrome-extension\manifest.json -------------------------------------------------------------------------------- /firebreath-plugin/depthjsplugin.h: -------------------------------------------------------------------------------- 1 | /**********************************************************\ 2 | 3 | Auto-generated depthjsplugin.h 4 | 5 | This file contains the auto-generated main plugin object 6 | implementation for the DepthJS Plugin project 7 | 8 | \**********************************************************/ 9 | #ifndef H_depthjspluginPLUGIN 10 | #define H_depthjspluginPLUGIN 11 | 12 | #include "PluginWindow.h" 13 | #include "PluginEvents/MouseEvents.h" 14 | #include "PluginEvents/AttachedEvent.h" 15 | 16 | #include "PluginCore.h" 17 | 18 | 19 | FB_FORWARD_PTR(depthjsplugin) 20 | class depthjsplugin : public FB::PluginCore 21 | { 22 | public: 23 | static void StaticInitialize(); 24 | static void StaticDeinitialize(); 25 | 26 | public: 27 | depthjsplugin(); 28 | virtual ~depthjsplugin(); 29 | 30 | public: 31 | void onPluginReady(); 32 | void shutdown(); 33 | virtual FB::JSAPIPtr createJSAPI(); 34 | // If you want your plugin to always be windowless, set this to true 35 | // If you want your plugin to be optionally windowless based on the 36 | // value of the "windowless" param tag, remove this method or return 37 | // FB::PluginCore::isWindowless() 38 | virtual bool isWindowless() { return true; } 39 | 40 | int kinect_status; 41 | bool RunDepthJS(); 42 | 43 | BEGIN_PLUGIN_EVENT_MAP() 44 | EVENTTYPE_CASE(FB::MouseDownEvent, onMouseDown, FB::PluginWindow) 45 | EVENTTYPE_CASE(FB::MouseUpEvent, onMouseUp, FB::PluginWindow) 46 | EVENTTYPE_CASE(FB::MouseMoveEvent, onMouseMove, FB::PluginWindow) 47 | EVENTTYPE_CASE(FB::MouseMoveEvent, onMouseMove, FB::PluginWindow) 48 | EVENTTYPE_CASE(FB::AttachedEvent, onWindowAttached, FB::PluginWindow) 49 | EVENTTYPE_CASE(FB::DetachedEvent, onWindowDetached, FB::PluginWindow) 50 | END_PLUGIN_EVENT_MAP() 51 | 52 | /** BEGIN EVENTDEF -- DON'T CHANGE THIS LINE **/ 53 | virtual bool onMouseDown(FB::MouseDownEvent *evt, FB::PluginWindow *); 54 | virtual bool onMouseUp(FB::MouseUpEvent *evt, FB::PluginWindow *); 55 | virtual bool onMouseMove(FB::MouseMoveEvent *evt, FB::PluginWindow *); 56 | virtual bool onWindowAttached(FB::AttachedEvent *evt, FB::PluginWindow *); 57 | virtual bool onWindowDetached(FB::DetachedEvent *evt, FB::PluginWindow *); 58 | /** END EVENTDEF -- DON'T CHANGE THIS LINE **/ 59 | }; 60 | 61 | 62 | #endif 63 | 64 | -------------------------------------------------------------------------------- /firebreath-plugin/depthjspluginAPI.h: -------------------------------------------------------------------------------- 1 | /**********************************************************\ 2 | 3 | Auto-generated depthjspluginAPI.h 4 | 5 | \**********************************************************/ 6 | 7 | #include 8 | #include 9 | #include 10 | #include "JSAPIAuto.h" 11 | #include "BrowserHost.h" 12 | #include "depthjsplugin.h" 13 | #include "DOM/Window.h" 14 | 15 | #ifndef H_depthjspluginAPI 16 | #define H_depthjspluginAPI 17 | 18 | class depthjspluginAPI : public FB::JSAPIAuto 19 | { 20 | public: 21 | depthjspluginAPI(const depthjspluginPtr& plugin, const FB::BrowserHostPtr& host); 22 | virtual ~depthjspluginAPI(); 23 | 24 | depthjspluginPtr getPlugin(); 25 | 26 | // Read/Write property ${PROPERTY.ident} 27 | std::string get_testString(); 28 | void set_testString(const std::string& val); 29 | 30 | // Read-only property ${PROPERTY.ident} 31 | std::string get_version(); 32 | 33 | // Method echo 34 | FB::variant echo(const FB::variant& msg); 35 | 36 | // Event helpers 37 | FB_JSAPI_EVENT(fired, 3, (const FB::variant&, bool, int)); 38 | FB_JSAPI_EVENT(echo, 2, (const FB::variant&, const int)); 39 | FB_JSAPI_EVENT(notify, 0, ()); 40 | 41 | // Method test-event 42 | void testEvent(const FB::variant& s); 43 | 44 | 45 | bool InitDepthJS(); 46 | void ShutdownDepthJS(); 47 | void CallbackTest(); 48 | 49 | void DepthJSLog(const std::string& s); 50 | 51 | void DepthJSEvent(const std::string& etype, const std::string& emessage); 52 | private: 53 | void DepthJSEvent_internal(const std::string& etype, const std::string& emessage); 54 | FB::JSObjectPtr npBackendObj; //DepthJS backend link 55 | 56 | depthjspluginWeakPtr m_plugin; 57 | FB::BrowserHostPtr m_host; 58 | 59 | std::string m_testString; 60 | }; 61 | 62 | #endif // H_depthjspluginAPI 63 | 64 | -------------------------------------------------------------------------------- /firebreath-plugin/openni_backend.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * openni_backend.h 3 | * webkit-plugin-mac 4 | * 5 | * Created by Roy Shilkrot on 9/30/11. 6 | * Copyright 2011 MIT. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef _OPENNI_BACKEND_HPP 11 | #define _OPENNI_BACKEND_HPP 12 | 13 | #include 14 | #include "depthjspluginAPI.h" 15 | 16 | int openni_backend(void* _arg); 17 | void kill_openni_backend(); 18 | bool is_openni_backend_dead(); 19 | int init_openni_backend(const boost::shared_ptr&); 20 | 21 | #endif -------------------------------------------------------------------------------- /firebreath-plugin/simple_templater.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | int main(int argc, char** argv) { 8 | if(argc < 5) { 9 | cerr << "USAGE: simple_templater