REVIEWED: Remove final punctuation in code comments
This commit is contained in:
parent
c1943f0f7c
commit
e85f245ad4
5 changed files with 34 additions and 43 deletions
41
src/rcore.c
41
src/rcore.c
|
@ -296,7 +296,7 @@ typedef struct CoreData {
|
||||||
char previousKeyState[MAX_KEYBOARD_KEYS]; // Registers previous frame key state
|
char previousKeyState[MAX_KEYBOARD_KEYS]; // Registers previous frame key state
|
||||||
|
|
||||||
// NOTE: Since key press logic involves comparing prev vs cur key state, we need to handle key repeats specially
|
// NOTE: Since key press logic involves comparing prev vs cur key state, we need to handle key repeats specially
|
||||||
char keyRepeatInFrame[MAX_KEYBOARD_KEYS]; // Registers key repeats for current frame.
|
char keyRepeatInFrame[MAX_KEYBOARD_KEYS]; // Registers key repeats for current frame
|
||||||
|
|
||||||
int keyPressedQueue[MAX_KEY_PRESSED_QUEUE]; // Input keys queue
|
int keyPressedQueue[MAX_KEY_PRESSED_QUEUE]; // Input keys queue
|
||||||
int keyPressedQueueCount; // Input keys queue count
|
int keyPressedQueueCount; // Input keys queue count
|
||||||
|
@ -806,7 +806,7 @@ bool IsCursorHidden(void)
|
||||||
return CORE.Input.Mouse.cursorHidden;
|
return CORE.Input.Mouse.cursorHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if cursor is on the current screen.
|
// Check if cursor is on the current screen
|
||||||
bool IsCursorOnScreen(void)
|
bool IsCursorOnScreen(void)
|
||||||
{
|
{
|
||||||
return CORE.Input.Mouse.cursorOnScreen;
|
return CORE.Input.Mouse.cursorOnScreen;
|
||||||
|
@ -1213,9 +1213,9 @@ VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device)
|
||||||
config.projection[1] = MatrixMultiply(proj, MatrixTranslate(-projOffset, 0.0f, 0.0f));
|
config.projection[1] = MatrixMultiply(proj, MatrixTranslate(-projOffset, 0.0f, 0.0f));
|
||||||
|
|
||||||
// Compute camera transformation matrices
|
// Compute camera transformation matrices
|
||||||
// NOTE: Camera movement might seem more natural if we model the head.
|
// NOTE: Camera movement might seem more natural if we model the head
|
||||||
// Our axis of rotation is the base of our head, so we might want to add
|
// Our axis of rotation is the base of our head, so we might want to add
|
||||||
// some y (base of head to eye level) and -z (center of head to eye protrusion) to the camera positions.
|
// some y (base of head to eye level) and -z (center of head to eye protrusion) to the camera positions
|
||||||
config.viewOffset[0] = MatrixTranslate(device.interpupillaryDistance*0.5f, 0.075f, 0.045f);
|
config.viewOffset[0] = MatrixTranslate(device.interpupillaryDistance*0.5f, 0.075f, 0.045f);
|
||||||
config.viewOffset[1] = MatrixTranslate(-device.interpupillaryDistance*0.5f, 0.075f, 0.045f);
|
config.viewOffset[1] = MatrixTranslate(-device.interpupillaryDistance*0.5f, 0.075f, 0.045f);
|
||||||
|
|
||||||
|
@ -1462,9 +1462,10 @@ Ray GetScreenToWorldRayEx(Vector2 position, Camera camera, int width, int height
|
||||||
Vector3 nearPoint = Vector3Unproject((Vector3){ deviceCoords.x, deviceCoords.y, 0.0f }, matProj, matView);
|
Vector3 nearPoint = Vector3Unproject((Vector3){ deviceCoords.x, deviceCoords.y, 0.0f }, matProj, matView);
|
||||||
Vector3 farPoint = Vector3Unproject((Vector3){ deviceCoords.x, deviceCoords.y, 1.0f }, matProj, matView);
|
Vector3 farPoint = Vector3Unproject((Vector3){ deviceCoords.x, deviceCoords.y, 1.0f }, matProj, matView);
|
||||||
|
|
||||||
// Unproject the mouse cursor in the near plane.
|
// Unproject the mouse cursor in the near plane
|
||||||
// We need this as the source position because orthographic projects, compared to perspective doesn't have a
|
// We need this as the source position because orthographic projects,
|
||||||
// convergence point, meaning that the "eye" of the camera is more like a plane than a point.
|
// compared to perspective doesn't have a convergence point,
|
||||||
|
// meaning that the "eye" of the camera is more like a plane than a point
|
||||||
Vector3 cameraPlanePointerPos = Vector3Unproject((Vector3){ deviceCoords.x, deviceCoords.y, -1.0f }, matProj, matView);
|
Vector3 cameraPlanePointerPos = Vector3Unproject((Vector3){ deviceCoords.x, deviceCoords.y, -1.0f }, matProj, matView);
|
||||||
|
|
||||||
// Calculate normalized direction vector
|
// Calculate normalized direction vector
|
||||||
|
@ -1495,12 +1496,12 @@ Matrix GetCameraMatrix2D(Camera2D camera)
|
||||||
// 1. Move it to target
|
// 1. Move it to target
|
||||||
// 2. Rotate by -rotation and scale by (1/zoom)
|
// 2. Rotate by -rotation and scale by (1/zoom)
|
||||||
// When setting higher scale, it's more intuitive for the world to become bigger (= camera become smaller),
|
// When setting higher scale, it's more intuitive for the world to become bigger (= camera become smaller),
|
||||||
// not for the camera getting bigger, hence the invert. Same deal with rotation.
|
// not for the camera getting bigger, hence the invert. Same deal with rotation
|
||||||
// 3. Move it by (-offset);
|
// 3. Move it by (-offset);
|
||||||
// Offset defines target transform relative to screen, but since we're effectively "moving" screen (camera)
|
// Offset defines target transform relative to screen, but since we're effectively "moving" screen (camera)
|
||||||
// we need to do it into opposite direction (inverse transform)
|
// we need to do it into opposite direction (inverse transform)
|
||||||
|
|
||||||
// Having camera transform in world-space, inverse of it gives the modelview transform.
|
// Having camera transform in world-space, inverse of it gives the modelview transform
|
||||||
// Since (A*B*C)' = C'*B'*A', the modelview is
|
// Since (A*B*C)' = C'*B'*A', the modelview is
|
||||||
// 1. Move to offset
|
// 1. Move to offset
|
||||||
// 2. Rotate and Scale
|
// 2. Rotate and Scale
|
||||||
|
@ -1691,7 +1692,7 @@ void WaitTime(double seconds)
|
||||||
req.tv_sec = sec;
|
req.tv_sec = sec;
|
||||||
req.tv_nsec = nsec;
|
req.tv_nsec = nsec;
|
||||||
|
|
||||||
// NOTE: Use nanosleep() on Unix platforms... usleep() it's deprecated.
|
// NOTE: Use nanosleep() on Unix platforms... usleep() it's deprecated
|
||||||
while (nanosleep(&req, &req) == -1) continue;
|
while (nanosleep(&req, &req) == -1) continue;
|
||||||
#endif
|
#endif
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
@ -1826,7 +1827,7 @@ void TakeScreenshot(const char *fileName)
|
||||||
|
|
||||||
// Setup window configuration flags (view FLAGS)
|
// Setup window configuration flags (view FLAGS)
|
||||||
// NOTE: This function is expected to be called before window creation,
|
// NOTE: This function is expected to be called before window creation,
|
||||||
// because it sets up some flags for the window creation process.
|
// because it sets up some flags for the window creation process
|
||||||
// To configure window states after creation, just use SetWindowState()
|
// To configure window states after creation, just use SetWindowState()
|
||||||
void SetConfigFlags(unsigned int flags)
|
void SetConfigFlags(unsigned int flags)
|
||||||
{
|
{
|
||||||
|
@ -3085,10 +3086,10 @@ int GetTouchPointCount(void)
|
||||||
// Initialize hi-resolution timer
|
// Initialize hi-resolution timer
|
||||||
void InitTimer(void)
|
void InitTimer(void)
|
||||||
{
|
{
|
||||||
// Setting a higher resolution can improve the accuracy of time-out intervals in wait functions.
|
// Setting a higher resolution can improve the accuracy of time-out intervals in wait functions
|
||||||
// However, it can also reduce overall system performance, because the thread scheduler switches tasks more often.
|
// However, it can also reduce overall system performance, because the thread scheduler switches tasks more often
|
||||||
// High resolutions can also prevent the CPU power management system from entering power-saving modes.
|
// High resolutions can also prevent the CPU power management system from entering power-saving modes
|
||||||
// Setting a higher resolution does not improve the accuracy of the high-resolution performance counter.
|
// Setting a higher resolution does not improve the accuracy of the high-resolution performance counter
|
||||||
#if defined(_WIN32) && defined(SUPPORT_WINMM_HIGHRES_TIMER) && !defined(SUPPORT_BUSY_WAIT_LOOP) && !defined(PLATFORM_DESKTOP_SDL)
|
#if defined(_WIN32) && defined(SUPPORT_WINMM_HIGHRES_TIMER) && !defined(SUPPORT_BUSY_WAIT_LOOP) && !defined(PLATFORM_DESKTOP_SDL)
|
||||||
timeBeginPeriod(1); // Setup high-resolution timer to 1ms (granularity of 1-2 ms)
|
timeBeginPeriod(1); // Setup high-resolution timer to 1ms (granularity of 1-2 ms)
|
||||||
#endif
|
#endif
|
||||||
|
@ -3572,16 +3573,6 @@ static void RecordAutomationEvent(void)
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Window events recording
|
|
||||||
//-------------------------------------------------------------------------------------
|
|
||||||
// TODO.
|
|
||||||
//-------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Custom actions events recording
|
|
||||||
//-------------------------------------------------------------------------------------
|
|
||||||
// TODO.
|
|
||||||
//-------------------------------------------------------------------------------------
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1593,7 +1593,7 @@ void DrawMeshInstanced(Mesh mesh, Material material, const Matrix *transforms, i
|
||||||
// Enable mesh VAO to attach new buffer
|
// Enable mesh VAO to attach new buffer
|
||||||
rlEnableVertexArray(mesh.vaoId);
|
rlEnableVertexArray(mesh.vaoId);
|
||||||
|
|
||||||
// This could alternatively use a static VBO and either glMapBuffer() or glBufferSubData().
|
// This could alternatively use a static VBO and either glMapBuffer() or glBufferSubData()
|
||||||
// It isn't clear which would be reliably faster in all cases and on all platforms,
|
// It isn't clear which would be reliably faster in all cases and on all platforms,
|
||||||
// anecdotally glMapBuffer() seems very slow (syncs) while glBufferSubData() seems
|
// anecdotally glMapBuffer() seems very slow (syncs) while glBufferSubData() seems
|
||||||
// no faster, since we're transferring all the transform matrices anyway
|
// no faster, since we're transferring all the transform matrices anyway
|
||||||
|
@ -2695,7 +2695,7 @@ Mesh GenMeshCylinder(float radius, float height, int slices)
|
||||||
{
|
{
|
||||||
// Instance a cylinder that sits on the Z=0 plane using the given tessellation
|
// Instance a cylinder that sits on the Z=0 plane using the given tessellation
|
||||||
// levels across the UV domain. Think of "slices" like a number of pizza
|
// levels across the UV domain. Think of "slices" like a number of pizza
|
||||||
// slices, and "stacks" like a number of stacked rings.
|
// slices, and "stacks" like a number of stacked rings
|
||||||
// Height and radius are both 1.0, but they can easily be changed with par_shapes_scale
|
// Height and radius are both 1.0, but they can easily be changed with par_shapes_scale
|
||||||
par_shapes_mesh *cylinder = par_shapes_create_cylinder(slices, 8);
|
par_shapes_mesh *cylinder = par_shapes_create_cylinder(slices, 8);
|
||||||
par_shapes_scale(cylinder, radius, radius, height);
|
par_shapes_scale(cylinder, radius, radius, height);
|
||||||
|
@ -2759,7 +2759,7 @@ Mesh GenMeshCone(float radius, float height, int slices)
|
||||||
{
|
{
|
||||||
// Instance a cone that sits on the Z=0 plane using the given tessellation
|
// Instance a cone that sits on the Z=0 plane using the given tessellation
|
||||||
// levels across the UV domain. Think of "slices" like a number of pizza
|
// levels across the UV domain. Think of "slices" like a number of pizza
|
||||||
// slices, and "stacks" like a number of stacked rings.
|
// slices, and "stacks" like a number of stacked rings
|
||||||
// Height and radius are both 1.0, but they can easily be changed with par_shapes_scale
|
// Height and radius are both 1.0, but they can easily be changed with par_shapes_scale
|
||||||
par_shapes_mesh *cone = par_shapes_create_cone(slices, 8);
|
par_shapes_mesh *cone = par_shapes_create_cone(slices, 8);
|
||||||
par_shapes_scale(cone, radius, radius, height);
|
par_shapes_scale(cone, radius, radius, height);
|
||||||
|
@ -3813,7 +3813,7 @@ RayCollision GetRayCollisionBox(Ray ray, BoundingBox box)
|
||||||
RayCollision collision = { 0 };
|
RayCollision collision = { 0 };
|
||||||
|
|
||||||
// Note: If ray.position is inside the box, the distance is negative (as if the ray was reversed)
|
// Note: If ray.position is inside the box, the distance is negative (as if the ray was reversed)
|
||||||
// Reversing ray.direction will give use the correct result.
|
// Reversing ray.direction will give use the correct result
|
||||||
bool insideBox = (ray.position.x > box.min.x) && (ray.position.x < box.max.x) &&
|
bool insideBox = (ray.position.x > box.min.x) && (ray.position.x < box.max.x) &&
|
||||||
(ray.position.y > box.min.y) && (ray.position.y < box.max.y) &&
|
(ray.position.y > box.min.y) && (ray.position.y < box.max.y) &&
|
||||||
(ray.position.z > box.min.z) && (ray.position.z < box.max.z);
|
(ray.position.z > box.min.z) && (ray.position.z < box.max.z);
|
||||||
|
@ -5068,7 +5068,7 @@ static Model LoadGLTF(const char *fileName)
|
||||||
{
|
{
|
||||||
cgltf_accessor *attribute = data->meshes[i].primitives[p].attributes[j].data;
|
cgltf_accessor *attribute = data->meshes[i].primitives[p].attributes[j].data;
|
||||||
|
|
||||||
// WARNING: SPECS: POSITION accessor MUST have its min and max properties defined.
|
// WARNING: SPECS: POSITION accessor MUST have its min and max properties defined
|
||||||
|
|
||||||
if ((attribute->component_type == cgltf_component_type_r_32f) && (attribute->type == cgltf_type_vec3))
|
if ((attribute->component_type == cgltf_component_type_r_32f) && (attribute->type == cgltf_type_vec3))
|
||||||
{
|
{
|
||||||
|
@ -5129,7 +5129,7 @@ static Model LoadGLTF(const char *fileName)
|
||||||
{
|
{
|
||||||
cgltf_accessor *attribute = data->meshes[i].primitives[p].attributes[j].data;
|
cgltf_accessor *attribute = data->meshes[i].primitives[p].attributes[j].data;
|
||||||
|
|
||||||
// WARNING: SPECS: All components of each COLOR_n accessor element MUST be clamped to [0.0, 1.0] range.
|
// WARNING: SPECS: All components of each COLOR_n accessor element MUST be clamped to [0.0, 1.0] range
|
||||||
|
|
||||||
if ((attribute->component_type == cgltf_component_type_r_8u) && (attribute->type == cgltf_type_vec4))
|
if ((attribute->component_type == cgltf_component_type_r_8u) && (attribute->type == cgltf_type_vec4))
|
||||||
{
|
{
|
||||||
|
@ -5369,7 +5369,7 @@ static Model LoadGLTF(const char *fileName)
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get interpolated pose for bone sampler at a specific time. Returns true on success.
|
// Get interpolated pose for bone sampler at a specific time. Returns true on success
|
||||||
static bool GetPoseAtTimeGLTF(cgltf_interpolation_type interpolationType, cgltf_accessor *input, cgltf_accessor *output, float time, void *data)
|
static bool GetPoseAtTimeGLTF(cgltf_interpolation_type interpolationType, cgltf_accessor *input, cgltf_accessor *output, float time, void *data)
|
||||||
{
|
{
|
||||||
if (interpolationType >= cgltf_interpolation_type_max_enum) return false;
|
if (interpolationType >= cgltf_interpolation_type_max_enum) return false;
|
||||||
|
@ -5833,7 +5833,7 @@ static Model LoadM3D(const char *fileName)
|
||||||
// We always need a default material, so we add +1
|
// We always need a default material, so we add +1
|
||||||
model.materialCount++;
|
model.materialCount++;
|
||||||
|
|
||||||
// Faces must be in non-decreasing materialid order. Verify that quickly, sorting them otherwise.
|
// Faces must be in non-decreasing materialid order. Verify that quickly, sorting them otherwise
|
||||||
// WARNING: Sorting is not needed, valid M3D model files should already be sorted
|
// WARNING: Sorting is not needed, valid M3D model files should already be sorted
|
||||||
// Just keeping the sorting function for reference (Check PR #3363 #3385)
|
// Just keeping the sorting function for reference (Check PR #3363 #3385)
|
||||||
/*
|
/*
|
||||||
|
@ -5841,12 +5841,12 @@ static Model LoadM3D(const char *fileName)
|
||||||
{
|
{
|
||||||
if (m3d->face[i-1].materialid <= m3d->face[i].materialid) continue;
|
if (m3d->face[i-1].materialid <= m3d->face[i].materialid) continue;
|
||||||
|
|
||||||
// face[i-1] > face[i]. slide face[i] lower.
|
// face[i-1] > face[i]. slide face[i] lower
|
||||||
m3df_t slider = m3d->face[i];
|
m3df_t slider = m3d->face[i];
|
||||||
j = i-1;
|
j = i-1;
|
||||||
|
|
||||||
do
|
do
|
||||||
{ // face[j] > slider, face[j+1] is svailable vacant gap.
|
{ // face[j] > slider, face[j+1] is svailable vacant gap
|
||||||
m3d->face[j+1] = m3d->face[j];
|
m3d->face[j+1] = m3d->face[j];
|
||||||
j = j-1;
|
j = j-1;
|
||||||
}
|
}
|
||||||
|
@ -6107,7 +6107,7 @@ static Model LoadM3D(const char *fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load bone-pose default mesh into animation vertices. These will be updated when UpdateModelAnimation gets
|
// Load bone-pose default mesh into animation vertices. These will be updated when UpdateModelAnimation gets
|
||||||
// called, but not before, however DrawMesh uses these if they exist (so not good if they are left empty).
|
// called, but not before, however DrawMesh uses these if they exist (so not good if they are left empty)
|
||||||
if (m3d->numbone && m3d->numskin)
|
if (m3d->numbone && m3d->numskin)
|
||||||
{
|
{
|
||||||
for (i = 0; i < model.meshCount; i++)
|
for (i = 0; i < model.meshCount; i++)
|
||||||
|
|
|
@ -1077,7 +1077,7 @@ bool ExportFontAsCode(Font font, const char *fileName)
|
||||||
#endif
|
#endif
|
||||||
// We have two possible mechanisms to assign font.recs and font.glyphs data,
|
// We have two possible mechanisms to assign font.recs and font.glyphs data,
|
||||||
// that data is already available as global arrays, we two options to assign that data:
|
// that data is already available as global arrays, we two options to assign that data:
|
||||||
// - 1. Data copy. This option consumes more memory and Font MUST be unloaded by user, requiring additional code.
|
// - 1. Data copy. This option consumes more memory and Font MUST be unloaded by user, requiring additional code
|
||||||
// - 2. Data assignment. This option consumes less memory and Font MUST NOT be unloaded by user because data is on protected DATA segment
|
// - 2. Data assignment. This option consumes less memory and Font MUST NOT be unloaded by user because data is on protected DATA segment
|
||||||
//#define SUPPORT_FONT_DATA_COPY
|
//#define SUPPORT_FONT_DATA_COPY
|
||||||
#if defined(SUPPORT_FONT_DATA_COPY)
|
#if defined(SUPPORT_FONT_DATA_COPY)
|
||||||
|
|
|
@ -920,8 +920,8 @@ Image GenImageColor(int width, int height, Color color)
|
||||||
#if defined(SUPPORT_IMAGE_GENERATION)
|
#if defined(SUPPORT_IMAGE_GENERATION)
|
||||||
// Generate image: linear gradient
|
// Generate image: linear gradient
|
||||||
// The direction value specifies the direction of the gradient (in degrees)
|
// The direction value specifies the direction of the gradient (in degrees)
|
||||||
// with 0 being vertical (from top to bottom), 90 being horizontal (from left to right).
|
// with 0 being vertical (from top to bottom), 90 being horizontal (from left to right)
|
||||||
// The gradient effectively rotates counter-clockwise by the specified amount.
|
// The gradient effectively rotates counter-clockwise by the specified amount
|
||||||
Image GenImageGradientLinear(int width, int height, int direction, Color start, Color end)
|
Image GenImageGradientLinear(int width, int height, int direction, Color start, Color end)
|
||||||
{
|
{
|
||||||
Color *pixels = (Color *)RL_MALLOC(width*height*sizeof(Color));
|
Color *pixels = (Color *)RL_MALLOC(width*height*sizeof(Color));
|
||||||
|
@ -2152,7 +2152,7 @@ void ImageBlurGaussian(Image *image, int blurSize)
|
||||||
ImageFormat(image, format);
|
ImageFormat(image, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The kernel matrix is assumed to be square. Only supply the width of the kernel.
|
// The kernel matrix is assumed to be square. Only supply the width of the kernel
|
||||||
void ImageKernelConvolution(Image *image, float* kernel, int kernelSize)
|
void ImageKernelConvolution(Image *image, float* kernel, int kernelSize)
|
||||||
{
|
{
|
||||||
if ((image->data == NULL) || (image->width == 0) || (image->height == 0) || kernel == NULL) return;
|
if ((image->data == NULL) || (image->width == 0) || (image->height == 0) || kernel == NULL) return;
|
||||||
|
@ -4243,7 +4243,7 @@ void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2
|
||||||
|
|
||||||
// NOTE: Vertex position can be transformed using matrices
|
// NOTE: Vertex position can be transformed using matrices
|
||||||
// but the process is way more costly than just calculating
|
// but the process is way more costly than just calculating
|
||||||
// the vertex positions manually, like done above.
|
// the vertex positions manually, like done above
|
||||||
// I leave here the old implementation for educational purposes,
|
// I leave here the old implementation for educational purposes,
|
||||||
// just in case someone wants to do some performance test
|
// just in case someone wants to do some performance test
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#if defined(PLATFORM_ANDROID)
|
#if defined(PLATFORM_ANDROID)
|
||||||
#include <errno.h> // Required for: Android error types
|
#include <errno.h> // Required for: Android error types
|
||||||
#include <android/log.h> // Required for: Android log system: __android_log_vprint()
|
#include <android/log.h> // Required for: Android log system: __android_log_vprint()
|
||||||
#include <android/asset_manager.h> // Required for: Android assets manager: AAsset, AAssetManager_open(), ...
|
#include <android/asset_manager.h> // Required for: Android assets manager: AAsset, AAssetManager_open()...
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h> // Required for: exit()
|
#include <stdlib.h> // Required for: exit()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue