Jelajahi Sumber

Reviewed some TODO

Ray 3 tahun lalu
induk
melakukan
83b3478fe4
9 mengubah file dengan 41 tambahan dan 33 penghapusan
  1. 1 3
      src/raudio.c
  2. 0 2
      src/rcamera.h
  3. 4 13
      src/rcore.c
  4. 1 1
      src/rgestures.h
  5. 0 1
      src/rglfw.c
  6. 2 2
      src/rlgl.h
  7. 1 3
      src/rtext.c
  8. 30 6
      src/rtextures.c
  9. 2 2
      src/utils.c

+ 1 - 3
src/raudio.c

@@ -193,7 +193,7 @@ typedef struct tagBITMAPINFOHEADER {
 #endif
 
 #if defined(SUPPORT_FILEFORMAT_OGG)
-    // TODO: Remap malloc()/free() calls to RL_MALLOC/RL_FREE
+    // TODO: Remap stb_vorbis malloc()/free() calls to RL_MALLOC/RL_FREE
 
     #define STB_VORBIS_IMPLEMENTATION
     #include "external/stb_vorbis.h"    // OGG loading functions
@@ -405,8 +405,6 @@ void UntrackAudioBuffer(AudioBuffer *buffer);
 // Initialize audio device
 void InitAudioDevice(void)
 {
-    // TODO: Load AUDIO context memory dynamically?
-
     // Init audio context
     ma_context_config ctxConfig = ma_context_config_init();
     ctxConfig.logCallback = OnLog;

+ 0 - 2
src/rcamera.h

@@ -279,7 +279,6 @@ void SetCameraMode(Camera camera, int mode)
 //       System: EnableCursor(), DisableCursor()
 //       Mouse: IsMouseButtonDown(), GetMousePosition(), GetMouseWheelMove()
 //       Keys:  IsKeyDown()
-// TODO: Port to quaternion-based camera (?)
 void UpdateCamera(Camera *camera)
 {
     static int swingCounter = 0;    // Used for 1st person swinging movement
@@ -532,7 +531,6 @@ void UpdateCamera(Camera *camera)
             // Camera distance clamp
             if (CAMERA.targetDistance < CAMERA_THIRD_PERSON_DISTANCE_CLAMP) CAMERA.targetDistance = CAMERA_THIRD_PERSON_DISTANCE_CLAMP;
 
-            // TODO: It seems camera->position is not correctly updated or some rounding issue makes the camera move straight to camera->target...
             camera->position.x = sinf(CAMERA.angle.x)*CAMERA.targetDistance*cosf(CAMERA.angle.y) + camera->target.x;
 
             if (CAMERA.angle.y <= 0.0f) camera->position.y = sinf(CAMERA.angle.y)*CAMERA.targetDistance*sinf(CAMERA.angle.y) + camera->target.y;

+ 4 - 13
src/rcore.c

@@ -680,11 +680,11 @@ void android_main(struct android_app *app)
     char arg0[] = "raylib";     // NOTE: argv[] are mutable
     CORE.Android.app = app;
 
-    // TODO: Should we maybe report != 0 return codes somewhere?
+    // NOTE: Return codes != 0 are skipped
     (void)main(1, (char *[]) { arg0, NULL });
 }
 
-// TODO: Add this to header (if apps really need it)
+// NOTE: Add this to header (if apps really need it)
 struct android_app *GetAndroidApp(void)
 {
     return CORE.Android.app;
@@ -1519,7 +1519,6 @@ void SetWindowMinSize(int width, int height)
 }
 
 // Set window dimensions
-// TODO: Issues on HighDPI scaling
 void SetWindowSize(int width, int height)
 {
 #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
@@ -1528,8 +1527,7 @@ void SetWindowSize(int width, int height)
 #if defined(PLATFORM_WEB)
     //emscripten_set_canvas_size(width, height);  // DEPRECATED!
 
-    // TODO: Below functions should be used to replace previous one but
-    // they do not seem to work properly
+    // TODO: Below functions should be used to replace previous one but they do not seem to work properly
     //emscripten_set_canvas_element_size("canvas", width, height);
     //emscripten_set_element_css_size("canvas", width, height);
 #endif
@@ -2677,7 +2675,6 @@ void TakeScreenshot(const char *fileName)
     emscripten_run_script(TextFormat("saveFileFromMEMFSToDisk('%s','%s')", GetFileName(path), GetFileName(path)));
 #endif
 
-    // TODO: Verification required for log
     TRACELOG(LOG_INFO, "SYSTEM: [%s] Screenshot taken successfully", path);
 }
 
@@ -3593,8 +3590,6 @@ Vector2 GetTouchPosition(int index)
 #if defined(PLATFORM_WEB) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
     if (index < MAX_TOUCH_POINTS) position = CORE.Input.Touch.position[index];
     else TRACELOG(LOG_WARNING, "INPUT: Required touch point out of range (Max touch points: %i)", MAX_TOUCH_POINTS);
-
-    // TODO: Touch position scaling required?
 #endif
 
     return position;
@@ -5473,8 +5468,6 @@ static EM_BOOL EmscriptenGamepadCallback(int eventType, const EmscriptenGamepadE
     }
     else CORE.Input.Gamepad.ready[gamepadEvent->index] = false;
 
-    // TODO: Test gamepadEvent->index
-
     return 0;
 }
 #endif
@@ -5539,7 +5532,6 @@ static void RestoreKeyboard(void)
 
 #if defined(SUPPORT_SSH_KEYBOARD_RPI)
 // Process keyboard inputs
-// TODO: Most probably input reading and processing should be in a separate thread
 static void ProcessKeyboard(void)
 {
     #define MAX_KEYBUFFER_SIZE      32      // Max size in bytes to read
@@ -5894,7 +5886,7 @@ static void ConfigureEvdevDevice(char *device)
 static void PollKeyboardEvents(void)
 {
     // Scancode to keycode mapping for US keyboards
-    // TODO: Probably replace this with a keymap from the X11 to get the correct regional map for the keyboard:
+    // TODO: Replace this with a keymap from the X11 to get the correct regional map for the keyboard:
     // Currently non US keyboards will have the wrong mapping for some keys
     static const int keymapUS[] = {
         0, 256, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 45, 61, 259, 258, 81, 87, 69, 82, 84,
@@ -6380,7 +6372,6 @@ static void LoadAutomationEvents(const char *fileName)
 // Export recorded events into a file
 static void ExportAutomationEvents(const char *fileName)
 {
-    // TODO: eventCount is required -> header? -> rAEL
     unsigned char fileId[4] = "rEP ";
 
     // Save as binary

+ 1 - 1
src/rgestures.h

@@ -412,7 +412,7 @@ void ProcessGestureEvent(GestureEvent event)
     }
     else if (GESTURES.Touch.pointCount > 2)     // More than two touch points
     {
-        // TODO.
+        // TODO: Process gesture events for more than two points
     }
 }
 

+ 0 - 1
src/rglfw.c

@@ -98,7 +98,6 @@
     #include "external/glfw/src/x11_monitor.c"
     #include "external/glfw/src/x11_window.c"
     #include "external/glfw/src/xkb_unicode.c"
-    // TODO: Joystick implementation
     #include "external/glfw/src/null_joystick.c"
     #include "external/glfw/src/posix_time.c"
     #include "external/glfw/src/posix_thread.c"

+ 2 - 2
src/rlgl.h

@@ -1294,8 +1294,8 @@ void rlVertex3f(float x, float y, float z)
         RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].texcoords[2*RLGL.State.vertexCounter] = RLGL.State.texcoordx;
         RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].texcoords[2*RLGL.State.vertexCounter + 1] = RLGL.State.texcoordy;
 
-        // Add current normal
-        // TODO.
+        // TODO: Add current normal
+        // By default rlVertexBuffer type does not store normals
 
         // Add current color
         RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].colors[4*RLGL.State.vertexCounter] = RLGL.State.colorr;

+ 1 - 3
src/rtext.c

@@ -775,8 +775,6 @@ Image GenImageFontAtlas(const GlyphInfo *chars, Rectangle **charRecs, int glyphC
         RL_FREE(context);
     }
 
-    // TODO: Crop image if required for smaller size
-
     // Convert image data from GRAYSCALE to GRAY_ALPHA
     unsigned char *dataGrayAlpha = (unsigned char *)RL_MALLOC(atlas.width*atlas.height*sizeof(unsigned char)*2); // Two channels
 
@@ -1352,7 +1350,7 @@ const char *TextToUpper(const char *text)
             buffer[i] = (char)toupper(text[i]);
             //if ((text[i] >= 'a') && (text[i] <= 'z')) buffer[i] = text[i] - 32;
 
-            // TODO: Support UTF-8 diacritics!
+            // TODO: Support UTF-8 diacritics to upper-case
             //if ((text[i] >= 'à') && (text[i] <= 'ý')) buffer[i] = text[i] - 32;
         }
         else { buffer[i] = '\0'; break; }

+ 30 - 6
src/rtextures.c

@@ -279,7 +279,7 @@ Image LoadImageAnim(const char *fileName, int *frames)
 #endif
     else image = LoadImage(fileName);
 
-    // TODO: Support APNG animated images?
+    // TODO: Support APNG animated images
 
     *frames = frameCount;
     return image;
@@ -1481,7 +1481,7 @@ void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, i
         int bytesPerPixel = GetPixelDataSize(1, 1, image->format);
         unsigned char *resizedData = (unsigned char *)RL_CALLOC(newWidth*newHeight*bytesPerPixel, 1);
 
-        // TODO: Fill resizedData with fill color (must be formatted to image->format)
+        // TODO: Fill resized canvas with fill color (must be formatted to image->format)
 
         int dstOffsetSize = ((int)dstPos.y*newWidth + (int)dstPos.x)*bytesPerPixel;
 
@@ -2893,7 +2893,7 @@ TextureCubemap LoadTextureCubemap(Image image, int layout)
             faces = GenImageColor(size, size*6, MAGENTA);
             ImageFormat(&faces, image.format);
 
-            // TODO: Image formating does not work with compressed textures!
+            // NOTE: Image formating does not work with compressed textures
         }
 
         for (int i = 0; i < 6; i++) ImageDraw(&faces, image, faceRecs[i], (Rectangle){ 0, (float)size*i, (float)size, (float)size }, WHITE);
@@ -3818,9 +3818,33 @@ Color GetPixelColor(void *srcPtr, int format)
         } break;
         case PIXELFORMAT_UNCOMPRESSED_R8G8B8A8: color = (Color){ ((unsigned char *)srcPtr)[0], ((unsigned char *)srcPtr)[1], ((unsigned char *)srcPtr)[2], ((unsigned char *)srcPtr)[3] }; break;
         case PIXELFORMAT_UNCOMPRESSED_R8G8B8: color = (Color){ ((unsigned char *)srcPtr)[0], ((unsigned char *)srcPtr)[1], ((unsigned char *)srcPtr)[2], 255 }; break;
-        // TODO: case PIXELFORMAT_UNCOMPRESSED_R32: break;
-        // TODO: case PIXELFORMAT_UNCOMPRESSED_R32G32B32: break;
-        // TODO: case PIXELFORMAT_UNCOMPRESSED_R32G32B32A32: break;
+        case PIXELFORMAT_UNCOMPRESSED_R32:
+        {
+            // NOTE: Pixel normalized float value is converted to [0..255]
+            color.r = (unsigned char)(((float *)srcPtr)[0]*255.0f);
+            color.g = (unsigned char)(((float *)srcPtr)[0]*255.0f);
+            color.b = (unsigned char)(((float *)srcPtr)[0]*255.0f);
+            color.a = 255;
+            
+        } break;
+        case PIXELFORMAT_UNCOMPRESSED_R32G32B32: 
+        {
+            // NOTE: Pixel normalized float value is converted to [0..255]
+            color.r = (unsigned char)(((float *)srcPtr)[0]*255.0f);
+            color.g = (unsigned char)(((float *)srcPtr)[1]*255.0f);
+            color.b = (unsigned char)(((float *)srcPtr)[2]*255.0f);
+            color.a = 255;
+
+        } break;
+        case PIXELFORMAT_UNCOMPRESSED_R32G32B32A32:
+        {
+            // NOTE: Pixel normalized float value is converted to [0..255]
+            color.r = (unsigned char)(((float *)srcPtr)[0]*255.0f);
+            color.g = (unsigned char)(((float *)srcPtr)[1]*255.0f);
+            color.b = (unsigned char)(((float *)srcPtr)[2]*255.0f);
+            color.a = (unsigned char)(((float *)srcPtr)[3]*255.0f);
+
+        } break;
         default: break;
     }
 

+ 2 - 2
src/utils.c

@@ -375,8 +375,8 @@ FILE *android_fopen(const char *fileName, const char *mode)
 {
     if (mode[0] == 'w')
     {
-        // TODO: fopen() is mapped to android_fopen() that only grants read access
-        // to assets directory through AAssetManager but we want to also be able to
+        // fopen() is mapped to android_fopen() that only grants read access to
+        // assets directory through AAssetManager but we want to also be able to
         // write data when required using the standard stdio FILE access functions
         // Ref: https://stackoverflow.com/questions/11294487/android-writing-saving-files-from-native-code-only
         #undef fopen