diff --git a/.vscode/settings.json b/.vscode/settings.json index abe035a..e298a3c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -29,7 +29,8 @@ "vector": "cpp", "list": "cpp", "xhash": "cpp", - "glfw3.h": "c" + "glfw3.h": "c", + "stdbool.h": "c" }, "C_Cpp.intelliSenseEngineFallback": "disabled", "mesonbuild.configureOnOpen": true, diff --git a/project/auxillary/vis_ast/dependencies/raylib/include/raylib.h b/project/auxillary/vis_ast/dependencies/raylib/include/raylib.h index 8ee6313..2bdcac2 100644 --- a/project/auxillary/vis_ast/dependencies/raylib/include/raylib.h +++ b/project/auxillary/vis_ast/dependencies/raylib/include/raylib.h @@ -292,27 +292,27 @@ typedef enum bool // Vector2, 2 components typedef struct Vector2 { - f32 x; - f32 y; + f32 x; // Vector x component + f32 y; // Vector y component } Vector2; // Vector3, 3 components typedef struct Vector3 { - f32 x; - f32 y; - f32 z; + f32 x; // Vector x component + f32 y; // Vector y component + f32 z; // Vector z component } Vector3; // Vector4, 4 components typedef struct Vector4 { - f32 x; - f32 y; - f32 z; - f32 w; + f32 x; // Vector x component + f32 y; // Vector y component + f32 z; // Vector z component + f32 w; // Vector w component } Vector4; @@ -322,52 +322,52 @@ typedef Vector4 Quaternion; // Matrix, 4x4 components, column major, OpenGL style, right-handed typedef struct Matrix { - f32 m0, m4, m8, m12; - f32 m1, m5, m9, m13; - f32 m2, m6, m10, m14; - f32 m3, m7, m11, m15; + f32 m0, m4, m8, m12; // Matrix first row (4 components) + f32 m1, m5, m9, m13; // Matrix second row (4 components) + f32 m2, m6, m10, m14; // Matrix third row (4 components) + f32 m3, m7, m11, m15; // Matrix fourth row (4 components) } Matrix; // Color, 4 components, R8G8B8A8 (32bit) typedef struct Color { - u8 r; - u8 g; - u8 b; - u8 a; + u8 r; // Color red value + u8 g; // Color green value + u8 b; // Color blue value + u8 a; // Color alpha value } Color; // Rectangle, 4 components typedef struct Rectangle { - f32 x; - f32 y; - f32 width; - f32 height; + f32 x; // Rectangle top-left corner position x + f32 y; // Rectangle top-left corner position y + f32 width; // Rectangle width + f32 height; // Rectangle height } Rectangle; // Image, pixel data stored in CPU memory (RAM) typedef struct Image { - void* data; - s32 width; - s32 height; - s32 mipmaps; - s32 format; + void* data; // Image raw data + s32 width; // Image base width + s32 height; // Image base height + s32 mipmaps; // Mipmap levels, 1 by default + s32 format; // Data format (PixelFormat type) } Image; // Texture, tex data stored in GPU memory (VRAM) typedef struct Texture { - u32 id; - s32 width; - s32 height; - s32 mipmaps; - s32 format; + u32 id; // OpenGL texture id + s32 width; // Texture base width + s32 height; // Texture base height + s32 mipmaps; // Mipmap levels, 1 by default + s32 format; // Data format (PixelFormat type) } Texture; @@ -380,9 +380,9 @@ typedef Texture TextureCubemap; // RenderTexture, fbo for texture rendering typedef struct RenderTexture { - u32 id; - Texture texture; - Texture depth; + u32 id; // OpenGL framebuffer object id + Texture texture; // Color buffer attachment texture + Texture depth; // Depth buffer attachment texture } RenderTexture; @@ -392,46 +392,46 @@ typedef RenderTexture RenderTexture2D; // NPatchInfo, n-patch layout info typedef struct NPatchInfo { - Rectangle source; - s32 left; - s32 top; - s32 right; - s32 bottom; - s32 layout; + Rectangle source; // Texture source rectangle + s32 left; // Left border offset + s32 top; // Top border offset + s32 right; // Right border offset + s32 bottom; // Bottom border offset + s32 layout; // Layout of the n-patch: 3x3, 1x3 or 3x1 } NPatchInfo; // GlyphInfo, font characters glyphs info typedef struct GlyphInfo { - s32 value; - s32 offsetX; - s32 offsetY; - s32 advanceX; - Image image; + s32 value; // Character value (Unicode) + s32 offsetX; // Character offset X when drawing + s32 offsetY; // Character offset Y when drawing + s32 advanceX; // Character advance position X + Image image; // Character image data } GlyphInfo; // Font, font texture and GlyphInfo array data typedef struct Font { - s32 baseSize; - s32 glyphCount; - s32 glyphPadding; - Texture2D texture; - Rectangle* recs; - GlyphInfo* glyphs; + s32 baseSize; // Base size (default chars height) + s32 glyphCount; // Number of glyph characters + s32 glyphPadding; // Padding around the glyph characters + Texture2D texture; // Texture atlas containing the glyphs + Rectangle* recs; // Rectangles in texture for the glyphs + GlyphInfo* glyphs; // Glyphs info data } Font; // Camera, defines position/orientation in 3d space typedef struct Camera3D { - Vector3 position; - Vector3 target; - Vector3 up; - f32 fovy; - s32 projection; + Vector3 position; // Camera position + Vector3 target; // Camera target it looks-at + Vector3 up; // Camera up vector (rotation over its axis) + f32 fovy; // Camera field-of-view aperture in Y (degrees) in perspective, used as near plane width in orthographic + s32 projection; // Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC } Camera3D; @@ -440,146 +440,146 @@ typedef Camera3D Camera; // Camera type fallback, defaults to Camera3D // Camera2D, defines position/orientation in 2d space typedef struct Camera2D { - Vector2 offset; - Vector2 target; - f32 rotation; - f32 zoom; + Vector2 offset; // Camera offset (displacement from target) + Vector2 target; // Camera target (rotation and zoom origin) + f32 rotation; // Camera rotation in degrees + f32 zoom; // Camera zoom (scaling), should be 1.0f by default } Camera2D; // Mesh, vertex data and vao/vbo typedef struct Mesh { - s32 vertexCount; - s32 triangleCount; + s32 vertexCount; // Number of vertices stored in arrays + s32 triangleCount; // Number of triangles stored (indexed or not) // Vertex attributes data - f32* vertices; - f32* texcoords; - f32* texcoords2; - f32* normals; - f32* tangents; - u8* colors; - u8* indices; + f32* vertices; // Vertex position (XYZ - 3 components per vertex) (shader-location = 0) + f32* texcoords; // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1) + f32* texcoords2; // Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5) + f32* normals; // Vertex normals (XYZ - 3 components per vertex) (shader-location = 2) + f32* tangents; // Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4) + u8* colors; // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3) + u8* indices; // Vertex indices (in case vertex data comes indexed) // Animation vertex data - f32* animVertices; - f32* animNormals; - u8* boneIds; - f32* boneWeights; + f32* animVertices; // Animated vertex positions (after bones transformations) + f32* animNormals; // Animated normals (after bones transformations) + u8* boneIds; // Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning) + f32* boneWeights; // Vertex bone weight, up to 4 bones influence by vertex (skinning) // OpenGL identifiers - u32 vaoId; - unsigned int* vboId; + u32 vaoId; // OpenGL Vertex Array Object id + unsigned int* vboId; // OpenGL Vertex Buffer Objects id (default vertex data) } Mesh; // Shader typedef struct Shader { - u32 id; - s32* locs; + u32 id; // Shader program id + s32* locs; // Shader locations array (RL_MAX_SHADER_LOCATIONS) } Shader; // MaterialMap typedef struct MaterialMap { - Texture2D texture; - Color color; - f32 value; + Texture2D texture; // Material map texture + Color color; // Material map color + f32 value; // Material map value } MaterialMap; // Material, includes shader and maps typedef struct Material { - Shader shader; - MaterialMap* maps; - f32 params; + Shader shader; // Material shader + MaterialMap* maps; // Material maps array (MAX_MATERIAL_MAPS) + f32 params; // Material generic parameters (if required) } Material; // Transform, vertex transformation data typedef struct Transform { - Vector3 translation; - Quaternion rotation; - Vector3 scale; + Vector3 translation; // Translation + Quaternion rotation; // Rotation + Vector3 scale; // Scale } Transform; // Bone, skeletal animation bone typedef struct BoneInfo { - char name[ 32 ]; - s32 parent; + char name[ 32 ]; // Bone name + s32 parent; // Bone parent } BoneInfo; // Model, meshes, materials and animation data typedef struct Model { - Matrix transform; + Matrix transform; // Local transform matrix - s32 meshCount; - s32 materialCount; - Mesh* meshes; - Material* materials; - s32* meshMaterial; + s32 meshCount; // Number of meshes + s32 materialCount; // Number of materials + Mesh* meshes; // Meshes array + Material* materials; // Materials array + s32* meshMaterial; // Mesh material number // Animation data - s32 boneCount; - BoneInfo* bones; - Transform* bindPose; + s32 boneCount; // Number of bones + BoneInfo* bones; // Bones information (skeleton) + Transform* bindPose; // Bones base transformation (pose) } Model; // ModelAnimation typedef struct ModelAnimation { - s32 boneCount; - s32 frameCount; - BoneInfo* bones; - Transform** framePoses; - char name[ 32 ]; + s32 boneCount; // Number of bones + s32 frameCount; // Number of animation frames + BoneInfo* bones; // Bones information (skeleton) + Transform** framePoses; // Poses array by frame + char name[ 32 ]; // Animation name } ModelAnimation; // Ray, ray for raycasting typedef struct Ray { - Vector3 position; - Vector3 direction; + Vector3 position; // Ray position (origin) + Vector3 direction; // Ray direction } Ray; // RayCollision, ray hit information typedef struct RayCollision { - bool hit; - f32 distance; - Vector3 point; - Vector3 normal; + bool hit; // Did the ray hit something? + f32 distance; // Distance to the nearest hit + Vector3 point; // Point of the nearest hit + Vector3 normal; // Surface normal of hit } RayCollision; // BoundingBox typedef struct BoundingBox { - Vector3 min; - Vector3 max; + Vector3 min; // Minimum vertex box-corner + Vector3 max; // Maximum vertex box-corner } BoundingBox; // Wave, audio wave data typedef struct Wave { - u32 frameCount; - u32 sampleRate; - u32 sampleSize; - u32 channels; - void* data; + u32 frameCount; // Total number of frames (considering channels) + u32 sampleRate; // Frequency (samples per second) + u32 sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported) + u32 channels; // Number of channels (1-mono, 2-stereo, ...) + void* data; // Buffer data pointer } Wave; @@ -591,71 +591,71 @@ typedef struct rAudioProcessor rAudioProcessor; // AudioStream, custom audio stream typedef struct AudioStream { - rAudioBuffer* buffer; - rAudioProcessor* processor; + rAudioBuffer* buffer; // Pointer to internal data used by the audio system + rAudioProcessor* processor; // Pointer to internal data processor, useful for audio effects - u32 sampleRate; - u32 sampleSize; - u32 channels; + u32 sampleRate; // Frequency (samples per second) + u32 sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported) + u32 channels; // Number of channels (1-mono, 2-stereo, ...) } AudioStream; // Sound typedef struct Sound { - AudioStream stream; - u32 frameCount; + AudioStream stream; // Audio stream + u32 frameCount; // Total number of frames (considering channels) } Sound; // Music, audio stream, anything longer than ~10 seconds should be streamed typedef struct Music { - AudioStream stream; - u32 frameCount; - bool looping; + AudioStream stream; // Audio stream + u32 frameCount; // Total number of frames (considering channels) + bool looping; // Music looping enable - s32 ctxType; - void* ctxData; + s32 ctxType; // Type of music context (audio filetype) + void* ctxData; // Audio context data, depends on type } Music; // VrDeviceInfo, Head-Mounted-Display device parameters typedef struct VrDeviceInfo { - s32 hResolution; - s32 vResolution; - f32 hScreenSize; - f32 vScreenSize; - f32 vScreenCenter; - f32 eyeToScreenDistance; - f32 lensSeparationDistance; - f32 interpupillaryDistance; - f32 lensDistortionValues; - f32 chromaAbCorrection; + s32 hResolution; // Horizontal resolution in pixels + s32 vResolution; // Vertical resolution in pixels + f32 hScreenSize; // Horizontal size in meters + f32 vScreenSize; // Vertical size in meters + f32 vScreenCenter; // Screen center in meters + f32 eyeToScreenDistance; // Distance between eye and display in meters + f32 lensSeparationDistance; // Lens separation distance in meters + f32 interpupillaryDistance; // IPD (distance between pupils) in meters + f32 lensDistortionValues; // Lens distortion constant parameters + f32 chromaAbCorrection; // Chromatic aberration correction parameters } VrDeviceInfo; // VrStereoConfig, VR stereo rendering configuration for simulator typedef struct VrStereoConfig { - Matrix projection[ 2 ]; - Matrix viewOffset[ 2 ]; - f32 leftLensCenter; - f32 rightLensCenter; - f32 leftScreenCenter; - f32 rightScreenCenter; - f32 scale; - f32 scaleIn; + Matrix projection[ 2 ]; // VR projection matrices (per eye) + Matrix viewOffset[ 2 ]; // VR view offset matrices (per eye) + f32 leftLensCenter; // VR left lens center + f32 rightLensCenter; // VR right lens center + f32 leftScreenCenter; // VR left screen center + f32 rightScreenCenter; // VR right screen center + f32 scale; // VR distortion scale + f32 scaleIn; // VR distortion scale in } VrStereoConfig; // File path list typedef struct FilePathList { - u32 capacity; - u32 count; - char** paths; + u32 capacity; // Filepaths max entries + u32 count; // Filepaths entries count + char** paths; // Filepaths entries } FilePathList; diff --git a/project/auxillary/vis_ast/dependencies/raylib/include/raymath.h b/project/auxillary/vis_ast/dependencies/raylib/include/raymath.h index 94da9b5..0a2073d 100644 --- a/project/auxillary/vis_ast/dependencies/raylib/include/raymath.h +++ b/project/auxillary/vis_ast/dependencies/raylib/include/raymath.h @@ -149,10 +149,10 @@ typedef Vector4 Quaternion; // Matrix type (OpenGL style 4x4 - right handed, column major) typedef struct Matrix { - f32 m0, m4, m8, m12; - f32 m1, m5, m9, m13; - f32 m2, m6, m10, m14; - f32 m3, m7, m11, m15; + f32 m0, m4, m8, m12; // Matrix first row (4 components) + f32 m1, m5, m9, m13; // Matrix second row (4 components) + f32 m2, m6, m10, m14; // Matrix third row (4 components) + f32 m3, m7, m11, m15; // Matrix fourth row (4 components) } Matrix; #endif diff --git a/project/auxillary/vis_ast/dependencies/raylib/include/rcamera.h b/project/auxillary/vis_ast/dependencies/raylib/include/rcamera.h index 677ac44..5b8f0f0 100644 --- a/project/auxillary/vis_ast/dependencies/raylib/include/rcamera.h +++ b/project/auxillary/vis_ast/dependencies/raylib/include/rcamera.h @@ -40,7 +40,7 @@ **********************************************************************************************/ #ifndef RCAMERA_H -#define RCAMERA_H +#define RL_RCAMERA_H //---------------------------------------------------------------------------------- // Defines and Macros @@ -52,24 +52,21 @@ #if defined( _WIN32 ) #if defined( BUILD_LIBTYPE_SHARED ) #if defined( __TINYC__ ) -#define __declspec( x ) __attribute__( ( x ) ) +#define RL___declspec( x ) __attribute__( ( x ) ) #endif -#define RLAPI __declspec( dllexport ) // We are building the library as a Win32 shared library (.dll) #elif defined( USE_LIBTYPE_SHARED ) -#define RLAPI __declspec( dllimport ) // We are using the library as a Win32 shared library (.dll) #endif #endif #ifndef RLAPI -#define RLAPI // Functions defined as 'extern' by default (implicit specifiers) #endif #if defined( RCAMERA_STANDALONE ) -#define CAMERA_CULL_DISTANCE_NEAR 0.01 -#define CAMERA_CULL_DISTANCE_FAR 1000.0 +#define RL_CAMERA_CULL_DISTANCE_NEAR 0.01 +#define RL_CAMERA_CULL_DISTANCE_FAR 1000.0 #else -#define CAMERA_CULL_DISTANCE_NEAR RL_CULL_DISTANCE_NEAR -#define CAMERA_CULL_DISTANCE_FAR RL_CULL_DISTANCE_FAR +#define RL_CAMERA_CULL_DISTANCE_NEAR RL_CULL_DISTANCE_NEAR +#define RL_CAMERA_CULL_DISTANCE_FAR RL_CULL_DISTANCE_FAR #endif //---------------------------------------------------------------------------------- @@ -80,25 +77,28 @@ // Vector2, 2 components typedef struct Vector2 { - float x; // Vector x component - float y; // Vector y component + f32 x; // Vector x component + f32 y; // Vector y component + } Vector2; // Vector3, 3 components typedef struct Vector3 { - float x; // Vector x component - float y; // Vector y component - float z; // Vector z component + f32 x; // Vector x component + f32 y; // Vector y component + f32 z; // Vector z component + } Vector3; // Matrix, 4x4 components, column major, OpenGL style, right-handed typedef struct Matrix { - float m0, m4, m8, m12; // Matrix first row (4 components) - float m1, m5, m9, m13; // Matrix second row (4 components) - float m2, m6, m10, m14; // Matrix third row (4 components) - float m3, m7, m11, m15; // Matrix fourth row (4 components) + f32 m0, m4, m8, m12; // Matrix first row (4 components) + f32 m1, m5, m9, m13; // Matrix second row (4 components) + f32 m2, m6, m10, m14; // Matrix third row (4 components) + f32 m3, m7, m11, m15; // Matrix fourth row (4 components) + } Matrix; // Camera type, defines a camera position/orientation in 3d space @@ -107,8 +107,9 @@ typedef struct Camera3D Vector3 position; // Camera position Vector3 target; // Camera target it looks-at Vector3 up; // Camera up vector (rotation over its axis) - float fovy; // Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic - int projection; // Camera projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC + f32 fovy; // Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic + s32 projection; // Camera projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC + } Camera3D; typedef Camera3D Camera; // Camera type fallback, defaults to Camera3D @@ -116,18 +117,20 @@ typedef Camera3D Camera; // Camera type fallback, defaults to Camera3D // Camera projection typedef enum { - CAMERA_PERSPECTIVE = 0, // Perspective projection - CAMERA_ORTHOGRAPHIC // Orthographic projection + Camera_Perspective = 0, // Perspective projection + Camera_Orthographic // orthographic projection + } CameraProjection; // Camera system modes typedef enum { - CAMERA_CUSTOM = 0, // Camera custom, controlled by user (UpdateCamera() does nothing) - CAMERA_FREE, // Camera free mode - CAMERA_ORBITAL, // Camera orbital, around target, zoom supported - CAMERA_FIRST_PERSON, // Camera first person - CAMERA_THIRD_PERSON // Camera third person + Camera_Custom = 0, // Camera custom, controlled by user (UpdateCamera() does nothing) + Camera_Free, // Camera free mode + Camera_Orbital, // Camera orbital, around target, zoom supported + Camera_First_Person, // Camera first person + Camera_Third_Person // camera third person + } CameraMode; #endif @@ -141,33 +144,38 @@ typedef enum //---------------------------------------------------------------------------------- #if defined( __cplusplus ) -extern "C" -{ // Prevents name mangling of functions +namespace raylib +{ + extern "C" + { +// Prevents name mangling of functions #endif - RLAPI Vector3 GetCameraForward( Camera* camera ); - RLAPI Vector3 GetCameraUp( Camera* camera ); - RLAPI Vector3 GetCameraRight( Camera* camera ); + RLAPI Vector3 get_camera_forward( Camera* camera ); + RLAPI Vector3 get_camera_up( Camera* camera ); + RLAPI Vector3 get_camera_right( Camera* camera ); - // Camera movement - RLAPI void CameraMoveForward( Camera* camera, float distance, bool moveInWorldPlane ); - RLAPI void CameraMoveUp( Camera* camera, float distance ); - RLAPI void CameraMoveRight( Camera* camera, float distance, bool moveInWorldPlane ); - RLAPI void CameraMoveToTarget( Camera* camera, float delta ); + // Camera movement + RLAPI void camera_move_forward( Camera* camera, f32 distance, bool moveInWorldPlane ); + RLAPI void camera_move_up( Camera* camera, f32 distance ); + RLAPI void camera_move_right( Camera* camera, f32 distance, bool moveInWorldPlane ); + RLAPI void camera_move_to_target( Camera* camera, f32 delta ); - // Camera rotation - RLAPI void CameraYaw( Camera* camera, float angle, bool rotateAroundTarget ); - RLAPI void CameraPitch( Camera* camera, float angle, bool lockView, bool rotateAroundTarget, bool rotateUp ); - RLAPI void CameraRoll( Camera* camera, float angle ); + // Camera rotation + RLAPI void camera_yaw( Camera* camera, f32 angle, bool rotateAroundTarget ); + RLAPI void camera_pitch( Camera* camera, f32 angle, bool lockView, bool rotateAroundTarget, bool rotateUp ); + RLAPI void camera_roll( Camera* camera, f32 angle ); - RLAPI Matrix GetCameraViewMatrix( Camera* camera ); - RLAPI Matrix GetCameraProjectionMatrix( Camera* camera, float aspect ); + RLAPI Matrix get_camera_view_matrix( Camera* camera ); + RLAPI Matrix get_camera_projection_matrix( Camera* camera, f32 aspect ); #if defined( __cplusplus ) + } } #endif -#endif // RCAMERA_H +#endif +// RCAMERA_H /*********************************************************************************** @@ -178,20 +186,21 @@ extern "C" #if defined( RCAMERA_IMPLEMENTATION ) -#include "raymath.h" // Required for vector maths: - // Vector3Add() - // Vector3Subtract() - // Vector3Scale() - // Vector3Normalize() - // Vector3Distance() - // Vector3CrossProduct() - // Vector3RotateByAxisAngle() - // Vector3Angle() - // Vector3Negate() - // MatrixLookAt() - // MatrixPerspective() - // MatrixOrtho() - // MatrixIdentity() +#include "raymath.h" +// Required for vector maths: +// Vector3Add() +// Vector3Subtract() +// Vector3Scale() +// Vector3Normalize() +// Vector3Distance() +// Vector3CrossProduct() +// Vector3RotateByAxisAngle() +// Vector3Angle() +// Vector3Negate() +// MatrixLookAt() +// MatrixPerspective() +// MatrixOrtho() +// MatrixIdentity() // raylib required functionality: // GetMouseDelta() @@ -203,23 +212,23 @@ extern "C" //---------------------------------------------------------------------------------- // Defines and Macros //---------------------------------------------------------------------------------- -#define CAMERA_MOVE_SPEED 0.09f -#define CAMERA_ROTATION_SPEED 0.03f -#define CAMERA_PAN_SPEED 0.2f +#define RL_CAMERA_MOVE_SPEED 0.09f +#define RL_CAMERA_ROTATION_SPEED 0.03f +#define RL_CAMERA_PAN_SPEED 0.2f // Camera mouse movement sensitivity -#define CAMERA_MOUSE_MOVE_SENSITIVITY 0.003f // TODO: it should be independant of framerate -#define CAMERA_MOUSE_SCROLL_SENSITIVITY 1.5f +#define RL_CAMERA_MOUSE_MOVE_SENSITIVITY 0.003f // TODO: it should be independant of framerate +#define RL_CAMERA_MOUSE_SCROLL_SENSITIVITY 1.5f -#define CAMERA_ORBITAL_SPEED 0.5f // Radians per second +#define RL_CAMERA_ORBITAL_SPEED 0.5f // Radians per second -#define CAMERA_FIRST_PERSON_STEP_TRIGONOMETRIC_DIVIDER 8.0f -#define CAMERA_FIRST_PERSON_STEP_DIVIDER 30.0f -#define CAMERA_FIRST_PERSON_WAVING_DIVIDER 200.0f +#define RL_CAMERA_FIRST_PERSON_STEP_TRIGONOMETRIC_DIVIDER 8.0f +#define RL_CAMERA_FIRST_PERSON_STEP_DIVIDER 30.0f +#define RL_CAMERA_FIRST_PERSON_WAVING_DIVIDER 200.0f // PLAYER (used by camera) -#define PLAYER_MOVEMENT_SENSITIVITY 20.0f +#define RL_PLAYER_MOVEMENT_SENSITIVITY 20.0f //---------------------------------------------------------------------------------- // Types and Structures Definition @@ -240,20 +249,20 @@ extern "C" // Module Functions Definition //---------------------------------------------------------------------------------- // Returns the cameras forward vector (normalized) -Vector3 GetCameraForward( Camera* camera ) +Vector3 get_camera_forward( Camera* camera ) { return Vector3Normalize( Vector3Subtract( camera->target, camera->position ) ); } // Returns the cameras up vector (normalized) // Note: The up vector might not be perpendicular to the forward vector -Vector3 GetCameraUp( Camera* camera ) +Vector3 get_camera_up( Camera* camera ) { return Vector3Normalize( camera->up ); } // Returns the cameras right vector (normalized) -Vector3 GetCameraRight( Camera* camera ) +Vector3 get_camera_right( Camera* camera ) { Vector3 forward = GetCameraForward( camera ); Vector3 up = GetCameraUp( camera ); @@ -262,7 +271,7 @@ Vector3 GetCameraRight( Camera* camera ) } // Moves the camera in its forward direction -void CameraMoveForward( Camera* camera, float distance, bool moveInWorldPlane ) +void camera_move_forward( Camera* camera, f32 distance, bool moveInWorldPlane ) { Vector3 forward = GetCameraForward( camera ); @@ -282,7 +291,7 @@ void CameraMoveForward( Camera* camera, float distance, bool moveInWorldPlane ) } // Moves the camera in its up direction -void CameraMoveUp( Camera* camera, float distance ) +void camera_move_up( Camera* camera, f32 distance ) { Vector3 up = GetCameraUp( camera ); @@ -295,7 +304,7 @@ void CameraMoveUp( Camera* camera, float distance ) } // Moves the camera target in its current right direction -void CameraMoveRight( Camera* camera, float distance, bool moveInWorldPlane ) +void camera_move_right( Camera* camera, f32 distance, bool moveInWorldPlane ) { Vector3 right = GetCameraRight( camera ); @@ -315,7 +324,7 @@ void CameraMoveRight( Camera* camera, float distance, bool moveInWorldPlane ) } // Moves the camera position closer/farther to/from the camera target -void CameraMoveToTarget( Camera* camera, float delta ) +void camera_move_to_target( Camera* camera, f32 delta ) { float distance = Vector3Distance( camera->position, camera->target ); @@ -335,9 +344,8 @@ void CameraMoveToTarget( Camera* camera, float delta ) // Yaw is "looking left and right" // If rotateAroundTarget is false, the camera rotates around its position // Note: angle must be provided in radians -void CameraYaw( Camera* camera, float angle, bool rotateAroundTarget ) +void camera_yaw( Camera* camera, f32 angle, bool rotateAroundTarget ) { - // Rotation axis Vector3 up = GetCameraUp( camera ); // View vector @@ -363,9 +371,8 @@ void CameraYaw( Camera* camera, float angle, bool rotateAroundTarget ) // - rotateAroundTarget defines if rotation is around target or around its position // - rotateUp rotates the up direction as well (typically only usefull in CAMERA_FREE) // NOTE: angle must be provided in radians -void CameraPitch( Camera* camera, float angle, bool lockView, bool rotateAroundTarget, bool rotateUp ) +void camera_pitch( Camera* camera, f32 angle, bool lockView, bool rotateAroundTarget, bool rotateUp ) { - // Up direction Vector3 up = GetCameraUp( camera ); // View vector @@ -417,9 +424,8 @@ void CameraPitch( Camera* camera, float angle, bool lockView, bool rotateAroundT // Rotates the camera around its forward vector // Roll is "turning your head sideways to the left or right" // Note: angle must be provided in radians -void CameraRoll( Camera* camera, float angle ) +void camera_roll( Camera* camera, f32 angle ) { - // Rotation axis Vector3 forward = GetCameraForward( camera ); // Rotate up direction around forward axis @@ -427,13 +433,13 @@ void CameraRoll( Camera* camera, float angle ) } // Returns the camera view matrix -Matrix GetCameraViewMatrix( Camera* camera ) +Matrix get_camera_view_matrix( Camera* camera ) { return MatrixLookAt( camera->position, camera->target, camera->up ); } // Returns the camera projection matrix -Matrix GetCameraProjectionMatrix( Camera* camera, float aspect ) +Matrix get_camera_projection_matrix( Camera* camera, f32 aspect ) { if ( camera->projection == CAMERA_PERSPECTIVE ) { @@ -453,7 +459,7 @@ Matrix GetCameraProjectionMatrix( Camera* camera, float aspect ) #if ! defined( RCAMERA_STANDALONE ) // Update camera position for selected mode // Camera mode: CAMERA_FREE, CAMERA_FIRST_PERSON, CAMERA_THIRD_PERSON, CAMERA_ORBITAL or CUSTOM -void UpdateCamera( Camera* camera, int mode ) +void update_camera( Camera* camera, s32 mode ) { Vector2 mousePositionDelta = GetMouseDelta(); @@ -560,20 +566,12 @@ void UpdateCamera( Camera* camera, int mode ) CameraMoveToTarget( camera, -2.0f ); } } -#endif // !RCAMERA_STANDALONE +#endif +// !RCAMERA_STANDALONE // Update camera movement, movement/rotation values should be provided by user -void UpdateCameraPro( Camera* camera, Vector3 movement, Vector3 rotation, float zoom ) +void update_camera_pro( Camera* camera, Vector3 movement, Vector3 rotation, f32 zoom ) { - // Required values - // movement.x - Move forward/backward - // movement.y - Move right/left - // movement.z - Move up/down - // rotation.x - yaw - // rotation.y - pitch - // rotation.z - roll - // zoom - Move towards target - bool lockView = true; bool rotateAroundTarget = false; bool rotateUp = false; @@ -593,4 +591,5 @@ void UpdateCameraPro( Camera* camera, Vector3 movement, Vector3 rotation, float CameraMoveToTarget( camera, zoom ); } -#endif // RCAMERA_IMPLEMENTATION +#endif +// RCAMERA_IMPLEMENTATION diff --git a/project/auxillary/vis_ast/dependencies/raylib/raylib_refactor.cpp b/project/auxillary/vis_ast/dependencies/raylib/raylib_refactor.cpp index 7d44dc3..e66e773 100644 --- a/project/auxillary/vis_ast/dependencies/raylib/raylib_refactor.cpp +++ b/project/auxillary/vis_ast/dependencies/raylib/raylib_refactor.cpp @@ -9,6 +9,7 @@ constexpr char const* path_config = "config.h"; constexpr char const* path_raylib = "raylib.h"; constexpr char const* path_raymath = "raymath.h"; +constexpr char const* path_rcamera = "rcamera.h"; constexpr char const* path_rcore = "rcore.h"; constexpr char const* path_rgestures = "rgestures.h"; constexpr char const* path_rgl = "rgl.h"; @@ -207,7 +208,7 @@ void refactor_file( char const* path ) String name_scratch = String::make_reserve( GlobalAllocator, kilobytes(1) ); - // CodeBody includes + // CodeBody includes // CodeBody nspace_body = def_body( ECode::Namespace ); CodeBody new_code = def_body( ECode::Global_Body ); @@ -283,6 +284,7 @@ int gen_main() refactor_file( path_config ); refactor_file( path_raylib ); refactor_file( path_raymath ); + refactor_file( path_rcamera ); return 0; } diff --git a/project/auxillary/vis_ast/update_deps.ps1 b/project/auxillary/vis_ast/update_deps.ps1 index 9098dc8..35367c7 100644 --- a/project/auxillary/vis_ast/update_deps.ps1 +++ b/project/auxillary/vis_ast/update_deps.ps1 @@ -111,7 +111,7 @@ function setup-raylib { $build_result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable Push-Location $path_raylib_src if ( Test-Path( $executable ) ) { - $time_taken = Measure-Command { & $executable + Measure-Command { & $executable | ForEach-Object { write-host `t $_ -ForegroundColor Green } diff --git a/project/components/interface.parsing.cpp b/project/components/interface.parsing.cpp index 0ada216..91d7339 100644 --- a/project/components/interface.parsing.cpp +++ b/project/components/interface.parsing.cpp @@ -3655,7 +3655,6 @@ CodeVar parse_variable_after_name( eat( TokType::Statement_End ); // Check for inline comment : = ; // - CodeComment inline_cmt = NoCode; if ( left && ( currtok_noskip.Type == TokType::Comment ) && currtok_noskip.Line == stmt_end.Line ) { inline_cmt = parse_comment();