Merge branch 'master' of github.com:raysan5/raylib
This commit is contained in:
commit
d0a2f9a39f
|
|
@ -36,9 +36,6 @@ include(CompilerFlags)
|
||||||
# Registers build options that are exposed to cmake
|
# Registers build options that are exposed to cmake
|
||||||
include(CMakeOptions.txt)
|
include(CMakeOptions.txt)
|
||||||
|
|
||||||
# Enforces a few environment and compiler configurations
|
|
||||||
include(BuildOptions)
|
|
||||||
|
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
if (NOT GLFW_BUILD_WAYLAND AND NOT GLFW_BUILD_X11)
|
if (NOT GLFW_BUILD_WAYLAND AND NOT GLFW_BUILD_X11)
|
||||||
MESSAGE(FATAL_ERROR "Cannot disable both Wayland and X11")
|
MESSAGE(FATAL_ERROR "Cannot disable both Wayland and X11")
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ option(ENABLE_MSAN "Enable MemorySanitizer (MSan) for debugging (not recommended
|
||||||
# Shared library is always PIC. Static library should be PIC too if linked into a shared library
|
# Shared library is always PIC. Static library should be PIC too if linked into a shared library
|
||||||
option(WITH_PIC "Compile static library as position-independent code" OFF)
|
option(WITH_PIC "Compile static library as position-independent code" OFF)
|
||||||
option(BUILD_SHARED_LIBS "Build raylib as a shared library" OFF)
|
option(BUILD_SHARED_LIBS "Build raylib as a shared library" OFF)
|
||||||
option(MACOS_FATLIB "Build fat library for both i386 and x86_64 on macOS" OFF)
|
|
||||||
cmake_dependent_option(USE_AUDIO "Build raylib with audio module" ON CUSTOMIZE_BUILD ON)
|
cmake_dependent_option(USE_AUDIO "Build raylib with audio module" ON CUSTOMIZE_BUILD ON)
|
||||||
|
|
||||||
enum_option(USE_EXTERNAL_GLFW "OFF;IF_POSSIBLE;ON" "Link raylib against system GLFW instead of embedded one")
|
enum_option(USE_EXTERNAL_GLFW "OFF;IF_POSSIBLE;ON" "Link raylib against system GLFW instead of embedded one")
|
||||||
|
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
if(${PLATFORM} MATCHES "Desktop" AND APPLE)
|
|
||||||
if(MACOS_FATLIB)
|
|
||||||
if (CMAKE_OSX_ARCHITECTURES)
|
|
||||||
message(FATAL_ERROR "User supplied -DCMAKE_OSX_ARCHITECTURES overrides -DMACOS_FATLIB=ON")
|
|
||||||
else()
|
|
||||||
set(CMAKE_OSX_ARCHITECTURES "x86_64;i386")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# This helps support the case where emsdk toolchain file is used
|
|
||||||
# either by setting it with -DCMAKE_TOOLCHAIN_FILE=<path_to_emsdk>/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
|
|
||||||
# or by using "emcmake cmake -B build -S ." as described in https://emscripten.org/docs/compiling/Building-Projects.html
|
|
||||||
if(EMSCRIPTEN)
|
|
||||||
SET(PLATFORM Web CACHE STRING "Forcing PLATFORM_WEB because EMSCRIPTEN was detected")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# vim: ft=cmake
|
|
||||||
|
|
@ -17,9 +17,8 @@ if (NOT raylib_FOUND) # If there's none, fetch and build raylib
|
||||||
FetchContent_GetProperties(raylib)
|
FetchContent_GetProperties(raylib)
|
||||||
if (NOT raylib_POPULATED) # Have we downloaded raylib yet?
|
if (NOT raylib_POPULATED) # Have we downloaded raylib yet?
|
||||||
set(FETCHCONTENT_QUIET NO)
|
set(FETCHCONTENT_QUIET NO)
|
||||||
FetchContent_Populate(raylib)
|
FetchContent_MakeAvailable(raylib)
|
||||||
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
|
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
|
||||||
add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -281,14 +281,15 @@ void android_main(struct android_app *app)
|
||||||
// Request to end the native activity
|
// Request to end the native activity
|
||||||
ANativeActivity_finish(app->activity);
|
ANativeActivity_finish(app->activity);
|
||||||
|
|
||||||
// Android ALooper_pollAll() variables
|
// Android ALooper_pollOnce() variables
|
||||||
int pollResult = 0;
|
int pollResult = 0;
|
||||||
int pollEvents = 0;
|
int pollEvents = 0;
|
||||||
|
|
||||||
// Waiting for application events before complete finishing
|
// Waiting for application events before complete finishing
|
||||||
while (!app->destroyRequested)
|
while (!app->destroyRequested)
|
||||||
{
|
{
|
||||||
while ((pollResult = ALooper_pollAll(0, NULL, &pollEvents, (void **)&platform.source)) >= 0)
|
// Poll all events until we reach return value TIMEOUT, meaning no events left to process
|
||||||
|
while ((pollResult = ALooper_pollOnce(0, NULL, &pollEvents, (void **)&platform.source)) > ALOOPER_POLL_TIMEOUT)
|
||||||
{
|
{
|
||||||
if (platform.source != NULL) platform.source->process(app, platform.source);
|
if (platform.source != NULL) platform.source->process(app, platform.source);
|
||||||
}
|
}
|
||||||
|
|
@ -682,13 +683,13 @@ void PollInputEvents(void)
|
||||||
CORE.Input.Keyboard.keyRepeatInFrame[i] = 0;
|
CORE.Input.Keyboard.keyRepeatInFrame[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Android ALooper_pollAll() variables
|
// Android ALooper_pollOnce() variables
|
||||||
int pollResult = 0;
|
int pollResult = 0;
|
||||||
int pollEvents = 0;
|
int pollEvents = 0;
|
||||||
|
|
||||||
// Poll Events (registered events)
|
// Poll Events (registered events) until we reach TIMEOUT which indicates there are no events left to poll
|
||||||
// NOTE: Activity is paused if not enabled (platform.appEnabled)
|
// NOTE: Activity is paused if not enabled (platform.appEnabled)
|
||||||
while ((pollResult = ALooper_pollAll(platform.appEnabled? 0 : -1, NULL, &pollEvents, (void**)&platform.source)) >= 0)
|
while ((pollResult = ALooper_pollOnce(platform.appEnabled? 0 : -1, NULL, &pollEvents, (void**)&platform.source)) > ALOOPER_POLL_TIMEOUT)
|
||||||
{
|
{
|
||||||
// Process this event
|
// Process this event
|
||||||
if (platform.source != NULL) platform.source->process(platform.app, platform.source);
|
if (platform.source != NULL) platform.source->process(platform.app, platform.source);
|
||||||
|
|
@ -767,15 +768,15 @@ int InitPlatform(void)
|
||||||
|
|
||||||
TRACELOG(LOG_INFO, "PLATFORM: ANDROID: Initialized successfully");
|
TRACELOG(LOG_INFO, "PLATFORM: ANDROID: Initialized successfully");
|
||||||
|
|
||||||
// Android ALooper_pollAll() variables
|
// Android ALooper_pollOnce() variables
|
||||||
int pollResult = 0;
|
int pollResult = 0;
|
||||||
int pollEvents = 0;
|
int pollEvents = 0;
|
||||||
|
|
||||||
// Wait for window to be initialized (display and context)
|
// Wait for window to be initialized (display and context)
|
||||||
while (!CORE.Window.ready)
|
while (!CORE.Window.ready)
|
||||||
{
|
{
|
||||||
// Process events loop
|
// Process events until we reach TIMEOUT, which indicates no more events queued.
|
||||||
while ((pollResult = ALooper_pollAll(0, NULL, &pollEvents, (void**)&platform.source)) >= 0)
|
while ((pollResult = ALooper_pollOnce(0, NULL, &pollEvents, (void**)&platform.source)) > ALOOPER_POLL_TIMEOUT)
|
||||||
{
|
{
|
||||||
// Process this event
|
// Process this event
|
||||||
if (platform.source != NULL) platform.source->process(platform.app, platform.source);
|
if (platform.source != NULL) platform.source->process(platform.app, platform.source);
|
||||||
|
|
|
||||||
|
|
@ -1626,7 +1626,9 @@ Music LoadMusicStreamFromMemory(const char *fileType, const unsigned char *data,
|
||||||
{
|
{
|
||||||
music.ctxType = MUSIC_AUDIO_FLAC;
|
music.ctxType = MUSIC_AUDIO_FLAC;
|
||||||
music.ctxData = ctxFlac;
|
music.ctxData = ctxFlac;
|
||||||
music.stream = LoadAudioStream(ctxFlac->sampleRate, ctxFlac->bitsPerSample, ctxFlac->channels);
|
int sampleSize = ctxFlac->bitsPerSample;
|
||||||
|
if (ctxFlac->bitsPerSample == 24) sampleSize = 16; // Forcing conversion to s16 on UpdateMusicStream()
|
||||||
|
music.stream = LoadAudioStream(ctxFlac->sampleRate, sampleSize, ctxFlac->channels);
|
||||||
music.frameCount = (unsigned int)ctxFlac->totalPCMFrameCount;
|
music.frameCount = (unsigned int)ctxFlac->totalPCMFrameCount;
|
||||||
music.looping = true; // Looping enabled by default
|
music.looping = true; // Looping enabled by default
|
||||||
musicLoaded = true;
|
musicLoaded = true;
|
||||||
|
|
|
||||||
|
|
@ -4092,6 +4092,12 @@ static Model LoadOBJ(const char *fileName)
|
||||||
model.materialCount = 1;
|
model.materialCount = 1;
|
||||||
TRACELOG(LOG_INFO, "MODEL: No materials provided, setting one default material for all meshes");
|
TRACELOG(LOG_INFO, "MODEL: No materials provided, setting one default material for all meshes");
|
||||||
}
|
}
|
||||||
|
else if (model.materialCount > 1 && model.meshCount > 1)
|
||||||
|
{
|
||||||
|
// TEMP warning about multiple materials, to be removed when proper splitting code is implemented
|
||||||
|
// any obj with multiple materials will need to have it's materials assigned by the user in code to work at this time
|
||||||
|
TRACELOG(LOG_INFO, "MODEL: OBJ has multiple materials, manual material assignment will be required.");
|
||||||
|
}
|
||||||
|
|
||||||
// Init model meshes and materials
|
// Init model meshes and materials
|
||||||
model.meshes = (Mesh *)RL_CALLOC(model.meshCount, sizeof(Mesh));
|
model.meshes = (Mesh *)RL_CALLOC(model.meshCount, sizeof(Mesh));
|
||||||
|
|
|
||||||
|
|
@ -1467,8 +1467,7 @@ float TextToFloat(const char *text)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10.0f + (float)(text[i] - '0');
|
for (; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10.0f + (float)(text[i] - '0');
|
||||||
|
|
||||||
if (text[i++] != '.') value *= sign;
|
if (text[i++] == '.')
|
||||||
else
|
|
||||||
{
|
{
|
||||||
float divisor = 10.0f;
|
float divisor = 10.0f;
|
||||||
for (; ((text[i] >= '0') && (text[i] <= '9')); i++)
|
for (; ((text[i] >= '0') && (text[i] <= '9')); i++)
|
||||||
|
|
@ -1478,7 +1477,7 @@ float TextToFloat(const char *text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value*sign;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SUPPORT_TEXT_MANIPULATION)
|
#if defined(SUPPORT_TEXT_MANIPULATION)
|
||||||
|
|
|
||||||
|
|
@ -1112,6 +1112,7 @@ Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float
|
||||||
{
|
{
|
||||||
Color *pixels = (Color *)RL_MALLOC(width*height*sizeof(Color));
|
Color *pixels = (Color *)RL_MALLOC(width*height*sizeof(Color));
|
||||||
|
|
||||||
|
float aspectRatio = (float)width / (float)height;
|
||||||
for (int y = 0; y < height; y++)
|
for (int y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < width; x++)
|
for (int x = 0; x < width; x++)
|
||||||
|
|
@ -1119,6 +1120,10 @@ Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float
|
||||||
float nx = (float)(x + offsetX)*(scale/(float)width);
|
float nx = (float)(x + offsetX)*(scale/(float)width);
|
||||||
float ny = (float)(y + offsetY)*(scale/(float)height);
|
float ny = (float)(y + offsetY)*(scale/(float)height);
|
||||||
|
|
||||||
|
// Apply aspect ratio compensation to wider side
|
||||||
|
if (width > height) nx *= aspectRatio;
|
||||||
|
else ny /= aspectRatio;
|
||||||
|
|
||||||
// Basic perlin noise implementation (not used)
|
// Basic perlin noise implementation (not used)
|
||||||
//float p = (stb_perlin_noise3(nx, ny, 0.0f, 0, 0, 0);
|
//float p = (stb_perlin_noise3(nx, ny, 0.0f, 0, 0, 0);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user