diff options
| author | Ray <[email protected]> | 2021-03-20 18:36:25 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2021-03-20 18:36:25 +0100 |
| commit | a76fcaba3ea8092be4b5ee26f6e97948b20129aa (patch) | |
| tree | 6c1b28e0b24e1ea71af41f813a97424f112218d1 /src/raylib.h | |
| parent | 4fba09794fffd1bf0b2b678353ba746388ace619 (diff) | |
| download | raylib-a76fcaba3ea8092be4b5ee26f6e97948b20129aa.tar.gz raylib-a76fcaba3ea8092be4b5ee26f6e97948b20129aa.zip | |
BIG CHANGE: REDESIGNED: Vr device simulator #1582
Vr simulator has been moved to core module and completely redesigned. Now user is in charge of stereo-render fbo and also in full control of distortion shader. Code is a bit more complex but better aligned with other raylib examples.
Diffstat (limited to 'src/raylib.h')
| -rw-r--r-- | src/raylib.h | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/src/raylib.h b/src/raylib.h index 0db3f06f..f3f9d7ec 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -449,18 +449,28 @@ typedef struct Music { // Head-Mounted-Display device parameters typedef struct VrDeviceInfo { - int hResolution; // HMD horizontal resolution in pixels - int vResolution; // HMD vertical resolution in pixels - float hScreenSize; // HMD horizontal size in meters - float vScreenSize; // HMD vertical size in meters - float vScreenCenter; // HMD screen center in meters - float eyeToScreenDistance; // HMD distance between eye and display in meters - float lensSeparationDistance; // HMD lens separation distance in meters - float interpupillaryDistance; // HMD IPD (distance between pupils) in meters - float lensDistortionValues[4]; // HMD lens distortion constant parameters - float chromaAbCorrection[4]; // HMD chromatic aberration correction parameters + int hResolution; // Horizontal resolution in pixels + int vResolution; // Vertical resolution in pixels + float hScreenSize; // Horizontal size in meters + float vScreenSize; // Vertical size in meters + float vScreenCenter; // Screen center in meters + float eyeToScreenDistance; // Distance between eye and display in meters + float lensSeparationDistance; // Lens separation distance in meters + float interpupillaryDistance; // IPD (distance between pupils) in meters + float lensDistortionValues[4]; // Lens distortion constant parameters + float chromaAbCorrection[4]; // Chromatic aberration correction parameters } VrDeviceInfo; +// VR Stereo rendering configuration for simulator +typedef struct VrStereoConfig { + float leftLensCenter[2]; // VR left lens center + float rightLensCenter[2]; // VR right lens center + float leftScreenCenter[2]; // VR left screen center + float rightScreenCenter[2]; // VR right screen center + float scale[2]; // VR distortion scale + float scaleIn[2]; // VR distortion scale in +} VrStereoConfig; + //---------------------------------------------------------------------------------- // Enumerators Definition //---------------------------------------------------------------------------------- @@ -1441,14 +1451,14 @@ RLAPI void BeginBlendMode(int mode); // Beg RLAPI void EndBlendMode(void); // End blending mode (reset to default: alpha blending) // VR control functions -RLAPI void InitVrSimulator(void); // Init VR simulator for selected device parameters +RLAPI void InitVrSimulator(VrDeviceInfo device); // Init VR simulator for selected device parameters RLAPI void CloseVrSimulator(void); // Close VR simulator for current device -RLAPI void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera -RLAPI void SetVrConfiguration(VrDeviceInfo info, Shader distortion); // Set stereo rendering configuration parameters RLAPI bool IsVrSimulatorReady(void); // Detect if VR simulator is ready -RLAPI void ToggleVrMode(void); // Enable/Disable VR experience -RLAPI void BeginVrDrawing(void); // Begin VR simulator stereo rendering +RLAPI void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera +RLAPI void BeginVrDrawing(RenderTexture2D target); // Begin VR simulator stereo rendering (using provided fbo) RLAPI void EndVrDrawing(void); // End VR simulator stereo rendering +RLAPI VrStereoConfig GetVrConfig(VrDeviceInfo device); // Get stereo rendering configuration parameters +RLAPI Texture2D GetVrTexture(void); // Get VR framebuffer texture //------------------------------------------------------------------------------------ // Audio Loading and Playing Functions (Module: audio) |
