From ac475f46b9609235a9db4f3057271f609c39db7b Mon Sep 17 00:00:00 2001 From: raysan5 Date: Thu, 28 Jan 2016 10:03:37 +0100 Subject: Added touch points id to gestures Required by ProcessGestureEvent() --- src/camera.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/camera.c') diff --git a/src/camera.c b/src/camera.c index 4768b176..1e7ac2ff 100644 --- a/src/camera.c +++ b/src/camera.c @@ -2,7 +2,7 @@ * * raylib Camera System - Camera Modes Setup and Control Functions * -* Copyright (c) 2015 Marc Palau and Ramon Santamaria +* Copyright (c) 2015 Marc Palau and Ramon Santamaria (@raysan5) * * This software is provided "as-is", without any express or implied warranty. In no event * will the authors be held liable for any damages arising from the use of this software. -- cgit v1.2.3 From 646f1c3f716dd817ff717d35480a744a8be46ead Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 3 Feb 2016 17:45:28 +0100 Subject: Some formating tweaks --- src/camera.c | 114 +++++++++++++++++++++++++++++------------------------------ src/camera.h | 4 +-- src/core.c | 15 ++++---- src/raylib.h | 4 +-- src/rlgl.c | 2 +- 5 files changed, 70 insertions(+), 69 deletions(-) (limited to 'src/camera.c') diff --git a/src/camera.c b/src/camera.c index 1e7ac2ff..6539da5f 100644 --- a/src/camera.c +++ b/src/camera.c @@ -36,44 +36,44 @@ // Defines and Macros //---------------------------------------------------------------------------------- // CAMERA_GENERIC -#define CAMERA_SCROLL_SENSITIVITY 1.5 +#define CAMERA_SCROLL_SENSITIVITY 1.5f // FREE_CAMERA -#define FREE_CAMERA_MOUSE_SENSITIVITY 0.01 -#define FREE_CAMERA_DISTANCE_MIN_CLAMP 0.3 -#define FREE_CAMERA_DISTANCE_MAX_CLAMP 120 -#define FREE_CAMERA_MIN_CLAMP 85 -#define FREE_CAMERA_MAX_CLAMP -85 -#define FREE_CAMERA_SMOOTH_ZOOM_SENSITIVITY 0.05 -#define FREE_CAMERA_PANNING_DIVIDER 5.1 +#define FREE_CAMERA_MOUSE_SENSITIVITY 0.01f +#define FREE_CAMERA_DISTANCE_MIN_CLAMP 0.3f +#define FREE_CAMERA_DISTANCE_MAX_CLAMP 120.0f +#define FREE_CAMERA_MIN_CLAMP 85.0f +#define FREE_CAMERA_MAX_CLAMP -85.0f +#define FREE_CAMERA_SMOOTH_ZOOM_SENSITIVITY 0.05f +#define FREE_CAMERA_PANNING_DIVIDER 5.1f // ORBITAL_CAMERA -#define ORBITAL_CAMERA_SPEED 0.01 +#define ORBITAL_CAMERA_SPEED 0.01f // FIRST_PERSON -//#define FIRST_PERSON_MOUSE_SENSITIVITY 0.003 -#define FIRST_PERSON_FOCUS_DISTANCE 25 -#define FIRST_PERSON_MIN_CLAMP 85 -#define FIRST_PERSON_MAX_CLAMP -85 +//#define FIRST_PERSON_MOUSE_SENSITIVITY 0.003f +#define FIRST_PERSON_FOCUS_DISTANCE 25.0f +#define FIRST_PERSON_MIN_CLAMP 85.0f +#define FIRST_PERSON_MAX_CLAMP -85.0f -#define FIRST_PERSON_STEP_TRIGONOMETRIC_DIVIDER 5.0 -#define FIRST_PERSON_STEP_DIVIDER 30.0 -#define FIRST_PERSON_WAVING_DIVIDER 200.0 +#define FIRST_PERSON_STEP_TRIGONOMETRIC_DIVIDER 5.0f +#define FIRST_PERSON_STEP_DIVIDER 30.0f +#define FIRST_PERSON_WAVING_DIVIDER 200.0f -#define FIRST_PERSON_HEIGHT_RELATIVE_EYES_POSITION 0.85 +#define FIRST_PERSON_HEIGHT_RELATIVE_EYES_POSITION 0.85f // THIRD_PERSON -//#define THIRD_PERSON_MOUSE_SENSITIVITY 0.003 -#define THIRD_PERSON_DISTANCE_CLAMP 1.2 -#define THIRD_PERSON_MIN_CLAMP 5 -#define THIRD_PERSON_MAX_CLAMP -85 -#define THIRD_PERSON_OFFSET (Vector3){ 0.4, 0, 0 } +//#define THIRD_PERSON_MOUSE_SENSITIVITY 0.003f +#define THIRD_PERSON_DISTANCE_CLAMP 1.2f +#define THIRD_PERSON_MIN_CLAMP 5.0f +#define THIRD_PERSON_MAX_CLAMP -85.0f +#define THIRD_PERSON_OFFSET (Vector3){ 0.4f, 0.0f, 0.0f } // PLAYER (used by camera) -#define PLAYER_WIDTH 0.4 -#define PLAYER_HEIGHT 0.9 -#define PLAYER_DEPTH 0.4 -#define PLAYER_MOVEMENT_DIVIDER 20.0 +#define PLAYER_WIDTH 0.4f +#define PLAYER_HEIGHT 0.9f +#define PLAYER_DEPTH 0.4f +#define PLAYER_MOVEMENT_DIVIDER 20.0f //---------------------------------------------------------------------------------- // Types and Structures Definition @@ -84,11 +84,11 @@ typedef enum { MOVE_FRONT = 0, MOVE_LEFT, MOVE_BACK, MOVE_RIGHT, MOVE_UP, MOVE_D //---------------------------------------------------------------------------------- // Global Variables Definition //---------------------------------------------------------------------------------- -static Camera internalCamera = {{2, 0, 2}, {0, 0, 0}, {0, 1, 0}}; -static Vector2 cameraAngle = { 0, 0 }; +static Camera internalCamera = {{ 2.0f, 0.0f, 2.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }}; +static Vector2 cameraAngle = { 0.0f, 0.0f }; static float cameraTargetDistance = 5.0f; -static Vector2 cameraMousePosition = { 0, 0 }; -static Vector2 cameraMouseVariation = { 0, 0 }; +static Vector2 cameraMousePosition = { 0.0f, 0.0f }; +static Vector2 cameraMouseVariation = { 0.0f, 0.0f }; static float mouseSensitivity = 0.003f; static int cameraMoveControl[6] = { 'W', 'A', 'S', 'D', 'E', 'Q' }; static int cameraMoveCounter = 0; @@ -107,7 +107,7 @@ static void ProcessCamera(Camera *camera, Vector3 *playerPosition); #if defined(CAMERA_STANDALONE) // NOTE: Camera controls depend on some raylib input functions // TODO: Set your own input functions (used in ProcessCamera()) -static Vector2 GetMousePosition() { return (Vector2){ 0, 0}; } +static Vector2 GetMousePosition() { return (Vector2){ 0.0f, 0.0f }; } static void SetMousePosition(Vector2 pos) {} static int IsMouseButtonDown(int button) { return 0;} static int GetMouseWheelMove() { return 0; } @@ -129,33 +129,33 @@ void SetCameraMode(int mode) if ((cameraMode == CAMERA_FIRST_PERSON) && (mode == CAMERA_FREE)) { cameraMode = CAMERA_THIRD_PERSON; - cameraTargetDistance = 5; - cameraAngle.y = -40 * DEG2RAD; + cameraTargetDistance = 5.0f; + cameraAngle.y = -40*DEG2RAD; ProcessCamera(&internalCamera, &internalCamera.position); } else if ((cameraMode == CAMERA_FIRST_PERSON) && (mode == CAMERA_ORBITAL)) { cameraMode = CAMERA_THIRD_PERSON; - cameraTargetDistance = 5; - cameraAngle.y = -40 * DEG2RAD; + cameraTargetDistance = 5.0f; + cameraAngle.y = -40*DEG2RAD; ProcessCamera(&internalCamera, &internalCamera.position); } else if ((cameraMode == CAMERA_CUSTOM) && (mode == CAMERA_FREE)) { - cameraTargetDistance = 10; - cameraAngle.x = 45 * DEG2RAD; - cameraAngle.y = -40 * DEG2RAD; - internalCamera.target = (Vector3){ 0, 0, 0 }; + cameraTargetDistance = 10.0f; + cameraAngle.x = 45*DEG2RAD; + cameraAngle.y = -40*DEG2RAD; + internalCamera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; ProcessCamera(&internalCamera, &internalCamera.position); ShowCursor(); } else if ((cameraMode == CAMERA_CUSTOM) && (mode == CAMERA_ORBITAL)) { - cameraTargetDistance = 10; - cameraAngle.x = 225 * DEG2RAD; - cameraAngle.y = -40 * DEG2RAD; - internalCamera.target = (Vector3){ 0, 0, 0}; + cameraTargetDistance = 10.0f; + cameraAngle.x = 225*DEG2RAD; + cameraAngle.y = -40*DEG2RAD; + internalCamera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; ProcessCamera(&internalCamera, &internalCamera.position); } @@ -165,7 +165,7 @@ void SetCameraMode(int mode) // Update camera (player position is ignored) void UpdateCamera(Camera *camera) { - Vector3 position = { 0, 0, 0 }; + Vector3 position = { 0.0f, 0.0f, 0.0f }; // Process internal camera and player position (if required) if (cameraMode != CAMERA_CUSTOM) ProcessCamera(&internalCamera, &position); @@ -244,7 +244,7 @@ void SetCameraMoveControls(int frontKey, int backKey, int leftKey, int rightKey, // Set camera mouse sensitivity (1st person and 3rd person cameras) void SetCameraMouseSensitivity(float sensitivity) { - mouseSensitivity = (sensitivity/10000.0); + mouseSensitivity = (sensitivity/10000.0f); } //---------------------------------------------------------------------------------- @@ -376,12 +376,12 @@ static void ProcessCamera(Camera *camera, Vector3 *playerPosition) // Focus to center // TODO: Move this function out of the module? - if (IsKeyDown('Z')) camera->target = (Vector3){ 0, 0, 0 }; + if (IsKeyDown('Z')) camera->target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera position update camera->position.x = sin(cameraAngle.x)*cameraTargetDistance*cos(cameraAngle.y) + camera->target.x; - if (cameraAngle.y <= 0) camera->position.y = sin(cameraAngle.y)*cameraTargetDistance*sin(cameraAngle.y) + camera->target.y; + if (cameraAngle.y <= 0.0f) camera->position.y = sin(cameraAngle.y)*cameraTargetDistance*sin(cameraAngle.y) + camera->target.y; else camera->position.y = -sin(cameraAngle.y)*cameraTargetDistance*sin(cameraAngle.y) + camera->target.y; camera->position.z = cos(cameraAngle.x)*cameraTargetDistance*cos(cameraAngle.y) + camera->target.z; @@ -398,12 +398,12 @@ static void ProcessCamera(Camera *camera, Vector3 *playerPosition) if (cameraTargetDistance < THIRD_PERSON_DISTANCE_CLAMP) cameraTargetDistance = THIRD_PERSON_DISTANCE_CLAMP; // Focus to center - if (IsKeyDown('Z')) camera->target = (Vector3){ 0, 0, 0 }; + if (IsKeyDown('Z')) camera->target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera position update camera->position.x = sin(cameraAngle.x)*cameraTargetDistance*cos(cameraAngle.y) + camera->target.x; - if (cameraAngle.y <= 0) camera->position.y = sin(cameraAngle.y)*cameraTargetDistance*sin(cameraAngle.y) + camera->target.y; + if (cameraAngle.y <= 0.0f) camera->position.y = sin(cameraAngle.y)*cameraTargetDistance*sin(cameraAngle.y) + camera->target.y; else camera->position.y = -sin(cameraAngle.y)*cameraTargetDistance*sin(cameraAngle.y) + camera->target.y; camera->position.z = cos(cameraAngle.x)*cameraTargetDistance*cos(cameraAngle.y) + camera->target.z; @@ -412,7 +412,7 @@ static void ProcessCamera(Camera *camera, Vector3 *playerPosition) case CAMERA_FIRST_PERSON: case CAMERA_THIRD_PERSON: { - int isMoving = 0; + bool isMoving = false; // Keyboard inputs if (IsKeyDown(cameraMoveControl[MOVE_FRONT])) @@ -422,7 +422,7 @@ static void ProcessCamera(Camera *camera, Vector3 *playerPosition) if (!cameraUseGravity) camera->position.y += sin(cameraAngle.y)/PLAYER_MOVEMENT_DIVIDER; - isMoving = 1; + isMoving = true; } else if (IsKeyDown(cameraMoveControl[MOVE_BACK])) { @@ -431,7 +431,7 @@ static void ProcessCamera(Camera *camera, Vector3 *playerPosition) if (!cameraUseGravity) camera->position.y -= sin(cameraAngle.y)/PLAYER_MOVEMENT_DIVIDER; - isMoving = 1; + isMoving = true; } if (IsKeyDown(cameraMoveControl[MOVE_LEFT])) @@ -439,23 +439,23 @@ static void ProcessCamera(Camera *camera, Vector3 *playerPosition) playerPosition->x -= cos(cameraAngle.x)/PLAYER_MOVEMENT_DIVIDER; playerPosition->z += sin(cameraAngle.x)/PLAYER_MOVEMENT_DIVIDER; - isMoving = 1; + isMoving = true; } else if (IsKeyDown(cameraMoveControl[MOVE_RIGHT])) { playerPosition->x += cos(cameraAngle.x)/PLAYER_MOVEMENT_DIVIDER; playerPosition->z -= sin(cameraAngle.x)/PLAYER_MOVEMENT_DIVIDER; - isMoving = 1; + isMoving = true; } if (IsKeyDown(cameraMoveControl[MOVE_UP])) { - if (!cameraUseGravity) playerPosition->y += 1/PLAYER_MOVEMENT_DIVIDER; + if (!cameraUseGravity) playerPosition->y += 1.0f/PLAYER_MOVEMENT_DIVIDER; } else if (IsKeyDown(cameraMoveControl[MOVE_DOWN])) { - if (!cameraUseGravity) playerPosition->y -= 1/PLAYER_MOVEMENT_DIVIDER; + if (!cameraUseGravity) playerPosition->y -= 1.0f/PLAYER_MOVEMENT_DIVIDER; } if (cameraMode == CAMERA_THIRD_PERSON) @@ -482,7 +482,7 @@ static void ProcessCamera(Camera *camera, Vector3 *playerPosition) // Camera position update camera->position.x = sin(cameraAngle.x)*cameraTargetDistance*cos(cameraAngle.y) + camera->target.x; - if (cameraAngle.y <= 0) camera->position.y = sin(cameraAngle.y)*cameraTargetDistance*sin(cameraAngle.y) + camera->target.y; + if (cameraAngle.y <= 0.0f) camera->position.y = sin(cameraAngle.y)*cameraTargetDistance*sin(cameraAngle.y) + camera->target.y; else camera->position.y = -sin(cameraAngle.y)*cameraTargetDistance*sin(cameraAngle.y) + camera->target.y; camera->position.z = cos(cameraAngle.x)*cameraTargetDistance*cos(cameraAngle.y) + camera->target.z; diff --git a/src/camera.h b/src/camera.h index ed85320a..9ad09c6f 100644 --- a/src/camera.h +++ b/src/camera.h @@ -28,8 +28,8 @@ #define PI 3.14159265358979323846 #endif -#define DEG2RAD (PI / 180.0f) -#define RAD2DEG (180.0f / PI) +#define DEG2RAD (PI/180.0f) +#define RAD2DEG (180.0f/PI) //---------------------------------------------------------------------------------- // Defines and Macros diff --git a/src/core.c b/src/core.c index 1c9e16ae..c872d43e 100644 --- a/src/core.c +++ b/src/core.c @@ -116,6 +116,7 @@ //---------------------------------------------------------------------------------- // Defines and Macros //---------------------------------------------------------------------------------- +#define STORAGE_FILENAME "storage.data" //---------------------------------------------------------------------------------- // Types and Structures Definition @@ -591,7 +592,7 @@ void Begin3dMode(Camera camera) // Setup perspective projection float aspect = (float)screenWidth/(float)screenHeight; - double top = 0.1f*tan(45.0f*PI/360.0f); + double top = 0.1*tan(45.0*PI/360.0); double right = top*aspect; // NOTE: zNear and zFar values are important when computing depth buffer values @@ -630,7 +631,7 @@ void SetTargetFPS(int fps) // Returns current FPS float GetFPS(void) { - return (float)(1/frameTime); + return (float)(1.0/frameTime); } // Returns time in seconds for one frame @@ -791,10 +792,10 @@ void StorageSaveValue(int position, int value) FILE *storageFile = NULL; // Try open existing file to append data - storageFile = fopen("storage.data", "rb+"); + storageFile = fopen(STORAGE_FILENAME, "rb+"); // If file doesn't exist, create a new storage data file - if (!storageFile) storageFile = fopen("storage.data", "wb"); + if (!storageFile) storageFile = fopen(STORAGE_FILENAME, "wb"); if (!storageFile) TraceLog(WARNING, "Storage data file could not be created"); else @@ -822,7 +823,7 @@ int StorageLoadValue(int position) int value = 0; // Try open existing file to append data - FILE *storageFile = fopen("storage.data", "rb"); + FILE *storageFile = fopen(STORAGE_FILENAME, "rb"); if (!storageFile) TraceLog(WARNING, "Storage data file could not be found"); else @@ -889,8 +890,8 @@ Ray GetMouseRay(Vector2 mousePosition, Camera camera) MatrixInvert(&matProjView); // Calculate far and near points - Quaternion near = { deviceCoords.x, deviceCoords.y, 0, 1}; - Quaternion far = { deviceCoords.x, deviceCoords.y, 1, 1}; + Quaternion near = { deviceCoords.x, deviceCoords.y, 0.0f, 1.0f}; + Quaternion far = { deviceCoords.x, deviceCoords.y, 1.0f, 1.0f}; // Multiply points by unproject matrix QuaternionTransform(&near, matProjView); diff --git a/src/raylib.h b/src/raylib.h index c306518d..3d8100b3 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -81,8 +81,8 @@ #define PI 3.14159265358979323846 #endif -#define DEG2RAD (PI / 180.0f) -#define RAD2DEG (180.0f / PI) +#define DEG2RAD (PI/180.0f) +#define RAD2DEG (180.0f/PI) // raylib Config Flags #define FLAG_FULLSCREEN_MODE 1 diff --git a/src/rlgl.c b/src/rlgl.c index 48e6ac1b..6810cb4b 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -1406,7 +1406,7 @@ void rlglDrawPostpro(void) #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) glBindFramebuffer(GL_FRAMEBUFFER, 0); - rlglDrawModel(postproQuad, (Vector3){0,0,0}, (Vector3){0,0,0}, 0.0f, (Vector3){1.0f, 1.0f, 1.0f}, (Color){ 255, 255, 255, 255 }, false); + rlglDrawModel(postproQuad, (Vector3){ 0.0f, 0.0f, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, 0.0f, (Vector3){1.0f, 1.0f, 1.0f}, (Color){ 255, 255, 255, 255 }, false); #endif } -- cgit v1.2.3 From 823abf666e09e96ccbf5230c96f2d3a61ff60895 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Fri, 12 Feb 2016 12:22:56 +0100 Subject: Reviewed code TODOs --- src/audio.c | 2 +- src/camera.c | 2 +- src/core.c | 17 +++++++---------- src/models.c | 1 - src/rlgl.c | 10 +++------- src/text.c | 2 +- src/textures.c | 10 ++++++---- 7 files changed, 19 insertions(+), 25 deletions(-) (limited to 'src/camera.c') diff --git a/src/audio.c b/src/audio.c index e40fdd41..260f6778 100644 --- a/src/audio.c +++ b/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) diff --git a/src/camera.c b/src/camera.c index 6539da5f..517e4a2b 100644 --- a/src/camera.c +++ b/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 diff --git a/src/core.c b/src/core.c index 05ec0c0a..413006e4 100644 --- a/src/core.c +++ b/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"); } diff --git a/src/models.c b/src/models.c index 94e61d84..8a36c279 100644 --- a/src/models.c +++ b/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; } } diff --git a/src/rlgl.c b/src/rlgl.c index 2ea06e1c..5f8a5ea1 100644 --- a/src/rlgl.c +++ b/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; diff --git a/src/text.c b/src/text.c index 3755932d..e4c7bbf3 100644 --- a/src/text.c +++ b/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 diff --git a/src/textures.c b/src/textures.c index f03d2d9a..36819daf 100644 --- a/src/textures.c +++ b/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 -- cgit v1.2.3