summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2023-12-14 15:32:45 +0100
committerRay <[email protected]>2023-12-14 15:32:45 +0100
commitd29b36310ff155cebd9e8227752805106489943a (patch)
tree41293470cb61df7c96c83e8bbeb0f806206277d4 /src
parent88db11fda4421c66a6043011b36a3f13494b98e5 (diff)
parentcec2261e968bfc554d7b1639dd4d55ab4e2235e6 (diff)
downloadraylib-d29b36310ff155cebd9e8227752805106489943a.tar.gz
raylib-d29b36310ff155cebd9e8227752805106489943a.zip
Merge branch 'master' of https://github.com/raysan5/raylib
Diffstat (limited to 'src')
-rw-r--r--src/raylib.h2
-rw-r--r--src/rcore.c4
-rw-r--r--src/rtext.c22
-rw-r--r--src/rtextures.c46
4 files changed, 43 insertions, 31 deletions
diff --git a/src/raylib.h b/src/raylib.h
index fd870c18..206b2657 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -484,7 +484,6 @@ typedef struct VrDeviceInfo {
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
@@ -1481,6 +1480,7 @@ RLAPI const char *TextToUpper(const char *text); // Get upp
RLAPI const char *TextToLower(const char *text); // Get lower case version of provided string
RLAPI const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
RLAPI int TextToInteger(const char *text); // Get integer value from text (negative values not supported)
+RLAPI float TextToFloat(const char *text); // Get float value from text (negative values not supported)
//------------------------------------------------------------------------------------
// Basic 3d Shapes Drawing Functions (Module: models)
diff --git a/src/rcore.c b/src/rcore.c
index a85b0971..8691be30 100644
--- a/src/rcore.c
+++ b/src/rcore.c
@@ -1192,8 +1192,8 @@ VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device)
// NOTE: Camera movement might seem more natural if we model the head.
// Our axis of rotation is the base of our head, so we might want to add
// some y (base of head to eye level) and -z (center of head to eye protrusion) to the camera positions.
- config.viewOffset[0] = MatrixTranslate(-device.interpupillaryDistance*0.5f, 0.075f, 0.045f);
- config.viewOffset[1] = MatrixTranslate(device.interpupillaryDistance*0.5f, 0.075f, 0.045f);
+ config.viewOffset[0] = MatrixTranslate(device.interpupillaryDistance*0.5f, 0.075f, 0.045f);
+ config.viewOffset[1] = MatrixTranslate(-device.interpupillaryDistance*0.5f, 0.075f, 0.045f);
// Compute eyes Viewports
/*
diff --git a/src/rtext.c b/src/rtext.c
index 1ab45277..a919fa4a 100644
--- a/src/rtext.c
+++ b/src/rtext.c
@@ -1421,6 +1421,28 @@ int TextToInteger(const char *text)
return value*sign;
}
+float TextToFloat(const char *text)
+{
+ float value = 0.0f;
+ float sign = 1.0f;
+
+ if ((text[0] == '+') || (text[0] == '-'))
+ {
+ if (text[0] == '-') sign = -1;
+ text++;
+ }
+ int i = 0;
+ for (; ((text[i] >= '0') && (text[i] <= '9')); ++i) value = value*10.0f + (float)(text[i] - '0');
+ if (text[i++] != '.') return value*sign;
+ float divisor = 10.0f;
+ for (; ((text[i] >= '0') && (text[i] <= '9')); ++i)
+ {
+ value += ((float)(text[i] - '0'))/divisor;
+ divisor = divisor*10.0f;
+ }
+ return value;
+}
+
#if defined(SUPPORT_TEXT_MANIPULATION)
// Copy one string to another, returns bytes copied
int TextCopy(char *dst, const char *src)
diff --git a/src/rtextures.c b/src/rtextures.c
index a7632f3d..d42304c7 100644
--- a/src/rtextures.c
+++ b/src/rtextures.c
@@ -1959,29 +1959,24 @@ void ImageBlurGaussian(Image *image, int blurSize) {
float avgG = 0.0f;
float avgB = 0.0f;
float avgAlpha = 0.0f;
- int convolutionSize = blurSize+1;
+ int convolutionSize = blurSize;
- for (int i = 0; i < blurSize+1; i++)
+ for (int i = 0; i < blurSize; i++)
{
avgR += pixelsCopy1[row*image->width + i].x;
avgG += pixelsCopy1[row*image->width + i].y;
avgB += pixelsCopy1[row*image->width + i].z;
avgAlpha += pixelsCopy1[row*image->width + i].w;
- }
-
- pixelsCopy2[row*image->width].x = avgR/convolutionSize;
- pixelsCopy2[row*image->width].y = avgG/convolutionSize;
- pixelsCopy2[row*image->width].z = avgB/convolutionSize;
- pixelsCopy2[row*image->width].w = avgAlpha/convolutionSize;
+ }
- for (int x = 1; x < image->width; x++)
+ for (int x = 0; x < image->width; x++)
{
- if (x-blurSize >= 0)
+ if (x-blurSize-1 >= 0)
{
- avgR -= pixelsCopy1[row*image->width + x-blurSize].x;
- avgG -= pixelsCopy1[row*image->width + x-blurSize].y;
- avgB -= pixelsCopy1[row*image->width + x-blurSize].z;
- avgAlpha -= pixelsCopy1[row*image->width + x-blurSize].w;
+ avgR -= pixelsCopy1[row*image->width + x-blurSize-1].x;
+ avgG -= pixelsCopy1[row*image->width + x-blurSize-1].y;
+ avgB -= pixelsCopy1[row*image->width + x-blurSize-1].z;
+ avgAlpha -= pixelsCopy1[row*image->width + x-blurSize-1].w;
convolutionSize--;
}
@@ -1999,7 +1994,7 @@ void ImageBlurGaussian(Image *image, int blurSize) {
pixelsCopy2[row*image->width + x].z = avgB/convolutionSize;
pixelsCopy2[row*image->width + x].w = avgAlpha/convolutionSize;
}
- }
+ }
// Vertical motion blur
for (int col = 0; col < image->width; col++)
@@ -2008,9 +2003,9 @@ void ImageBlurGaussian(Image *image, int blurSize) {
float avgG = 0.0f;
float avgB = 0.0f;
float avgAlpha = 0.0f;
- int convolutionSize = blurSize+1;
+ int convolutionSize = blurSize;
- for (int i = 0; i < blurSize+1; i++)
+ for (int i = 0; i < blurSize; i++)
{
avgR += pixelsCopy2[i*image->width + col].x;
avgG += pixelsCopy2[i*image->width + col].y;
@@ -2018,19 +2013,14 @@ void ImageBlurGaussian(Image *image, int blurSize) {
avgAlpha += pixelsCopy2[i*image->width + col].w;
}
- pixelsCopy1[col].x = (unsigned char) (avgR/convolutionSize);
- pixelsCopy1[col].y = (unsigned char) (avgG/convolutionSize);
- pixelsCopy1[col].z = (unsigned char) (avgB/convolutionSize);
- pixelsCopy1[col].w = (unsigned char) (avgAlpha/convolutionSize);
-
- for (int y = 1; y < image->height; y++)
+ for (int y = 0; y < image->height; y++)
{
- if (y-blurSize >= 0)
+ if (y-blurSize-1 >= 0)
{
- avgR -= pixelsCopy2[(y-blurSize)*image->width + col].x;
- avgG -= pixelsCopy2[(y-blurSize)*image->width + col].y;
- avgB -= pixelsCopy2[(y-blurSize)*image->width + col].z;
- avgAlpha -= pixelsCopy2[(y-blurSize)*image->width + col].w;
+ avgR -= pixelsCopy2[(y-blurSize-1)*image->width + col].x;
+ avgG -= pixelsCopy2[(y-blurSize-1)*image->width + col].y;
+ avgB -= pixelsCopy2[(y-blurSize-1)*image->width + col].z;
+ avgAlpha -= pixelsCopy2[(y-blurSize-1)*image->width + col].w;
convolutionSize--;
}
if (y+blurSize < image->height)