/** * @file * * @author Max Lammers * @author Mamadou Babaei * * @section LICENSE * * Copyright (c) 2020 - 2025 SenseGlove * * @section DESCRIPTION * * Internal class to help a Nova Glove keep track of active effects. * Since the Nova's Haptics are significantly different from a SenseGlove DK1, they get their own stream. */ #pragma once #include #include #include "Platform.hpp" namespace SGCore { namespace Nova { /// Internal class to help a Nova Glove keep track of active effects. class SGCORE_API NovaGloveHapticStream; } // namespace Nova namespace Haptics { /// Internal class to help a Nova Glove keep track of active effects. class SGCORE_API ThresholdCommand; }// namespace Haptics }// namespace SGCore /// Internal class to help a Nova Glove keep track of active effects. class SGCORE_API SGCore::Nova::NovaGloveHapticStream { //--------------------------------------------------------------------------------- // C++ Constructor Voodoo private: struct Impl; std::unique_ptr Pimpl; public: //--------------------------------------------------------------------------------- // Actual C++ Constructors /** * The default constructor. */ NovaGloveHapticStream(); /** * The copy constructor. */ NovaGloveHapticStream(const NovaGloveHapticStream& rhs); /** * The move constructor. */ NovaGloveHapticStream(NovaGloveHapticStream&& rhs) noexcept; virtual ~NovaGloveHapticStream(); public: /** * The copy assignment operator. */ NovaGloveHapticStream& operator=(const NovaGloveHapticStream& rhs); /** * The move assignment operator. */ NovaGloveHapticStream& operator=(NovaGloveHapticStream&& rhs) noexcept; public: //--------------------------------------------------------------------------------------------------- // "Set Force-Feedback Level" commands /// Sets the force level for a specific finger in the buffer. /// /// void AddForceLevel(int32_t finger, float level01); /// Copy a set of FFB levels into the 'previous command', which will be used as a fallback value in case /// no change is made to a specific finger. /// void StoreLastForceFeedback(const std::vector& levels); //--------------------------------------------------------------------------------------------------- // "Set FFB Threshold" Command /// Queue a finger's threshold /// /// void QueueThreshold(int32_t finger, float value); /// Queue thresholds for all fingers /// /// void QueueThresholds(const std::vector& affectedFingers, const std::vector& values); /// Clear a Threshold on a specifc finger /// void ClearThreshold(int32_t finger); /// Clears thresholds on all fingers. void ClearThresholds(); /// Returns true if there have been updates to the Thresholds. /// bool ThresholdsUpdated(); /// The next Threshold command made to be sent next frame. /// Haptics::ThresholdCommand GetNextThresholdCommand(); /// Store the Threshold command you've just sent to optimize sending it. /// void StoreLastThresholdCommand(Haptics::ThresholdCommand command); //--------------------------------------------------------------------------------------------------- // "Set Vibration Level" commands /// Sets the amplitude for a specific finger in the buffer. /// /// void AddVibrationLevel(int32_t finger, float amplitude); /// Copy a set of amplitudes into the 'previous command', which will be used as a fallback value in case /// no change is made to a specific finger. /// void StoreLastVibro(const std::vector& levels); //--------------------------------------------------------------------------------------------------- // "Set Wrist Level" commands /// Sets the Latest Wrist Level to a desired level /// void AddWristCommand(float amplitude); /// Copy an amplitude into the 'previous command', which will be used as a fallback value in case no /// change is made to the wrist. /// void StoreLastWrist(float wrist); /// Clear the wrist command void ClearWristCommands(); public: //--------------------------------------------------------------------------------------------------- // Command Compilation /// Compile the commands into a set of traditional Nova Commands. /// void CompileTraditionalCommands(std::vector& out_forceFeedbackLevels, std::vector& out_buzzLevels, float& out_wristLvl); /// Clears any active command(s) on the Nova Glove, completely resetting the stream. void ClearAllCommands(); /// Removes all non-active or elapsed Nova effects from the stream, ready for the next frame. void ResetBuffer(); };