LeiaSR SDK 720218b2 v1.32.7.6322 2025-02-13T14:55:38Z
Stable
Weaver.h
Go to the documentation of this file.
1
5#pragma once
6#include "WeaverTypes.h"
7#include <string>
8#include <vector>
9
10#ifdef WIN32
11# ifdef COMPILING_DLL_DimencoWeaving
12# define DIMENCOSR_API __declspec(dllexport)
13# else
14# define DIMENCOSR_API __declspec(dllimport)
15# endif
16#else
17# define DIMENCOSR_API
18#endif
19
24template <class T>
26
27 static_assert(std::is_member_function_pointer<decltype(static_cast<bool (T::*)(unsigned int, unsigned int)>(&T::canWeave))>::value,
28 "This weaver class does not implement the canWeave(unsigned int, unsigned int) function of the weaver interface");
29 static_assert(std::is_member_function_pointer<decltype(static_cast<bool (T::*)(unsigned int, unsigned int, unsigned int, unsigned int)>(&T::canWeave))>::value,
30 "This weaver class does not implement the canWeave(unsigned int, unsigned int, unsigned int, unsigned int) function of the weaver interface");
31 static_assert(std::is_member_function_pointer<decltype(static_cast<void (T::*)(unsigned int, unsigned int)>(&T::weave))>::value,
32 "This weaver class does not implement the weave(unsigned int, unsigned int) function of the weaver interface");
33 static_assert(std::is_member_function_pointer<decltype(static_cast<void (T::*)(unsigned int, unsigned int, unsigned int, unsigned int)>(&T::weave))>::value,
34 "This weaver class does not implement the weave(unsigned int, unsigned int, unsigned int, unsigned int) function of the weaver interface");
35}
36
37namespace Dimenco {
38
40
41public:
46 static void SetGlobalParameters(FLOAT3 userPos);
47
53 static void SetGlobalParameters(const char* configPath, FLOAT3 userPos);
54
58 static void ReconfigureWeaver();
59
63 static void SetDeviceSerialNumbers(const std::vector<std::string> &deviceSerialNumbers);
64
68 static void SetInstallPath(const std::string &installPath);
69
79 static void FillAttributes(const FLOAT2& TextureRes, const FLOAT4& Position, FLOAT4& phases, FLOAT4& dxy, FLOAT2& ScreenPos, FLOAT2& WeaverVars);
80
91 static WeaverErrorCode LoadTexture(WeaverTextureType type, unsigned char** out_pTexture, int* out_width, int* out_height, int* out_channels, int* out_bitsPerPixel);
92
104 static WeaverErrorCode LoadTexture(WeaverTextureType type, unsigned char** out_pTexture, int* out_width, int* out_height, int* out_channels, int* out_bitsPerPixel, bool flipVertical);
105
110 static void UnLoadCorrectionTexture(unsigned char** in_pTexture);
111
112 static float GetPattern();
113 static float GetXTalkFactor();
114 static float GetXTalkDynamicFactor();
115 static float GetFilterWidth();
116 static float GetFilterSlope();
117
121 static float GetSlant();
122
126 static float GetPx();
127
131 static float GetN();
132
136 static float GetDoN();
137
138private:
139 static void _SetGlobalParameters(FLOAT3 userPos);
140};
141
142}
143
144#undef DIMENCOSR_API
enum DIMENCOSR_API WeaverTextureType
Definition: WeaverTypes.h:17
enum DIMENCOSR_API WeaverErrorCode
Definition: WeaverTypes.h:22
#define DIMENCOSR_API
Definition: Weaver.h:17
void isWeaverClass()
Checks at compile time whether a class implements the all common weaver interface functions.
Definition: Weaver.h:25
Definition: Weaver.h:39
static void ReconfigureWeaver()
Reconfigures global weaver parameters.
static float GetFilterSlope()
static void SetGlobalParameters(const char *configPath, FLOAT3 userPos)
Set global shader parameters needed for weaving, using a different .ini file.
static void UnLoadCorrectionTexture(unsigned char **in_pTexture)
Unloads a texture.
static float GetPattern()
static void SetDeviceSerialNumbers(const std::vector< std::string > &deviceSerialNumbers)
Sets the device serial numbers of attached devices to be used when loading calibration data.
static void SetGlobalParameters(FLOAT3 userPos)
Set global shader parameters needed for weaving.
static WeaverErrorCode LoadTexture(WeaverTextureType type, unsigned char **out_pTexture, int *out_width, int *out_height, int *out_channels, int *out_bitsPerPixel)
Load a weaver texture.
static WeaverErrorCode LoadTexture(WeaverTextureType type, unsigned char **out_pTexture, int *out_width, int *out_height, int *out_channels, int *out_bitsPerPixel, bool flipVertical)
Load a weaver texture.
static void SetInstallPath(const std::string &installPath)
Sets the install path for Simulated Reality to be used when configuring the weaver.
static float GetDoN()
Returns D over N in millimeters.
static float GetPx()
Returns pitch in x direction in pixels.
static float GetXTalkFactor()
static float GetXTalkDynamicFactor()
static float GetN()
Returns the refractive index N.
static float GetSlant()
Returns slant as a coëfficiënt.
static float GetFilterWidth()
static void FillAttributes(const FLOAT2 &TextureRes, const FLOAT4 &Position, FLOAT4 &phases, FLOAT4 &dxy, FLOAT2 &ScreenPos, FLOAT2 &WeaverVars)
Fill the vertex attributes needed for weaving.
Definition: Weaver.h:37
Definition: WeaverTypes.h:35
Definition: WeaverTypes.h:46
Definition: WeaverTypes.h:54