Browse Source

Reviewed code TODOs

raysan5 9 years ago
parent
commit
823abf666e
7 changed files with 19 additions and 25 deletions
  1. 1 1
      src/audio.c
  2. 1 1
      src/camera.c
  3. 7 10
      src/core.c
  4. 0 1
      src/models.c
  5. 3 7
      src/rlgl.c
  6. 1 1
      src/text.c
  7. 6 4
      src/textures.c

+ 1 - 1
src/audio.c

@@ -280,9 +280,9 @@ Sound LoadSoundFromWave(Wave wave)
 }
 
 // Load sound to memory from rRES file (raylib Resource)
+// TODO: Maybe rresName could be directly a char array with all the data?
 Sound LoadSoundFromRES(const char *rresName, int resId)
 {
-    // NOTE: rresName could be directly a char array with all the data!!! --> TODO
     Sound sound = { 0 };
 
 #if defined(AUDIO_STANDALONE)

+ 1 - 1
src/camera.c

@@ -375,7 +375,7 @@ static void ProcessCamera(Camera *camera, Vector3 *playerPosition)
             }
 
             // Focus to center
-            // TODO: Move this function out of the module?
+            // TODO: Move this function out of this module?
             if (IsKeyDown('Z')) camera->target = (Vector3){ 0.0f, 0.0f, 0.0f };
 
             // Camera position update

+ 7 - 10
src/core.c

@@ -359,7 +359,7 @@ void InitWindow(int width, int height, struct android_app *state)
     if (orientation == ACONFIGURATION_ORIENTATION_PORT) TraceLog(INFO, "PORTRAIT window orientation");
     else if (orientation == ACONFIGURATION_ORIENTATION_LAND) TraceLog(INFO, "LANDSCAPE window orientation");
 
-    // TODO: Review, it doesn't work...
+    // TODO: Automatic orientation doesn't seem to work
     if (width <= height)
     {
         AConfiguration_setOrientation(app->config, ACONFIGURATION_ORIENTATION_PORT);
@@ -1246,7 +1246,7 @@ int GetTouchY(void)
 }
 
 // Returns touch position XY
-// TODO: touch position should be scaled depending on display size and render size
+// TODO: Touch position should be scaled depending on display size and render size
 Vector2 GetTouchPosition(int index)
 {
     Vector2 position = { -1.0f, -1.0f };
@@ -1257,7 +1257,7 @@ Vector2 GetTouchPosition(int index)
 
     if ((screenWidth > displayWidth) || (screenHeight > displayHeight))
     {
-        // TODO: Seems to work ok but... review!
+        // TODO: Review touch position scaling for screenSize vs displaySize
         position.x = position.x*((float)screenWidth/(float)(displayWidth - renderOffsetX)) - renderOffsetX/2;
         position.y = position.y*((float)screenHeight/(float)(displayHeight - renderOffsetY)) - renderOffsetY/2;
     }
@@ -1668,8 +1668,7 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i
 #endif
     else currentKeyState[key] = action;
 
-    // HACK for GuiTextBox, to deteck back key
-    // TODO: Review...
+    // TODO: Review (and remove) this HACK for GuiTextBox, to deteck back key
     if ((key == 259) && (action == GLFW_PRESS)) lastKeyPressed = 3;
 }
 
@@ -1678,8 +1677,6 @@ static void MouseButtonCallback(GLFWwindow *window, int button, int action, int
 {
     currentMouseState[button] = action;
     
-    // TODO: Test mouse gestures
-    
 #define ENABLE_MOUSE_GESTURES
 #if defined(ENABLE_MOUSE_GESTURES)
     // Process mouse events as touches to be able to use mouse-gestures
@@ -2046,7 +2043,7 @@ static bool GetKeyStatus(int key)
 #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
     return glfwGetKey(window, key);
 #elif defined(PLATFORM_ANDROID)
-    // TODO: Check virtual keyboard (?)
+    // TODO: Check for virtual keyboard
     return false;
 #elif defined(PLATFORM_RPI)
     // NOTE: Keys states are filled in PollInputEvents()
@@ -2061,7 +2058,7 @@ static bool GetMouseButtonStatus(int button)
 #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
     return glfwGetMouseButton(window, button);
 #elif defined(PLATFORM_ANDROID)
-    // TODO: Check virtual keyboard (?)
+    // TODO: Check for virtual keyboard
     return false;
 #elif defined(PLATFORM_RPI)
     // NOTE: mouse buttons array is filled on PollInputEvents()
@@ -2382,7 +2379,7 @@ static void RestoreKeyboard(void)
 // Init gamepad system
 static void InitGamepad(void)
 {
-    // TODO: Gamepad support
+    // TODO: Add Gamepad support
     if ((gamepadStream = open(DEFAULT_GAMEPAD_DEV, O_RDONLY|O_NONBLOCK)) < 0) TraceLog(WARNING, "Gamepad device could not be opened, no gamepad available");
     else TraceLog(INFO, "Gamepad device initialized successfully");
 }

+ 0 - 1
src/models.c

@@ -704,7 +704,6 @@ Model LoadHeightmap(Image heightmap, Vector3 size)
             // TODO: Calculate normals in an efficient way
 
             nCounter += 18;     // 6 vertex, 18 floats
-
             trisCounter += 2;
         }
     }

+ 3 - 7
src/rlgl.c

@@ -171,7 +171,7 @@ typedef struct {
 typedef struct {
     GLuint textureId;
     int vertexCount;
-    // TODO: DrawState state -> Blending mode, shader
+    // TODO: Store draw state -> blending mode, shader
 } DrawCall;
 
 // pixel type (same as Color type)
@@ -1475,11 +1475,7 @@ void rlglDrawModel(Model model, Vector3 position, Vector3 rotationAxis, float ro
     // Calculate model-view-projection matrix (MVP)
     Matrix matMVP = MatrixMultiply(matModelView, matProjection);        // Transform to screen-space coordinates
 
-    // NOTE: Drawing in OpenGL 3.3+, matrices are passed to shader
-    // TODO: Reduce number of matrices passed to shaders, use only matMVP
-    //glUniformMatrix4fv(model.material.shader.modelLoc, 1, false, MatrixToFloat(matModel));
-    //glUniformMatrix4fv(model.material.shader.viewLoc, 1, false, MatrixToFloat(matView));
-    
+    // Send combined model-view-projection matrix to shader
     glUniformMatrix4fv(model.shader.mvpLoc, 1, false, MatrixToFloat(matMVP));
 
     // Apply color tinting to model
@@ -1900,7 +1896,7 @@ void rlglGenerateMipmaps(Texture2D texture)
         int mipmapCount = GenerateMipmaps(data, texture.width, texture.height);
 
         // TODO: Adjust mipmap size depending on texture format!
-        int size = texture.width*texture.height*4;
+        int size = texture.width*texture.height*4;  // RGBA 32bit only
         int offset = size;
 
         int mipWidth = texture.width/2;

+ 1 - 1
src/text.c

@@ -346,7 +346,7 @@ void DrawTextEx(SpriteFont spriteFont, const char *text, Vector2 position, int f
     
     for(int i = 0; i < length; i++)
     {
-        // TODO: Right now we are supposing characters follow a continous order and start at FONT_FIRST_CHAR,
+        // TODO: Right now we are supposing characters that follow a continous order and start at FONT_FIRST_CHAR,
         // this sytem can be improved to support any characters order and init value...
         // An intermediate table could be created to link char values with predefined char position index in chars rectangle array
         

+ 6 - 4
src/textures.c

@@ -712,7 +712,7 @@ void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp)
             {
                 oldpixel = pixels[y*image->width + x];
                 
-                // TODO: New pixel obtained by bits truncate, it would be better to round values (check ImageFormat())
+                // NOTE: New pixel obtained by bits truncate, it would be better to round values (check ImageFormat())
                 newpixel.r = oldpixel.r>>(8 - rBpp);     // R bits
                 newpixel.g = oldpixel.g>>(8 - gBpp);     // G bits
                 newpixel.b = oldpixel.b>>(8 - bBpp);     // B bits
@@ -769,7 +769,7 @@ void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp)
 }
 
 // Convert image to POT (power-of-two)
-// NOTE: Requirement on OpenGL ES 2.0 (RPI, HTML5)
+// NOTE: It could be useful on OpenGL ES 2.0 (RPI, HTML5)
 void ImageToPOT(Image *image, Color fillColor)
 {
     Color *pixels = GetImageData(*image);   // Get pixels data
@@ -784,7 +784,7 @@ void ImageToPOT(Image *image, Color fillColor)
         Color *pixelsPOT = NULL;
 
         // Generate POT array from NPOT data
-        pixelsPOT = (Color *)malloc(potWidth * potHeight * sizeof(Color));
+        pixelsPOT = (Color *)malloc(potWidth*potHeight*sizeof(Color));
 
         for (int j = 0; j < potHeight; j++)
         {
@@ -896,7 +896,9 @@ void ImageCrop(Image *image, Rectangle crop)
 }
 
 // Resize and image to new size
-// NOTE: Uses stb default scaling filter
+// NOTE: Uses stb default scaling filters (both bicubic):
+// STBIR_DEFAULT_FILTER_UPSAMPLE    STBIR_FILTER_CATMULLROM
+// STBIR_DEFAULT_FILTER_DOWNSAMPLE  STBIR_FILTER_MITCHELL   (high-quality Catmull-Rom)
 void ImageResize(Image *image, int newWidth, int newHeight) 
 {
     // Get data as Color pixels array to work with it