Skip to content

Commit

Permalink
sutd demo app
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaqchen committed Nov 16, 2022
1 parent 6df98e9 commit 817c1ab
Show file tree
Hide file tree
Showing 126 changed files with 9,820 additions and 1,489 deletions.
77 changes: 76 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -354,4 +354,79 @@ python/
data/

# VS Code
.vscode/
.vscode/



# UNITY GITIGNORE START
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Mm]emoryCaptures/

# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta

# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

# Autogenerated Jetbrains Rider plugin
[Aa]ssets/Plugins/Editor/JetBrains*

# Visual Studio cache directory
.vs/
#*/.config
#*/.vscode
# Gradle cache directory
.gradle/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.unitypackage

# Crashlytics generated file

crashlytics-build.properties


Docker/dev_script/

**/__pycache__/
*.pyc
**/.vscode
*/.vscode/c_cpp_properties.json
*/docs/*
# UNITY GITIGNORE END
262 changes: 235 additions & 27 deletions HL2UnityPlugin/HL2ResearchMode.cpp

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions HL2UnityPlugin/HL2ResearchMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@ namespace winrt::HL2UnityPlugin::implementation
int GetLongDepthBufferSize();
hstring PrintDepthResolution();
hstring PrintDepthExtrinsics();
hstring PrintLongDepthExtrinsics();
hstring PrintLFResolution();
hstring PrintLFExtrinsics();
hstring PrintRFResolution();
hstring PrintRFExtrinsics();
hstring PrintLLResolution();
hstring PrintLLExtrinsics();
hstring PrintRRResolution();
hstring PrintRRExtrinsics();
hstring PrintAccelExtrinsics();
hstring PrintGyroExtrinsics();

void InitializeDepthSensor();
void InitializeLongDepthSensor();
Expand All @@ -56,6 +63,8 @@ namespace winrt::HL2UnityPlugin::implementation
bool LongDepthMapTextureUpdated();
bool LFImageUpdated();
bool RFImageUpdated();
bool LLImageUpdated();
bool RRImageUpdated();
bool AccelSampleUpdated();
bool GyroSampleUpdated();
bool MagSampleUpdated();
Expand All @@ -74,6 +83,8 @@ namespace winrt::HL2UnityPlugin::implementation
com_array<uint8_t> GetLongDepthMapTextureBuffer();
com_array<uint8_t> GetLFCameraBuffer(int64_t& ts);
com_array<uint8_t> GetRFCameraBuffer(int64_t& ts);
com_array<uint8_t> GetLLCameraBuffer(int64_t& ts);
com_array<uint8_t> GetRRCameraBuffer(int64_t& ts);
com_array<uint8_t> GetLRFCameraBuffer(int64_t& ts_left, int64_t& ts_right);

com_array<float> GetAccelSample();
Expand Down Expand Up @@ -101,6 +112,8 @@ namespace winrt::HL2UnityPlugin::implementation

UINT8* m_LFImage = nullptr;
UINT8* m_RFImage = nullptr;
UINT8* m_LLImage = nullptr;
UINT8* m_RRImage = nullptr;
float* m_accelSample = nullptr;
float* m_gyroSample = nullptr;
float* m_magSample = nullptr;
Expand All @@ -113,13 +126,21 @@ namespace winrt::HL2UnityPlugin::implementation
IResearchModeCameraSensor* m_LFCameraSensor = nullptr;
IResearchModeSensor* m_RFSensor = nullptr;
IResearchModeCameraSensor* m_RFCameraSensor = nullptr;
IResearchModeSensor* m_LLSensor = nullptr;
IResearchModeCameraSensor* m_LLCameraSensor = nullptr;
IResearchModeSensor* m_RRSensor = nullptr;
IResearchModeCameraSensor* m_RRCameraSensor = nullptr;
IResearchModeSensor* m_accelSensor = nullptr;
IResearchModeAccelSensor* m_explicitAccelSensor = nullptr;
IResearchModeSensor* m_gyroSensor = nullptr;
IResearchModeGyroSensor* m_explicitGyroSensor = nullptr;
IResearchModeSensor* m_magSensor = nullptr;
ResearchModeSensorResolution m_depthResolution;
ResearchModeSensorResolution m_longDepthResolution;
ResearchModeSensorResolution m_LFResolution;
ResearchModeSensorResolution m_RFResolution;
ResearchModeSensorResolution m_LLResolution;
ResearchModeSensorResolution m_RRResolution;
IResearchModeSensorDevice* m_pSensorDevice = nullptr;
std::vector<ResearchModeSensorDescriptor> m_sensorDescriptors;
IResearchModeSensorDeviceConsent* m_pSensorDeviceConsent = nullptr;
Expand All @@ -129,6 +150,8 @@ namespace winrt::HL2UnityPlugin::implementation
std::atomic_int m_longDepthBufferSize = 0;
std::atomic_int m_LFbufferSize = 0;
std::atomic_int m_RFbufferSize = 0;
std::atomic_int m_LLbufferSize = 0;
std::atomic_int m_RRbufferSize = 0;
std::atomic_uint16_t m_centerDepth = 0;
float m_centerPoint[3]{ 0,0,0 };

Expand All @@ -148,6 +171,8 @@ namespace winrt::HL2UnityPlugin::implementation
std::atomic_bool m_useRoiFilter = false;
std::atomic_bool m_LFImageUpdated = false;
std::atomic_bool m_RFImageUpdated = false;
std::atomic_bool m_LLImageUpdated = false;
std::atomic_bool m_RRImageUpdated = false;
std::atomic_bool m_accelSampleUpdated = false;
std::atomic_bool m_gyroSampleUpdated = false;
std::atomic_bool m_magSampleUpdated = false;
Expand All @@ -174,6 +199,14 @@ namespace winrt::HL2UnityPlugin::implementation
DirectX::XMMATRIX m_LFCameraPoseInvMatrix;
DirectX::XMFLOAT4X4 m_RFCameraPose;
DirectX::XMMATRIX m_RFCameraPoseInvMatrix;
DirectX::XMFLOAT4X4 m_LLCameraPose;
DirectX::XMMATRIX m_LLCameraPoseInvMatrix;
DirectX::XMFLOAT4X4 m_RRCameraPose;
DirectX::XMMATRIX m_RRCameraPoseInvMatrix;
DirectX::XMFLOAT4X4 m_accelSensorPose;
DirectX::XMMATRIX m_accelSensorPoseInvMatrix;
DirectX::XMFLOAT4X4 m_gyroSensorPose;
DirectX::XMMATRIX m_gyroSensorPoseInvMatrix;
std::thread* m_pDepthUpdateThread;
std::thread* m_pLongDepthUpdateThread;
std::thread* m_pSpatialCamerasFrontUpdateThread;
Expand Down Expand Up @@ -203,6 +236,8 @@ namespace winrt::HL2UnityPlugin::implementation
struct SpatialCameraFrame {
Frame LFFrame;
Frame RFFrame;
Frame LLFrame;
Frame RRFrame;
} m_lastSpatialFrame;
};
}
Expand Down
11 changes: 11 additions & 0 deletions HL2UnityPlugin/HL2ResearchMode.idl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ namespace HL2UnityPlugin

UInt8[] GetLFCameraBuffer(out Int64 ts);
UInt8[] GetRFCameraBuffer(out Int64 ts);
UInt8[] GetLLCameraBuffer(out Int64 ts);
UInt8[] GetRRCameraBuffer(out Int64 ts);
UInt8[] GetLRFCameraBuffer(out Int64 ts_left, out Int64 ts_right);

Single[] GetAccelSample();
Expand All @@ -30,10 +32,17 @@ namespace HL2UnityPlugin
Int32 GetLongDepthBufferSize();
String PrintDepthResolution();
String PrintDepthExtrinsics();
String PrintLongDepthExtrinsics();
String PrintLFResolution();
String PrintLFExtrinsics();
String PrintRFResolution();
String PrintRFExtrinsics();
String PrintLLResolution();
String PrintLLExtrinsics();
String PrintRRResolution();
String PrintRRExtrinsics();
String PrintAccelExtrinsics();
String PrintGyroExtrinsics();

Boolean DepthMapTextureUpdated();
Boolean ShortAbImageTextureUpdated();
Expand All @@ -44,6 +53,8 @@ namespace HL2UnityPlugin

Boolean LFImageUpdated();
Boolean RFImageUpdated();
Boolean LLImageUpdated();
Boolean RRImageUpdated();
Boolean AccelSampleUpdated();
Boolean GyroSampleUpdated();
Boolean MagSampleUpdated();
Expand Down
2 changes: 1 addition & 1 deletion UnitySample/Assets/MRTK/Shaders/MRTK.Shaders.sentinel
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ver: 0
ver: 2
Loading

0 comments on commit 817c1ab

Please sign in to comment.