From 5139948ef935dae9999ae668d093a7614b1428eb Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 19 Jul 2016 09:42:48 +0200 Subject: Updated to Oculus PC SDK 1.6 --- .../OculusSDK/LibOVR/Include/Extras/OVR_Math.h | 4 +- src/external/OculusSDK/LibOVR/Include/OVR_CAPI.h | 103 +++++++++++++++++---- .../OculusSDK/LibOVR/Include/OVR_Version.h | 2 +- 3 files changed, 89 insertions(+), 20 deletions(-) diff --git a/src/external/OculusSDK/LibOVR/Include/Extras/OVR_Math.h b/src/external/OculusSDK/LibOVR/Include/Extras/OVR_Math.h index 718c21cb..89293ff8 100644 --- a/src/external/OculusSDK/LibOVR/Include/Extras/OVR_Math.h +++ b/src/external/OculusSDK/LibOVR/Include/Extras/OVR_Math.h @@ -1501,9 +1501,9 @@ public: if (len == 0) twist->w = T(1); // identity else - twist /= len; // normalize + *twist /= len; // normalize - return *this * twist.Inverted(); + return *this * twist->Inverted(); } // Normalized linear interpolation of quaternions diff --git a/src/external/OculusSDK/LibOVR/Include/OVR_CAPI.h b/src/external/OculusSDK/LibOVR/Include/OVR_CAPI.h index cf7aab62..53340478 100644 --- a/src/external/OculusSDK/LibOVR/Include/OVR_CAPI.h +++ b/src/external/OculusSDK/LibOVR/Include/OVR_CAPI.h @@ -756,17 +756,11 @@ typedef enum ovrButton_ ovrButton_RThumb = 0x00000004, ovrButton_RShoulder = 0x00000008, - // Bit mask of all buttons on the right Touch controller - ovrButton_RMask = ovrButton_A | ovrButton_B | ovrButton_RThumb | ovrButton_RShoulder, - ovrButton_X = 0x00000100, ovrButton_Y = 0x00000200, ovrButton_LThumb = 0x00000400, ovrButton_LShoulder = 0x00000800, - // Bit mask of all buttons on the left Touch controller - ovrButton_LMask = ovrButton_X | ovrButton_Y | ovrButton_LThumb | ovrButton_LShoulder, - // Navigation through DPad. ovrButton_Up = 0x00010000, ovrButton_Down = 0x00020000, @@ -779,6 +773,13 @@ typedef enum ovrButton_ ovrButton_Home = 0x01000000, ovrButton_Private = ovrButton_VolUp | ovrButton_VolDown | ovrButton_Home, + // Bit mask of all buttons on the right Touch controller + ovrButton_RMask = ovrButton_A | ovrButton_B | ovrButton_RThumb | ovrButton_RShoulder, + + // Bit mask of all buttons on the left Touch controller + ovrButton_LMask = ovrButton_X | ovrButton_Y | ovrButton_LThumb | ovrButton_LShoulder | + ovrButton_Enter, + ovrButton_EnumSize = 0x7fffffff ///< \internal Force type int32_t. } ovrButton; @@ -823,6 +824,25 @@ typedef enum ovrTouch_ ovrTouch_EnumSize = 0x7fffffff ///< \internal Force type int32_t. } ovrTouch; +/// Describes the Touch Haptics engine. +/// Currently, those values will NOT change during a session. +typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) ovrTouchHapticsDesc_ +{ + // Haptics engine frequency/sample-rate, sample time in seconds equals 1.0/sampleRateHz + int SampleRateHz; + // Size of each Haptics sample, sample value range is [0, 2^(Bytes*8)-1] + int SampleSizeInBytes; + + // Queue size that would guarantee Haptics engine would not starve for data + // Make sure size doesn't drop below it for best results + int QueueMinSizeToAvoidStarvation; + + // Minimum, Maximum and Optimal number of samples that can be sent to Haptics through ovr_SubmitControllerVibration + int SubmitMinSamples; + int SubmitMaxSamples; + int SubmitOptimalSamples; +} ovrTouchHapticsDesc; + /// Specifies which controller is connected; multiple can be connected at once. typedef enum ovrControllerType_ { @@ -838,6 +858,31 @@ typedef enum ovrControllerType_ ovrControllerType_EnumSize = 0x7fffffff ///< \internal Force type int32_t. } ovrControllerType; +/// Haptics buffer submit mode +typedef enum ovrHapticsBufferSubmitMode_ +{ + // Enqueue buffer for later playback + ovrHapticsBufferSubmit_Enqueue +} ovrHapticsBufferSubmitMode; + +/// Haptics buffer descriptor, contains amplitude samples used for Touch vibration +typedef struct ovrHapticsBuffer_ +{ + const void* Samples; + int SamplesCount; + ovrHapticsBufferSubmitMode SubmitMode; +} ovrHapticsBuffer; + +/// State of the Haptics playback for Touch vibration +typedef struct ovrHapticsPlaybackState_ +{ + // Remaining space available to queue more samples + int RemainingQueueSpace; + + // Number of samples currently queued + int SamplesQueued; +} ovrHapticsPlaybackState; + /// Provides names for the left and right hand array indexes. /// @@ -1358,25 +1403,49 @@ OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetInputState(ovrSession session, ovrControll /// OVR_PUBLIC_FUNCTION(unsigned int) ovr_GetConnectedControllerTypes(ovrSession session); +/// Gets information about Haptics engine for the specified Touch controller. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] controllerType The controller to retrieve the information from. +/// +/// \return Returns an ovrTouchHapticsDesc. +/// +OVR_PUBLIC_FUNCTION(ovrTouchHapticsDesc) ovr_GetTouchHapticsDesc(ovrSession session, ovrControllerType controllerType); -/// Turns on vibration of the given controller. +/// Sets constant vibration (with specified frequency and amplitude) to a controller. +/// Note: ovr_SetControllerVibration cannot be used interchangeably with ovr_SubmitControllerVibration. /// -/// To disable vibration, call ovr_SetControllerVibration with an amplitude of 0. -/// Vibration automatically stops after a nominal amount of time, so if you want vibration -/// to be continuous over multiple seconds then you need to call this function periodically. +/// This method should be called periodically, vibration lasts for a maximum of 2.5 seconds. +/// It's recommended to call this method once a second, calls will be rejected if called too frequently (over 30hz). /// /// \param[in] session Specifies an ovrSession previously returned by ovr_Create. -/// \param[in] controllerType Specifies the controller to apply the vibration to. -/// \param[in] frequency Specifies a vibration frequency in the range of 0.0 to 1.0. -/// Currently the only valid values are 0.0, 0.5, and 1.0 and other values will -/// be clamped to one of these. -/// \param[in] amplitude Specifies a vibration amplitude in the range of 0.0 to 1.0. +/// \param[in] controllerType The controller to set the vibration to. +/// \param[in] frequency Vibration frequency. Supported values are: 0.0 (disabled), 0.5 and 1.0. Non valid values will be clamped. +/// \param[in] amplitude Vibration amplitude in the [0.0, 1.0] range. +/// \return Returns ovrSuccess upon success. /// +OVR_PUBLIC_FUNCTION(ovrResult) ovr_SetControllerVibration(ovrSession session, ovrControllerType controllerType, float frequency, float amplitude); + +/// Submits a Haptics buffer (used for vibration) to Touch (only) controllers. +/// Note: ovr_SubmitControllerVibration cannot be used interchangeably with ovr_SetControllerVibration. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] controllerType Controller where the Haptics buffer will be played. +/// \param[in] buffer Haptics buffer containing amplitude samples to be played. /// \return Returns ovrSuccess upon success. +/// \see ovrHapticsBuffer /// -/// \see ovrControllerType +OVR_PUBLIC_FUNCTION(ovrResult) ovr_SubmitControllerVibration(ovrSession session, ovrControllerType controllerType, const ovrHapticsBuffer* buffer); + +/// Gets the Haptics engine playback state of a specific Touch controller. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] controllerType Controller where the Haptics buffer wil be played. +/// \param[in] outState State of the haptics engine. +/// \return Returns ovrSuccess upon success. +/// \see ovrHapticsPlaybackState /// -OVR_PUBLIC_FUNCTION(ovrResult) ovr_SetControllerVibration(ovrSession session, ovrControllerType controllerType, float frequency, float amplitude); +OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetControllerVibrationState(ovrSession session, ovrControllerType controllerType, ovrHapticsPlaybackState* outState); ///@} diff --git a/src/external/OculusSDK/LibOVR/Include/OVR_Version.h b/src/external/OculusSDK/LibOVR/Include/OVR_Version.h index 376fa7d5..d8378304 100644 --- a/src/external/OculusSDK/LibOVR/Include/OVR_Version.h +++ b/src/external/OculusSDK/LibOVR/Include/OVR_Version.h @@ -19,7 +19,7 @@ // Master version numbers #define OVR_PRODUCT_VERSION 1 // Product version doesn't participate in semantic versioning. #define OVR_MAJOR_VERSION 1 // If you change these values then you need to also make sure to change LibOVR/Projects/Windows/LibOVR.props in parallel. -#define OVR_MINOR_VERSION 5 // +#define OVR_MINOR_VERSION 6 // #define OVR_PATCH_VERSION 0 #define OVR_BUILD_NUMBER 0 -- cgit v1.2.3 From 76c9e9883d8b66d2f48e5416102c818e90481a8f Mon Sep 17 00:00:00 2001 From: raysan5 Date: Tue, 19 Jul 2016 10:02:44 +0200 Subject: Update runtime DLL to version 1.6 --- src/external/OculusSDK/LibOVR/LibOVRRT32_1.dll | Bin 1018320 -> 1023952 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/external/OculusSDK/LibOVR/LibOVRRT32_1.dll b/src/external/OculusSDK/LibOVR/LibOVRRT32_1.dll index 8553ce11..843c0e44 100644 Binary files a/src/external/OculusSDK/LibOVR/LibOVRRT32_1.dll and b/src/external/OculusSDK/LibOVR/LibOVRRT32_1.dll differ -- cgit v1.2.3 From 61558ab83faa52e738b264ea85fe34448651ba87 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Tue, 19 Jul 2016 10:57:35 +0200 Subject: Updated shaders pack Some deep review of this shaders is required for optimization... --- shaders/glsl100/bloom.fs | 2 +- shaders/glsl100/blur.fs | 7 ++++--- shaders/glsl100/cross_hatching.fs | 2 +- shaders/glsl100/cross_stitching.fs | 7 ++++--- shaders/glsl100/dream_vision.fs | 2 +- shaders/glsl100/fisheye.fs | 2 +- shaders/glsl100/pixel.fs | 7 ++++--- shaders/glsl100/posterization.fs | 2 +- shaders/glsl100/predator.fs | 2 +- shaders/glsl100/scanlines.fs | 2 +- shaders/glsl100/standard.fs | 13 ++++--------- shaders/glsl100/swirl.fs | 7 ++++--- shaders/glsl330/bloom.fs | 2 +- shaders/glsl330/blur.fs | 7 ++++--- shaders/glsl330/cross_hatching.fs | 2 +- shaders/glsl330/cross_stitching.fs | 7 ++++--- shaders/glsl330/depth.fs | 2 +- shaders/glsl330/dream_vision.fs | 2 +- shaders/glsl330/fisheye.fs | 2 +- shaders/glsl330/pixel.fs | 7 ++++--- shaders/glsl330/posterization.fs | 2 +- shaders/glsl330/predator.fs | 2 +- shaders/glsl330/scanlines.fs | 7 +++++-- shaders/glsl330/standard.fs | 13 ++++--------- shaders/glsl330/swirl.fs | 7 ++++--- 25 files changed, 59 insertions(+), 58 deletions(-) diff --git a/shaders/glsl100/bloom.fs b/shaders/glsl100/bloom.fs index 128736f2..82278fc3 100644 --- a/shaders/glsl100/bloom.fs +++ b/shaders/glsl100/bloom.fs @@ -8,7 +8,7 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables diff --git a/shaders/glsl100/blur.fs b/shaders/glsl100/blur.fs index 80d40834..1935f080 100644 --- a/shaders/glsl100/blur.fs +++ b/shaders/glsl100/blur.fs @@ -8,12 +8,13 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables -const float renderWidth = 1280; -const float renderHeight = 720; +// NOTE: Render size values must be passed from code +const float renderWidth = 800; +const float renderHeight = 450; float offset[3] = float[]( 0.0, 1.3846153846, 3.2307692308 ); float weight[3] = float[]( 0.2270270270, 0.3162162162, 0.0702702703 ); diff --git a/shaders/glsl100/cross_hatching.fs b/shaders/glsl100/cross_hatching.fs index 1f7dab08..ced0fd63 100644 --- a/shaders/glsl100/cross_hatching.fs +++ b/shaders/glsl100/cross_hatching.fs @@ -8,7 +8,7 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables diff --git a/shaders/glsl100/cross_stitching.fs b/shaders/glsl100/cross_stitching.fs index 6fabc027..67639a55 100644 --- a/shaders/glsl100/cross_stitching.fs +++ b/shaders/glsl100/cross_stitching.fs @@ -8,12 +8,13 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables -const float renderWidth = 1280; -const float renderHeight = 720; +// NOTE: Render size values must be passed from code +const float renderWidth = 800; +const float renderHeight = 450; float stitchingSize = 6.0f; diff --git a/shaders/glsl100/dream_vision.fs b/shaders/glsl100/dream_vision.fs index d0cdc687..fa9c5b77 100644 --- a/shaders/glsl100/dream_vision.fs +++ b/shaders/glsl100/dream_vision.fs @@ -8,7 +8,7 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables diff --git a/shaders/glsl100/fisheye.fs b/shaders/glsl100/fisheye.fs index 9dba297b..461e1405 100644 --- a/shaders/glsl100/fisheye.fs +++ b/shaders/glsl100/fisheye.fs @@ -8,7 +8,7 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables diff --git a/shaders/glsl100/pixel.fs b/shaders/glsl100/pixel.fs index c532f219..41ba3ed6 100644 --- a/shaders/glsl100/pixel.fs +++ b/shaders/glsl100/pixel.fs @@ -8,12 +8,13 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables -const float renderWidth = 1280; -const float renderHeight = 720; +// NOTE: Render size values must be passed from code +const float renderWidth = 800; +const float renderHeight = 450; uniform float pixelWidth = 5.0f; uniform float pixelHeight = 5.0f; diff --git a/shaders/glsl100/posterization.fs b/shaders/glsl100/posterization.fs index 801ca89c..a7942c82 100644 --- a/shaders/glsl100/posterization.fs +++ b/shaders/glsl100/posterization.fs @@ -8,7 +8,7 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables diff --git a/shaders/glsl100/predator.fs b/shaders/glsl100/predator.fs index 1f0e2ce5..efa7fe79 100644 --- a/shaders/glsl100/predator.fs +++ b/shaders/glsl100/predator.fs @@ -8,7 +8,7 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables diff --git a/shaders/glsl100/scanlines.fs b/shaders/glsl100/scanlines.fs index d885e10b..529120d0 100644 --- a/shaders/glsl100/scanlines.fs +++ b/shaders/glsl100/scanlines.fs @@ -8,7 +8,7 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables diff --git a/shaders/glsl100/standard.fs b/shaders/glsl100/standard.fs index d5daa445..3e78022d 100644 --- a/shaders/glsl100/standard.fs +++ b/shaders/glsl100/standard.fs @@ -34,7 +34,6 @@ struct Light { }; const int maxLights = 8; -uniform int lightsCount; uniform Light lights[maxLights]; vec3 CalcPointLight(Light l, vec3 n, vec3 v, float s) @@ -134,19 +133,15 @@ void main() float spec = 1.0; if (useSpecular == 1) spec *= normalize(texture2D(texture2, fragTexCoord).r); - for (int i = 0; i < lightsCount; i++) + for (int i = 0; i < maxLights; i++) { // Check if light is enabled if (lights[i].enabled == 1) { // Calculate lighting based on light type - switch (lights[i].type) - { - case 0: lighting += CalcPointLight(lights[i], n, v, spec); break; - case 1: lighting += CalcDirectionalLight(lights[i], n, v, spec); break; - case 2: lighting += CalcSpotLight(lights[i], n, v, spec); break; - default: break; - } + if(lights[i].type == 0) lighting += CalcPointLight(lights[i], n, v, spec); + else if(lights[i].type == 1) lighting += CalcDirectionalLight(lights[i], n, v, spec); + else if(lights[i].type == 2) lighting += CalcSpotLight(lights[i], n, v, spec); } } diff --git a/shaders/glsl100/swirl.fs b/shaders/glsl100/swirl.fs index 0d6d24f2..6b17874c 100644 --- a/shaders/glsl100/swirl.fs +++ b/shaders/glsl100/swirl.fs @@ -8,12 +8,13 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables -const float renderWidth = 800.0; // HARDCODED for example! -const float renderHeight = 480.0; // Use uniforms instead... +// NOTE: Render size values must be passed from code +const float renderWidth = 800; +const float renderHeight = 450; float radius = 250.0; float angle = 0.8; diff --git a/shaders/glsl330/bloom.fs b/shaders/glsl330/bloom.fs index 0307bc06..102e6605 100644 --- a/shaders/glsl330/bloom.fs +++ b/shaders/glsl330/bloom.fs @@ -6,7 +6,7 @@ in vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // Output fragment color out vec4 finalColor; diff --git a/shaders/glsl330/blur.fs b/shaders/glsl330/blur.fs index 7c31f727..e4df406d 100644 --- a/shaders/glsl330/blur.fs +++ b/shaders/glsl330/blur.fs @@ -6,15 +6,16 @@ in vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // Output fragment color out vec4 finalColor; // NOTE: Add here your custom variables -const float renderWidth = 1280.0; -const float renderHeight = 720.0; +// NOTE: Render size values must be passed from code +const float renderWidth = 800; +const float renderHeight = 450; float offset[3] = float[](0.0, 1.3846153846, 3.2307692308); float weight[3] = float[](0.2270270270, 0.3162162162, 0.0702702703); diff --git a/shaders/glsl330/cross_hatching.fs b/shaders/glsl330/cross_hatching.fs index c12c48cd..f95ad075 100644 --- a/shaders/glsl330/cross_hatching.fs +++ b/shaders/glsl330/cross_hatching.fs @@ -6,7 +6,7 @@ in vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // Output fragment color out vec4 finalColor; diff --git a/shaders/glsl330/cross_stitching.fs b/shaders/glsl330/cross_stitching.fs index 7c87c6cd..9cdd36ca 100644 --- a/shaders/glsl330/cross_stitching.fs +++ b/shaders/glsl330/cross_stitching.fs @@ -6,15 +6,16 @@ in vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // Output fragment color out vec4 finalColor; // NOTE: Add here your custom variables -const float renderWidth = 1280.0; -const float renderHeight = 720.0; +// NOTE: Render size values must be passed from code +const float renderWidth = 800.0; +const float renderHeight = 450.0; float stitchingSize = 6.0; diff --git a/shaders/glsl330/depth.fs b/shaders/glsl330/depth.fs index 06d399f9..2422f390 100644 --- a/shaders/glsl330/depth.fs +++ b/shaders/glsl330/depth.fs @@ -6,7 +6,7 @@ in vec4 fragColor; // Input uniform values uniform sampler2D texture0; // Depth texture -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // Output fragment color out vec4 finalColor; diff --git a/shaders/glsl330/dream_vision.fs b/shaders/glsl330/dream_vision.fs index 0ea4ce20..03115862 100644 --- a/shaders/glsl330/dream_vision.fs +++ b/shaders/glsl330/dream_vision.fs @@ -5,7 +5,7 @@ in vec2 fragTexCoord; out vec4 fragColor; uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables diff --git a/shaders/glsl330/fisheye.fs b/shaders/glsl330/fisheye.fs index 5bd9abf4..e85d7c9d 100644 --- a/shaders/glsl330/fisheye.fs +++ b/shaders/glsl330/fisheye.fs @@ -5,7 +5,7 @@ in vec2 fragTexCoord; out vec4 fragColor; uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables diff --git a/shaders/glsl330/pixel.fs b/shaders/glsl330/pixel.fs index 9ed3ea7d..cf8aec44 100644 --- a/shaders/glsl330/pixel.fs +++ b/shaders/glsl330/pixel.fs @@ -6,15 +6,16 @@ in vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // Output fragment color out vec4 finalColor; // NOTE: Add here your custom variables -const float renderWidth = 1280.0; -const float renderHeight = 720.0; +// NOTE: Render size values must be passed from code +const float renderWidth = 800; +const float renderHeight = 450; uniform float pixelWidth = 5.0; uniform float pixelHeight = 5.0; diff --git a/shaders/glsl330/posterization.fs b/shaders/glsl330/posterization.fs index f1d72a19..be2b5dd6 100644 --- a/shaders/glsl330/posterization.fs +++ b/shaders/glsl330/posterization.fs @@ -6,7 +6,7 @@ in vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // Output fragment color out vec4 finalColor; diff --git a/shaders/glsl330/predator.fs b/shaders/glsl330/predator.fs index 9269dfd4..6a55c762 100644 --- a/shaders/glsl330/predator.fs +++ b/shaders/glsl330/predator.fs @@ -6,7 +6,7 @@ in vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // Output fragment color out vec4 finalColor; diff --git a/shaders/glsl330/scanlines.fs b/shaders/glsl330/scanlines.fs index 177f000d..22dc9cd5 100644 --- a/shaders/glsl330/scanlines.fs +++ b/shaders/glsl330/scanlines.fs @@ -6,20 +6,23 @@ in vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // Output fragment color out vec4 finalColor; // NOTE: Add here your custom variables +// NOTE: Render size values must be passed from code +const float renderWidth = 800; +const float renderHeight = 450; float offset = 0.0; -float frequency = 720.0/3.0; uniform float time; void main() { + float frequency = renderHeight/3.0; /* // Scanlines method 1 float tval = 0; //time diff --git a/shaders/glsl330/standard.fs b/shaders/glsl330/standard.fs index e5a6d1bc..f728be81 100644 --- a/shaders/glsl330/standard.fs +++ b/shaders/glsl330/standard.fs @@ -34,7 +34,6 @@ struct Light { }; const int maxLights = 8; -uniform int lightsCount; uniform Light lights[maxLights]; vec3 CalcPointLight(Light l, vec3 n, vec3 v, float s) @@ -134,19 +133,15 @@ void main() float spec = 1.0; if (useSpecular == 1) spec *= normalize(texture(texture2, fragTexCoord).r); - for (int i = 0; i < lightsCount; i++) + for (int i = 0; i < maxLights; i++) { // Check if light is enabled if (lights[i].enabled == 1) { // Calculate lighting based on light type - switch (lights[i].type) - { - case 0: lighting += CalcPointLight(lights[i], n, v, spec); break; - case 1: lighting += CalcDirectionalLight(lights[i], n, v, spec); break; - case 2: lighting += CalcSpotLight(lights[i], n, v, spec); break; - default: break; - } + if(lights[i].type == 0) lighting += CalcPointLight(lights[i], n, v, spec); + else if(lights[i].type == 1) lighting += CalcDirectionalLight(lights[i], n, v, spec); + else if(lights[i].type == 2) lighting += CalcSpotLight(lights[i], n, v, spec); } } diff --git a/shaders/glsl330/swirl.fs b/shaders/glsl330/swirl.fs index 80c16cc9..c4b66768 100644 --- a/shaders/glsl330/swirl.fs +++ b/shaders/glsl330/swirl.fs @@ -6,15 +6,16 @@ in vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // Output fragment color out vec4 finalColor; // NOTE: Add here your custom variables -const float renderWidth = 800.0; // HARDCODED for example! -const float renderHeight = 480.0; // Use uniforms instead... +// NOTE: Render size values must be passed from code +const float renderWidth = 800; +const float renderHeight = 450; float radius = 250.0; float angle = 0.8; -- cgit v1.2.3 From 3140496a12cceb6753f8f1f7dd9f74b61a04c727 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Tue, 19 Jul 2016 11:01:27 +0200 Subject: Updated --- release/win32/mingw32/libraylib.a | Bin 589058 -> 589058 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/release/win32/mingw32/libraylib.a b/release/win32/mingw32/libraylib.a index abb8ddd1..15a72244 100644 Binary files a/release/win32/mingw32/libraylib.a and b/release/win32/mingw32/libraylib.a differ -- cgit v1.2.3 From c12737ae38b613896a243d2b46b289f10ad30d75 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Tue, 19 Jul 2016 11:06:09 +0200 Subject: Removed old shader --- shaders/glsl330/phong.fs | 85 ------------------------------------------------ shaders/glsl330/phong.vs | 29 ----------------- 2 files changed, 114 deletions(-) delete mode 100644 shaders/glsl330/phong.fs delete mode 100644 shaders/glsl330/phong.vs diff --git a/shaders/glsl330/phong.fs b/shaders/glsl330/phong.fs deleted file mode 100644 index b2414a15..00000000 --- a/shaders/glsl330/phong.fs +++ /dev/null @@ -1,85 +0,0 @@ -#version 330 - -// Input vertex attributes (from vertex shader) -in vec2 fragTexCoord; -in vec3 fragNormal; - -// Input uniform values -uniform sampler2D texture0; -uniform vec4 colDiffuse; - -// Output fragment color -out vec4 finalColor; - -// NOTE: Add here your custom variables - -// Light uniform values -uniform vec3 lightAmbientColor = vec3(0.6, 0.3, 0.0); -uniform vec3 lightDiffuseColor = vec3(1.0, 0.5, 0.0); -uniform vec3 lightSpecularColor = vec3(0.0, 1.0, 0.0); -uniform float lightIntensity = 1.0; -uniform float lightSpecIntensity = 1.0; - -// Material uniform values -uniform vec3 matAmbientColor = vec3(1.0, 1.0, 1.0); -uniform vec3 matSpecularColor = vec3(1.0, 1.0, 1.0); -uniform float matGlossiness = 50.0; - -// World uniform values -uniform vec3 lightPosition; -uniform vec3 cameraPosition; - -// Fragment shader output data -out vec4 fragColor; - -// Calculate ambient lighting component -vec3 AmbientLighting() -{ - return (matAmbientColor*lightAmbientColor); -} - -// Calculate diffuse lighting component -vec3 DiffuseLighting(in vec3 N, in vec3 L) -{ - // Lambertian reflection calculation - float diffuse = clamp(dot(N, L), 0, 1); - - return (colDiffuse.xyz*lightDiffuseColor*lightIntensity*diffuse); -} - -// Calculate specular lighting component -vec3 SpecularLighting(in vec3 N, in vec3 L, in vec3 V) -{ - float specular = 0.0; - - // Calculate specular reflection only if the surface is oriented to the light source - if (dot(N, L) > 0) - { - // Calculate half vector - vec3 H = normalize(L + V); - - // Calculate specular intensity - specular = pow(dot(N, H), 3 + matGlossiness); - } - - return (matSpecularColor*lightSpecularColor*lightSpecIntensity*specular); -} - -void main() -{ - // Normalize input vectors - vec3 L = normalize(lightPosition); - vec3 V = normalize(cameraPosition); - vec3 N = normalize(fragNormal); - - // Calculate lighting components - vec3 ambient = AmbientLighting(); - vec3 diffuse = DiffuseLighting(N, L); - vec3 specular = SpecularLighting(N, L, V); - - // Texel color fetching from texture sampler - vec4 texelColor = texture(texture0, fragTexCoord); - - // Calculate final fragment color - finalColor = vec4(texelColor.rgb*(ambient + diffuse + specular), texelColor.a); -} \ No newline at end of file diff --git a/shaders/glsl330/phong.vs b/shaders/glsl330/phong.vs deleted file mode 100644 index d68d9b3f..00000000 --- a/shaders/glsl330/phong.vs +++ /dev/null @@ -1,29 +0,0 @@ -#version 330 - -// Input vertex attributes -in vec3 vertexPosition; -in vec2 vertexTexCoord; -in vec3 vertexNormal; - -// Input uniform values -uniform mat4 mvpMatrix; - -// Output vertex attributes (to fragment shader) -out vec2 fragTexCoord; -out vec3 fragNormal; - -// NOTE: Add here your custom variables -uniform mat4 modelMatrix; - -void main() -{ - // Send vertex attributes to fragment shader - fragTexCoord = vertexTexCoord; - - // Calculate view vector normal from model - mat3 normalMatrix = transpose(inverse(mat3(modelMatrix))); - fragNormal = normalize(normalMatrix*vertexNormal); - - // Calculate final vertex position - gl_Position = mvpMatrix*vec4(vertexPosition, 1.0); -} \ No newline at end of file -- cgit v1.2.3 From c482f37dfde9343ee1cc315153dcef80254c7a0b Mon Sep 17 00:00:00 2001 From: raysan5 Date: Tue, 19 Jul 2016 11:32:10 +0200 Subject: Updated... again... --- release/html5/libraylib.bc | Bin 721928 -> 723804 bytes release/win32/mingw32/libraylib.a | Bin 589058 -> 614414 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/release/html5/libraylib.bc b/release/html5/libraylib.bc index edf5302e..5a26136b 100644 Binary files a/release/html5/libraylib.bc and b/release/html5/libraylib.bc differ diff --git a/release/win32/mingw32/libraylib.a b/release/win32/mingw32/libraylib.a index 15a72244..6e9db0d2 100644 Binary files a/release/win32/mingw32/libraylib.a and b/release/win32/mingw32/libraylib.a differ -- cgit v1.2.3