1#ifndef CNSDK_LEIA_CORE_CXX_INTERLACER_HPP
2#define CNSDK_LEIA_CORE_CXX_INTERLACER_HPP
42 *
this = std::move(other);
50 explicit operator bool()
const
68 leia_interlacer_set_layer_count(
_interlacer, layerCount);
83 return leia_interlacer_get_layer_count(
_interlacer);
97 leia_interlacer_set_tile_layout(
_interlacer, tileLayout);
102 leia_interlacer_output_as_tiles(
_interlacer, enable);
107 leia_interlacer_set_baseline_scaling(
_interlacer, baseline);
112 return leia_interlacer_get_baseline_scaling(
_interlacer);
117 return leia_interlacer_get_convergence_distance(
_interlacer);
121 leia_interlacer_set_convergence_distance(
_interlacer, distance);
145 leia_interlacer_get_converged_orthographic_view_info(
146 _interlacer, viewIndex, cameraPos, cameraDir, cameraUp, width, height, nearPlane, farPlane, viewPos, viewProjectionMatrix, viewShearX, viewShearY);
159 float* viewFieldOfView,
163 leia_interlacer_get_converged_perspective_view_info(
_interlacer,
173 viewProjectionMatrix,
189 leia_interlacer_get_rect_matrix(
_interlacer, transformMatrix);
193 leia_interlacer_set_local_matrix(
_interlacer, transformMatrix);
197 leia_interlacer_set_custom_texture_matrix(
_interlacer, textureTransform);
221 leia_interlacer_set_single_view_mode(
_interlacer, setSingleView, singleViewIndex);
225 leia_interlacer_set_single_view_mode_listener(
_interlacer, listener);
229 leia_interlacer_set_source_views_size(
_interlacer, sourceWidth, sourceHeight, isHorizontalViews);
234 leia_interlacer_get_source_views_size(
_interlacer, sourceWidth, sourceHeight, &_isHorizontalViews);
235 *isHorizontalViews = bool(_isHorizontalViews);
239 leia_interlacer_set_source_media_is_video(
_interlacer, isVideo);
243 leia_interlacer_set_source_media_scale(
_interlacer, scaleX, scaleY);
247 leia_interlacer_set_source_views_srgb(
_interlacer, isSRGB);
251 leia_interlacer_set_in_shader_srgb_conversion(
_interlacer, sRGBRead, sRGBWrite);
255 leia_interlacer_set_viewport_screen_position(
_interlacer, posX, posY);
257 void SetViewport(int32_t posX, int32_t posY, int32_t width, int32_t height)
259 leia_interlacer_set_viewport(
_interlacer, posX, posY, width, height);
263 leia_interlacer_enable_reconvergence(
_interlacer, enable);
268 return bool(leia_interlacer_is_reconvergence_enabled(
_interlacer));
287 return leia_interlacer_get_reconvergence(
_interlacer, layer);
304 leia_interlacer_set_reconvergence(
_interlacer, value, layer);
323 leia_interlacer_set_reconvergence_zoom(
_interlacer, zoomX, zoomXY, layer);
327 leia_interlacer_set_use_atlas_for_views(
_interlacer, useAtlasForViews);
332 return bool(leia_interlacer_get_use_atlas_for_views(
_interlacer));
336 leia_interlacer_get_view_offset(
_interlacer, view, offset);
340 leia_interlacer_set_invert_screen_texture_coordinates(
_interlacer, invert);
346 return leia_interlacer_get_graphics_api(
_interlacer);
358#if !defined(LEIA_WRAPPER_DISABLE_EXCEPTION)
361 throw CoreInitFailed();
379 leia_interlacer_retain(_interlacer);
381 leia_interlacer_set_calibration_pattern.Load(coreLibPtr);
382 leia_interlacer_set_gamma.Load(coreLibPtr);
383 leia_interlacer_enable_act.Load(coreLibPtr);
384 leia_interlacer_is_act_enabled.Load(coreLibPtr);
385 leia_interlacer_init_zone_plate.Load(coreLibPtr);
386 leia_interlacer_set_zone_plate.Load(coreLibPtr);
399 leia_interlacer_initialize_gui.Load(coreLibPtr);
400 leia_interlacer_set_gui_visibility.Load(coreLibPtr);
401 leia_interlacer_is_gui_visible.Load(coreLibPtr);
402 leia_interlacer_process_gui_input_wndproc.Load(coreLibPtr);
403 leia_interlacer_process_gui_input_ndk.Load(coreLibPtr);
404 leia_interlacer_process_gui_motion_input.Load(coreLibPtr);
405 leia_interlacer_shutdown_gui.Load(coreLibPtr);
413 leia_interlacer_release(_interlacer);
417 *
this = std::move(other);
421 std::swap(_interlacer, other._interlacer);
424 explicit operator bool()
const
426 return _interlacer !=
nullptr;
431 if (leia_interlacer_set_calibration_pattern)
432 leia_interlacer_set_calibration_pattern(_interlacer, pattern);
434 void SetGamma(
float rGamma,
float gGamma,
float bGamma)
436 if (leia_interlacer_set_gamma)
437 leia_interlacer_set_gamma(_interlacer, rGamma, gGamma, bGamma);
442 if (leia_interlacer_enable_act)
443 leia_interlacer_enable_act(_interlacer, enable);
448 if (leia_interlacer_is_act_enabled)
449 return bool(leia_interlacer_is_act_enabled(_interlacer));
453 bool InitZonePlate(
int viewportWidth,
int viewportHeight,
float* posX,
float* posY,
float* scaleX,
float* scaleY,
float* overrideSupportCirclePhase)
455 if (leia_interlacer_init_zone_plate)
456 return bool(leia_interlacer_init_zone_plate(_interlacer, viewportWidth, viewportHeight, posX, posY, scaleX, scaleY, overrideSupportCirclePhase));
459 void SetZonePlate(
float posX,
float posY,
float scaleX,
float scaleY,
float overrideSupportCirclePhase)
461 if (leia_interlacer_set_zone_plate)
462 leia_interlacer_set_zone_plate(_interlacer, posX, posY, scaleX, scaleY, overrideSupportCirclePhase);
529 if (leia_interlacer_initialize_gui)
530 leia_interlacer_initialize_gui(_interlacer, config, sRGB);
534 if (leia_interlacer_set_gui_visibility)
535 leia_interlacer_set_gui_visibility(_interlacer, isVisible);
540 if (leia_interlacer_is_gui_visible)
541 return bool(leia_interlacer_is_gui_visible(_interlacer));
544#if defined(LEIA_OS_WINDOWS)
545 GuiInputState ProcessGuiInput(
void* surface, uint32_t msg, uint64_t wparam, int64_t lparam)
547 if (leia_interlacer_process_gui_input_wndproc)
548 return leia_interlacer_process_gui_input_wndproc(_interlacer, surface, msg, wparam, lparam);
551#elif defined(LEIA_OS_ANDROID)
554 if (leia_interlacer_process_gui_input_ndk)
555 return leia_interlacer_process_gui_input_ndk(_interlacer, inputEvent);
560 if (leia_interlacer_process_gui_motion_input)
561 return leia_interlacer_process_gui_motion_input(_interlacer, jni, motionInput);
567 if (leia_interlacer_shutdown_gui)
568 leia_interlacer_shutdown_gui(_interlacer);
615 *
this = std::move(other);
619 std::swap(_ptr, other._ptr);
622 explicit operator bool()
const
624 return _ptr !=
nullptr;
649 float baselineScaling,
650 float convergencePlaneDistance,
653 float* viewComfortZoneNear,
654 float* viewComfortZoneFar)
656 leia_get_view_comfort_zone(mode, baselineScaling, convergencePlaneDistance, nearPlane, farPlane, viewComfortZoneNear, viewComfortZoneFar);
665 float perspectiveFieldOfView,
666 float perspectiveAspectRatio,
671 float convergencePlaneDistance,
672 float convergencePlaneHeight,
675 float* viewFieldOfView,
679 leia_get_view_info(mode,
684 perspectiveFieldOfView,
685 perspectiveAspectRatio,
690 convergencePlaneDistance,
691 convergencePlaneHeight,
693 viewProjectionMatrix,
Definition interlacer.hpp:372
InterlacerExperimental(leia_core_library *coreLibPtr, Interlacer const &interlacer)
Definition interlacer.hpp:377
void SetN(float n)
Definition interlacer.hpp:496
void SetCameraAngles(bool isLeft, float thetaXFpc, float thetaYFpc, float thetaZFpc)
Definition interlacer.hpp:486
void SetGuiVisibility(bool isVisible)
Definition interlacer.hpp:532
void SetSupportCirclePhase(float phase)
Definition interlacer.hpp:470
void EnableDoNCorrection(bool enable)
Definition interlacer.hpp:522
InterlacerExperimental(InterlacerExperimental &&other)
Definition interlacer.hpp:415
InterlacerExperimental()
Definition interlacer.hpp:374
float GetActCoef()
Definition interlacer.hpp:516
bool GetZonePlateResults(float *slant, float *pitch, float *phc, float *dOverN, float *n)
Definition interlacer.hpp:464
~InterlacerExperimental()
Definition interlacer.hpp:410
void SetCameraRectificationParameters(bool isFront, float deltaThetaX, float deltaThetaY, float deltaThetaZ, float calibrationTargetDistanceMm)
Definition interlacer.hpp:481
void InitializeGui(InterlacerDebugMenuConfiguration const *config, bool sRGB)
Definition interlacer.hpp:527
void SetGamma(float rGamma, float gGamma, float bGamma)
Definition interlacer.hpp:434
void SetDOverN(float dOverN)
Definition interlacer.hpp:491
void SetActCoef(float actCoef)
Definition interlacer.hpp:511
InterlacerExperimental & operator=(InterlacerExperimental &&other)
Definition interlacer.hpp:419
void EnablePhaseCorrection(bool enable)
Definition interlacer.hpp:501
LEIA_NODISCARD bool IsGuiVisible()
Definition interlacer.hpp:538
void SetCalibrationPattern(CalibrationPattern pattern)
Definition interlacer.hpp:429
bool InitZonePlate(int viewportWidth, int viewportHeight, float *posX, float *posY, float *scaleX, float *scaleY, float *overrideSupportCirclePhase)
Definition interlacer.hpp:453
void SetZonePlate(float posX, float posY, float scaleX, float scaleY, float overrideSupportCirclePhase)
Definition interlacer.hpp:459
void InvertPhaseCorrection(bool invert)
Definition interlacer.hpp:506
void ShutdownGui()
Definition interlacer.hpp:565
InterlacerExperimental(CoreLibrary const &coreLibrary, Interlacer const &interlacer)
Definition interlacer.hpp:407
bool WriteZonePlateResults(float slant, float pitch, float phc, float dOverN, float n)
Definition interlacer.hpp:475
LEIA_NODISCARD bool IsACTEnabled() const
Definition interlacer.hpp:446
void EnableACT(bool enable)
Definition interlacer.hpp:440
C++ wrapper for leia_interlacer.
Definition interlacer.hpp:26
leia_interlacer * _interlacer
Definition interlacer.hpp:367
void SetConvergenceDistance(float distance)
Definition interlacer.hpp:119
void SetPhc(float phase)
Definition interlacer.hpp:127
void SetTileLayout(TileLayout tileLayout)
Definition interlacer.hpp:95
void EnableUserMatrix(bool enabled)
Definition interlacer.hpp:199
void SetSourceViewsSize(int32_t sourceWidth, int32_t sourceHeight, bool isHorizontalViews)
Definition interlacer.hpp:227
float GetPhc()
Definition interlacer.hpp:123
void SetSourceMediaScale(float scaleX, float scaleY)
Definition interlacer.hpp:241
Interlacer(leia_interlacer *interlacer, bool isInterlacerOwned)
Definition interlacer.hpp:356
void GetConvergedOrthographicViewInfo(int32_t viewIndex, LEIA_CONST_FLOAT_SLICE(3) cameraPos, LEIA_CONST_FLOAT_SLICE(3) cameraDir, LEIA_CONST_FLOAT_SLICE(3) cameraUp, float width, float height, float nearPlane, float farPlane, LEIA_FLOAT_SLICE(3) viewPos, LEIA_FLOAT_SLICE(16) viewProjectionMatrix, float *viewShearX, float *viewShearY)
Definition interlacer.hpp:132
void GetNumTiles(int32_t *tx, int32_t *ty) const
Definition interlacer.hpp:90
Interlacer(Interlacer const &)=delete
LEIA_NODISCARD GraphicsAPI GetGraphicsAPI()
Definition interlacer.hpp:344
void SetUserMatrix(LEIA_CONST_FLOAT_SLICE(16) transformMatrix)
Definition interlacer.hpp:207
void SetSourceMediaIsVideo(bool isVideo)
Definition interlacer.hpp:237
void SetFlipInputUvVertical(bool flip)
Definition interlacer.hpp:215
void SetCustomTextureMatrix(LEIA_CONST_FLOAT_SLICE(16) textureTransform)
Definition interlacer.hpp:195
Interlacer()
Definition interlacer.hpp:28
void GetUserMatrix(LEIA_FLOAT_SLICE(16) transformMatrix)
Definition interlacer.hpp:203
LEIA_NODISCARD float GetConvergenceDistance()
Definition interlacer.hpp:115
void SetUseAtlasForViews(bool useAtlasForViews)
Definition interlacer.hpp:325
void GetConvergedPerspectiveViewInfo(int32_t viewIndex, LEIA_CONST_FLOAT_SLICE(3) cameraPos, LEIA_CONST_FLOAT_SLICE(3) cameraDir, LEIA_CONST_FLOAT_SLICE(3) cameraUp, float fieldOfView, float aspectRatio, float nearPlane, float farPlane, LEIA_FLOAT_SLICE(3) viewPos, LEIA_FLOAT_SLICE(16) viewProjectionMatrix, float *viewFieldOfView, float *viewShearX, float *viewShearY)
Definition interlacer.hpp:149
void SetBaselineScaling(float baseline)
Definition interlacer.hpp:105
Interlacer(Interlacer &&other)
Definition interlacer.hpp:40
LEIA_NODISCARD bool GetUseAtlasForViews()
Definition interlacer.hpp:330
void SetLocalMatrix(LEIA_CONST_FLOAT_SLICE(16) transformMatrix)
Definition interlacer.hpp:191
void SetViewport(int32_t posX, int32_t posY, int32_t width, int32_t height)
Definition interlacer.hpp:257
LEIA_NODISCARD int GetLayerCount() const
Gets the current number of layers.
Definition interlacer.hpp:81
LEIA_NODISCARD bool IsReconvergenceEnabled()
Definition interlacer.hpp:266
void EnableReconvergence(bool enable)
Definition interlacer.hpp:261
void SetAlpha(float alpha)
Definition interlacer.hpp:211
LEIA_NODISCARD float GetBaselineScaling()
Definition interlacer.hpp:110
LEIA_NODISCARD leia_interlacer * GetHandle() const
Definition interlacer.hpp:350
void GetSourceViewsSize(int32_t *sourceWidth, int32_t *sourceHeight, bool *isHorizontalViews)
Definition interlacer.hpp:231
~Interlacer()
Definition interlacer.hpp:31
void GetRectMatrix(LEIA_FLOAT_SLICE(16) transformMatrix)
Definition interlacer.hpp:187
LEIA_NODISCARD FitMode GetFitMode()
Definition interlacer.hpp:183
void SetSingleViewModeListener(InterlacerSingleViewModeListener const *listener)
Definition interlacer.hpp:223
Interlacer & operator=(Interlacer &&other)
Definition interlacer.hpp:44
void SetNumTiles(int32_t tx, int32_t ty)
Definition interlacer.hpp:86
bool _isInterlacerOwned
Definition interlacer.hpp:368
void SetViewportScreenPosition(int32_t posX, int32_t posY)
Definition interlacer.hpp:253
void SetSingleViewMode(bool setSingleView, int32_t singleViewIndex)
Definition interlacer.hpp:219
void GetViewOffset(int32_t view, LEIA_FLOAT_SLICE(3) offset)
Definition interlacer.hpp:334
void SetReconvergenceZoom(bool zoomX, bool zoomXY, int layer=0)
Set what directions reconvergence is calculated for.
Definition interlacer.hpp:321
void SetOutputAsTiles(bool enable)
Definition interlacer.hpp:100
LEIA_NODISCARD float GetReconvergence(int layer=0)
Get the reconvergence amount.
Definition interlacer.hpp:285
void SetSourceViewsSRGB(bool isSRGB)
Definition interlacer.hpp:245
void SetInvertScreenTextureCoordinates(bool invert)
Definition interlacer.hpp:338
void SetLayerCount(int layerCount)
Sets the number of layers to interlace.
Definition interlacer.hpp:66
void SetReconvergence(float value, int layer=0)
Set the reconvergence amount.
Definition interlacer.hpp:302
Interlacer & operator=(Interlacer const &)=delete
void SetInShaderSRGBConversion(bool sRGBRead, bool sRGBWrite)
Definition interlacer.hpp:249
void SetFitMode(FitMode mode)
Definition interlacer.hpp:178
C++ wrapper for leia_interlacer_init_configuration.
Definition interlacer.hpp:604
InterlacerInitConfiguration & operator=(InterlacerInitConfiguration &&other)
Definition interlacer.hpp:617
~InterlacerInitConfiguration()
Definition interlacer.hpp:609
void SetIsProtected(bool isProtected)
Definition interlacer.hpp:627
LEIA_NODISCARD leia_interlacer_init_configuration * GetHandle() const
Definition interlacer.hpp:636
InterlacerInitConfiguration()
Definition interlacer.hpp:606
void SetUseAtlasForViews(bool useAtlasForViews)
Definition interlacer.hpp:631
InterlacerInitConfiguration(InterlacerInitConfiguration &&other)
Definition interlacer.hpp:613
BEGIN_CAPI_DECL typedef int32_t leia_bool
Definition types.h:10
leia_tile_layout
Definition types.h:139
leia_view_info_mode
Definition types.h:152
leia_graphics_api
Definition types.h:13
leia_fit_mode
Definition types.h:103
leia_calibration_pattern
Definition types.h:113
#define LEIA_FORCE_INLINE
Definition defines.h:56
#define LEIA_NODISCARD
Definition defines.h:86
#define LEIA_CXX_DECLARE_EXPERIMENTAL_API_ENTRY(T)
Definition experimental.hpp:42
LEIASDK_API float leia_interlacer_get_phc(struct leia_interlacer *)
LEIASDK_API void leia_interlacer_set_enable_user_matrix(struct leia_interlacer *interlacer, leia_bool enabled)
void(* leia_interlacer_set_n)(struct leia_interlacer *, float n)
Definition interlacer.h:483
LEIASDK_API void leia_interlacer_set_phc(struct leia_interlacer *, float phase)
LEIASDK_API void leia_interlacer_init_configuration_set_is_protected(struct leia_interlacer_init_configuration *, leia_bool)
Whether we are using a protected OpenGL context.
void(* leia_interlacer_set_support_circle_phase)(struct leia_interlacer *, float phase)
Definition interlacer.h:458
float(* leia_interlacer_get_act_coef)(struct leia_interlacer *)
Definition interlacer.h:489
void(* leia_interlacer_enable_phase_correction)(struct leia_interlacer *, leia_bool enable)
Definition interlacer.h:474
LEIASDK_API void leia_interlacer_init_configuration_set_use_atlas_for_views(struct leia_interlacer_init_configuration *, leia_bool)
If we should use atlas by default.
leia_bool(* leia_interlacer_get_zone_plate_results)(struct leia_interlacer *, float *slant, float *pitch, float *phc, float *dOverN, float *n)
Definition interlacer.h:455
void(* leia_interlacer_set_camera_angles)(struct leia_interlacer *, leia_bool isLeft, float thetaXFpc, float thetaYFpc, float thetaZFpc)
Definition interlacer.h:468
leia_bool(* leia_interlacer_write_zone_plate_results)(struct leia_interlacer *, float slant, float pitch, float phc, float dOverN, float n)
Definition interlacer.h:461
void(* leia_interlacer_enable_don_correction)(struct leia_interlacer *, leia_bool enable)
Definition interlacer.h:480
void(* leia_interlacer_set_act_coef)(struct leia_interlacer *, float n)
Definition interlacer.h:486
LEIASDK_API void leia_interlacer_get_user_matrix(struct leia_interlacer *interlacer, LEIA_FLOAT_SLICE(16) transformMatrix)
void(* leia_interlacer_set_dovern)(struct leia_interlacer *, float dOverN)
Definition interlacer.h:471
LEIA_NODISCARD LEIASDK_API struct leia_interlacer_init_configuration * leia_interlacer_init_configuration_alloc()
LEIASDK_API void leia_interlacer_init_configuration_free(struct leia_interlacer_init_configuration *)
void(* leia_interlacer_set_camera_rectification_parameters)(struct leia_interlacer *, leia_bool isFront, float deltaThetaX, float deltaThetaY, float deltaThetaZ, float calibrationTargetDistanceMm)
Definition interlacer.h:464
LEIASDK_API void leia_interlacer_set_user_matrix(struct leia_interlacer *interlacer, LEIA_CONST_FLOAT_SLICE(16) transformMatrix)
void(* leia_interlacer_invert_phase_correction)(struct leia_interlacer *, leia_bool invert)
Definition interlacer.h:477
void * jobject
Definition jniTypes.h:15
const struct JNINativeInterface * JNIEnv
Definition jniTypes.h:28
leia_interlacer_gui_input_state GuiInputState
Definition interlacer.hpp:21
LEIA_FORCE_INLINE void GetViewInfo(ViewInfoMode mode, LEIA_CONST_FLOAT_SLICE(3) viewOffset, LEIA_CONST_FLOAT_SLICE(3) cameraPos, LEIA_CONST_FLOAT_SLICE(3) cameraDir, LEIA_CONST_FLOAT_SLICE(3) cameraUp, float perspectiveFieldOfView, float perspectiveAspectRatio, float orthoWidth, float orthoHeight, float nearPlane, float farPlane, float convergencePlaneDistance, float convergencePlaneHeight, LEIA_FLOAT_SLICE(3) viewPos, LEIA_FLOAT_SLICE(16) viewProjectionMatrix, float *viewFieldOfView, float *viewShearX, float *viewShearY)
Definition interlacer.hpp:660
LEIA_FORCE_INLINE void GetViewComfortZone(ViewInfoMode mode, float baselineScaling, float convergencePlaneDistance, float nearPlane, float farPlane, float *viewComfortZoneNear, float *viewComfortZoneFar)
Definition interlacer.hpp:648
#define LEIA_FLOAT_SLICE(size)
Definition slice.h:27
#define LEIA_CONST_FLOAT_SLICE(size)
Definition slice.h:28
Core library.
Definition library.h:17
leia_interlacer's initial configuration.
Definition interlacer.h:46
Definition interlacer.h:549
The main entity used for performing interlacing on Leia devices.
Definition interlacer.h:41