Skip to content

Commit

Permalink
Replace bhaptics submodule with plain version; done since we need to …
Browse files Browse the repository at this point in the history
…modify the header to be compatible with the Far Cry SDK
  • Loading branch information
fholger committed Sep 3, 2023
1 parent 926ccfe commit 760b26b
Show file tree
Hide file tree
Showing 8 changed files with 573 additions and 4 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@
[submodule "Sources/ThirdParty/openvr"]
path = Sources/ThirdParty/openvr
url = https://github.com/ValveSoftware/openvr.git
[submodule "Sources/ThirdParty/bhaptics"]
path = Sources/ThirdParty/bhaptics
url = https://github.com/bhaptics/haptic-library.git
1 change: 0 additions & 1 deletion Sources/ThirdParty/bhaptics
Submodule bhaptics deleted from dbb750
80 changes: 80 additions & 0 deletions Sources/ThirdParty/bhaptics/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
.idea/

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules

# CMake
cmake-build-*/
CMakeCache.txt
bin/**/CMakeCache.txt
bin/**/CMakeFiles
bin/**/cmake_install.cmake
bin/**/Makefile
bin/**/*.cbp
bin/**/*.exe
bin/**/*.manifest
bin/**/*.exp
bin/**/hello_binary
bin/**/Testing/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

build/
2 changes: 2 additions & 0 deletions Sources/ThirdParty/bhaptics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## Unity plugin 1.4.8(Nov 1st, 2019.)
* Update: Add app name to the plugin.
3 changes: 3 additions & 0 deletions Sources/ThirdParty/bhaptics/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
License

Use of bHaptics SDK is subject to the bHaptics SDK agreement (https://bhaptics.gitbook.io/license-sdk/).
36 changes: 36 additions & 0 deletions Sources/ThirdParty/bhaptics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## bHaptics Haptic Library
* Written in C++ 11
* Tested in windows
* Current version is 1.4.14

## Prerequisite
* bHaptics Player has to be installed (Windows)
* The app can be found in
bHaptics webpage: [http://www.bhaptics.com](http://bhaptics.com/)

## Latest library files
* https://github.com/bhaptics/haptic-library/tree/master/bin


## Documentation
* https://github.com/bhaptics/haptic-library/wiki/Documentation


## 3rd party dependencies
* nlohmann/json : https://github.com/nlohmann/json
* easywsclient : https://github.com/dhbaird/easywsclient


## Samples
* [unity-plugin github](https://github.com/bhaptics/tactosy-sharp/tree/master/samples/unity-plugin), [Unity asset store](https://assetstore.unity.com/packages/tools/integration/bhaptics-haptic-plugin-76647)
* [unreal-plugin github](https://github.com/bhaptics/TactUnrealEngine4), [Unreal market place](https://www.unrealengine.com/marketplace/en-US/slug/bhaptics-haptic-manager)


## Contact
* Official Website: http://www.bhaptics.com/
* E-mail: [email protected]
* Issues : https://github.com/bhaptics/tac-sharp/issues/new

Last update of README.md: Nov 1st, 2019.

#### Copyright (c) 2016-2019 bHaptics Inc. All rights reserved.
148 changes: 148 additions & 0 deletions Sources/ThirdParty/bhaptics/include/shared/HapticLibrary.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
#ifndef HAPTIC_LIBRARY_H
#define HAPTIC_LIBRARY_H


#if defined _WIN32 || defined __CYGWIN__
#ifdef BHAPTICS_BUILDING_DLL
#ifdef __GNUC__
#define DLL_PUBLIC __attribute__ ((dllexport))
#else
#define DLL_PUBLIC __declspec(dllexport) // Note: actually gcc seems to also supports this syntax.
#endif
#else
#ifdef __GNUC__
#define DLL_PUBLIC __attribute__ ((dllimport))
#else
#define DLL_PUBLIC __declspec(dllimport) // Note: actually gcc seems to also supports this syntax.
#endif
#endif
#define DLL_LOCAL
#else
#if __GNUC__ >= 4
#define DLL_PUBLIC __attribute__ ((visibility ("default")))
#define DLL_LOCAL __attribute__ ((visibility ("hidden")))
#else
#define DLL_PUBLIC
#define DLL_LOCAL
#endif
#endif

//#include "model.h"
//#include <vector>


#ifdef __cplusplus
extern "C" { // only need to export C interface if
// used by C++ source code
#endif

struct point {
float x, y;
int intensity;
int motorCount;
};

struct status {
int values[20];
};

DLL_PUBLIC void ChangeUrl(const char* url);

DLL_PUBLIC bool TryGetExePath(char* buf, int& size);

DLL_PUBLIC const char* GetExePath();

// Initialises a connection to the bHaptics Player. Should only be called once: when the game starts.
DLL_PUBLIC void Initialise(const char* appId, const char* appName);
DLL_PUBLIC void InitialiseSync(const char* appId, const char* appName);

// End the connecection to the bHaptics Player. Should only be called once: when the game ends.
DLL_PUBLIC void Destroy();

// Register a preset .tact feedback file, created using the bHaptics Designer.
// Registered files can then be called and played back using the given key.
// File is submitted as an already processed JSON string of the Project attribute.
DLL_PUBLIC void RegisterFeedback(const char* key, const char* projectJson);

DLL_PUBLIC void RegisterFeedbackFromTactFile(const char* key, const char* tactFileStr);

DLL_PUBLIC void RegisterFeedbackFromTactFileReflected(const char* key, const char* tactFileStr);

// Register a preset .tact feedback file, created using the bHaptics Designer.
// Registered files can then be called and played back using the given key.
// File Path is given, and feedback file is parsed and processed by the SDK.
DLL_PUBLIC void LoadAndRegisterFeedback(const char* Key, const char* FilePath);

// Submit a request to play a registered feedback file using its Key.
DLL_PUBLIC void SubmitRegistered(const char* key);

DLL_PUBLIC void SubmitRegisteredStartMillis(const char* key, int startMillis);

// Submit a request to play a registered feedback file, with additional options.
// ScaleOption scales the intensity and duration of the feedback by some factor.
// RotationOption uses cylindrical projection to rotate a Vest feedback file, as well as the vertical position.
// AltKey provides a unique key to play this custom feedback under, as opposed to the original feedback Key.
//DLL_PUBLIC void SubmitRegisteredAlt(const char* Key, const char* AltKey, bhaptics::ScaleOption ScaleOpt, bhaptics::RotationOption RotOption);

DLL_PUBLIC void SubmitRegisteredWithOption(const char* Key, const char* AltKey, float intensity, float duration, float offsetAngleX, float offsetAngleY);

//DLL_PUBLIC void SubmitByteArray(const char *key, bhaptics::PositionType Pos, unsigned char *buf, size_t length,
// int durationMillis);
//
//DLL_PUBLIC void SubmitPathArray(const char *key, bhaptics::PositionType Pos, point *points, size_t length,
// int durationMillis);

// Submit an array of 20 integers, representing the strength of each motor vibration, ranging from 0 to 100.
// Specify the Position (playback device) as well as the duration of the feedback effect in milliseconds.
//DLL_PUBLIC void Submit(const char* Key, bhaptics::PositionType Pos, std::vector<uint8_t>& MotorBytes, int DurationMillis);

// Submit an array of DotPoints, representing the motor's Index and Intensity.
// Specify the Position (playback device) as well as the duration of the feedback effect in milliseconds.
//DLL_PUBLIC void SubmitDot(const char* Key, bhaptics::PositionType Pos, std::vector<bhaptics::DotPoint>& Points, int DurationMillis);

// Submit an array of PathPoints, representing the xy-position of the feedback on a unit square.
// Based off the intensity and position, specific motors are chosen by the bHaptics Player and vibrated.
// Specify the Position (playback device) as well as the duration of the feedback effect in milliseconds.
//DLL_PUBLIC void SubmitPath(const char* Key, bhaptics::PositionType Pos, std::vector<bhaptics::PathPoint>& Points, int DurationMillis);

// Boolean to check if a Feedback has been registered or not under the given Key.
DLL_PUBLIC bool IsFeedbackRegistered(const char* key);

// Boolean to check if there are any Feedback effects currently playing.
DLL_PUBLIC bool IsPlaying();

// Boolean to check if a feedback effect under the given Key is currently playing.
DLL_PUBLIC bool IsPlayingKey(const char* Key);

// Turn off all currently playing feedback effects.
DLL_PUBLIC void TurnOff();

// Turn off the feedback effect specified by the Key.
DLL_PUBLIC void TurnOffKey(const char* Key);

// Enable Haptic Feedback calls to the bHaptics Player (on by default)
DLL_PUBLIC void EnableFeedback();

// Disable Haptic Feedback calls to the bHaptics Player
DLL_PUBLIC void DisableFeedback();

// Toggle between Enabling/Disabling haptic feedback.
DLL_PUBLIC void ToggleFeedback();

// Boolean to check if a specific device is connected to the bHaptics Player.
//DLL_PUBLIC bool IsDevicePlaying(bhaptics::PositionType Pos);

// Returns an array of the current status of each device.
// Used for UI to ensure that haptic feedback is playing.
//DLL_PUBLIC void GetResponseStatus(std::vector<bhaptics::HapticFeedback>& retValues);

// Returns the current motor values for a given device.
// Used for UI to ensure that haptic feedback is playing.
// return value is 20
//DLL_PUBLIC bool TryGetResponseForPosition(bhaptics::PositionType Pos, status& s);

#ifdef __cplusplus
}
#endif

#endif
Loading

0 comments on commit 760b26b

Please sign in to comment.