mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-20 20:49:17 -05:00
Compare commits
3 Commits
ccfa3f762a
...
d4f636151b
| Author | SHA1 | Date | |
|---|---|---|---|
| d4f636151b | |||
| a96cbe0183 | |||
| 4c1efc2bd3 |
@ -36,7 +36,7 @@ void main()
|
|||||||
vec3 ambient = albedo*vec3(0.1);
|
vec3 ambient = albedo*vec3(0.1);
|
||||||
vec3 viewDirection = normalize(viewPosition - fragPosition);
|
vec3 viewDirection = normalize(viewPosition - fragPosition);
|
||||||
|
|
||||||
for (int i = 0; i < NR_LIGHTS; ++i)
|
for (int i = 0; i < NR_LIGHTS; i++)
|
||||||
{
|
{
|
||||||
if (lights[i].enabled == 0) continue;
|
if (lights[i].enabled == 0) continue;
|
||||||
vec3 lightDirection = lights[i].position - fragPosition;
|
vec3 lightDirection = lights[i].position - fragPosition;
|
||||||
|
|||||||
@ -34,7 +34,7 @@ void main()
|
|||||||
// Fc(z) = z^2 + c on the complex numbers c from the plane does not diverge to infinity starting at z = 0
|
// Fc(z) = z^2 + c on the complex numbers c from the plane does not diverge to infinity starting at z = 0
|
||||||
// Here: z = a + bi. Iterations: z -> z^2 + c = (a + bi)^2 + (c.x + c.yi) = (a^2 - b^2 + c.x) + (2ab + c.y)i
|
// Here: z = a + bi. Iterations: z -> z^2 + c = (a + bi)^2 + (c.x + c.yi) = (a^2 - b^2 + c.x) + (2ab + c.y)i
|
||||||
|
|
||||||
for (int iter = 0; iter < maxIterationsLimit; ++iter)
|
for (int iter = 0; iter < maxIterationsLimit; iter++)
|
||||||
{
|
{
|
||||||
float aa = a*a;
|
float aa = a*a;
|
||||||
float bb = b*b;
|
float bb = b*b;
|
||||||
|
|||||||
@ -34,7 +34,7 @@ void main()
|
|||||||
vec3 ambient = albedo*vec3(0.1);
|
vec3 ambient = albedo*vec3(0.1);
|
||||||
vec3 viewDirection = normalize(viewPosition - fragPosition);
|
vec3 viewDirection = normalize(viewPosition - fragPosition);
|
||||||
|
|
||||||
for (int i = 0; i < NR_LIGHTS; ++i)
|
for (int i = 0; i < NR_LIGHTS; i++)
|
||||||
{
|
{
|
||||||
if (lights[i].enabled == 0) continue;
|
if (lights[i].enabled == 0) continue;
|
||||||
vec3 lightDirection = lights[i].position - fragPosition;
|
vec3 lightDirection = lights[i].position - fragPosition;
|
||||||
|
|||||||
@ -41,7 +41,7 @@ void main()
|
|||||||
a = aa - bb + c.x;
|
a = aa - bb + c.x;
|
||||||
b = twoab + c.y;
|
b = twoab + c.y;
|
||||||
|
|
||||||
++iter;
|
iter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iter >= maxIterations)
|
if (iter >= maxIterations)
|
||||||
|
|||||||
@ -32,7 +32,7 @@ void main() {
|
|||||||
vec3 ambient = albedo*vec3(0.1f);
|
vec3 ambient = albedo*vec3(0.1f);
|
||||||
vec3 viewDirection = normalize(viewPosition - fragPosition);
|
vec3 viewDirection = normalize(viewPosition - fragPosition);
|
||||||
|
|
||||||
for (int i = 0; i < NR_LIGHTS; ++i)
|
for (int i = 0; i < NR_LIGHTS; i++)
|
||||||
{
|
{
|
||||||
if (lights[i].enabled == 0) continue;
|
if (lights[i].enabled == 0) continue;
|
||||||
vec3 lightDirection = lights[i].position - fragPosition;
|
vec3 lightDirection = lights[i].position - fragPosition;
|
||||||
|
|||||||
@ -31,7 +31,7 @@ void main()
|
|||||||
// Here: z = a + bi. Iterations: z -> z^2 + c = (a + bi)^2 + (c.x + c.yi) = (a^2 - b^2 + c.x) + (2ab + c.y)i
|
// Here: z = a + bi. Iterations: z -> z^2 + c = (a + bi)^2 + (c.x + c.yi) = (a^2 - b^2 + c.x) + (2ab + c.y)i
|
||||||
|
|
||||||
int iter = 0;
|
int iter = 0;
|
||||||
for (iter = 0; iter < maxIterations; ++iter)
|
for (iter = 0; iter < maxIterations; iter++)
|
||||||
{
|
{
|
||||||
float aa = a*a;
|
float aa = a*a;
|
||||||
float bb = b*b;
|
float bb = b*b;
|
||||||
|
|||||||
@ -141,7 +141,7 @@ static PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB = NULL;
|
|||||||
#define STYLE_MASK_READONLY (WS_MINIMIZE | WS_MAXIMIZE)
|
#define STYLE_MASK_READONLY (WS_MINIMIZE | WS_MAXIMIZE)
|
||||||
#define STYLE_MASK_WRITABLE (~STYLE_MASK_READONLY)
|
#define STYLE_MASK_WRITABLE (~STYLE_MASK_READONLY)
|
||||||
|
|
||||||
#define STYLE_FLAGS_RESIZABLE WS_THICKFRAME
|
#define STYLE_FLAGS_RESIZABLE (WS_THICKFRAME | WS_MAXIMIZEBOX)
|
||||||
|
|
||||||
#define STYLE_FLAGS_UNDECORATED_OFF (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)
|
#define STYLE_FLAGS_UNDECORATED_OFF (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)
|
||||||
#define STYLE_FLAGS_UNDECORATED_ON WS_POPUP
|
#define STYLE_FLAGS_UNDECORATED_ON WS_POPUP
|
||||||
@ -270,8 +270,8 @@ static DWORD MakeWindowStyle(unsigned flags)
|
|||||||
|
|
||||||
// Minimized takes precedence over maximized
|
// Minimized takes precedence over maximized
|
||||||
int mized = MIZED_NONE;
|
int mized = MIZED_NONE;
|
||||||
if (FLAG_IS_SET(flags, FLAG_WINDOW_MINIMIZED)) mized = MIZED_MIN;
|
if (flags & FLAG_WINDOW_MINIMIZED) mized = MIZED_MIN;
|
||||||
if (flags & FLAG_WINDOW_MAXIMIZED) mized = MIZED_MAX;
|
else if (flags & FLAG_WINDOW_MAXIMIZED) mized = MIZED_MAX;
|
||||||
|
|
||||||
switch (mized)
|
switch (mized)
|
||||||
{
|
{
|
||||||
@ -1590,8 +1590,6 @@ int InitPlatform(void)
|
|||||||
|
|
||||||
if (rlGetVersion() == RL_OPENGL_11_SOFTWARE) // Using software renderer
|
if (rlGetVersion() == RL_OPENGL_11_SOFTWARE) // Using software renderer
|
||||||
{
|
{
|
||||||
//ShowWindow(platform.hwnd, SW_SHOWDEFAULT); //SW_SHOWNORMAL
|
|
||||||
|
|
||||||
// Initialize software framebuffer
|
// Initialize software framebuffer
|
||||||
BITMAPINFO bmi = { 0 };
|
BITMAPINFO bmi = { 0 };
|
||||||
ZeroMemory(&bmi, sizeof(bmi));
|
ZeroMemory(&bmi, sizeof(bmi));
|
||||||
@ -1620,6 +1618,9 @@ int InitPlatform(void)
|
|||||||
|
|
||||||
CORE.Window.ready = true;
|
CORE.Window.ready = true;
|
||||||
|
|
||||||
|
// Activate window to set focus and show taskbar icon
|
||||||
|
ShowWindow(platform.hwnd, SW_SHOWDEFAULT);
|
||||||
|
|
||||||
// Update flags (in case of deferred state change required)
|
// Update flags (in case of deferred state change required)
|
||||||
UpdateFlags(platform.hwnd, platform.desiredFlags, platform.appScreenWidth, platform.appScreenHeight);
|
UpdateFlags(platform.hwnd, platform.desiredFlags, platform.appScreenWidth, platform.appScreenHeight);
|
||||||
|
|
||||||
@ -1916,6 +1917,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
|||||||
|
|
||||||
EndPaint(hwnd, &ps);
|
EndPaint(hwnd, &ps);
|
||||||
}
|
}
|
||||||
|
else DefWindowProc(hwnd, msg, wparam, lparam);
|
||||||
}
|
}
|
||||||
case WM_INPUT:
|
case WM_INPUT:
|
||||||
{
|
{
|
||||||
@ -2090,10 +2092,10 @@ static void UpdateWindowStyle(HWND hwnd, unsigned desiredFlags)
|
|||||||
// Minimized takes precedence over maximized
|
// Minimized takes precedence over maximized
|
||||||
Mized currentMized = MIZED_NONE;
|
Mized currentMized = MIZED_NONE;
|
||||||
Mized desiredMized = MIZED_NONE;
|
Mized desiredMized = MIZED_NONE;
|
||||||
if (CORE.Window.flags & WS_MINIMIZE) currentMized = MIZED_MIN;
|
if (CORE.Window.flags & FLAG_WINDOW_MINIMIZED) currentMized = MIZED_MIN;
|
||||||
else if (CORE.Window.flags & WS_MAXIMIZE) currentMized = MIZED_MAX;
|
else if (CORE.Window.flags & FLAG_WINDOW_MAXIMIZED) currentMized = MIZED_MAX;
|
||||||
if (desiredFlags & WS_MINIMIZE) currentMized = MIZED_MIN;
|
if (desiredFlags & FLAG_WINDOW_MINIMIZED) desiredMized = MIZED_MIN;
|
||||||
else if (desiredFlags & WS_MAXIMIZE) currentMized = MIZED_MAX;
|
else if (desiredFlags & FLAG_WINDOW_MAXIMIZED) desiredMized = MIZED_MAX;
|
||||||
|
|
||||||
if (currentMized != desiredMized)
|
if (currentMized != desiredMized)
|
||||||
{
|
{
|
||||||
@ -2109,10 +2111,41 @@ static void UpdateWindowStyle(HWND hwnd, unsigned desiredFlags)
|
|||||||
// Sanitize flags
|
// Sanitize flags
|
||||||
static unsigned SanitizeFlags(int mode, unsigned flags)
|
static unsigned SanitizeFlags(int mode, unsigned flags)
|
||||||
{
|
{
|
||||||
if ((flags & FLAG_WINDOW_MAXIMIZED) && (flags & FLAG_BORDERLESS_WINDOWED_MODE))
|
if (flags & FLAG_WINDOW_MAXIMIZED)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "WIN32: WINDOW: Borderless windows mode overriding maximized window flag");
|
if (flags & FLAG_BORDERLESS_WINDOWED_MODE)
|
||||||
flags &= ~FLAG_WINDOW_MAXIMIZED;
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "WIN32: WINDOW: Borderless windows mode overriding maximized window flag");
|
||||||
|
flags &= ~FLAG_WINDOW_MAXIMIZED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (~flags & FLAG_WINDOW_RESIZABLE)
|
||||||
|
{
|
||||||
|
if (!(CORE.Window.flags & FLAG_WINDOW_MAXIMIZED))
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "WIN32: WINDOW: Cannot maximize a non-resizable window");
|
||||||
|
flags &= ~FLAG_WINDOW_MAXIMIZED;
|
||||||
|
}
|
||||||
|
else if (CORE.Window.flags & FLAG_WINDOW_RESIZABLE)
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "WIN32: WINDOW: Cannot set window as non-resizable when maximized");
|
||||||
|
flags |= FLAG_WINDOW_RESIZABLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!(CORE.Window.flags & FLAG_WINDOW_MAXIMIZED))
|
||||||
|
{
|
||||||
|
if (CORE.Window.flags & FLAG_WINDOW_MINIMIZED)
|
||||||
|
{
|
||||||
|
// Window needs to be unminimized before it can be maximized since minimizing takes precedence
|
||||||
|
flags &= ~FLAG_WINDOW_MINIMIZED;
|
||||||
|
}
|
||||||
|
else if ((flags & FLAG_WINDOW_MINIMIZED) && !(CORE.Window.flags & FLAG_WINDOW_MINIMIZED))
|
||||||
|
{
|
||||||
|
TRACELOG(LOG_WARNING, "WIN32: WINDOW: Cannot minimize and maximize a window in the same frame");
|
||||||
|
flags &= ~FLAG_WINDOW_MINIMIZED;
|
||||||
|
flags &= ~FLAG_WINDOW_MAXIMIZED;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == 1)
|
if (mode == 1)
|
||||||
|
|||||||
@ -2662,7 +2662,7 @@ const char *GetApplicationDirectory(void)
|
|||||||
|
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
for (int i = len; i >= 0; --i)
|
for (int i = len; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (appDir[i] == '\\')
|
if (appDir[i] == '\\')
|
||||||
{
|
{
|
||||||
@ -2684,7 +2684,7 @@ const char *GetApplicationDirectory(void)
|
|||||||
|
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
for (int i = len; i >= 0; --i)
|
for (int i = len; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (appDir[i] == '/')
|
if (appDir[i] == '/')
|
||||||
{
|
{
|
||||||
@ -2706,7 +2706,7 @@ const char *GetApplicationDirectory(void)
|
|||||||
if (_NSGetExecutablePath(appDir, &size) == 0)
|
if (_NSGetExecutablePath(appDir, &size) == 0)
|
||||||
{
|
{
|
||||||
int appDirLength = (int)strlen(appDir);
|
int appDirLength = (int)strlen(appDir);
|
||||||
for (int i = appDirLength; i >= 0; --i)
|
for (int i = appDirLength; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (appDir[i] == '/')
|
if (appDir[i] == '/')
|
||||||
{
|
{
|
||||||
@ -2729,7 +2729,7 @@ const char *GetApplicationDirectory(void)
|
|||||||
if (sysctl(mib, 4, appDir, &size, NULL, 0) == 0)
|
if (sysctl(mib, 4, appDir, &size, NULL, 0) == 0)
|
||||||
{
|
{
|
||||||
int appDirLength = (int)strlen(appDir);
|
int appDirLength = (int)strlen(appDir);
|
||||||
for (int i = appDirLength; i >= 0; --i)
|
for (int i = appDirLength; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (appDir[i] == '/')
|
if (appDir[i] == '/')
|
||||||
{
|
{
|
||||||
@ -3004,6 +3004,7 @@ unsigned int GetDirectoryFileCountEx(const char *basePath, const char *filter, b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
closedir(dir);
|
||||||
}
|
}
|
||||||
else TRACELOG(LOG_WARNING, "FILEIO: Directory cannot be opened (%s)", basePath); // Maybe it's a file...
|
else TRACELOG(LOG_WARNING, "FILEIO: Directory cannot be opened (%s)", basePath); // Maybe it's a file...
|
||||||
return fileCounter;
|
return fileCounter;
|
||||||
|
|||||||
Reference in New Issue
Block a user