initial implementation; might not be the cleanest, barely held together, but thats what i have right now.
This commit is contained in:
parent
79497e1c88
commit
5add3352d4
|
|
@ -50,7 +50,7 @@ if(NOT TARGET uninstall AND PROJECT_IS_TOP_LEVEL)
|
|||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
endif()
|
||||
|
||||
if (${BUILD_EXAMPLES})
|
||||
if (${BUILD_EXAMPLES} AND NOT ${PLATFORM} MATCHES "Headless")
|
||||
MESSAGE(STATUS "Building examples is enabled")
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ if(EMSCRIPTEN)
|
|||
# When configuring web builds with "emcmake cmake -B build -S .", set PLATFORM to Web by default
|
||||
SET(PLATFORM Web CACHE STRING "Platform to build for.")
|
||||
endif()
|
||||
enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM;SDL" "Platform to build for.")
|
||||
enum_option(PLATFORM "Desktop;Web;Android;Raspberry Pi;DRM;SDL;Headless" "Platform to build for.")
|
||||
|
||||
enum_option(OPENGL_VERSION "OFF;4.3;3.3;2.1;1.1;ES 2.0;ES 3.0" "Force a specific OpenGL Version?")
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,11 @@ elseif ("${PLATFORM}" MATCHES "SDL")
|
|||
add_compile_definitions(USING_SDL2_PACKAGE)
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
||||
elseif(${PLATFORM} MATCHES "Headless")
|
||||
message(STATUS "Building raylib in headless mode")
|
||||
set(PLATFORM_CPP "PLATFORM_HEADLESS")
|
||||
set(CUSTOMIZE_BUILD OFF)
|
||||
endif()
|
||||
|
||||
if (NOT ${OPENGL_VERSION} MATCHES "OFF")
|
||||
set(SUGGESTED_GRAPHICS "${GRAPHICS}")
|
||||
|
|
|
|||
|
|
@ -113,6 +113,8 @@ elseif ("${PLATFORM}" STREQUAL "DRM")
|
|||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
|
||||
|
||||
elseif(${PLATFORM} MATCHES "Headless")
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)
|
||||
elseif (NOT SUPPORT_GESTURES_SYSTEM)
|
||||
# Items requiring gestures system
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/textures/textures_mouse_painting.c)
|
||||
|
|
|
|||
|
|
@ -325,7 +325,11 @@ endif
|
|||
# -D_GNU_SOURCE access to lots of nonstandard GNU/Linux extension functions
|
||||
# -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers
|
||||
# -fno-strict-aliasing jar_xm.h does shady stuff (breaks strict aliasing)
|
||||
CFLAGS = -Wall -D_GNU_SOURCE -D$(TARGET_PLATFORM) -D$(GRAPHICS) -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing
|
||||
CFLAGS = -Wall -D_GNU_SOURCE -D$(TARGET_PLATFORM)
|
||||
ifdef GRAPHICS
|
||||
CFLAGS += -D$(GRAPHICS)
|
||||
endif
|
||||
CFLAGS += -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing
|
||||
|
||||
ifneq ($(RAYLIB_CONFIG_FLAGS), NONE)
|
||||
CFLAGS += -DEXTERNAL_CONFIG_FLAGS $(RAYLIB_CONFIG_FLAGS)
|
||||
|
|
|
|||
451
src/config.h
451
src/config.h
|
|
@ -27,56 +27,23 @@
|
|||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Module selection - Some modules could be avoided
|
||||
// Mandatory modules: rcore, rlgl, utils
|
||||
//------------------------------------------------------------------------------------
|
||||
#define SUPPORT_MODULE_RSHAPES 1
|
||||
#define SUPPORT_MODULE_RTEXTURES 1
|
||||
#define SUPPORT_MODULE_RTEXT 1 // WARNING: It requires SUPPORT_MODULE_RTEXTURES to load sprite font textures
|
||||
#define SUPPORT_MODULE_RTEXT 1
|
||||
#define SUPPORT_MODULE_RMODELS 1
|
||||
#define SUPPORT_MODULE_RAUDIO 1
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Module: rcore - Configuration Flags
|
||||
//------------------------------------------------------------------------------------
|
||||
// Camera module is included (rcamera.h) and multiple predefined cameras are available: free, 1st/3rd person, orbital
|
||||
#define SUPPORT_CAMERA_SYSTEM 1
|
||||
// Gestures module is included (rgestures.h) to support gestures detection: tap, hold, swipe, drag
|
||||
#define SUPPORT_GESTURES_SYSTEM 1
|
||||
// Include pseudo-random numbers generator (rprand.h), based on Xoshiro128** and SplitMix64
|
||||
#define SUPPORT_RPRAND_GENERATOR 1
|
||||
// Mouse gestures are directly mapped like touches and processed by gestures system
|
||||
#define SUPPORT_MOUSE_GESTURES 1
|
||||
// Reconfigure standard input to receive key inputs, works with SSH connection.
|
||||
#define SUPPORT_SSH_KEYBOARD_RPI 1
|
||||
// Setting a higher resolution can improve the accuracy of time-out intervals in wait functions.
|
||||
// However, it can also reduce overall system performance, because the thread scheduler switches tasks more often.
|
||||
#define SUPPORT_WINMM_HIGHRES_TIMER 1
|
||||
// Use busy wait loop for timing sync, if not defined, a high-resolution timer is set up and used
|
||||
//#define SUPPORT_BUSY_WAIT_LOOP 1
|
||||
// Use a partial-busy wait loop, in this case frame sleeps for most of the time, but then runs a busy loop at the end for accuracy
|
||||
#define SUPPORT_PARTIALBUSY_WAIT_LOOP 1
|
||||
// Allow automatic screen capture of current screen pressing F12, defined in KeyCallback()
|
||||
#define SUPPORT_SCREEN_CAPTURE 1
|
||||
// Allow automatic gif recording of current screen pressing CTRL+F12, defined in KeyCallback()
|
||||
#define SUPPORT_GIF_RECORDING 1
|
||||
// Support CompressData() and DecompressData() functions
|
||||
#define SUPPORT_COMPRESSION_API 1
|
||||
// Support automatic generated events, loading and recording of those events when required
|
||||
#define SUPPORT_AUTOMATION_EVENTS 1
|
||||
// Support custom frame control, only for advanced users
|
||||
// By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timing + PollInputEvents()
|
||||
// Enabling this flag allows manual control of the frame processes, use at your own risk
|
||||
//#define SUPPORT_CUSTOM_FRAME_CONTROL 1
|
||||
|
||||
// Support for clipboard image loading
|
||||
// NOTE: Only working on SDL3, GLFW (Windows) and RGFW (Windows)
|
||||
#define SUPPORT_CLIPBOARD_IMAGE 1
|
||||
|
||||
// NOTE: Clipboard image loading requires support for some image file formats
|
||||
// TODO: Those defines should probably be removed from here, I prefer to let the user manage them
|
||||
#if defined(SUPPORT_CLIPBOARD_IMAGE)
|
||||
#ifndef SUPPORT_MODULE_RTEXTURES
|
||||
#define SUPPORT_MODULE_RTEXTURES 1
|
||||
|
|
@ -84,61 +51,44 @@
|
|||
#ifndef STBI_REQUIRED
|
||||
#define STBI_REQUIRED
|
||||
#endif
|
||||
#ifndef SUPPORT_FILEFORMAT_BMP // For clipboard image on Windows
|
||||
#ifndef SUPPORT_FILEFORMAT_BMP
|
||||
#define SUPPORT_FILEFORMAT_BMP 1
|
||||
#endif
|
||||
#ifndef SUPPORT_FILEFORMAT_PNG // Wayland uses png for prints, at least it was on 22 LTS ubuntu
|
||||
#ifndef SUPPORT_FILEFORMAT_PNG
|
||||
#define SUPPORT_FILEFORMAT_PNG 1
|
||||
#endif
|
||||
#ifndef SUPPORT_FILEFORMAT_JPG
|
||||
#define SUPPORT_FILEFORMAT_JPG 1
|
||||
#endif
|
||||
#endif
|
||||
#define MAX_FILEPATH_CAPACITY 8192
|
||||
#define MAX_FILEPATH_LENGTH 4096
|
||||
|
||||
// rcore: Configuration values
|
||||
//------------------------------------------------------------------------------------
|
||||
#define MAX_FILEPATH_CAPACITY 8192 // Maximum file paths capacity
|
||||
#define MAX_FILEPATH_LENGTH 4096 // Maximum length for filepaths (Linux PATH_MAX default value)
|
||||
#define MAX_KEYBOARD_KEYS 512
|
||||
#define MAX_MOUSE_BUTTONS 8
|
||||
#define MAX_GAMEPADS 4
|
||||
#define MAX_GAMEPAD_AXES 8
|
||||
#define MAX_GAMEPAD_BUTTONS 32
|
||||
#define MAX_GAMEPAD_VIBRATION_TIME 2.0f
|
||||
#define MAX_TOUCH_POINTS 8
|
||||
#define MAX_KEY_PRESSED_QUEUE 16
|
||||
#define MAX_CHAR_PRESSED_QUEUE 16
|
||||
|
||||
#define MAX_KEYBOARD_KEYS 512 // Maximum number of keyboard keys supported
|
||||
#define MAX_MOUSE_BUTTONS 8 // Maximum number of mouse buttons supported
|
||||
#define MAX_GAMEPADS 4 // Maximum number of gamepads supported
|
||||
#define MAX_GAMEPAD_AXES 8 // Maximum number of axes supported (per gamepad)
|
||||
#define MAX_GAMEPAD_BUTTONS 32 // Maximum number of buttons supported (per gamepad)
|
||||
#define MAX_GAMEPAD_VIBRATION_TIME 2.0f // Maximum vibration time in seconds
|
||||
#define MAX_TOUCH_POINTS 8 // Maximum number of touch points supported
|
||||
#define MAX_KEY_PRESSED_QUEUE 16 // Maximum number of keys in the key input queue
|
||||
#define MAX_CHAR_PRESSED_QUEUE 16 // Maximum number of characters in the char input queue
|
||||
#define MAX_DECOMPRESSION_SIZE 64
|
||||
|
||||
#define MAX_DECOMPRESSION_SIZE 64 // Max size allocated for decompression in MB
|
||||
#define MAX_AUTOMATION_EVENTS 16384
|
||||
|
||||
#define MAX_AUTOMATION_EVENTS 16384 // Maximum number of automation events to record
|
||||
#define RL_SUPPORT_MESH_GPU_SKINNING 1
|
||||
#define RL_DEFAULT_BATCH_BUFFERS 1
|
||||
#define RL_DEFAULT_BATCH_DRAWCALLS 256
|
||||
#define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Module: rlgl - Configuration values
|
||||
//------------------------------------------------------------------------------------
|
||||
#define RL_MAX_MATRIX_STACK_SIZE 32
|
||||
|
||||
// Enable OpenGL Debug Context (only available on OpenGL 4.3)
|
||||
//#define RLGL_ENABLE_OPENGL_DEBUG_CONTEXT 1
|
||||
#define RL_MAX_SHADER_LOCATIONS 32
|
||||
|
||||
// Show OpenGL extensions and capabilities detailed logs on init
|
||||
//#define RLGL_SHOW_GL_DETAILS_INFO 1
|
||||
|
||||
#define RL_SUPPORT_MESH_GPU_SKINNING 1 // GPU skinning, comment if your GPU does not support more than 8 VBOs
|
||||
|
||||
//#define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 4096 // Default internal render batch elements limits
|
||||
#define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering)
|
||||
#define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture)
|
||||
#define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of textures units that can be activated on batch drawing (SetShaderValueTexture())
|
||||
|
||||
#define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack
|
||||
|
||||
#define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported
|
||||
|
||||
#define RL_CULL_DISTANCE_NEAR 0.05 // Default projection matrix near cull distance
|
||||
#define RL_CULL_DISTANCE_FAR 4000.0 // Default projection matrix far cull distance
|
||||
|
||||
// Default shader vertex attribute locations
|
||||
#define RL_CULL_DISTANCE_NEAR 0.05
|
||||
#define RL_CULL_DISTANCE_FAR 4000.0
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD 1
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL 2
|
||||
|
|
@ -151,146 +101,285 @@
|
|||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS 8
|
||||
#endif
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_LOCATION_INSTANCE_TX 9
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition"
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord"
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal"
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor"
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent"
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2"
|
||||
|
||||
// Default shader vertex attribute names to set location points
|
||||
// NOTE: When a new shader is loaded, the following locations are tried to be set for convenience
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_POSITION "vertexPosition" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD "vertexTexCoord" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_NORMAL "vertexNormal" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_COLOR "vertexColor" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_COLOR
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TANGENT "vertexTangent" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT
|
||||
#define RL_DEFAULT_SHADER_ATTRIB_NAME_TEXCOORD2 "vertexTexCoord2" // Bound by default to shader location: RL_DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2
|
||||
|
||||
#define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp" // model-view-projection matrix
|
||||
#define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView" // view matrix
|
||||
#define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection" // projection matrix
|
||||
#define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel" // model matrix
|
||||
#define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal" // normal matrix (transpose(inverse(matModelView))
|
||||
#define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse" // color diffuse (base tint color, multiplied by texture color)
|
||||
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0" // texture0 (texture slot active 0)
|
||||
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1" // texture1 (texture slot active 1)
|
||||
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2" // texture2 (texture slot active 2)
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Module: rshapes - Configuration Flags
|
||||
//------------------------------------------------------------------------------------
|
||||
// Use QUADS instead of TRIANGLES for drawing when possible
|
||||
// Some lines-based shapes could still use lines
|
||||
#define RL_DEFAULT_SHADER_UNIFORM_NAME_MVP "mvp"
|
||||
#define RL_DEFAULT_SHADER_UNIFORM_NAME_VIEW "matView"
|
||||
#define RL_DEFAULT_SHADER_UNIFORM_NAME_PROJECTION "matProjection"
|
||||
#define RL_DEFAULT_SHADER_UNIFORM_NAME_MODEL "matModel"
|
||||
#define RL_DEFAULT_SHADER_UNIFORM_NAME_NORMAL "matNormal"
|
||||
#define RL_DEFAULT_SHADER_UNIFORM_NAME_COLOR "colDiffuse"
|
||||
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE0 "texture0"
|
||||
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1 "texture1"
|
||||
#define RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2 "texture2"
|
||||
#define SUPPORT_QUADS_DRAW_MODE 1
|
||||
|
||||
// rshapes: Configuration values
|
||||
//------------------------------------------------------------------------------------
|
||||
#define SPLINE_SEGMENT_DIVISIONS 24 // Spline segments subdivisions
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Module: rtextures - Configuration Flags
|
||||
//------------------------------------------------------------------------------------
|
||||
// Selected desired fileformats to be supported for image data loading
|
||||
#define SPLINE_SEGMENT_DIVISIONS 24
|
||||
#define SUPPORT_FILEFORMAT_PNG 1
|
||||
//#define SUPPORT_FILEFORMAT_BMP 1
|
||||
//#define SUPPORT_FILEFORMAT_TGA 1
|
||||
//#define SUPPORT_FILEFORMAT_JPG 1
|
||||
#define SUPPORT_FILEFORMAT_GIF 1
|
||||
#define SUPPORT_FILEFORMAT_QOI 1
|
||||
//#define SUPPORT_FILEFORMAT_PSD 1
|
||||
#define SUPPORT_FILEFORMAT_DDS 1
|
||||
//#define SUPPORT_FILEFORMAT_HDR 1
|
||||
//#define SUPPORT_FILEFORMAT_PIC 1
|
||||
//#define SUPPORT_FILEFORMAT_KTX 1
|
||||
//#define SUPPORT_FILEFORMAT_ASTC 1
|
||||
//#define SUPPORT_FILEFORMAT_PKM 1
|
||||
//#define SUPPORT_FILEFORMAT_PVR 1
|
||||
|
||||
// Support image export functionality (.png, .bmp, .tga, .jpg, .qoi)
|
||||
#define SUPPORT_IMAGE_EXPORT 1
|
||||
// Support procedural image generation functionality (gradient, spot, perlin-noise, cellular)
|
||||
#define SUPPORT_IMAGE_GENERATION 1
|
||||
// Support multiple image editing functions to scale, adjust colors, flip, draw on images, crop...
|
||||
// If not defined, still some functions are supported: ImageFormat(), ImageCrop(), ImageToPOT()
|
||||
#define SUPPORT_IMAGE_MANIPULATION 1
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Module: rtext - Configuration Flags
|
||||
//------------------------------------------------------------------------------------
|
||||
// Default font is loaded on window initialization to be available for the user to render simple text
|
||||
// NOTE: If enabled, uses external module functions to load default raylib font
|
||||
#define SUPPORT_DEFAULT_FONT 1
|
||||
// Selected desired font fileformats to be supported for loading
|
||||
#define SUPPORT_FILEFORMAT_TTF 1
|
||||
#define SUPPORT_FILEFORMAT_FNT 1
|
||||
//#define SUPPORT_FILEFORMAT_BDF 1
|
||||
|
||||
// Support text management functions
|
||||
// If not defined, still some functions are supported: TextLength(), TextFormat()
|
||||
#define SUPPORT_TEXT_MANIPULATION 1
|
||||
|
||||
// On font atlas image generation [GenImageFontAtlas()], add a 3x3 pixels white rectangle
|
||||
// at the bottom-right corner of the atlas. It can be useful to for shapes drawing, to allow
|
||||
// drawing text and shapes with a single draw call [SetShapesTexture()].
|
||||
#define SUPPORT_FONT_ATLAS_WHITE_REC 1
|
||||
|
||||
// rtext: Configuration values
|
||||
//------------------------------------------------------------------------------------
|
||||
#define MAX_TEXT_BUFFER_LENGTH 1024 // Size of internal static buffers used on some functions:
|
||||
// TextFormat(), TextSubtext(), TextToUpper(), TextToLower(), TextToPascal(), TextSplit()
|
||||
#define MAX_TEXTSPLIT_COUNT 128 // Maximum number of substrings to split: TextSplit()
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Module: rmodels - Configuration Flags
|
||||
//------------------------------------------------------------------------------------
|
||||
// Selected desired model fileformats to be supported for loading
|
||||
#define MAX_TEXT_BUFFER_LENGTH 1024
|
||||
#define MAX_TEXTSPLIT_COUNT 128
|
||||
#define SUPPORT_FILEFORMAT_OBJ 1
|
||||
#define SUPPORT_FILEFORMAT_MTL 1
|
||||
#define SUPPORT_FILEFORMAT_IQM 1
|
||||
#define SUPPORT_FILEFORMAT_GLTF 1
|
||||
#define SUPPORT_FILEFORMAT_VOX 1
|
||||
#define SUPPORT_FILEFORMAT_M3D 1
|
||||
// Support procedural mesh generation functions, uses external par_shapes.h library
|
||||
// NOTE: Some generated meshes DO NOT include generated texture coordinates
|
||||
#define SUPPORT_MESH_GENERATION 1
|
||||
|
||||
// rmodels: Configuration values
|
||||
//------------------------------------------------------------------------------------
|
||||
#define MAX_MATERIAL_MAPS 12 // Maximum number of shader maps supported
|
||||
#define MAX_MATERIAL_MAPS 12
|
||||
|
||||
#ifdef RL_SUPPORT_MESH_GPU_SKINNING
|
||||
#define MAX_MESH_VERTEX_BUFFERS 9 // Maximum vertex buffers (VBO) per mesh
|
||||
#define MAX_MESH_VERTEX_BUFFERS 9
|
||||
#else
|
||||
#define MAX_MESH_VERTEX_BUFFERS 7 // Maximum vertex buffers (VBO) per mesh
|
||||
#define MAX_MESH_VERTEX_BUFFERS 7
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Module: raudio - Configuration Flags
|
||||
//------------------------------------------------------------------------------------
|
||||
// Desired audio fileformats to be supported for loading
|
||||
#define SUPPORT_FILEFORMAT_WAV 1
|
||||
#define SUPPORT_FILEFORMAT_OGG 1
|
||||
#define SUPPORT_FILEFORMAT_MP3 1
|
||||
#define SUPPORT_FILEFORMAT_QOA 1
|
||||
//#define SUPPORT_FILEFORMAT_FLAC 1
|
||||
#define SUPPORT_FILEFORMAT_XM 1
|
||||
#define SUPPORT_FILEFORMAT_MOD 1
|
||||
#define AUDIO_DEVICE_FORMAT ma_format_f32
|
||||
#define AUDIO_DEVICE_CHANNELS 2
|
||||
#define AUDIO_DEVICE_SAMPLE_RATE 0
|
||||
|
||||
// raudio: Configuration values
|
||||
//------------------------------------------------------------------------------------
|
||||
#define AUDIO_DEVICE_FORMAT ma_format_f32 // Device output format (miniaudio: float-32bit)
|
||||
#define AUDIO_DEVICE_CHANNELS 2 // Device output channels: stereo
|
||||
#define AUDIO_DEVICE_SAMPLE_RATE 0 // Device sample rate (device default)
|
||||
|
||||
#define MAX_AUDIO_BUFFER_POOL_CHANNELS 16 // Maximum number of audio pool channels
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Module: utils - Configuration Flags
|
||||
//------------------------------------------------------------------------------------
|
||||
// Standard file io library (stdio.h) included
|
||||
#define MAX_AUDIO_BUFFER_POOL_CHANNELS 16
|
||||
#define SUPPORT_STANDARD_FILEIO 1
|
||||
// Show TRACELOG() output messages
|
||||
// NOTE: By default LOG_DEBUG traces not shown
|
||||
#define SUPPORT_TRACELOG 1
|
||||
//#define SUPPORT_TRACELOG_DEBUG 1
|
||||
#define MAX_TRACELOG_MSG_LENGTH 256
|
||||
|
||||
// utils: Configuration values
|
||||
//------------------------------------------------------------------------------------
|
||||
#define MAX_TRACELOG_MSG_LENGTH 256 // Max length of one trace-log message
|
||||
#ifdef PLATFORM_HEADLESS
|
||||
#undef SUPPORT_MODULE_RTEXTURES
|
||||
#undef SUPPORT_MODULE_RMODELS
|
||||
#undef SUPPORT_MODULE_RAUDIO
|
||||
#undef SUPPORT_CAMERA_SYSTEM
|
||||
#undef SUPPORT_GESTURES_SYSTEM
|
||||
#undef SUPPORT_MOUSE_GESTURES
|
||||
#undef SUPPORT_SSH_KEYBOARD_RPI
|
||||
#undef SUPPORT_PARTIALBUSY_WAIT_LOOP
|
||||
#undef SUPPORT_SCREEN_CAPTURE
|
||||
#undef SUPPORT_GIF_RECORDING
|
||||
#undef SUPPORT_AUTOMATION_EVENTS
|
||||
#undef SUPPORT_CLIPBOARD_IMAGE
|
||||
#undef SUPPORT_MODULE_RTEXTURES
|
||||
#undef STBI_REQUIRED
|
||||
#undef SUPPORT_FILEFORMAT_BMP
|
||||
#undef SUPPORT_FILEFORMAT_PNG
|
||||
#undef SUPPORT_FILEFORMAT_JPG
|
||||
#undef SUPPORT_QUADS_DRAW_MODE
|
||||
#undef SUPPORT_FILEFORMAT_PNG
|
||||
#undef SUPPORT_FILEFORMAT_BMP
|
||||
#undef SUPPORT_FILEFORMAT_TGA
|
||||
#undef SUPPORT_FILEFORMAT_JPG
|
||||
#undef SUPPORT_FILEFORMAT_GIF
|
||||
#undef SUPPORT_FILEFORMAT_QOI
|
||||
#undef SUPPORT_FILEFORMAT_PSD
|
||||
#undef SUPPORT_FILEFORMAT_DDS
|
||||
#undef SUPPORT_FILEFORMAT_HDR
|
||||
#undef SUPPORT_FILEFORMAT_PIC
|
||||
#undef SUPPORT_FILEFORMAT_KTX
|
||||
#undef SUPPORT_FILEFORMAT_ASTC
|
||||
#undef SUPPORT_FILEFORMAT_PKM
|
||||
#undef SUPPORT_FILEFORMAT_PVR
|
||||
#undef SUPPORT_IMAGE_EXPORT
|
||||
#undef SUPPORT_IMAGE_GENERATION
|
||||
#undef SUPPORT_IMAGE_MANIPULATION
|
||||
#undef SUPPORT_DEFAULT_FONT
|
||||
#undef SUPPORT_FILEFORMAT_TTF
|
||||
#undef SUPPORT_FILEFORMAT_FNT
|
||||
#undef SUPPORT_FONT_ATLAS_WHITE_REC
|
||||
#undef SUPPORT_FILEFORMAT_OBJ
|
||||
#undef SUPPORT_FILEFORMAT_MTL
|
||||
#undef SUPPORT_FILEFORMAT_IQM
|
||||
#undef SUPPORT_FILEFORMAT_GLTF
|
||||
#undef SUPPORT_FILEFORMAT_VOX
|
||||
#undef SUPPORT_FILEFORMAT_M3D
|
||||
#undef SUPPORT_MESH_GENERATION
|
||||
#undef SUPPORT_FILEFORMAT_WAV
|
||||
#undef SUPPORT_FILEFORMAT_OGG
|
||||
#undef SUPPORT_FILEFORMAT_MP3
|
||||
#undef SUPPORT_FILEFORMAT_QOA
|
||||
#undef SUPPORT_FILEFORMAT_XM
|
||||
#undef SUPPORT_FILEFORMAT_MOD
|
||||
|
||||
#endif // CONFIG_H
|
||||
|
||||
// Define all rlgl functions to be nothing
|
||||
#define rlMatrixMode(mode) ((void)0)
|
||||
#define rlPushMatrix() ((void)0)
|
||||
#define rlPopMatrix() ((void)0)
|
||||
#define rlLoadIdentity() ((void)0)
|
||||
#define rlTranslatef(x, y, z) ((void)0)
|
||||
#define rlRotatef(angle, x, y, z) ((void)0)
|
||||
#define rlScalef(x, y, z) ((void)0)
|
||||
#define rlMultMatrixf(matf) ((void)0)
|
||||
#define rlFrustum(left, right, bottom, top, znear, zfar) ((void)0)
|
||||
#define rlOrtho(left, right, bottom, top, znear, zfar) ((void)0)
|
||||
#define rlViewport(x, y, width, height) ((void)0)
|
||||
#define rlSetClipPlanes(nearPlane, farPlane) ((void)0)
|
||||
#define rlGetCullDistanceNear() ((void)0)
|
||||
#define rlGetCullDistanceFar() ((void)0)
|
||||
#define rlBegin(mode) ((void)0)
|
||||
#define rlEnd() ((void)0)
|
||||
#define rlVertex2i(x, y) ((void)0)
|
||||
#define rlVertex2f(x, y) ((void)0)
|
||||
#define rlVertex3f(x, y, z) ((void)0)
|
||||
#define rlTexCoord2f(x, y) ((void)0)
|
||||
#define rlNormal3f(x, y, z) ((void)0)
|
||||
#define rlColor4ub(r, g, b, a) ((void)0)
|
||||
#define rlColor3f(x, y, z) ((void)0)
|
||||
#define rlColor4f(x, y, z, w) ((void)0)
|
||||
#define rlEnableVertexArray(vaoId) ((void)0)
|
||||
#define rlDisableVertexArray() ((void)0)
|
||||
#define rlEnableVertexBuffer(id) ((void)0)
|
||||
#define rlDisableVertexBuffer() ((void)0)
|
||||
#define rlEnableVertexBufferElement(id) ((void)0)
|
||||
#define rlDisableVertexBufferElement() ((void)0)
|
||||
#define rlEnableVertexAttribute(index) ((void)0)
|
||||
#define rlDisableVertexAttribute(index) ((void)0)
|
||||
#define rlEnableStatePointer(vertexAttribType, buffer) ((void)0)
|
||||
#define rlDisableStatePointer(vertexAttribType) ((void)0)
|
||||
#define rlActiveTextureSlot(slot) ((void)0)
|
||||
#define rlEnableTexture(id) ((void)0)
|
||||
#define rlDisableTexture() ((void)0)
|
||||
#define rlEnableTextureCubemap(id) ((void)0)
|
||||
#define rlDisableTextureCubemap() ((void)0)
|
||||
#define rlTextureParameters(id, param, value) ((void)0)
|
||||
#define rlCubemapParameters(id, param, value) ((void)0)
|
||||
#define rlEnableShader(id) ((void)0)
|
||||
#define rlDisableShader() ((void)0)
|
||||
#define rlEnableFramebuffer(id) ((void)0)
|
||||
#define rlDisableFramebuffer() ((void)0)
|
||||
#define rlGetActiveFramebuffer() ((void)0)
|
||||
#define rlActiveDrawBuffers(count) ((void)0)
|
||||
#define rlBlitFramebuffer(srcX, srcY, srcWidth, srcHeight, dstX, dstY, dstWidth, dstHeight, bufferMask) ((void)0)
|
||||
#define rlBindFramebuffer(target, framebuffer) ((void)0)
|
||||
#define rlEnableColorBlend() ((void)0)
|
||||
#define rlDisableColorBlend() ((void)0)
|
||||
#define rlEnableDepthTest() ((void)0)
|
||||
#define rlDisableDepthTest() ((void)0)
|
||||
#define rlEnableDepthMask() ((void)0)
|
||||
#define rlDisableDepthMask() ((void)0)
|
||||
#define rlEnableBackfaceCulling() ((void)0)
|
||||
#define rlDisableBackfaceCulling() ((void)0)
|
||||
#define rlColorMask(r, g, b, a) ((void)0)
|
||||
#define rlSetCullFace(mode) ((void)0)
|
||||
#define rlEnableScissorTest() ((void)0)
|
||||
#define rlDisableScissorTest() ((void)0)
|
||||
#define rlScissor(x, y, width, height) ((void)0)
|
||||
#define rlEnablePointMode() ((void)0)
|
||||
#define rlDisablePointMode() ((void)0)
|
||||
#define rlEnableWireMode() ((void)0)
|
||||
#define rlDisableWireMode() ((void)0)
|
||||
#define rlSetLineWidth(width) ((void)0)
|
||||
#define rlGetLineWidth() ((void)0)
|
||||
#define rlEnableSmoothLines() ((void)0)
|
||||
#define rlDisableSmoothLines() ((void)0)
|
||||
#define rlEnableStereoRender() ((void)0)
|
||||
#define rlDisableStereoRender() ((void)0)
|
||||
#define rlIsStereoRenderEnabled() ((void)0)
|
||||
|
||||
#define rlClearColor(r, g, b, a) ((void)0)
|
||||
#define rlClearScreenBuffers() ((void)0)
|
||||
#define rlCheckErrors() ((void)0)
|
||||
#define rlSetBlendMode(mode) ((void)0)
|
||||
#define rlSetBlendFactors(glSrcFactor, glDstFactor, glEquation) ((void)0)
|
||||
#define rlSetBlendFactorsSeparate(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha, glEqRGB, glEqAlpha) ((void)0)
|
||||
#define rlglInit(width, height) ((void)0)
|
||||
#define rlglClose() ((void)0)
|
||||
#define rlLoadExtensions(loader) ((void)0)
|
||||
#define rlGetProcAddress(procName) ((void)0)
|
||||
#define rlGetVersion() ((void)0)
|
||||
#define rlSetFramebufferWidth(width) ((void)0)
|
||||
#define rlGetFramebufferWidth() ((void)0)
|
||||
#define rlSetFramebufferHeight(height) ((void)0)
|
||||
#define rlGetFramebufferHeight() ((void)0)
|
||||
|
||||
#define rlGetTextureIdDefault() ((void)0)
|
||||
#define rlGetShaderIdDefault() ((void)0)
|
||||
#define rlGetShaderLocsDefault() ((void)0)
|
||||
#define rlLoadRenderBatch(numBuffers, bufferElements) ((void)0)
|
||||
#define rlUnloadRenderBatch(batch) ((void)0)
|
||||
#define rlDrawRenderBatch(batch) ((void)0)
|
||||
#define rlSetRenderBatchActive(batch) ((void)0)
|
||||
#define rlDrawRenderBatchActive() ((void)0)
|
||||
#define rlCheckRenderBatchLimit(vCount) ((void)0)
|
||||
|
||||
#define rlSetTexture(id) ((void)0)
|
||||
#define rlLoadVertexArray() ((void)0)
|
||||
#define rlLoadVertexBuffer(buffer, size, dynamic) ((void)0)
|
||||
#define rlLoadVertexBufferElement(buffer, size, dynamic) ((void)0)
|
||||
#define rlUpdateVertexBuffer(bufferId, data, dataSize, offset) ((void)0)
|
||||
#define rlUpdateVertexBufferElements(id, data, dataSize, offset) ((void)0)
|
||||
#define rlUnloadVertexArray(vaoId) ((void)0)
|
||||
#define rlUnloadVertexBuffer(vboId) ((void)0)
|
||||
#define rlSetVertexAttribute(index, compSize, type, normalized, stride, offset) ((void)0)
|
||||
#define rlSetVertexAttributeDivisor(index, divisor) ((void)0)
|
||||
#define rlSetVertexAttributeDefault(locIndex, value, attribType, count) ((void)0)
|
||||
#define rlDrawVertexArray(offset, count) ((void)0)
|
||||
#define rlDrawVertexArrayElements(offset, count, buffer) ((void)0)
|
||||
#define rlDrawVertexArrayInstanced(offset, count, instances) ((void)0)
|
||||
#define rlDrawVertexArrayElementsInstanced(offset, count, buffer, instances) ((void)0)
|
||||
#define rlLoadTexture(data, width, height, format, mipmapCount) ((void)0)
|
||||
#define rlLoadTextureDepth(width, height, useRenderBuffer) ((void)0)
|
||||
#define rlLoadTextureCubemap(data, size, format, mipmapCount) ((void)0)
|
||||
#define rlUpdateTexture(id, offsetX, offsetY, width, height, format, data) ((void)0)
|
||||
#define rlGetGlTextureFormats(format, glInternalFormat, glFormat, glType) ((void)0)
|
||||
#define rlGetPixelFormatName(format) ((void)0)
|
||||
#define rlUnloadTexture(id) ((void)0)
|
||||
#define rlGenTextureMipmaps(id, width, height, format, mipmaps) ((void)0)
|
||||
#define rlReadTexturePixels(id, width, height, format) ((void)0)
|
||||
#define rlReadScreenPixels(width, height) ((void)0)
|
||||
#define rlLoadFramebuffer() ((void)0)
|
||||
#define rlFramebufferAttach(fboId, texId, attachType, texType, mipLevel) ((void)0)
|
||||
#define rlFramebufferComplete(id) ((void)0)
|
||||
#define rlUnloadFramebuffer(id) ((void)0)
|
||||
#define rlLoadShaderCode(vsCode, fsCode) ((void)0)
|
||||
#define rlCompileShader(shaderCode, type) ((void)0)
|
||||
#define rlLoadShaderProgram(vShaderId, fShaderId) ((void)0)
|
||||
#define rlUnloadShaderProgram(id) ((void)0)
|
||||
#define rlGetLocationUniform(shaderId, uniformName) ((void)0)
|
||||
#define rlGetLocationAttrib(shaderId, attribName) ((void)0)
|
||||
#define rlSetUniform(locIndex, value, uniformType, count) ((void)0)
|
||||
#define rlSetUniformMatrix(locIndex, mat) ((void)0)
|
||||
#define rlSetUniformMatrices(locIndex, mat, count) ((void)0)
|
||||
#define rlSetUniformSampler(locIndex, textureId) ((void)0)
|
||||
#define rlSetShader(id, locs) ((void)0)
|
||||
#define rlLoadComputeShaderProgram(shaderId) ((void)0)
|
||||
#define rlComputeShaderDispatch(groupX, groupY, groupZ) ((void)0)
|
||||
#define rlLoadShaderBuffer(size, data, usageHint) ((void)0)
|
||||
#define rlUnloadShaderBuffer(ssboId) ((void)0)
|
||||
#define rlUpdateShaderBuffer(id, data, dataSize, offset) ((void)0)
|
||||
#define rlBindShaderBuffer(id, index) ((void)0)
|
||||
#define rlReadShaderBuffer(id, dest, count, offset) ((void)0)
|
||||
#define rlCopyShaderBuffer(destId, srcId, destOffset, srcOffset, count) ((void)0)
|
||||
#define rlGetShaderBufferSize(id) ((void)0)
|
||||
#define rlBindImageTexture(id, index, format, readonly) ((void)0)
|
||||
#define rlGetMatrixModelview() ((void)0)
|
||||
#define rlGetMatrixProjection() ((void)0)
|
||||
#define rlGetMatrixTransform() ((void)0)
|
||||
#define rlGetMatrixProjectionStereo(eye) ((void)0)
|
||||
#define rlGetMatrixViewOffsetStereo(eye) ((void)0)
|
||||
#define rlSetMatrixProjection(proj) ((void)0)
|
||||
#define rlSetMatrixModelview(view) ((void)0)
|
||||
#define rlSetMatrixProjectionStereo(right, left) ((void)0)
|
||||
#define rlSetMatrixViewOffsetStereo(right, left) ((void)0)
|
||||
#define rlLoadDrawCube() ((void)0)
|
||||
#define rlLoadDrawQuad() ((void)0)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
99
src/rcore.c
99
src/rcore.c
|
|
@ -26,6 +26,8 @@
|
|||
* - Linux DRM subsystem (KMS mode)
|
||||
* > PLATFORM_ANDROID:
|
||||
* - Android (ARM, ARM64)
|
||||
* > PLATFORM_HEADLESS:
|
||||
* - All platforms, dummy implementations
|
||||
*
|
||||
* CONFIGURATION:
|
||||
* #define SUPPORT_DEFAULT_FONT (default)
|
||||
|
|
@ -117,8 +119,10 @@
|
|||
#include <time.h> // Required for: time() [Used in InitTimer()]
|
||||
#include <math.h> // Required for: tan() [Used in BeginMode3D()], atan2f() [Used in LoadVrStereoConfig()]
|
||||
|
||||
#define RLGL_IMPLEMENTATION
|
||||
#include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2
|
||||
#ifndef PLATFORM_HEADLESS
|
||||
#define RLGL_IMPLEMENTATION
|
||||
#include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2
|
||||
#endif
|
||||
|
||||
#define RAYMATH_IMPLEMENTATION
|
||||
#include "raymath.h" // Vector2, Vector3, Quaternion and Matrix functionality
|
||||
|
|
@ -561,6 +565,8 @@ const char *TextFormat(const char *text, ...); // Formatting of text with variab
|
|||
#include "platforms/rcore_drm.c"
|
||||
#elif defined(PLATFORM_ANDROID)
|
||||
#include "platforms/rcore_android.c"
|
||||
#elif defined(PLATFORM_HEADLESS)
|
||||
#include "platforms/rcore_headless.c"
|
||||
#else
|
||||
// TODO: Include your custom platform backend!
|
||||
// i.e software rendering backend or console backend!
|
||||
|
|
@ -633,6 +639,8 @@ void InitWindow(int width, int height, const char *title)
|
|||
TRACELOG(LOG_INFO, "Platform backend: NATIVE DRM");
|
||||
#elif defined(PLATFORM_ANDROID)
|
||||
TRACELOG(LOG_INFO, "Platform backend: ANDROID");
|
||||
#elif defined(PLATFORM_HEADLESS)
|
||||
TRACELOG(LOG_INFO, "Platform backend: HEADLESS");
|
||||
#else
|
||||
// TODO: Include your custom platform backend!
|
||||
// i.e software rendering backend or console backend!
|
||||
|
|
@ -642,6 +650,7 @@ void InitWindow(int width, int height, const char *title)
|
|||
TRACELOG(LOG_INFO, "Supported raylib modules:");
|
||||
TRACELOG(LOG_INFO, " > rcore:..... loaded (mandatory)");
|
||||
TRACELOG(LOG_INFO, " > rlgl:...... loaded (mandatory)");
|
||||
|
||||
#if defined(SUPPORT_MODULE_RSHAPES)
|
||||
TRACELOG(LOG_INFO, " > rshapes:... loaded (optional)");
|
||||
#else
|
||||
|
|
@ -693,6 +702,7 @@ void InitWindow(int width, int height, const char *title)
|
|||
}
|
||||
//--------------------------------------------------------------
|
||||
|
||||
#if !defined(PLATFORM_HEADLESS)
|
||||
// Initialize rlgl default data (buffers and shaders)
|
||||
// NOTE: CORE.Window.currentFbo.width and CORE.Window.currentFbo.height not used, just stored as globals in rlgl
|
||||
rlglInit(CORE.Window.currentFbo.width, CORE.Window.currentFbo.height);
|
||||
|
|
@ -701,38 +711,39 @@ void InitWindow(int width, int height, const char *title)
|
|||
// Setup default viewport
|
||||
SetupViewport(CORE.Window.currentFbo.width, CORE.Window.currentFbo.height);
|
||||
|
||||
#if defined(SUPPORT_MODULE_RTEXT)
|
||||
#if defined(SUPPORT_DEFAULT_FONT)
|
||||
// Load default font
|
||||
// WARNING: External function: Module required: rtext
|
||||
LoadFontDefault();
|
||||
#if defined(SUPPORT_MODULE_RTEXT)
|
||||
#if defined(SUPPORT_DEFAULT_FONT)
|
||||
// Load default font
|
||||
// WARNING: External function: Module required: rtext
|
||||
LoadFontDefault();
|
||||
#if defined(SUPPORT_MODULE_RSHAPES)
|
||||
// Set font white rectangle for shapes drawing, so shapes and text can be batched together
|
||||
// WARNING: rshapes module is required, if not available, default internal white rectangle is used
|
||||
Rectangle rec = GetFontDefault().recs[95];
|
||||
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
|
||||
{
|
||||
// NOTE: We try to maxime rec padding to avoid pixel bleeding on MSAA filtering
|
||||
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 2, rec.y + 2, 1, 1 });
|
||||
}
|
||||
else
|
||||
{
|
||||
// NOTE: We set up a 1px padding on char rectangle to avoid pixel bleeding
|
||||
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 1, rec.y + 1, rec.width - 2, rec.height - 2 });
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#if defined(SUPPORT_MODULE_RSHAPES)
|
||||
// Set font white rectangle for shapes drawing, so shapes and text can be batched together
|
||||
// WARNING: rshapes module is required, if not available, default internal white rectangle is used
|
||||
Rectangle rec = GetFontDefault().recs[95];
|
||||
if (CORE.Window.flags & FLAG_MSAA_4X_HINT)
|
||||
{
|
||||
// NOTE: We try to maxime rec padding to avoid pixel bleeding on MSAA filtering
|
||||
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 2, rec.y + 2, 1, 1 });
|
||||
}
|
||||
else
|
||||
{
|
||||
// NOTE: We set up a 1px padding on char rectangle to avoid pixel bleeding
|
||||
SetShapesTexture(GetFontDefault().texture, (Rectangle){ rec.x + 1, rec.y + 1, rec.width - 2, rec.height - 2 });
|
||||
}
|
||||
// Set default texture and rectangle to be used for shapes drawing
|
||||
// NOTE: rlgl default texture is a 1x1 pixel UNCOMPRESSED_R8G8B8A8
|
||||
Texture2D texture = { rlGetTextureIdDefault(), 1, 1, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };
|
||||
SetShapesTexture(texture, (Rectangle){ 0.0f, 0.0f, 1.0f, 1.0f }); // WARNING: Module required: rshapes
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#if defined(SUPPORT_MODULE_RSHAPES)
|
||||
// Set default texture and rectangle to be used for shapes drawing
|
||||
// NOTE: rlgl default texture is a 1x1 pixel UNCOMPRESSED_R8G8B8A8
|
||||
Texture2D texture = { rlGetTextureIdDefault(), 1, 1, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };
|
||||
SetShapesTexture(texture, (Rectangle){ 0.0f, 0.0f, 1.0f, 1.0f }); // WARNING: Module required: rshapes
|
||||
#endif
|
||||
#endif
|
||||
|
||||
CORE.Time.frameCounter = 0;
|
||||
CORE.Window.shouldClose = false;
|
||||
#endif
|
||||
|
||||
// Initialize random seed
|
||||
SetRandomSeed((unsigned int)time(NULL));
|
||||
|
|
@ -1028,27 +1039,32 @@ void EndDrawing(void)
|
|||
// Initialize 2D mode with custom camera (2D)
|
||||
void BeginMode2D(Camera2D camera)
|
||||
{
|
||||
#ifndef PLATFORM_HEADLESS
|
||||
rlDrawRenderBatchActive(); // Update and draw internal render batch
|
||||
|
||||
rlLoadIdentity(); // Reset current matrix (modelview)
|
||||
|
||||
// Apply 2d camera transformation to modelview
|
||||
rlMultMatrixf(MatrixToFloat(GetCameraMatrix2D(camera)));
|
||||
#endif
|
||||
}
|
||||
|
||||
// Ends 2D mode with custom camera
|
||||
void EndMode2D(void)
|
||||
{
|
||||
#ifndef PLATFORM_HEADLESS
|
||||
rlDrawRenderBatchActive(); // Update and draw internal render batch
|
||||
|
||||
rlLoadIdentity(); // Reset current matrix (modelview)
|
||||
|
||||
if (rlGetActiveFramebuffer() == 0) rlMultMatrixf(MatrixToFloat(CORE.Window.screenScale)); // Apply screen scaling if required
|
||||
#endif
|
||||
}
|
||||
|
||||
// Initializes 3D mode with custom camera (3D)
|
||||
void BeginMode3D(Camera camera)
|
||||
{
|
||||
#ifndef PLATFORM_HEADLESS
|
||||
rlDrawRenderBatchActive(); // Update and draw internal render batch
|
||||
|
||||
rlMatrixMode(RL_PROJECTION); // Switch to projection matrix
|
||||
|
|
@ -1083,11 +1099,13 @@ void BeginMode3D(Camera camera)
|
|||
rlMultMatrixf(MatrixToFloat(matView)); // Multiply modelview matrix by view matrix (camera)
|
||||
|
||||
rlEnableDepthTest(); // Enable DEPTH_TEST for 3D
|
||||
#endif
|
||||
}
|
||||
|
||||
// Ends 3D mode and returns to default 2D orthographic mode
|
||||
void EndMode3D(void)
|
||||
{
|
||||
#ifndef PLATFORM_HEADLESS
|
||||
rlDrawRenderBatchActive(); // Update and draw internal render batch
|
||||
|
||||
rlMatrixMode(RL_PROJECTION); // Switch to projection matrix
|
||||
|
|
@ -1099,6 +1117,7 @@ void EndMode3D(void)
|
|||
if (rlGetActiveFramebuffer() == 0) rlMultMatrixf(MatrixToFloat(CORE.Window.screenScale)); // Apply screen scaling if required
|
||||
|
||||
rlDisableDepthTest(); // Disable DEPTH_TEST for 2D
|
||||
#endif
|
||||
}
|
||||
|
||||
// Initializes render texture for drawing
|
||||
|
|
@ -1237,6 +1256,7 @@ VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device)
|
|||
{
|
||||
VrStereoConfig config = { 0 };
|
||||
|
||||
#ifndef PLATFORM_HEADLESS
|
||||
if (rlGetVersion() != RL_OPENGL_11)
|
||||
{
|
||||
// Compute aspect ratio
|
||||
|
|
@ -1302,6 +1322,7 @@ VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device)
|
|||
*/
|
||||
}
|
||||
else TRACELOG(LOG_WARNING, "RLGL: VR Simulator not supported on OpenGL 1.1");
|
||||
#endif
|
||||
|
||||
return config;
|
||||
}
|
||||
|
|
@ -1343,6 +1364,7 @@ Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode)
|
|||
{
|
||||
Shader shader = { 0 };
|
||||
|
||||
#ifndef PLATFORM_HEADLESS
|
||||
shader.id = rlLoadShaderCode(vsCode, fsCode);
|
||||
|
||||
if (shader.id == rlGetShaderIdDefault()) shader.locs = rlGetShaderLocsDefault();
|
||||
|
|
@ -1391,6 +1413,7 @@ Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode)
|
|||
shader.locs[SHADER_LOC_MAP_SPECULAR] = rlGetLocationUniform(shader.id, RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE1); // SHADER_LOC_MAP_METALNESS
|
||||
shader.locs[SHADER_LOC_MAP_NORMAL] = rlGetLocationUniform(shader.id, RL_DEFAULT_SHADER_SAMPLER2D_NAME_TEXTURE2);
|
||||
}
|
||||
#endif
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
|
@ -1430,6 +1453,7 @@ bool IsShaderValid(Shader shader)
|
|||
// Unload shader from GPU memory (VRAM)
|
||||
void UnloadShader(Shader shader)
|
||||
{
|
||||
#ifndef PLATFORM_HEADLESS
|
||||
if (shader.id != rlGetShaderIdDefault())
|
||||
{
|
||||
rlUnloadShaderProgram(shader.id);
|
||||
|
|
@ -1437,18 +1461,27 @@ void UnloadShader(Shader shader)
|
|||
// NOTE: If shader loading failed, it should be 0
|
||||
RL_FREE(shader.locs);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Get shader uniform location
|
||||
int GetShaderLocation(Shader shader, const char *uniformName)
|
||||
{
|
||||
#ifndef PLATFORM_HEADLESS
|
||||
return rlGetLocationUniform(shader.id, uniformName);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Get shader attribute location
|
||||
int GetShaderLocationAttrib(Shader shader, const char *attribName)
|
||||
{
|
||||
#ifndef PLATFORM_HEADLESS
|
||||
return rlGetLocationAttrib(shader.id, attribName);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Set shader uniform value
|
||||
|
|
@ -1507,6 +1540,7 @@ Ray GetScreenToWorldRayEx(Vector2 position, Camera camera, int width, int height
|
|||
{
|
||||
Ray ray = { 0 };
|
||||
|
||||
#ifndef PLATFORM_HEADLESS
|
||||
// Calculate normalized device coordinates
|
||||
// NOTE: y value is negative
|
||||
float x = (2.0f*position.x)/(float)width - 1.0f;
|
||||
|
|
@ -1554,6 +1588,7 @@ Ray GetScreenToWorldRayEx(Vector2 position, Camera camera, int width, int height
|
|||
|
||||
// Apply calculated vectors to ray
|
||||
ray.direction = direction;
|
||||
#endif
|
||||
|
||||
return ray;
|
||||
}
|
||||
|
|
@ -1605,6 +1640,9 @@ Vector2 GetWorldToScreen(Vector3 position, Camera camera)
|
|||
// Get size position for a 3d world space position (useful for texture drawing)
|
||||
Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int height)
|
||||
{
|
||||
Vector2 result = { 0 };
|
||||
|
||||
#ifndef PLATFORM_HEADLESS
|
||||
// Calculate projection matrix (from perspective instead of frustum
|
||||
Matrix matProj = MatrixIdentity();
|
||||
|
||||
|
|
@ -1643,7 +1681,10 @@ Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int heigh
|
|||
// Calculate 2d screen position vector
|
||||
Vector2 screenPosition = { (ndcPos.x + 1.0f)/2.0f*(float)width, (ndcPos.y + 1.0f)/2.0f*(float)height };
|
||||
|
||||
return screenPosition;
|
||||
result = screenPosition;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Get the screen space position for a 2d camera world space position
|
||||
|
|
|
|||
|
|
@ -53,7 +53,9 @@
|
|||
|
||||
#if defined(SUPPORT_MODULE_RSHAPES)
|
||||
|
||||
#include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2
|
||||
#ifndef PLATFORM_HEADLESS
|
||||
#include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2
|
||||
#endif
|
||||
|
||||
#include <math.h> // Required for: sinf(), asinf(), cosf(), acosf(), sqrtf(), fabsf()
|
||||
#include <float.h> // Required for: FLT_EPSILON
|
||||
|
|
@ -821,6 +823,7 @@ void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Col
|
|||
// but it solves another issue: https://github.com/raysan5/raylib/issues/3884
|
||||
void DrawRectangleLines(int posX, int posY, int width, int height, Color color)
|
||||
{
|
||||
#ifndef PLATFORM_HEADLESS
|
||||
Matrix mat = rlGetMatrixTransform();
|
||||
float xOffset = 0.5f/mat.m0;
|
||||
float yOffset = 0.5f/mat.m5;
|
||||
|
|
@ -839,6 +842,7 @@ void DrawRectangleLines(int posX, int posY, int width, int height, Color color)
|
|||
rlVertex2f((float)posX + xOffset, (float)posY + (float)height - yOffset);
|
||||
rlVertex2f((float)posX + xOffset, (float)posY + yOffset);
|
||||
rlEnd();
|
||||
#endif
|
||||
|
||||
/*
|
||||
// Previous implementation, it has issues... but it does not require view matrix...
|
||||
|
|
|
|||
|
|
@ -63,7 +63,9 @@
|
|||
#if defined(SUPPORT_MODULE_RTEXT)
|
||||
|
||||
#include "utils.h" // Required for: LoadFile*()
|
||||
#include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2 -> Only DrawTextPro()
|
||||
#ifndef PLATFORM_HEADLESS
|
||||
#include "rlgl.h" // OpenGL abstraction layer to OpenGL 1.1, 2.1, 3.3+ or ES2 -> Only DrawTextPro()
|
||||
#endif
|
||||
|
||||
#include <stdlib.h> // Required for: malloc(), free()
|
||||
#include <stdio.h> // Required for: vsprintf()
|
||||
|
|
|
|||
|
|
@ -310,6 +310,9 @@ ifeq ($(PLATFORM),PLATFORM_DRM)
|
|||
# NOTE: Required packages: libasound2-dev (ALSA)
|
||||
LDLIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lgbm -ldrm -ldl
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_HEADLESS)
|
||||
LDLIBS = -lraylib
|
||||
endif
|
||||
|
||||
|
||||
# Define all object files from source files
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user