Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
'deps/oculus/src/*.cpp',
'deps/openvr/src/*.cpp',
'deps/exokit-bindings/leapmotion/src/*.cc',
'deps/exokit-bindings/zed/src/*.cc',
],
'include_dirs': [
"<!(node -e \"console.log(require.resolve('nan').slice(0, -16))\")",
Expand All @@ -43,6 +44,8 @@
"<!(node -e \"console.log(require.resolve('native-oculus-deps').slice(0, -9) + '/Include')\")",
"<!(node -e \"console.log(require.resolve('native-openvr-deps').slice(0, -9) + '/headers')\")",
"<!(node -e \"console.log(require.resolve('leapmotion').slice(0, -9) + '/include')\")",
"C:\\Program Files (x86)\\ZED SDK\\include",
"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\include",
'<(module_root_dir)/deps/exokit-bindings',
'<(module_root_dir)/deps/exokit-bindings/utf8',
'<(module_root_dir)/deps/exokit-bindings/node',
Expand All @@ -64,6 +67,7 @@
'<(module_root_dir)/deps/oculus/include',
'<(module_root_dir)/deps/openvr/include',
'<(module_root_dir)/deps/exokit-bindings/leapmotion/include',
'<(module_root_dir)/deps/exokit-bindings/zed/include',
],
'library_dirs': [
"<!(node -e \"console.log(require.resolve('native-graphics-deps').slice(0, -9) + '/lib/windows/glew')\")",
Expand All @@ -74,6 +78,8 @@
"<!(node -e \"console.log(require.resolve('native-oculus-deps').slice(0, -9) + '/Lib/Windows/x64/Release/VS2017')\")",
"<!(node -e \"console.log(require.resolve('native-openvr-deps').slice(0, -9) + '/lib/win64')\")",
"<!(node -e \"console.log(require.resolve('leapmotion').slice(0, -9) + '/lib/win')\")",
"C:\\Program Files (x86)\\ZED SDK\\lib",
"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\lib\\x64",
"<!(node -e \"console.log(require.resolve('native-browser-deps-windows').slice(0, -9) + '/lib2/windows')\")",
"<!(node -e \"console.log(require.resolve('native-webrtc-deps').slice(0, -9) + '/lib/windows')\")",
],
Expand All @@ -92,6 +98,9 @@
'swresample.lib',
'openvr_api.lib',
'Leap.lib',
'sl_zed64.lib',
'sl_core64.lib',
'cudart.lib',
'libcef.lib',
'libcef_dll_wrapper.lib',
'LibOVR.lib',
Expand Down Expand Up @@ -119,6 +128,8 @@
"<!(node -e \"console.log(require.resolve('native-oculus-deps').slice(0, -9) + '/Lib/Windows/x64/Release/VS2017')\")",
"<!(node -e \"console.log(require.resolve('native-openvr-deps').slice(0, -9) + '/bin/win64/openvr_api.dll')\")",
"<!(node -e \"console.log(require.resolve('leapmotion').slice(0, -9) + '/lib/win/Leap.dll')\")",
"C:\\Program Files (x86)\\ZED SDK\\bin\\sl_zed64.dll",
"C:\\Program Files (x86)\\ZED SDK\\bin\\sl_core64.dll",
"<!(node -e \"console.log(require.resolve('native-browser-deps-windows').slice(0, -9) + '/lib2/windows/libcef.dll')\")",
"<!(node -e \"console.log(require.resolve('native-browser-deps-windows').slice(0, -9) + '/lib2/windows/chrome_elf.dll')\")",
"<!(node -e \"console.log(require.resolve('native-browser-deps-windows').slice(0, -9) + '/lib2/windows/libEGL.dll')\")",
Expand Down
3 changes: 2 additions & 1 deletion deps/exokit-bindings/bindings/include/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
#include <webrtc.h>
// Stub out on Android for now until get libcef working on Android.
#if !defined(ANDROID)
#include <browser.h>
#include <browser.h>
#endif
#if _WIN32
#include <zed.h>
#include <leapmotion.h>
#endif
#if defined(LUMIN)
Expand Down
70 changes: 70 additions & 0 deletions deps/exokit-bindings/zed/include/zed.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#ifndef _ZED_H_
#define _ZED_H_

#include <v8.h>
#include <node.h>
#include <nan.h>

#include <defines.h>
#include <windowsystem.h>

#include <chrono>
#include <thread>
#include <mutex>

#include <sl/Camera.hpp>
#include <webgl.h>
#include <cuda_gl_interop.h>

using namespace v8;
using namespace node;

namespace zed {

bool cudaSafeCall(cudaError_t err);

class Zed : public ObjectWrap {
public:
static Local<Object> Initialize(Isolate *isolate);

// protected:
Zed();
~Zed();

static NAN_METHOD(New);
static NAN_METHOD(RequestPresent);
static NAN_METHOD(ExitPresent);
static NAN_METHOD(WaitGetPoses);

void Poll();

sl::Camera camera;
sl::Translation position;
sl::Orientation orientation;
sl::Mesh mesh;
sl::Mesh::chunkList chunks;
std::chrono::high_resolution_clock::time_point ts_last;
GLuint tex;
GLuint leftTex;
GLuint rightTex;
NATIVEwindow *window;
int textureWidth;
int textureHeight;
// cudaGraphicsResource *pcuImageRes;
sl::Mat leftImage;
sl::Mat rightImage;
cudaGraphicsResource *leftCudaImageResource;
cudaGraphicsResource *rightCudaImageResource;
// Nan::Persistent<Function> cbFn;
std::mutex mutex;
std::thread thread;
uv_async_t *async;
uv_sem_t reqSem;
Nan::Persistent<Array> result;
};

}

Local<Object> makeZed();

#endif
Loading