Fieol

KinectV1Device.h

Mar 31st, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.30 KB | None | 0 0
  1. //
  2. // Copyright 2018 Adam Horvath - MIRROR.UPLUGINS.COM - info@uplugins.com - All Rights Reserved.
  3. //
  4.  
  5. #pragma once
  6. #include "VirtualMirrorFunctionLibrary.h"
  7. #include "MotionSensorDevice.h"
  8.  
  9.  
  10. //KinectV1 log
  11. DECLARE_LOG_CATEGORY_EXTERN(KinectV1, Log, All);
  12.  
  13. #define MAX_DEPTH 10000
  14.  
  15. class FKinectV1Device: public FMotionSensorDevice
  16. {
  17.    
  18. public:
  19.     FKinectV1Device();
  20.     virtual ~FKinectV1Device();
  21.  
  22.     /** Startup the device, and do any initialization that may be needed */
  23.     bool StartupDevice();
  24.  
  25.     /** Tear down the device */
  26.     void ShutdownDevice();
  27.    
  28.     /** Update device on each Tick */
  29.     void UpdateDevice(float DeltaTime);
  30.    
  31.     UTexture2D* GetTextureRGB();
  32.     UTexture2D* GetTextureDEPTH();
  33.     UTexture2D* GetTextureUSER();
  34.  
  35.     FString GetDeviceName();
  36.    
  37.  
  38.     //Experimental RGB without the user
  39.     void UpdateTextureCLEANRGB();
  40.  
  41.     bool Init(bool playOni=false);
  42.     void Cleanup(void);
  43.  
  44.     //Sensor control
  45.     bool SensorInit(bool playOni=false);
  46.     bool SensorShutdown();
  47.    
  48.  
  49.     //Tracking control
  50.     void AbortTracking();
  51.     bool IsTracking();
  52.  
  53.     //Skeleton data
  54.     FVector GetBonePosition(EJointType skelJoint, bool flip = false);
  55.     FVector2D GetBonePosition2D(EJointType skelJoint);
  56.     FRotator GetBoneRotation(EJointType skelJoint, bool flip = false);
  57.     EJointType GetClosestBodyJoint(EJointType HandJoint);
  58.  
  59.    
  60.  
  61.    
  62.     float                       SensorHeight;
  63.     float                       SensorAngle;
  64.     FVector                     SensorOffset;
  65.    
  66.  
  67. protected:
  68.     void UpdateTextureRGB();
  69.     void UpdateTextureDEPTH();
  70.     void UpdateTextureUSER();
  71.    
  72.     void UpdateUserTracker();
  73.  
  74.     nite::JointType ConvertJoint(EJointType Joint);
  75.  
  76.    
  77.  
  78.     UTexture2D*                 TextureRGB;
  79.     UTexture2D*                 TextureDEPTH;
  80.     UTexture2D*                 TextureUSER;
  81.     UTexture2D*                 DummyTexture;
  82.    
  83.     RGBQUAD*                    QuadRGB;
  84.     RGBQUAD*                    QuadDEPTH;
  85.     RGBQUAD*                    QuadUSER;
  86.    
  87.  
  88.     bool                        initiated;
  89.    
  90.     openni::Device              Device;
  91.     FString                     DeviceName;
  92.  
  93.     openni::VideoStream         DepthStream;
  94.     openni::VideoFrameRef       DepthFrame;
  95.     openni::VideoStream         ColorStream;
  96.     openni::VideoFrameRef       ColorFrame;
  97.  
  98.     nite::UserTracker*          UserTracker;
  99.     nite::UserTrackerFrameRef   UserTrackerFrame;
  100.  
  101.     float                       RefreshTimer;
  102.  
  103.     bool                        FloorFound;
  104.     nite::Plane                 SceneFloor;
  105.     FVector                     CoM;
  106.  
  107.     int32                       NumberOfUsers;
  108.     int32                       TrackedUserID;
  109.    
  110.     bool                        Calibrating;
  111.    
  112.    
  113.    
  114.    
  115.    
  116.    
  117. };
Add Comment
Please, Sign In to add comment