Merge branch 'raysan5-master'
Updated to the latest changes on raysan5-master Reverted some "trigger-format-finger" code in raylib.h Minor API changes
This commit is contained in:
commit
22249b72cf
17
src/core.c
17
src/core.c
|
|
@ -273,6 +273,7 @@ static GLFWwindow *window; // Native window (graphic device
|
||||||
#endif
|
#endif
|
||||||
static bool windowReady = false; // Check if window has been initialized successfully
|
static bool windowReady = false; // Check if window has been initialized successfully
|
||||||
static bool windowMinimized = false; // Check if window has been minimized
|
static bool windowMinimized = false; // Check if window has been minimized
|
||||||
|
static bool windowResized = false; // Check if window has been resized
|
||||||
static const char *windowTitle = NULL; // Window text title...
|
static const char *windowTitle = NULL; // Window text title...
|
||||||
|
|
||||||
static unsigned int displayWidth, displayHeight;// Display width and height (monitor, device-screen, LCD, ...)
|
static unsigned int displayWidth, displayHeight;// Display width and height (monitor, device-screen, LCD, ...)
|
||||||
|
|
@ -742,6 +743,16 @@ bool IsWindowMinimized(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if window has been resized
|
||||||
|
bool IsWindowResized(void)
|
||||||
|
{
|
||||||
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) || defined(PLATFORM_UWP)
|
||||||
|
return windowResized;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Check if window is currently hidden
|
// Check if window is currently hidden
|
||||||
bool IsWindowHidden(void)
|
bool IsWindowHidden(void)
|
||||||
{
|
{
|
||||||
|
|
@ -990,6 +1001,8 @@ const char *GetClipboardText(void)
|
||||||
{
|
{
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
return glfwGetClipboardString(window);
|
return glfwGetClipboardString(window);
|
||||||
|
#else
|
||||||
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3136,6 +3149,8 @@ static void PollInputEvents(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
windowResized = false;
|
||||||
|
|
||||||
#if defined(SUPPORT_EVENTS_WAITING)
|
#if defined(SUPPORT_EVENTS_WAITING)
|
||||||
glfwWaitEvents();
|
glfwWaitEvents();
|
||||||
#else
|
#else
|
||||||
|
|
@ -3412,6 +3427,8 @@ static void WindowSizeCallback(GLFWwindow *window, int width, int height)
|
||||||
currentHeight = height;
|
currentHeight = height;
|
||||||
|
|
||||||
// NOTE: Postprocessing texture is not scaled to new size
|
// NOTE: Postprocessing texture is not scaled to new size
|
||||||
|
|
||||||
|
windowResized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GLFW3 WindowIconify Callback, runs when window is minimized/restored
|
// GLFW3 WindowIconify Callback, runs when window is minimized/restored
|
||||||
|
|
|
||||||
|
|
@ -367,7 +367,7 @@ static mal_uint32 OnAudioBufferDSPRead(mal_dsp *pDSP, mal_uint32 frameCount, voi
|
||||||
{
|
{
|
||||||
AudioBuffer *audioBuffer = (AudioBuffer *)pUserData;
|
AudioBuffer *audioBuffer = (AudioBuffer *)pUserData;
|
||||||
|
|
||||||
mal_uint32 subBufferSizeInFrames = audioBuffer->bufferSizeInFrames/2;
|
mal_uint32 subBufferSizeInFrames = (audioBuffer->bufferSizeInFrames > 1)? audioBuffer->bufferSizeInFrames/2 : audioBuffer->bufferSizeInFrames;
|
||||||
mal_uint32 currentSubBufferIndex = audioBuffer->frameCursorPos/subBufferSizeInFrames;
|
mal_uint32 currentSubBufferIndex = audioBuffer->frameCursorPos/subBufferSizeInFrames;
|
||||||
|
|
||||||
if (currentSubBufferIndex > 1)
|
if (currentSubBufferIndex > 1)
|
||||||
|
|
|
||||||
307
src/raylib.h
307
src/raylib.h
|
|
@ -75,11 +75,9 @@
|
||||||
#include <inttypes.h> // Required for rnet
|
#include <inttypes.h> // Required for rnet
|
||||||
|
|
||||||
#if defined(_WIN32) && defined(BUILD_LIBTYPE_SHARED)
|
#if defined(_WIN32) && defined(BUILD_LIBTYPE_SHARED)
|
||||||
# define RLAPI \
|
#define RLAPI __declspec(dllexport) // We are building raylib as a Win32 shared library (.dll)
|
||||||
__declspec(dllexport) // We are building raylib as a Win32 shared library (.dll)
|
|
||||||
#elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED)
|
#elif defined(_WIN32) && defined(USE_LIBTYPE_SHARED)
|
||||||
# define RLAPI \
|
#define RLAPI __declspec(dllimport) // We are using raylib as a Win32 shared library (.dll)
|
||||||
__declspec(dllimport) // We are using raylib as a Win32 shared library (.dll)
|
|
||||||
#else
|
#else
|
||||||
#define RLAPI // We are building or using raylib as a static library (or Linux shared library)
|
#define RLAPI // We are building or using raylib as a static library (or Linux shared library)
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -97,10 +95,8 @@
|
||||||
#define MAX_TOUCH_POINTS 10 // Maximum number of touch points supported
|
#define MAX_TOUCH_POINTS 10 // Maximum number of touch points supported
|
||||||
|
|
||||||
// Shader and material limits
|
// Shader and material limits
|
||||||
#define MAX_SHADER_LOCATIONS \
|
#define MAX_SHADER_LOCATIONS 32 // Maximum number of predefined locations stored in shader struct
|
||||||
32 // Maximum number of predefined locations stored in shader struct
|
#define MAX_MATERIAL_MAPS 12 // Maximum number of texture maps stored in shader struct
|
||||||
#define MAX_MATERIAL_MAPS \
|
|
||||||
12 // Maximum number of texture maps stored in shader struct
|
|
||||||
|
|
||||||
// Network defines
|
// Network defines
|
||||||
#define SOCKET_MAX_SET_SIZE 32
|
#define SOCKET_MAX_SET_SIZE 32
|
||||||
|
|
@ -118,11 +114,9 @@
|
||||||
// getnameinfo() defines
|
// getnameinfo() defines
|
||||||
#define NAME_INFO_DEFAULT 0x00 /* No flags set */
|
#define NAME_INFO_DEFAULT 0x00 /* No flags set */
|
||||||
#define NAME_INFO_NOFQDN 0x01 /* Only return nodename portion for local hosts */
|
#define NAME_INFO_NOFQDN 0x01 /* Only return nodename portion for local hosts */
|
||||||
#define NAME_INFO_NUMERICHOST \
|
#define NAME_INFO_NUMERICHOST 0x02 /* Return numeric form of the host's address */
|
||||||
0x02 /* Return numeric form of the host's address */
|
|
||||||
#define NAME_INFO_NAMEREQD 0x04 /* Error if the host's name not in DNS */
|
#define NAME_INFO_NAMEREQD 0x04 /* Error if the host's name not in DNS */
|
||||||
#define NAME_INFO_NUMERICSERV \
|
#define NAME_INFO_NUMERICSERV 0x08 /* Return numeric form of the service (port #) */
|
||||||
0x08 /* Return numeric form of the service (port #) */
|
|
||||||
#define NAME_INFO_DGRAM 0x10 /* Service is a datagram service */
|
#define NAME_INFO_DGRAM 0x10 /* Service is a datagram service */
|
||||||
|
|
||||||
// NOTE: MSC C++ compiler does not support compound literals (C99 feature)
|
// NOTE: MSC C++ compiler does not support compound literals (C99 feature)
|
||||||
|
|
@ -135,59 +129,33 @@
|
||||||
|
|
||||||
// Some Basic Colors
|
// Some Basic Colors
|
||||||
// NOTE: Custom raylib color palette for amazing visuals on WHITE background
|
// NOTE: Custom raylib color palette for amazing visuals on WHITE background
|
||||||
#define LIGHTGRAY \
|
#define LIGHTGRAY CLITERAL{ 200, 200, 200, 255 } // Light Gray
|
||||||
CLITERAL { 200, 200, 200, 255 } // Light Gray
|
#define GRAY CLITERAL{ 130, 130, 130, 255 } // Gray
|
||||||
#define GRAY \
|
#define DARKGRAY CLITERAL{ 80, 80, 80, 255 } // Dark Gray
|
||||||
CLITERAL { 130, 130, 130, 255 } // Gray
|
#define YELLOW CLITERAL{ 253, 249, 0, 255 } // Yellow
|
||||||
#define DARKGRAY \
|
#define GOLD CLITERAL{ 255, 203, 0, 255 } // Gold
|
||||||
CLITERAL { 80, 80, 80, 255 } // Dark Gray
|
#define ORANGE CLITERAL{ 255, 161, 0, 255 } // Orange
|
||||||
#define YELLOW \
|
#define PINK CLITERAL{ 255, 109, 194, 255 } // Pink
|
||||||
CLITERAL { 253, 249, 0, 255 } // Yellow
|
#define RED CLITERAL{ 230, 41, 55, 255 } // Red
|
||||||
#define GOLD \
|
#define MAROON CLITERAL{ 190, 33, 55, 255 } // Maroon
|
||||||
CLITERAL { 255, 203, 0, 255 } // Gold
|
#define GREEN CLITERAL{ 0, 228, 48, 255 } // Green
|
||||||
#define ORANGE \
|
#define LIME CLITERAL{ 0, 158, 47, 255 } // Lime
|
||||||
CLITERAL { 255, 161, 0, 255 } // Orange
|
#define DARKGREEN CLITERAL{ 0, 117, 44, 255 } // Dark Green
|
||||||
#define PINK \
|
#define SKYBLUE CLITERAL{ 102, 191, 255, 255 } // Sky Blue
|
||||||
CLITERAL { 255, 109, 194, 255 } // Pink
|
#define BLUE CLITERAL{ 0, 121, 241, 255 } // Blue
|
||||||
#define RED \
|
#define DARKBLUE CLITERAL{ 0, 82, 172, 255 } // Dark Blue
|
||||||
CLITERAL { 230, 41, 55, 255 } // Red
|
#define PURPLE CLITERAL{ 200, 122, 255, 255 } // Purple
|
||||||
#define MAROON \
|
#define VIOLET CLITERAL{ 135, 60, 190, 255 } // Violet
|
||||||
CLITERAL { 190, 33, 55, 255 } // Maroon
|
#define DARKPURPLE CLITERAL{ 112, 31, 126, 255 } // Dark Purple
|
||||||
#define GREEN \
|
#define BEIGE CLITERAL{ 211, 176, 131, 255 } // Beige
|
||||||
CLITERAL { 0, 228, 48, 255 } // Green
|
#define BROWN CLITERAL{ 127, 106, 79, 255 } // Brown
|
||||||
#define LIME \
|
#define DARKBROWN CLITERAL{ 76, 63, 47, 255 } // Dark Brown
|
||||||
CLITERAL { 0, 158, 47, 255 } // Lime
|
|
||||||
#define DARKGREEN \
|
|
||||||
CLITERAL { 0, 117, 44, 255 } // Dark Green
|
|
||||||
#define SKYBLUE \
|
|
||||||
CLITERAL { 102, 191, 255, 255 } // Sky Blue
|
|
||||||
#define BLUE \
|
|
||||||
CLITERAL { 0, 121, 241, 255 } // Blue
|
|
||||||
#define DARKBLUE \
|
|
||||||
CLITERAL { 0, 82, 172, 255 } // Dark Blue
|
|
||||||
#define PURPLE \
|
|
||||||
CLITERAL { 200, 122, 255, 255 } // Purple
|
|
||||||
#define VIOLET \
|
|
||||||
CLITERAL { 135, 60, 190, 255 } // Violet
|
|
||||||
#define DARKPURPLE \
|
|
||||||
CLITERAL { 112, 31, 126, 255 } // Dark Purple
|
|
||||||
#define BEIGE \
|
|
||||||
CLITERAL { 211, 176, 131, 255 } // Beige
|
|
||||||
#define BROWN \
|
|
||||||
CLITERAL { 127, 106, 79, 255 } // Brown
|
|
||||||
#define DARKBROWN \
|
|
||||||
CLITERAL { 76, 63, 47, 255 } // Dark Brown
|
|
||||||
|
|
||||||
#define WHITE \
|
#define WHITE CLITERAL{ 255, 255, 255, 255 } // White
|
||||||
CLITERAL { 255, 255, 255, 255 } // White
|
#define BLACK CLITERAL{ 0, 0, 0, 255 } // Black
|
||||||
#define BLACK \
|
#define BLANK CLITERAL{ 0, 0, 0, 0 } // Blank (Transparent)
|
||||||
CLITERAL { 0, 0, 0, 255 } // Black
|
#define MAGENTA CLITERAL{ 255, 0, 255, 255 } // Magenta
|
||||||
#define BLANK \
|
#define RAYWHITE CLITERAL{ 245, 245, 245, 255 } // My own White (raylib logo)
|
||||||
CLITERAL { 0, 0, 0, 0 } // Blank (Transparent)
|
|
||||||
#define MAGENTA \
|
|
||||||
CLITERAL { 255, 0, 255, 255 } // Magenta
|
|
||||||
#define RAYWHITE \
|
|
||||||
CLITERAL { 245, 245, 245, 255 } // My own White (raylib logo)
|
|
||||||
|
|
||||||
// Temporal hack to avoid breaking old codebases using
|
// Temporal hack to avoid breaking old codebases using
|
||||||
// deprecated raylib implementation of these functions
|
// deprecated raylib implementation of these functions
|
||||||
|
|
@ -202,34 +170,27 @@
|
||||||
#if defined(__STDC__) && __STDC_VERSION__ >= 199901L
|
#if defined(__STDC__) && __STDC_VERSION__ >= 199901L
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#elif !defined(__cplusplus) && !defined(bool)
|
#elif !defined(__cplusplus) && !defined(bool)
|
||||||
typedef enum
|
typedef enum { false, true } bool;
|
||||||
{
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
} bool;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Network typedefs
|
// Network typedefs
|
||||||
typedef int32_t SocketChannel;
|
typedef int32_t SocketChannel;
|
||||||
|
|
||||||
// Vector2 type
|
// Vector2 type
|
||||||
typedef struct Vector2
|
typedef struct Vector2 {
|
||||||
{
|
|
||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
} Vector2;
|
} Vector2;
|
||||||
|
|
||||||
// Vector3 type
|
// Vector3 type
|
||||||
typedef struct Vector3
|
typedef struct Vector3 {
|
||||||
{
|
|
||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
float z;
|
float z;
|
||||||
} Vector3;
|
} Vector3;
|
||||||
|
|
||||||
// Vector4 type
|
// Vector4 type
|
||||||
typedef struct Vector4
|
typedef struct Vector4 {
|
||||||
{
|
|
||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
float z;
|
float z;
|
||||||
|
|
@ -240,8 +201,7 @@ typedef struct Vector4
|
||||||
typedef Vector4 Quaternion;
|
typedef Vector4 Quaternion;
|
||||||
|
|
||||||
// Matrix type (OpenGL style 4x4 - right handed, column major)
|
// Matrix type (OpenGL style 4x4 - right handed, column major)
|
||||||
typedef struct Matrix
|
typedef struct Matrix {
|
||||||
{
|
|
||||||
float m0, m4, m8, m12;
|
float m0, m4, m8, m12;
|
||||||
float m1, m5, m9, m13;
|
float m1, m5, m9, m13;
|
||||||
float m2, m6, m10, m14;
|
float m2, m6, m10, m14;
|
||||||
|
|
@ -249,8 +209,7 @@ typedef struct Matrix
|
||||||
} Matrix;
|
} Matrix;
|
||||||
|
|
||||||
// Color type, RGBA (32bit)
|
// Color type, RGBA (32bit)
|
||||||
typedef struct Color
|
typedef struct Color {
|
||||||
{
|
|
||||||
unsigned char r;
|
unsigned char r;
|
||||||
unsigned char g;
|
unsigned char g;
|
||||||
unsigned char b;
|
unsigned char b;
|
||||||
|
|
@ -258,8 +217,7 @@ typedef struct Color
|
||||||
} Color;
|
} Color;
|
||||||
|
|
||||||
// Rectangle type
|
// Rectangle type
|
||||||
typedef struct Rectangle
|
typedef struct Rectangle {
|
||||||
{
|
|
||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
float width;
|
float width;
|
||||||
|
|
@ -268,8 +226,7 @@ typedef struct Rectangle
|
||||||
|
|
||||||
// Image type, bpp always RGBA (32bit)
|
// Image type, bpp always RGBA (32bit)
|
||||||
// NOTE: Data stored in CPU memory (RAM)
|
// NOTE: Data stored in CPU memory (RAM)
|
||||||
typedef struct Image
|
typedef struct Image {
|
||||||
{
|
|
||||||
void *data; // Image raw data
|
void *data; // Image raw data
|
||||||
int width; // Image base width
|
int width; // Image base width
|
||||||
int height; // Image base height
|
int height; // Image base height
|
||||||
|
|
@ -279,8 +236,7 @@ typedef struct Image
|
||||||
|
|
||||||
// Texture2D type
|
// Texture2D type
|
||||||
// NOTE: Data stored in GPU memory
|
// NOTE: Data stored in GPU memory
|
||||||
typedef struct Texture2D
|
typedef struct Texture2D {
|
||||||
{
|
|
||||||
unsigned int id; // OpenGL texture id
|
unsigned int id; // OpenGL texture id
|
||||||
int width; // Texture base width
|
int width; // Texture base width
|
||||||
int height; // Texture base height
|
int height; // Texture base height
|
||||||
|
|
@ -295,8 +251,7 @@ typedef Texture2D Texture;
|
||||||
typedef Texture2D TextureCubemap;
|
typedef Texture2D TextureCubemap;
|
||||||
|
|
||||||
// RenderTexture2D type, for texture rendering
|
// RenderTexture2D type, for texture rendering
|
||||||
typedef struct RenderTexture2D
|
typedef struct RenderTexture2D {
|
||||||
{
|
|
||||||
unsigned int id; // OpenGL Framebuffer Object (FBO) id
|
unsigned int id; // OpenGL Framebuffer Object (FBO) id
|
||||||
Texture2D texture; // Color buffer attachment texture
|
Texture2D texture; // Color buffer attachment texture
|
||||||
Texture2D depth; // Depth buffer attachment texture
|
Texture2D depth; // Depth buffer attachment texture
|
||||||
|
|
@ -307,8 +262,7 @@ typedef struct RenderTexture2D
|
||||||
typedef RenderTexture2D RenderTexture;
|
typedef RenderTexture2D RenderTexture;
|
||||||
|
|
||||||
// N-Patch layout info
|
// N-Patch layout info
|
||||||
typedef struct NPatchInfo
|
typedef struct NPatchInfo {
|
||||||
{
|
|
||||||
Rectangle sourceRec; // Region in the texture
|
Rectangle sourceRec; // Region in the texture
|
||||||
int left; // left border offset
|
int left; // left border offset
|
||||||
int top; // top border offset
|
int top; // top border offset
|
||||||
|
|
@ -318,8 +272,7 @@ typedef struct NPatchInfo
|
||||||
} NPatchInfo;
|
} NPatchInfo;
|
||||||
|
|
||||||
// Font character info
|
// Font character info
|
||||||
typedef struct CharInfo
|
typedef struct CharInfo {
|
||||||
{
|
|
||||||
int value; // Character value (Unicode)
|
int value; // Character value (Unicode)
|
||||||
Rectangle rec; // Character rectangle in sprite font
|
Rectangle rec; // Character rectangle in sprite font
|
||||||
int offsetX; // Character offset X when drawing
|
int offsetX; // Character offset X when drawing
|
||||||
|
|
@ -329,8 +282,7 @@ typedef struct CharInfo
|
||||||
} CharInfo;
|
} CharInfo;
|
||||||
|
|
||||||
// Font type, includes texture and charSet array data
|
// Font type, includes texture and charSet array data
|
||||||
typedef struct Font
|
typedef struct Font {
|
||||||
{
|
|
||||||
Texture2D texture; // Font texture
|
Texture2D texture; // Font texture
|
||||||
int baseSize; // Base size (default chars height)
|
int baseSize; // Base size (default chars height)
|
||||||
int charsCount; // Number of characters
|
int charsCount; // Number of characters
|
||||||
|
|
@ -340,8 +292,7 @@ typedef struct Font
|
||||||
#define SpriteFont Font // SpriteFont type fallback, defaults to Font
|
#define SpriteFont Font // SpriteFont type fallback, defaults to Font
|
||||||
|
|
||||||
// Camera type, defines a camera position/orientation in 3d space
|
// Camera type, defines a camera position/orientation in 3d space
|
||||||
typedef struct Camera3D
|
typedef struct Camera3D {
|
||||||
{
|
|
||||||
Vector3 position; // Camera position
|
Vector3 position; // Camera position
|
||||||
Vector3 target; // Camera target it looks-at
|
Vector3 target; // Camera target it looks-at
|
||||||
Vector3 up; // Camera up vector (rotation over its axis)
|
Vector3 up; // Camera up vector (rotation over its axis)
|
||||||
|
|
@ -352,8 +303,7 @@ typedef struct Camera3D
|
||||||
#define Camera Camera3D // Camera type fallback, defaults to Camera3D
|
#define Camera Camera3D // Camera type fallback, defaults to Camera3D
|
||||||
|
|
||||||
// Camera2D type, defines a 2d camera
|
// Camera2D type, defines a 2d camera
|
||||||
typedef struct Camera2D
|
typedef struct Camera2D {
|
||||||
{
|
|
||||||
Vector2 offset; // Camera offset (displacement from target)
|
Vector2 offset; // Camera offset (displacement from target)
|
||||||
Vector2 target; // Camera target (rotation and zoom origin)
|
Vector2 target; // Camera target (rotation and zoom origin)
|
||||||
float rotation; // Camera rotation in degrees
|
float rotation; // Camera rotation in degrees
|
||||||
|
|
@ -361,16 +311,14 @@ typedef struct Camera2D
|
||||||
} Camera2D;
|
} Camera2D;
|
||||||
|
|
||||||
// Bounding box type
|
// Bounding box type
|
||||||
typedef struct BoundingBox
|
typedef struct BoundingBox {
|
||||||
{
|
|
||||||
Vector3 min; // Minimum vertex box-corner
|
Vector3 min; // Minimum vertex box-corner
|
||||||
Vector3 max; // Maximum vertex box-corner
|
Vector3 max; // Maximum vertex box-corner
|
||||||
} BoundingBox;
|
} BoundingBox;
|
||||||
|
|
||||||
// Vertex data definning a mesh
|
// Vertex data definning a mesh
|
||||||
// NOTE: Data stored in CPU memory (and GPU)
|
// NOTE: Data stored in CPU memory (and GPU)
|
||||||
typedef struct Mesh
|
typedef struct Mesh {
|
||||||
{
|
|
||||||
int vertexCount; // Number of vertices stored in arrays
|
int vertexCount; // Number of vertices stored in arrays
|
||||||
int triangleCount; // Number of triangles stored (indexed or not)
|
int triangleCount; // Number of triangles stored (indexed or not)
|
||||||
|
|
||||||
|
|
@ -395,46 +343,49 @@ typedef struct Mesh
|
||||||
} Mesh;
|
} Mesh;
|
||||||
|
|
||||||
// Shader type (generic)
|
// Shader type (generic)
|
||||||
typedef struct Shader
|
typedef struct Shader {
|
||||||
{
|
|
||||||
unsigned int id; // Shader program id
|
unsigned int id; // Shader program id
|
||||||
int locs[MAX_SHADER_LOCATIONS]; // Shader locations array
|
int locs[MAX_SHADER_LOCATIONS]; // Shader locations array
|
||||||
} Shader;
|
} Shader;
|
||||||
|
|
||||||
// Material texture map
|
// Material texture map
|
||||||
typedef struct MaterialMap
|
typedef struct MaterialMap {
|
||||||
{
|
|
||||||
Texture2D texture; // Material map texture
|
Texture2D texture; // Material map texture
|
||||||
Color color; // Material map color
|
Color color; // Material map color
|
||||||
float value; // Material map value
|
float value; // Material map value
|
||||||
} MaterialMap;
|
} MaterialMap;
|
||||||
|
|
||||||
// Material type (generic)
|
// Material type (generic)
|
||||||
typedef struct Material
|
typedef struct Material {
|
||||||
{
|
|
||||||
Shader shader; // Material shader
|
Shader shader; // Material shader
|
||||||
MaterialMap maps[MAX_MATERIAL_MAPS]; // Material maps
|
MaterialMap maps[MAX_MATERIAL_MAPS]; // Material maps
|
||||||
float *params; // Material generic parameters (if required)
|
float *params; // Material generic parameters (if required)
|
||||||
} Material;
|
} Material;
|
||||||
|
|
||||||
// Model type
|
// Model type
|
||||||
typedef struct Model
|
typedef struct Model {
|
||||||
{
|
|
||||||
Mesh mesh; // Vertex data buffers (RAM and VRAM)
|
Mesh mesh; // Vertex data buffers (RAM and VRAM)
|
||||||
Matrix transform; // Local transform matrix
|
Matrix transform; // Local transform matrix
|
||||||
Material material; // Shader and textures data
|
Material material; // Shader and textures data
|
||||||
|
/*
|
||||||
|
Mesh *meshes; // Vertex data buffers (RAM and VRAM)
|
||||||
|
int meshCount;
|
||||||
|
|
||||||
|
Material *materials; // Shader and textures data
|
||||||
|
int materialCount;
|
||||||
|
|
||||||
|
int *meshMaterial; // Material assigned to every mesh
|
||||||
|
*/
|
||||||
} Model;
|
} Model;
|
||||||
|
|
||||||
// Ray type (useful for raycast)
|
// Ray type (useful for raycast)
|
||||||
typedef struct Ray
|
typedef struct Ray {
|
||||||
{
|
|
||||||
Vector3 position; // Ray position (origin)
|
Vector3 position; // Ray position (origin)
|
||||||
Vector3 direction; // Ray direction
|
Vector3 direction; // Ray direction
|
||||||
} Ray;
|
} Ray;
|
||||||
|
|
||||||
// Raycast hit information
|
// Raycast hit information
|
||||||
typedef struct RayHitInfo
|
typedef struct RayHitInfo {
|
||||||
{
|
|
||||||
bool hit; // Did the ray hit something?
|
bool hit; // Did the ray hit something?
|
||||||
float distance; // Distance to nearest hit
|
float distance; // Distance to nearest hit
|
||||||
Vector3 position; // Position of nearest hit
|
Vector3 position; // Position of nearest hit
|
||||||
|
|
@ -442,8 +393,7 @@ typedef struct RayHitInfo
|
||||||
} RayHitInfo;
|
} RayHitInfo;
|
||||||
|
|
||||||
// Wave type, defines audio wave data
|
// Wave type, defines audio wave data
|
||||||
typedef struct Wave
|
typedef struct Wave {
|
||||||
{
|
|
||||||
unsigned int sampleCount; // Number of samples
|
unsigned int sampleCount; // Number of samples
|
||||||
unsigned int sampleRate; // Frequency (samples per second)
|
unsigned int sampleRate; // Frequency (samples per second)
|
||||||
unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported)
|
unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported)
|
||||||
|
|
@ -452,8 +402,7 @@ typedef struct Wave
|
||||||
} Wave;
|
} Wave;
|
||||||
|
|
||||||
// Sound source type
|
// Sound source type
|
||||||
typedef struct Sound
|
typedef struct Sound {
|
||||||
{
|
|
||||||
void *audioBuffer; // Pointer to internal data used by the audio system
|
void *audioBuffer; // Pointer to internal data used by the audio system
|
||||||
|
|
||||||
unsigned int source; // Audio source id
|
unsigned int source; // Audio source id
|
||||||
|
|
@ -467,8 +416,7 @@ typedef struct MusicData *Music;
|
||||||
|
|
||||||
// Audio stream type
|
// Audio stream type
|
||||||
// NOTE: Useful to create custom audio streams not bound to a specific file
|
// NOTE: Useful to create custom audio streams not bound to a specific file
|
||||||
typedef struct AudioStream
|
typedef struct AudioStream {
|
||||||
{
|
|
||||||
unsigned int sampleRate; // Frequency (samples per second)
|
unsigned int sampleRate; // Frequency (samples per second)
|
||||||
unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported)
|
unsigned int sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported)
|
||||||
unsigned int channels; // Number of channels (1-mono, 2-stereo)
|
unsigned int channels; // Number of channels (1-mono, 2-stereo)
|
||||||
|
|
@ -481,8 +429,7 @@ typedef struct AudioStream
|
||||||
} AudioStream;
|
} AudioStream;
|
||||||
|
|
||||||
// Head-Mounted-Display device parameters
|
// Head-Mounted-Display device parameters
|
||||||
typedef struct VrDeviceInfo
|
typedef struct VrDeviceInfo {
|
||||||
{
|
|
||||||
int hResolution; // HMD horizontal resolution in pixels
|
int hResolution; // HMD horizontal resolution in pixels
|
||||||
int vResolution; // HMD vertical resolution in pixels
|
int vResolution; // HMD vertical resolution in pixels
|
||||||
float hScreenSize; // HMD horizontal size in meters
|
float hScreenSize; // HMD horizontal size in meters
|
||||||
|
|
@ -496,8 +443,7 @@ typedef struct VrDeviceInfo
|
||||||
} VrDeviceInfo;
|
} VrDeviceInfo;
|
||||||
|
|
||||||
// VR Stereo rendering configuration for simulator
|
// VR Stereo rendering configuration for simulator
|
||||||
typedef struct VrStereoConfig
|
typedef struct VrStereoConfig {
|
||||||
{
|
|
||||||
RenderTexture2D stereoFbo; // VR stereo rendering framebuffer
|
RenderTexture2D stereoFbo; // VR stereo rendering framebuffer
|
||||||
Shader distortionShader; // VR stereo rendering distortion shader
|
Shader distortionShader; // VR stereo rendering distortion shader
|
||||||
Matrix eyesProjection[2]; // VR stereo rendering eyes projection matrices
|
Matrix eyesProjection[2]; // VR stereo rendering eyes projection matrices
|
||||||
|
|
@ -506,35 +452,32 @@ typedef struct VrStereoConfig
|
||||||
int eyeViewportLeft[4]; // VR stereo rendering left eye viewport [x, y, w, h]
|
int eyeViewportLeft[4]; // VR stereo rendering left eye viewport [x, y, w, h]
|
||||||
} VrStereoConfig;
|
} VrStereoConfig;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// IPAddress definition (in network byte order)
|
// IPAddress definition (in network byte order)
|
||||||
typedef struct IPAddress
|
typedef struct IPAddress {
|
||||||
{
|
|
||||||
unsigned long host; /* 32-bit IPv4 host address */
|
unsigned long host; /* 32-bit IPv4 host address */
|
||||||
unsigned short port; /* 16-bit protocol port */
|
unsigned short port; /* 16-bit protocol port */
|
||||||
} IPAddress;
|
} IPAddress;
|
||||||
|
|
||||||
// An option ID, value, sizeof(value) tuple for setsockopt(2).
|
// An option ID, value, sizeof(value) tuple for setsockopt(2).
|
||||||
typedef struct SocketOpt
|
typedef struct SocketOpt {
|
||||||
{
|
|
||||||
int id;
|
int id;
|
||||||
void *value;
|
void *value;
|
||||||
int valueLen;
|
int valueLen;
|
||||||
} SocketOpt;
|
} SocketOpt;
|
||||||
|
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
SOCKET_TCP = 1, // SOCK_STREAM
|
SOCKET_TCP = 1, // SOCK_STREAM
|
||||||
SOCKET_UDP = 2 // SOCK_DGRAM
|
SOCKET_UDP = 2 // SOCK_DGRAM
|
||||||
} SocketType;
|
} SocketType;
|
||||||
|
|
||||||
typedef struct UDPChannel
|
typedef struct UDPChannel {
|
||||||
{
|
|
||||||
int numbound; // The total number of addresses this channel is bound to
|
int numbound; // The total number of addresses this channel is bound to
|
||||||
IPAddress address[SOCKET_MAX_UDPADDRESSES]; // The list of remote addresses this channel is bound to
|
IPAddress address[SOCKET_MAX_UDPADDRESSES]; // The list of remote addresses this channel is bound to
|
||||||
} UDPChannel;
|
} UDPChannel;
|
||||||
|
|
||||||
typedef struct Socket
|
typedef struct Socket {
|
||||||
{
|
|
||||||
int ready; // Is the socket ready? i.e. has information
|
int ready; // Is the socket ready? i.e. has information
|
||||||
int status; // The last status code to have occured using this socket
|
int status; // The last status code to have occured using this socket
|
||||||
bool isServer; // Is this socket a server socket (i.e. TCP/UDP Listen Server)
|
bool isServer; // Is this socket a server socket (i.e. TCP/UDP Listen Server)
|
||||||
|
|
@ -544,15 +487,13 @@ typedef struct Socket
|
||||||
struct UDPChannel bindings[SOCKET_MAX_UDPCHANNELS]; // The amount of channels (if UDP) this socket is bound to
|
struct UDPChannel bindings[SOCKET_MAX_UDPCHANNELS]; // The amount of channels (if UDP) this socket is bound to
|
||||||
} Socket;
|
} Socket;
|
||||||
|
|
||||||
typedef struct SocketSet
|
typedef struct SocketSet {
|
||||||
{
|
|
||||||
int numsockets;
|
int numsockets;
|
||||||
int maxsockets;
|
int maxsockets;
|
||||||
struct Socket **sockets;
|
struct Socket **sockets;
|
||||||
} SocketSet;
|
} SocketSet;
|
||||||
|
|
||||||
typedef struct SocketDataPacket
|
typedef struct SocketDataPacket {
|
||||||
{
|
|
||||||
int channel; /* The src/dst channel of the packet */
|
int channel; /* The src/dst channel of the packet */
|
||||||
unsigned char *data; /* The packet data */
|
unsigned char *data; /* The packet data */
|
||||||
int len; /* The length of the packet data */
|
int len; /* The length of the packet data */
|
||||||
|
|
@ -564,8 +505,7 @@ typedef struct SocketDataPacket
|
||||||
// Configuration for a socket. Not all of these fields need to
|
// Configuration for a socket. Not all of these fields need to
|
||||||
// be set, and ones omitted from a C99-style "designated initializer"
|
// be set, and ones omitted from a C99-style "designated initializer"
|
||||||
// struct literal will be zeroed out and replaced with defaults.
|
// struct literal will be zeroed out and replaced with defaults.
|
||||||
typedef struct SocketConfig
|
typedef struct SocketConfig {
|
||||||
{
|
|
||||||
// Hostname and port, for TCP or UDP sockets. */
|
// Hostname and port, for TCP or UDP sockets. */
|
||||||
char * host; // The host address in xxx.xxx.xxx.xxx form
|
char * host; // The host address in xxx.xxx.xxx.xxx form
|
||||||
char * port; // The target port/server in the form "http" or "25565"
|
char * port; // The target port/server in the form "http" or "25565"
|
||||||
|
|
@ -577,15 +517,13 @@ typedef struct SocketConfig
|
||||||
} SocketConfig;
|
} SocketConfig;
|
||||||
|
|
||||||
// Result from calling open with a given config.
|
// Result from calling open with a given config.
|
||||||
typedef struct SocketResult
|
typedef struct SocketResult {
|
||||||
{
|
|
||||||
int status;
|
int status;
|
||||||
Socket *socket;
|
Socket *socket;
|
||||||
} SocketResult;
|
} SocketResult;
|
||||||
|
|
||||||
//
|
//
|
||||||
typedef struct Packet
|
typedef struct Packet {
|
||||||
{
|
|
||||||
uint32_t size; // The total size of bytes in data
|
uint32_t size; // The total size of bytes in data
|
||||||
uint32_t offs; // The offset to data access
|
uint32_t offs; // The offset to data access
|
||||||
uint32_t maxs; // The max size of data
|
uint32_t maxs; // The max size of data
|
||||||
|
|
@ -605,8 +543,7 @@ typedef struct _SocketAddressStorage *SocketAddressStorage;
|
||||||
|
|
||||||
// System config flags
|
// System config flags
|
||||||
// NOTE: Used for bit masks
|
// NOTE: Used for bit masks
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
FLAG_SHOW_LOGO = 1, // Set to show raylib logo at startup
|
FLAG_SHOW_LOGO = 1, // Set to show raylib logo at startup
|
||||||
FLAG_FULLSCREEN_MODE = 2, // Set to run program in fullscreen
|
FLAG_FULLSCREEN_MODE = 2, // Set to run program in fullscreen
|
||||||
FLAG_WINDOW_RESIZABLE = 4, // Set to allow resizable window
|
FLAG_WINDOW_RESIZABLE = 4, // Set to allow resizable window
|
||||||
|
|
@ -618,8 +555,7 @@ typedef enum
|
||||||
} ConfigFlag;
|
} ConfigFlag;
|
||||||
|
|
||||||
// Trace log type
|
// Trace log type
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
LOG_ALL, // Display all logs
|
LOG_ALL, // Display all logs
|
||||||
LOG_TRACE,
|
LOG_TRACE,
|
||||||
LOG_DEBUG,
|
LOG_DEBUG,
|
||||||
|
|
@ -631,8 +567,7 @@ typedef enum
|
||||||
} TraceLogType;
|
} TraceLogType;
|
||||||
|
|
||||||
// Keyboard keys
|
// Keyboard keys
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
// Alphanumeric keys
|
// Alphanumeric keys
|
||||||
KEY_APOSTROPHE = 39,
|
KEY_APOSTROPHE = 39,
|
||||||
KEY_COMMA = 44,
|
KEY_COMMA = 44,
|
||||||
|
|
@ -746,8 +681,7 @@ typedef enum
|
||||||
} KeyboardKey;
|
} KeyboardKey;
|
||||||
|
|
||||||
// Android buttons
|
// Android buttons
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
KEY_BACK = 4,
|
KEY_BACK = 4,
|
||||||
KEY_MENU = 82,
|
KEY_MENU = 82,
|
||||||
KEY_VOLUME_UP = 24,
|
KEY_VOLUME_UP = 24,
|
||||||
|
|
@ -755,16 +689,14 @@ typedef enum
|
||||||
} AndroidButton;
|
} AndroidButton;
|
||||||
|
|
||||||
// Mouse buttons
|
// Mouse buttons
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
MOUSE_LEFT_BUTTON = 0,
|
MOUSE_LEFT_BUTTON = 0,
|
||||||
MOUSE_RIGHT_BUTTON = 1,
|
MOUSE_RIGHT_BUTTON = 1,
|
||||||
MOUSE_MIDDLE_BUTTON = 2
|
MOUSE_MIDDLE_BUTTON = 2
|
||||||
} MouseButton;
|
} MouseButton;
|
||||||
|
|
||||||
// Gamepad number
|
// Gamepad number
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
GAMEPAD_PLAYER1 = 0,
|
GAMEPAD_PLAYER1 = 0,
|
||||||
GAMEPAD_PLAYER2 = 1,
|
GAMEPAD_PLAYER2 = 1,
|
||||||
GAMEPAD_PLAYER3 = 2,
|
GAMEPAD_PLAYER3 = 2,
|
||||||
|
|
@ -774,8 +706,7 @@ typedef enum
|
||||||
// PS3 USB Controller Buttons
|
// PS3 USB Controller Buttons
|
||||||
// TODO: Provide a generic way to list gamepad controls schemes,
|
// TODO: Provide a generic way to list gamepad controls schemes,
|
||||||
// defining specific controls schemes is not a good option
|
// defining specific controls schemes is not a good option
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
GAMEPAD_PS3_BUTTON_TRIANGLE = 0,
|
GAMEPAD_PS3_BUTTON_TRIANGLE = 0,
|
||||||
GAMEPAD_PS3_BUTTON_CIRCLE = 1,
|
GAMEPAD_PS3_BUTTON_CIRCLE = 1,
|
||||||
GAMEPAD_PS3_BUTTON_CROSS = 2,
|
GAMEPAD_PS3_BUTTON_CROSS = 2,
|
||||||
|
|
@ -794,8 +725,7 @@ typedef enum
|
||||||
} GamepadPS3Button;
|
} GamepadPS3Button;
|
||||||
|
|
||||||
// PS3 USB Controller Axis
|
// PS3 USB Controller Axis
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
GAMEPAD_PS3_AXIS_LEFT_X = 0,
|
GAMEPAD_PS3_AXIS_LEFT_X = 0,
|
||||||
GAMEPAD_PS3_AXIS_LEFT_Y = 1,
|
GAMEPAD_PS3_AXIS_LEFT_Y = 1,
|
||||||
GAMEPAD_PS3_AXIS_RIGHT_X = 2,
|
GAMEPAD_PS3_AXIS_RIGHT_X = 2,
|
||||||
|
|
@ -805,8 +735,7 @@ typedef enum
|
||||||
} GamepadPS3Axis;
|
} GamepadPS3Axis;
|
||||||
|
|
||||||
// Xbox360 USB Controller Buttons
|
// Xbox360 USB Controller Buttons
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
GAMEPAD_XBOX_BUTTON_A = 0,
|
GAMEPAD_XBOX_BUTTON_A = 0,
|
||||||
GAMEPAD_XBOX_BUTTON_B = 1,
|
GAMEPAD_XBOX_BUTTON_B = 1,
|
||||||
GAMEPAD_XBOX_BUTTON_X = 2,
|
GAMEPAD_XBOX_BUTTON_X = 2,
|
||||||
|
|
@ -824,8 +753,7 @@ typedef enum
|
||||||
|
|
||||||
// Xbox360 USB Controller Axis,
|
// Xbox360 USB Controller Axis,
|
||||||
// NOTE: For Raspberry Pi, axis must be reconfigured
|
// NOTE: For Raspberry Pi, axis must be reconfigured
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
GAMEPAD_XBOX_AXIS_LEFT_X = 0, // [-1..1] (left->right)
|
GAMEPAD_XBOX_AXIS_LEFT_X = 0, // [-1..1] (left->right)
|
||||||
GAMEPAD_XBOX_AXIS_LEFT_Y = 1, // [1..-1] (up->down)
|
GAMEPAD_XBOX_AXIS_LEFT_Y = 1, // [1..-1] (up->down)
|
||||||
GAMEPAD_XBOX_AXIS_RIGHT_X = 2, // [-1..1] (left->right)
|
GAMEPAD_XBOX_AXIS_RIGHT_X = 2, // [-1..1] (left->right)
|
||||||
|
|
@ -835,8 +763,7 @@ typedef enum
|
||||||
} GamepadXbox360Axis;
|
} GamepadXbox360Axis;
|
||||||
|
|
||||||
// Android Gamepad Controller (SNES CLASSIC)
|
// Android Gamepad Controller (SNES CLASSIC)
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
GAMEPAD_ANDROID_DPAD_UP = 19,
|
GAMEPAD_ANDROID_DPAD_UP = 19,
|
||||||
GAMEPAD_ANDROID_DPAD_DOWN = 20,
|
GAMEPAD_ANDROID_DPAD_DOWN = 20,
|
||||||
GAMEPAD_ANDROID_DPAD_LEFT = 21,
|
GAMEPAD_ANDROID_DPAD_LEFT = 21,
|
||||||
|
|
@ -855,8 +782,7 @@ typedef enum
|
||||||
} GamepadAndroid;
|
} GamepadAndroid;
|
||||||
|
|
||||||
// Shader location point type
|
// Shader location point type
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
LOC_VERTEX_POSITION = 0,
|
LOC_VERTEX_POSITION = 0,
|
||||||
LOC_VERTEX_TEXCOORD01,
|
LOC_VERTEX_TEXCOORD01,
|
||||||
LOC_VERTEX_TEXCOORD02,
|
LOC_VERTEX_TEXCOORD02,
|
||||||
|
|
@ -888,8 +814,7 @@ typedef enum
|
||||||
#define LOC_MAP_SPECULAR LOC_MAP_METALNESS
|
#define LOC_MAP_SPECULAR LOC_MAP_METALNESS
|
||||||
|
|
||||||
// Shader uniform data types
|
// Shader uniform data types
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
UNIFORM_FLOAT = 0,
|
UNIFORM_FLOAT = 0,
|
||||||
UNIFORM_VEC2,
|
UNIFORM_VEC2,
|
||||||
UNIFORM_VEC3,
|
UNIFORM_VEC3,
|
||||||
|
|
@ -902,8 +827,7 @@ typedef enum
|
||||||
} ShaderUniformDataType;
|
} ShaderUniformDataType;
|
||||||
|
|
||||||
// Material map type
|
// Material map type
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
MAP_ALBEDO = 0, // MAP_DIFFUSE
|
MAP_ALBEDO = 0, // MAP_DIFFUSE
|
||||||
MAP_METALNESS = 1, // MAP_SPECULAR
|
MAP_METALNESS = 1, // MAP_SPECULAR
|
||||||
MAP_NORMAL = 2,
|
MAP_NORMAL = 2,
|
||||||
|
|
@ -922,8 +846,7 @@ typedef enum
|
||||||
|
|
||||||
// Pixel formats
|
// Pixel formats
|
||||||
// NOTE: Support depends on OpenGL version and platform
|
// NOTE: Support depends on OpenGL version and platform
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
UNCOMPRESSED_GRAYSCALE = 1, // 8 bit per pixel (no alpha)
|
UNCOMPRESSED_GRAYSCALE = 1, // 8 bit per pixel (no alpha)
|
||||||
UNCOMPRESSED_GRAY_ALPHA, // 8*2 bpp (2 channels)
|
UNCOMPRESSED_GRAY_ALPHA, // 8*2 bpp (2 channels)
|
||||||
UNCOMPRESSED_R5G6B5, // 16 bpp
|
UNCOMPRESSED_R5G6B5, // 16 bpp
|
||||||
|
|
@ -950,8 +873,7 @@ typedef enum
|
||||||
// Texture parameters: filter mode
|
// Texture parameters: filter mode
|
||||||
// NOTE 1: Filtering considers mipmaps if available in the texture
|
// NOTE 1: Filtering considers mipmaps if available in the texture
|
||||||
// NOTE 2: Filter is accordingly set for minification and magnification
|
// NOTE 2: Filter is accordingly set for minification and magnification
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
FILTER_POINT = 0, // No filter, just pixel aproximation
|
FILTER_POINT = 0, // No filter, just pixel aproximation
|
||||||
FILTER_BILINEAR, // Linear filtering
|
FILTER_BILINEAR, // Linear filtering
|
||||||
FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps)
|
FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps)
|
||||||
|
|
@ -961,8 +883,7 @@ typedef enum
|
||||||
} TextureFilterMode;
|
} TextureFilterMode;
|
||||||
|
|
||||||
// Cubemap layout type
|
// Cubemap layout type
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
CUBEMAP_AUTO_DETECT = 0, // Automatically detect layout type
|
CUBEMAP_AUTO_DETECT = 0, // Automatically detect layout type
|
||||||
CUBEMAP_LINE_VERTICAL, // Layout is defined by a vertical line with faces
|
CUBEMAP_LINE_VERTICAL, // Layout is defined by a vertical line with faces
|
||||||
CUBEMAP_LINE_HORIZONTAL, // Layout is defined by an horizontal line with faces
|
CUBEMAP_LINE_HORIZONTAL, // Layout is defined by an horizontal line with faces
|
||||||
|
|
@ -972,8 +893,7 @@ typedef enum
|
||||||
} CubemapLayoutType;
|
} CubemapLayoutType;
|
||||||
|
|
||||||
// Texture parameters: wrap mode
|
// Texture parameters: wrap mode
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
WRAP_REPEAT = 0, // Repeats texture in tiled mode
|
WRAP_REPEAT = 0, // Repeats texture in tiled mode
|
||||||
WRAP_CLAMP, // Clamps texture to edge pixel in tiled mode
|
WRAP_CLAMP, // Clamps texture to edge pixel in tiled mode
|
||||||
WRAP_MIRROR_REPEAT, // Mirrors and repeats the texture in tiled mode
|
WRAP_MIRROR_REPEAT, // Mirrors and repeats the texture in tiled mode
|
||||||
|
|
@ -981,16 +901,14 @@ typedef enum
|
||||||
} TextureWrapMode;
|
} TextureWrapMode;
|
||||||
|
|
||||||
// Font type, defines generation method
|
// Font type, defines generation method
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
FONT_DEFAULT = 0, // Default font generation, anti-aliased
|
FONT_DEFAULT = 0, // Default font generation, anti-aliased
|
||||||
FONT_BITMAP, // Bitmap font generation, no anti-aliasing
|
FONT_BITMAP, // Bitmap font generation, no anti-aliasing
|
||||||
FONT_SDF // SDF font generation, requires external shader
|
FONT_SDF // SDF font generation, requires external shader
|
||||||
} FontType;
|
} FontType;
|
||||||
|
|
||||||
// Color blending modes (pre-defined)
|
// Color blending modes (pre-defined)
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
BLEND_ALPHA = 0, // Blend textures considering alpha (default)
|
BLEND_ALPHA = 0, // Blend textures considering alpha (default)
|
||||||
BLEND_ADDITIVE, // Blend textures adding colors
|
BLEND_ADDITIVE, // Blend textures adding colors
|
||||||
BLEND_MULTIPLIED // Blend textures multiplying colors
|
BLEND_MULTIPLIED // Blend textures multiplying colors
|
||||||
|
|
@ -998,8 +916,7 @@ typedef enum
|
||||||
|
|
||||||
// Gestures type
|
// Gestures type
|
||||||
// NOTE: It could be used as flags to enable only some gestures
|
// NOTE: It could be used as flags to enable only some gestures
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
GESTURE_NONE = 0,
|
GESTURE_NONE = 0,
|
||||||
GESTURE_TAP = 1,
|
GESTURE_TAP = 1,
|
||||||
GESTURE_DOUBLETAP = 2,
|
GESTURE_DOUBLETAP = 2,
|
||||||
|
|
@ -1014,8 +931,7 @@ typedef enum
|
||||||
} GestureType;
|
} GestureType;
|
||||||
|
|
||||||
// Camera system modes
|
// Camera system modes
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
CAMERA_CUSTOM = 0,
|
CAMERA_CUSTOM = 0,
|
||||||
CAMERA_FREE,
|
CAMERA_FREE,
|
||||||
CAMERA_ORBITAL,
|
CAMERA_ORBITAL,
|
||||||
|
|
@ -1024,15 +940,13 @@ typedef enum
|
||||||
} CameraMode;
|
} CameraMode;
|
||||||
|
|
||||||
// Camera projection modes
|
// Camera projection modes
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
CAMERA_PERSPECTIVE = 0,
|
CAMERA_PERSPECTIVE = 0,
|
||||||
CAMERA_ORTHOGRAPHIC
|
CAMERA_ORTHOGRAPHIC
|
||||||
} CameraType;
|
} CameraType;
|
||||||
|
|
||||||
// Head Mounted Display devices
|
// Head Mounted Display devices
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
HMD_DEFAULT_DEVICE = 0,
|
HMD_DEFAULT_DEVICE = 0,
|
||||||
HMD_OCULUS_RIFT_DK2,
|
HMD_OCULUS_RIFT_DK2,
|
||||||
HMD_OCULUS_RIFT_CV1,
|
HMD_OCULUS_RIFT_CV1,
|
||||||
|
|
@ -1042,8 +956,7 @@ typedef enum
|
||||||
} VrDeviceType;
|
} VrDeviceType;
|
||||||
|
|
||||||
// Type of n-patch
|
// Type of n-patch
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
NPT_9PATCH = 0, // Npatch defined by 3x3 tiles
|
NPT_9PATCH = 0, // Npatch defined by 3x3 tiles
|
||||||
NPT_3PATCH_VERTICAL, // Npatch defined by 1x3 tiles
|
NPT_3PATCH_VERTICAL, // Npatch defined by 1x3 tiles
|
||||||
NPT_3PATCH_HORIZONTAL // Npatch defined by 3x1 tiles
|
NPT_3PATCH_HORIZONTAL // Npatch defined by 3x1 tiles
|
||||||
|
|
@ -1053,8 +966,7 @@ typedef enum
|
||||||
typedef void (*TraceLogCallback)(int logType, const char *text, va_list args);
|
typedef void (*TraceLogCallback)(int logType, const char *text, va_list args);
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C"
|
extern "C" { // Prevents name mangling of functions
|
||||||
{ // Prevents name mangling of functions
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
|
|
@ -1072,6 +984,7 @@ extern "C"
|
||||||
RLAPI void CloseWindow(void); // Close window and unload OpenGL context
|
RLAPI void CloseWindow(void); // Close window and unload OpenGL context
|
||||||
RLAPI bool IsWindowReady(void); // Check if window has been initialized successfully
|
RLAPI bool IsWindowReady(void); // Check if window has been initialized successfully
|
||||||
RLAPI bool IsWindowMinimized(void); // Check if window has been minimized (or lost focus)
|
RLAPI bool IsWindowMinimized(void); // Check if window has been minimized (or lost focus)
|
||||||
|
RLAPI bool IsWindowResized(void); // Check if window has been resized
|
||||||
RLAPI bool IsWindowHidden(void); // Check if window is currently hidden
|
RLAPI bool IsWindowHidden(void); // Check if window is currently hidden
|
||||||
RLAPI void ToggleFullscreen(void); // Toggle fullscreen mode (only PLATFORM_DESKTOP)
|
RLAPI void ToggleFullscreen(void); // Toggle fullscreen mode (only PLATFORM_DESKTOP)
|
||||||
RLAPI void UnhideWindow(void); // Show the window
|
RLAPI void UnhideWindow(void); // Show the window
|
||||||
|
|
@ -1369,7 +1282,8 @@ extern "C"
|
||||||
RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
|
RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
|
||||||
RLAPI void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using font and additional parameters
|
RLAPI void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using font and additional parameters
|
||||||
RLAPI void DrawTextRec(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rectangle limits
|
RLAPI void DrawTextRec(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint); // Draw text using font inside rectangle limits
|
||||||
RLAPI void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectText, Color selectBack); // Draw text using font inside rectangle limits with support for text selection
|
RLAPI void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint,
|
||||||
|
int selectStart, int selectLength, Color selectText, Color selectBack); // Draw text using font inside rectangle limits with support for text selection
|
||||||
|
|
||||||
// Text misc. functions
|
// Text misc. functions
|
||||||
RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font
|
RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font
|
||||||
|
|
@ -1635,7 +1549,6 @@ extern "C"
|
||||||
uint32_t PacketRead32(Packet *packet);
|
uint32_t PacketRead32(Packet *packet);
|
||||||
uint64_t PacketRead64(Packet *packet);
|
uint64_t PacketRead64(Packet *packet);
|
||||||
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
36
src/rlgl.h
36
src/rlgl.h
|
|
@ -728,6 +728,8 @@ typedef struct DrawCall {
|
||||||
//unsigned int vaoId; // Vertex Array id to be used on the draw
|
//unsigned int vaoId; // Vertex Array id to be used on the draw
|
||||||
//unsigned int shaderId; // Shader id to be used on the draw
|
//unsigned int shaderId; // Shader id to be used on the draw
|
||||||
unsigned int textureId; // Texture id to be used on the draw
|
unsigned int textureId; // Texture id to be used on the draw
|
||||||
|
// TODO: Support additional texture units?
|
||||||
|
|
||||||
//Matrix projection; // Projection matrix for this draw
|
//Matrix projection; // Projection matrix for this draw
|
||||||
//Matrix modelview; // Modelview matrix for this draw
|
//Matrix modelview; // Modelview matrix for this draw
|
||||||
} DrawCall;
|
} DrawCall;
|
||||||
|
|
@ -2725,18 +2727,18 @@ void rlDrawMesh(Mesh mesh, Material material, Matrix transform)
|
||||||
// Unload mesh data from CPU and GPU
|
// Unload mesh data from CPU and GPU
|
||||||
void rlUnloadMesh(Mesh *mesh)
|
void rlUnloadMesh(Mesh *mesh)
|
||||||
{
|
{
|
||||||
if (mesh->vertices != NULL) free(mesh->vertices);
|
free(mesh->vertices);
|
||||||
if (mesh->texcoords != NULL) free(mesh->texcoords);
|
free(mesh->texcoords);
|
||||||
if (mesh->normals != NULL) free(mesh->normals);
|
free(mesh->normals);
|
||||||
if (mesh->colors != NULL) free(mesh->colors);
|
free(mesh->colors);
|
||||||
if (mesh->tangents != NULL) free(mesh->tangents);
|
free(mesh->tangents);
|
||||||
if (mesh->texcoords2 != NULL) free(mesh->texcoords2);
|
free(mesh->texcoords2);
|
||||||
if (mesh->indices != NULL) free(mesh->indices);
|
free(mesh->indices);
|
||||||
|
|
||||||
if (mesh->baseVertices != NULL) free(mesh->baseVertices);
|
free(mesh->baseVertices);
|
||||||
if (mesh->baseNormals != NULL) free(mesh->baseNormals);
|
free(mesh->baseNormals);
|
||||||
if (mesh->weightBias != NULL) free(mesh->weightBias);
|
free(mesh->weightBias);
|
||||||
if (mesh->weightId != NULL) free(mesh->weightId);
|
free(mesh->weightId);
|
||||||
|
|
||||||
rlDeleteBuffers(mesh->vboId[0]); // vertex
|
rlDeleteBuffers(mesh->vboId[0]); // vertex
|
||||||
rlDeleteBuffers(mesh->vboId[1]); // texcoords
|
rlDeleteBuffers(mesh->vboId[1]); // texcoords
|
||||||
|
|
@ -4132,9 +4134,13 @@ static void DrawBuffersDefault(void)
|
||||||
|
|
||||||
glUniformMatrix4fv(currentShader.locs[LOC_MATRIX_MVP], 1, false, MatrixToFloat(matMVP));
|
glUniformMatrix4fv(currentShader.locs[LOC_MATRIX_MVP], 1, false, MatrixToFloat(matMVP));
|
||||||
glUniform4f(currentShader.locs[LOC_COLOR_DIFFUSE], 1.0f, 1.0f, 1.0f, 1.0f);
|
glUniform4f(currentShader.locs[LOC_COLOR_DIFFUSE], 1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
glUniform1i(currentShader.locs[LOC_MAP_DIFFUSE], 0);
|
glUniform1i(currentShader.locs[LOC_MAP_DIFFUSE], 0); // Provided value refers to the texture unit (active)
|
||||||
|
|
||||||
// NOTE: Additional map textures not considered for default buffers drawing
|
// TODO: Support additional texture units on custom shader
|
||||||
|
//if (currentShader->locs[LOC_MAP_SPECULAR] > 0) glUniform1i(currentShader.locs[LOC_MAP_SPECULAR], 1);
|
||||||
|
//if (currentShader->locs[LOC_MAP_NORMAL] > 0) glUniform1i(currentShader.locs[LOC_MAP_NORMAL], 2);
|
||||||
|
|
||||||
|
// NOTE: Right now additional map textures not considered for default buffers drawing
|
||||||
|
|
||||||
int vertexOffset = 0;
|
int vertexOffset = 0;
|
||||||
|
|
||||||
|
|
@ -4165,6 +4171,10 @@ static void DrawBuffersDefault(void)
|
||||||
{
|
{
|
||||||
glBindTexture(GL_TEXTURE_2D, draws[i].textureId);
|
glBindTexture(GL_TEXTURE_2D, draws[i].textureId);
|
||||||
|
|
||||||
|
// TODO: Find some way to bind additional textures --> Use global texture IDs? Register them on draw[i]?
|
||||||
|
//if (currentShader->locs[LOC_MAP_SPECULAR] > 0) { glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, textureUnit1_id); }
|
||||||
|
//if (currentShader->locs[LOC_MAP_SPECULAR] > 0) { glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, textureUnit2_id); }
|
||||||
|
|
||||||
if ((draws[i].mode == RL_LINES) || (draws[i].mode == RL_TRIANGLES)) glDrawArrays(draws[i].mode, vertexOffset, draws[i].vertexCount);
|
if ((draws[i].mode == RL_LINES) || (draws[i].mode == RL_TRIANGLES)) glDrawArrays(draws[i].mode, vertexOffset, draws[i].vertexCount);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* DEPENDENCIES:
|
* DEPENDENCIES:
|
||||||
* raylib.h - TraceLog
|
* raylib.h - TraceLog
|
||||||
* sysnet.h - platform-specific network includes
|
* rnet.h - platform-specific network includes
|
||||||
*
|
*
|
||||||
* CONTRIBUTORS:
|
* CONTRIBUTORS:
|
||||||
* Jak Barnes (github: @syphonx) (Feb. 2019):
|
* Jak Barnes (github: @syphonx) (Feb. 2019):
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
# include <stdarg.h>
|
# include <stdarg.h>
|
||||||
#else
|
#else
|
||||||
# include "raylib.h"
|
# include "raylib.h"
|
||||||
# include "sysnet.h"
|
# include "rnet.h"
|
||||||
# if !defined(EXTERNAL_CONFIG_FLAGS)
|
# if !defined(EXTERNAL_CONFIG_FLAGS)
|
||||||
# include "config.h" // Defines module configuration flags
|
# include "config.h" // Defines module configuration flags
|
||||||
# endif
|
# endif
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/**********************************************************************************************
|
/**********************************************************************************************
|
||||||
*
|
*
|
||||||
* sysnet - Provides cross-platform network defines, macros etc
|
* rnet - Provides cross-platform network defines, macros etc
|
||||||
*
|
*
|
||||||
* DEPENDENCIES:
|
* DEPENDENCIES:
|
||||||
* <limits.h> - Used for cross-platform type specifiers
|
* <limits.h> - Used for cross-platform type specifiers
|
||||||
|
|
@ -688,7 +688,6 @@ void UnloadFont(Font font)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < font.charsCount; i++)
|
for (int i = 0; i < font.charsCount; i++)
|
||||||
{
|
{
|
||||||
if(font.chars[i].data != NULL)
|
|
||||||
free(font.chars[i].data);
|
free(font.chars[i].data);
|
||||||
}
|
}
|
||||||
UnloadTexture(font.texture);
|
UnloadTexture(font.texture);
|
||||||
|
|
@ -1327,13 +1326,11 @@ int TextToInteger(const char *text)
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module specific Functions Definition
|
// Module specific Functions Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(SUPPORT_FILEFORMAT_FNT)
|
#if defined(SUPPORT_FILEFORMAT_FNT)
|
||||||
// Load a BMFont file (AngelCode font file)
|
// Load a BMFont file (AngelCode font file)
|
||||||
static Font LoadBMFont(const char *fileName)
|
static Font LoadBMFont(const char *fileName)
|
||||||
|
|
|
||||||
|
|
@ -353,7 +353,7 @@ Image LoadImageRaw(const char *fileName, int width, int height, int format, int
|
||||||
{
|
{
|
||||||
TraceLog(LOG_WARNING, "[%s] RAW image data can not be read, wrong requested format or size", fileName);
|
TraceLog(LOG_WARNING, "[%s] RAW image data can not be read, wrong requested format or size", fileName);
|
||||||
|
|
||||||
if (image.data != NULL) free(image.data);
|
free(image.data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -414,10 +414,7 @@ RenderTexture2D LoadRenderTexture(int width, int height)
|
||||||
// Unload image from CPU memory (RAM)
|
// Unload image from CPU memory (RAM)
|
||||||
void UnloadImage(Image image)
|
void UnloadImage(Image image)
|
||||||
{
|
{
|
||||||
if (image.data != NULL) free(image.data);
|
free(image.data);
|
||||||
|
|
||||||
// NOTE: It becomes anoying every time a texture is loaded
|
|
||||||
//TraceLog(LOG_INFO, "Unloaded image data");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unload texture from GPU memory (VRAM)
|
// Unload texture from GPU memory (VRAM)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user