mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-25 10:22:33 -05:00
Updated raylib data structures (markdown)
@ -3,53 +3,55 @@ Those structures are quite common in most of the engines out there.
|
|||||||
|
|
||||||
### raylib data structures
|
### raylib data structures
|
||||||
```c
|
```c
|
||||||
|
Struct name [32bit size] [64bit change] Description
|
||||||
|
-----------------------------------------------------------------------------------------------------------------------
|
||||||
// Basic data structures
|
// Basic data structures
|
||||||
struct Color; [ 4 bytes] // RGBA values, 4 char, 32bit color
|
struct Color; [ 4 bytes] - // RGBA values, 4 char, 32bit color
|
||||||
struct Rectangle; [16 bytes] // 4 float values
|
struct Rectangle; [16 bytes] - // 4 float values
|
||||||
struct Vector2; [ 8 bytes] // 2 float values
|
struct Vector2; [ 8 bytes] - // 2 float values
|
||||||
struct Vector3; [12 bytes] // 3 float values
|
struct Vector3; [12 bytes] - // 3 float values
|
||||||
struct Vector4; [16 bytes] // 4 float values
|
struct Vector4; [16 bytes] - // 4 float values
|
||||||
struct Matrix; [64 bytes] // 16 float values, right handed, column major
|
struct Matrix; [64 bytes] - // 16 float values, right handed, column major
|
||||||
struct Quaternion; [16 bytes] // Vector4 alias
|
struct Quaternion; [16 bytes] - // Vector4 alias
|
||||||
|
|
||||||
// 2D data structures (pixels, font...)
|
// 2D data structures (pixels, font...)
|
||||||
struct Image; [20 bytes] // Image data pointer (RAM) and 4 data parameters
|
struct Image; [20 bytes] [+4 bytes] // Image data pointer (RAM) and 4 data parameters
|
||||||
struct Texture2D; [20 bytes] // OpenGL texture id (VRAM) and basic info
|
struct Texture2D; [20 bytes] - // OpenGL texture id (VRAM) and basic info
|
||||||
struct Texture; [20 bytes] // Texture2D alias
|
struct Texture; [20 bytes] - // Texture2D alias
|
||||||
struct TextureCubemap; [20 bytes] // OpenGL cubemap texture id and basic info
|
struct TextureCubemap; [20 bytes] - // OpenGL cubemap texture id and basic info
|
||||||
struct RenderTexture2D; [28 bytes] // OpenGL framebuffer id and color+depth textures
|
struct RenderTexture2D; [28 bytes] - // OpenGL framebuffer id and color+depth textures
|
||||||
struct RenderTexture [28 bytes] // RenderTexture2D alias
|
struct RenderTexture [28 bytes] - // RenderTexture2D alias
|
||||||
|
|
||||||
struct NPatchInfo [36 bytes] // Source rectangle and border offsets
|
struct NPatchInfo [36 bytes] - // Source rectangle and border offsets
|
||||||
struct CharInfo; [32 bytes] // One character image and info properties
|
struct CharInfo; [32 bytes] [+4 bytes] // One character image and info properties
|
||||||
struct Font; [36 bytes] // Texture atlas and recs+chars data array pointers
|
struct Font; [36 bytes] [+12 bytes] // Texture atlas and recs+chars data array pointers
|
||||||
|
|
||||||
// Screen view structures
|
// Screen view structures
|
||||||
struct Camera2D; [24 bytes] // 2D camera offset, target, rotation and zoom
|
struct Camera2D; [24 bytes] - // 2D camera offset, target, rotation and zoom
|
||||||
struct Camera3D; [44 bytes] // 3D camera position, target, up vectors and parameters
|
struct Camera3D; [44 bytes] - // 3D camera position, target, up vectors and parameters
|
||||||
struct Camera; [44 bytes] // Camera3D alias
|
struct Camera; [44 bytes] - // Camera3D alias
|
||||||
struct VrDeviceInfo; [64 bytes] // Head-Mounted-Display device configuration parameters
|
struct VrDeviceInfo; [64 bytes] - // Head-Mounted-Display device configuration parameters
|
||||||
|
|
||||||
// 3D data structures (vertex, material properties...)
|
// 3D data structures (vertex, material properties...)
|
||||||
// NOTE: Those structures are more complex so they use some internal pointers to data
|
// NOTE: Those structures are more complex so they use some internal pointers to data
|
||||||
struct Mesh; [60 bytes] // Vertex data, OpenGL buffers ids, animation data (skeleton bones and pose)
|
struct Mesh; [60 bytes] [+52 bytes] // Vertex data, OpenGL buffers ids, animation data (skeleton bones and pose)
|
||||||
struct Shader; [ 8 bytes] // OpenGL program id, locations array pointer
|
struct Shader; [ 8 bytes] [+8 bytes] // OpenGL program id, locations array pointer
|
||||||
struct Material; [16 bytes] // Shader and maps array pointer
|
struct Material; [16 bytes] [+16 bytes] // Shader and maps array pointer
|
||||||
struct MaterialMap [28 bytes] // Texture, color and value
|
struct MaterialMap [28 bytes] - // Texture, color and value
|
||||||
struct Model; [96 bytes] // Meshes+materials array pointers, transform matrix (64 bytes)
|
struct Model; [96 bytes] [+24 bytes] // Meshes+materials array pointers, transform matrix (64 bytes)
|
||||||
struct ModelAnimation; [16 bytes] // Skeletal bones data and frames transformation
|
struct ModelAnimation; [16 bytes] [+8 bytes] // Skeletal bones data and frames transformation
|
||||||
struct BoneInfo; [36 bytes] // Bone name (32 bytes) and parent id
|
struct BoneInfo; [36 bytes] - // Bone name (32 bytes) and parent id
|
||||||
struct Transform; [40 bytes] // Vertex transformation: translation, rotation, scale
|
struct Transform; [40 bytes] - // Vertex transformation: translation, rotation, scale
|
||||||
|
|
||||||
struct Ray; [24 bytes] // Ray-casting position+direction vectors
|
struct Ray; [24 bytes] - // Ray-casting position+direction vectors
|
||||||
struct RayHitInfo; [32 bytes] // Ray collision information
|
struct RayHitInfo; [32 bytes] - // Ray collision information
|
||||||
struct BoundingBox; [12 bytes] // Defined by min and max vertex
|
struct BoundingBox; [12 bytes] - // Defined by min and max vertex
|
||||||
|
|
||||||
// Audio related data
|
// Audio related data
|
||||||
struct Wave; [20 bytes] // Wave data pointer (RAM) and data parameters
|
struct Wave; [20 bytes] [+4 bytes] // Wave data pointer (RAM) and data parameters
|
||||||
struct AudioStream; [16 bytes] // Audio buffer pointer (private) and parameters
|
struct AudioStream; [12 bytes] [+4 bytes] // Audio buffer pointer (private) and parameters
|
||||||
struct Sound; [20 bytes] // Audio stream and samples count
|
struct Sound; [16 bytes] [+8 bytes] // Audio stream and samples count
|
||||||
struct Music; [32 bytes] // Audio stream and music data pointer for streaming
|
struct Music; [18 bytes] [+12 bytes] // Audio stream and music data pointer for streaming
|
||||||
```
|
```
|
||||||
|
|
||||||
raylib abuses the data pass-by-value on most of its functions, actually, only around 10% of the functions require dealing with data pointers. For this reason, I tried to keep data structures as small as possible, usually under 64 bytes size, and use internal pointers when data requires modification by some function (usually Load/Update/Unload functions).
|
raylib abuses the data pass-by-value on most of its functions, actually, only around 10% of the functions require dealing with data pointers. For this reason, I tried to keep data structures as small as possible, usually under 64 bytes size, and use internal pointers when data requires modification by some function (usually Load/Update/Unload functions).
|
||||||
|
|||||||
Reference in New Issue
Block a user