From 604a8c0b78b6f51abcce61aa0c3db25412acafa7 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 28 Apr 2019 14:45:46 +0200 Subject: [PATCH 1/4] WARNING: Functions renamed Two functions have been renamed for coherence; previous naming was confusing for several users: - DrawPolyEx() ---> DrawTriangleFan() - DrawPolyExLines() ---> DrawLineStrip() --- src/raylib.h | 4 +-- src/shapes.c | 99 ++++++++++++++++++++++++++-------------------------- 2 files changed, 52 insertions(+), 51 deletions(-) diff --git a/src/raylib.h b/src/raylib.h index 43260e066..c1cebdc83 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1058,6 +1058,7 @@ RLAPI void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Colo RLAPI void DrawLineV(Vector2 startPos, Vector2 endPos, Color color); // Draw a line (Vector version) RLAPI void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line defining thickness RLAPI void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color); // Draw a line using cubic-bezier curves in-out +RLAPI void DrawLineStrip(Vector2 *points, int numPoints, Color color); // Draw lines sequence RLAPI void DrawCircle(int centerX, int centerY, float radius, Color color); // Draw a color-filled circle RLAPI void DrawCircleSector(Vector2 center, float radius, int startAngle, int endAngle, int segments, Color color); // Draw a piece of a circle RLAPI void DrawCircleSectorLines(Vector2 center, float radius, int startAngle, int endAngle, int segments, Color color); // Draw circle sector outline @@ -1079,9 +1080,8 @@ RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Co RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, int lineThick, Color color); // Draw rectangle with rounded edges outline RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline +RLAPI void DrawTriangleFan(Vector2 *points, int numPoints, Color color); // Draw a triangle fan defined by points RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version) -RLAPI void DrawPolyEx(Vector2 *points, int numPoints, Color color); // Draw a closed polygon defined by points -RLAPI void DrawPolyExLines(Vector2 *points, int numPoints, Color color); // Draw polygon lines RLAPI void SetShapesTexture(Texture2D texture, Rectangle source); // Define default texture used to draw shapes diff --git a/src/shapes.c b/src/shapes.c index ecef287c0..93b332f5f 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -176,6 +176,25 @@ void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color) } } +// Draw lines sequence +void DrawLineStrip(Vector2 *points, int pointsCount, Color color) +{ + if (pointsCount >= 2) + { + if (rlCheckBufferLimit(pointsCount)) rlglDraw(); + + rlBegin(RL_LINES); + rlColor4ub(color.r, color.g, color.b, color.a); + + for (int i = 0; i < pointsCount - 1; i++) + { + rlVertex2f(points[i].x, points[i].y); + rlVertex2f(points[i + 1].x, points[i + 1].y); + } + rlEnd(); + } +} + // Draw a color-filled circle void DrawCircle(int centerX, int centerY, float radius, Color color) { @@ -1208,6 +1227,37 @@ void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color) rlEnd(); } +// Draw a triangle fan defined by points +// NOTE: First point provided is shared by all triangles +void DrawTriangleFan(Vector2 *points, int pointsCount, Color color) +{ + if (pointsCount >= 3) + { + if (rlCheckBufferLimit((pointsCount - 2)*4)) rlglDraw(); + + rlEnableTexture(GetShapesTexture().id); + rlBegin(RL_QUADS); + rlColor4ub(color.r, color.g, color.b, color.a); + + for (int i = 1; i < pointsCount - 1; i++) + { + rlTexCoord2f(recTexShapes.x/texShapes.width, recTexShapes.y/texShapes.height); + rlVertex2f(points[0].x, points[0].y); + + rlTexCoord2f(recTexShapes.x/texShapes.width, (recTexShapes.y + recTexShapes.height)/texShapes.height); + rlVertex2f(points[i].x, points[i].y); + + rlTexCoord2f((recTexShapes.x + recTexShapes.width)/texShapes.width, (recTexShapes.y + recTexShapes.height)/texShapes.height); + rlVertex2f(points[i + 1].x, points[i + 1].y); + + rlTexCoord2f((recTexShapes.x + recTexShapes.width)/texShapes.width, recTexShapes.y/texShapes.height); + rlVertex2f(points[i + 1].x, points[i + 1].y); + } + rlEnd(); + rlDisableTexture(); + } +} + // Draw a regular polygon of n sides (Vector version) void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color) { @@ -1256,55 +1306,6 @@ void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color col rlPopMatrix(); } -// Draw a closed polygon defined by points -void DrawPolyEx(Vector2 *points, int pointsCount, Color color) -{ - if (pointsCount >= 3) - { - if (rlCheckBufferLimit((pointsCount - 2)*4)) rlglDraw(); - - rlEnableTexture(GetShapesTexture().id); - rlBegin(RL_QUADS); - rlColor4ub(color.r, color.g, color.b, color.a); - - for (int i = 1; i < pointsCount - 1; i++) - { - rlTexCoord2f(recTexShapes.x/texShapes.width, recTexShapes.y/texShapes.height); - rlVertex2f(points[0].x, points[0].y); - - rlTexCoord2f(recTexShapes.x/texShapes.width, (recTexShapes.y + recTexShapes.height)/texShapes.height); - rlVertex2f(points[i].x, points[i].y); - - rlTexCoord2f((recTexShapes.x + recTexShapes.width)/texShapes.width, (recTexShapes.y + recTexShapes.height)/texShapes.height); - rlVertex2f(points[i + 1].x, points[i + 1].y); - - rlTexCoord2f((recTexShapes.x + recTexShapes.width)/texShapes.width, recTexShapes.y/texShapes.height); - rlVertex2f(points[i + 1].x, points[i + 1].y); - } - rlEnd(); - rlDisableTexture(); - } -} - -// Draw polygon using lines -void DrawPolyExLines(Vector2 *points, int pointsCount, Color color) -{ - if (pointsCount >= 2) - { - if (rlCheckBufferLimit(pointsCount)) rlglDraw(); - - rlBegin(RL_LINES); - rlColor4ub(color.r, color.g, color.b, color.a); - - for (int i = 0; i < pointsCount - 1; i++) - { - rlVertex2f(points[i].x, points[i].y); - rlVertex2f(points[i + 1].x, points[i + 1].y); - } - rlEnd(); - } -} - // Define default texture used to draw shapes void SetShapesTexture(Texture2D texture, Rectangle source) { From 55cb13f1b8e499b61bd8779c3e6d222102dff522 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 28 Apr 2019 15:46:08 +0200 Subject: [PATCH 2/4] Remove example on Android --- examples/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index ab5ff5489..32d27ddc5 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -48,6 +48,7 @@ if(${PLATFORM} MATCHES "Android") list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_rlgl_solar_system.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_obj_viewer.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_animation.c) + list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/models/models_first_person_maze.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_custom_uniform.c) list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_model_shader.c) From 7c10f971c1f8edfc65b074aceec7c3a0696c9b87 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 28 Apr 2019 16:03:59 +0200 Subject: [PATCH 3/4] Expose enable/disable backface culling Some tweaks on BeginVrDrawing() --- src/rlgl.h | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/rlgl.h b/src/rlgl.h index 1091f0d1c..b067e5c78 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -451,6 +451,8 @@ RLAPI void rlEnableRenderTexture(unsigned int id); // Enable render t RLAPI void rlDisableRenderTexture(void); // Disable render texture (fbo), return to default framebuffer RLAPI void rlEnableDepthTest(void); // Enable depth test RLAPI void rlDisableDepthTest(void); // Disable depth test +RLAPI void rlEnableBackfaceCulling(void); // Enable backface culling +RLAPI void rlDisableBackfaceCulling(void); // Disable backface culling RLAPI void rlEnableWireMode(void); // Enable wire mode RLAPI void rlDisableWireMode(void); // Disable wire mode RLAPI void rlDeleteTextures(unsigned int id); // Delete OpenGL texture from GPU @@ -1345,6 +1347,18 @@ void rlDisableDepthTest(void) glDisable(GL_DEPTH_TEST); } +// Enable backface culling +void rlEnableBackfaceCulling(void) +{ + glEnable(GL_CULL_FACE); +} + +// Disable backface culling +void rlDisableBackfaceCulling(void) +{ + glDisable(GL_CULL_FACE); +} + // Enable wire mode void rlEnableWireMode(void) { @@ -3657,30 +3671,25 @@ void ToggleVrMode(void) #endif } -// Begin Oculus drawing configuration +// Begin VR drawing configuration void BeginVrDrawing(void) { #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) if (vrSimulatorReady) { - // Setup framebuffer for stereo rendering - rlEnableRenderTexture(stereoFbo.id); - - // NOTE: If your application is configured to treat the texture as a linear format (e.g. GL_RGBA) - // and performs linear-to-gamma conversion in GLSL or does not care about gamma-correction, then: - // - Require OculusBuffer format to be OVR_FORMAT_R8G8B8A8_UNORM_SRGB - // - Do NOT enable GL_FRAMEBUFFER_SRGB - //glEnable(GL_FRAMEBUFFER_SRGB); + + rlEnableRenderTexture(stereoFbo.id); // Setup framebuffer for stereo rendering + //glEnable(GL_FRAMEBUFFER_SRGB); // Enable SRGB framebuffer (only if required) - //glViewport(0, 0, buffer.width, buffer.height); // Useful if rendering to separate framebuffers (every eye) - rlClearScreenBuffers(); // Clear current framebuffer(s) + //glViewport(0, 0, buffer.width, buffer.height); // Useful if rendering to separate framebuffers (every eye) + rlClearScreenBuffers(); // Clear current framebuffer vrStereoRender = true; } #endif } -// End Oculus drawing process (and desktop mirror) +// End VR drawing process (and desktop mirror) void EndVrDrawing(void) { #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) From 40940f439860b3345198dc44cd493f0c0dc12f7c Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 28 Apr 2019 16:45:23 +0200 Subject: [PATCH 4/4] Some formatting review --- src/core.c | 67 +++++++++++++++++++++++++---------------------------- src/rlgl.h | 16 ++++++------- src/utils.c | 10 ++++---- 3 files changed, 44 insertions(+), 49 deletions(-) diff --git a/src/core.c b/src/core.c index 2a8f2e3ac..1273a057d 100644 --- a/src/core.c +++ b/src/core.c @@ -476,12 +476,13 @@ static EM_BOOL EmscriptenGamepadCallback(int eventType, const EmscriptenGamepadE #endif #if defined(PLATFORM_RPI) +static void InitEvdevInput(void); // Evdev inputs initialization +static void EventThreadSpawn(char *device); // Identifies a input device and spawns a thread to handle it if needed +static void *EventThread(void *arg); // Input device events reading thread + static void InitKeyboard(void); // Init raw keyboard system (standard input reading) static void ProcessKeyboard(void); // Process keyboard events static void RestoreKeyboard(void); // Restore keyboard system -static void InitEvdevInput(void); // Mouse initialization (including mouse thread) -static void EventThreadSpawn(char *device); // Identifies a input device and spawns a thread to handle it if needed -static void *EventThread(void *arg); // Input device events reading thread static void InitGamepad(void); // Init raw gamepad input static void *GamepadThread(void *arg); // Mouse reading thread #endif @@ -595,7 +596,7 @@ void InitWindow(int width, int height, const char *title) #if defined(PLATFORM_RPI) // Init raw input system - InitEvdevInput(); // Mouse init + InitEvdevInput(); // Evdev inputs initialization InitKeyboard(); // Keyboard init InitGamepad(); // Gamepad init #endif @@ -629,7 +630,7 @@ void InitWindow(int width, int height, const char *title) SetTargetFPS(60); LogoAnimation(); } -#endif // defined(PLATFORM_ANDROID) +#endif // PLATFORM_ANDROID } // Close window and unload OpenGL context @@ -2369,12 +2370,12 @@ static bool InitGraphicsDevice(int width, int height) // Screen size security check if (screenWidth <= 0) screenWidth = displayWidth; if (screenHeight <= 0) screenHeight = displayHeight; -#endif // defined(PLATFORM_DESKTOP) +#endif // PLATFORM_DESKTOP #if defined(PLATFORM_WEB) displayWidth = screenWidth; displayHeight = screenHeight; -#endif // defined(PLATFORM_WEB) +#endif // PLATFORM_WEB glfwDefaultWindowHints(); // Set default windows hints: //glfwWindowHint(GLFW_RED_BITS, 8); // Framebuffer red color component bits @@ -2552,7 +2553,7 @@ static bool InitGraphicsDevice(int width, int height) glfwSwapInterval(1); TraceLog(LOG_INFO, "Trying to enable VSYNC"); } -#endif // defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) +#endif // PLATFORM_DESKTOP || PLATFORM_WEB #if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_UWP) fullscreen = true; @@ -2819,7 +2820,7 @@ static bool InitGraphicsDevice(int width, int height) //ANativeWindow_setBuffersGeometry(androidApp->window, 0, 0, displayFormat); // Force use of native display size surface = eglCreateWindowSurface(display, config, androidApp->window, NULL); -#endif // defined(PLATFORM_ANDROID) +#endif // PLATFORM_ANDROID #if defined(PLATFORM_RPI) graphics_get_display_size(0, &displayWidth, &displayHeight); @@ -2859,7 +2860,8 @@ static bool InitGraphicsDevice(int width, int height) surface = eglCreateWindowSurface(display, config, &nativeWindow, NULL); //--------------------------------------------------------------------------------- -#endif // defined(PLATFORM_RPI) +#endif // PLATFORM_RPI + // There must be at least one frame displayed before the buffers are swapped //eglSwapInterval(display, 1); @@ -2880,7 +2882,7 @@ static bool InitGraphicsDevice(int width, int height) TraceLog(LOG_INFO, "Screen size: %i x %i", screenWidth, screenHeight); TraceLog(LOG_INFO, "Viewport offsets: %i, %i", renderOffsetX, renderOffsetY); } -#endif // defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) +#endif // PLATFORM_ANDROID || PLATFORM_RPI renderWidth = screenWidth; renderHeight = screenHeight; @@ -3103,7 +3105,7 @@ static void PollInputEvents(void) for (int i = 0; i < 512; i++)previousKeyState[i] = currentKeyState[i]; // Grab a keypress from the evdev fifo if avalable - if(lastKeyPressedEvdev.Head != lastKeyPressedEvdev.Tail) + if (lastKeyPressedEvdev.Head != lastKeyPressedEvdev.Tail) { lastKeyPressed = lastKeyPressedEvdev.Contents[lastKeyPressedEvdev.Tail]; // Read the key from the buffer lastKeyPressedEvdev.Tail = (lastKeyPressedEvdev.Tail + 1) & 0x07; // Increment the tail pointer forwards and binary wraparound after 7 (fifo is 8 elements long) @@ -3267,7 +3269,7 @@ static void PollInputEvents(void) DeleteUWPMessage(msg); //Delete, we are done } -#endif // defined(PLATFORM_UWP) +#endif // PLATFORM_UWP #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) // Mouse input polling @@ -3414,12 +3416,11 @@ static void PollInputEvents(void) #endif #if defined(PLATFORM_RPI) - // NOTE: Mouse input events polling is done asynchonously in another pthread - EventThread() - // NOTE: Keyboard reading could be done using input_event(s) reading or just read from stdin, // we now use both methods inside here. 2nd method is still used for legacy purposes (Allows for input trough SSH console) ProcessKeyboard(); + // NOTE: Mouse input events polling is done asynchronously in another pthread - EventThread() // NOTE: Gamepad (Joystick) input events polling is done asynchonously in another pthread - GamepadThread() #endif } @@ -4244,6 +4245,7 @@ static void InitEvdevInput(void) // Open the linux directory of "/dev/input" directory = opendir(DEFAULT_EVDEV_PATH); + if (directory) { while ((entity = readdir(directory)) != NULL) @@ -4460,9 +4462,10 @@ static void EventThreadSpawn(char *device) static void *EventThread(void *arg) { // Scancode to keycode mapping for US keyboards - // TODO: Proabobly 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) + // TODO: Probably 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 keymap_US[] = - {0,256,49,50,51,52,53,54,55,56,57,48,45,61,259,258,81,87,69,82,84, + { 0,256,49,50,51,52,53,54,55,56,57,48,45,61,259,258,81,87,69,82,84, 89,85,73,79,80,91,93,257,341,65,83,68,70,71,72,74,75,76,59,39,96, 340,92,90,88,67,86,66,78,77,44,46,47,344,332,342,32,280,290,291, 292,293,294,295,296,297,298,299,282,281,327,328,329,333,324,325, @@ -4476,7 +4479,7 @@ static void *EventThread(void *arg) 192,193,194,0,0,0,0,0,200,201,202,203,204,205,206,207,208,209,210, 211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226, 227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242, - 243,244,245,246,247,248,0,0,0,0,0,0,0,}; + 243,244,245,246,247,248,0,0,0,0,0,0,0, }; struct input_event event; InputEventWorker *worker = (InputEventWorker *)arg; @@ -4515,10 +4518,7 @@ static void *EventThread(void *arg) #endif } - if (event.code == REL_WHEEL) - { - currentMouseWheelY += event.value; - } + if (event.code == REL_WHEEL) currentMouseWheelY += event.value; } // Absolute movement parsing @@ -4546,26 +4546,21 @@ static void *EventThread(void *arg) } // Multitouch movement - if (event.code == ABS_MT_SLOT) - { - worker->touchSlot = event.value; // Remeber the slot number for the folowing events - } + if (event.code == ABS_MT_SLOT) worker->touchSlot = event.value; // Remeber the slot number for the folowing events if (event.code == ABS_MT_POSITION_X) { - if (worker->touchSlot < MAX_TOUCH_POINTS) - touchPosition[worker->touchSlot].x = (event.value - worker->absRange.x)*screenWidth/worker->absRange.width; // Scale acording to absRange + if (worker->touchSlot < MAX_TOUCH_POINTS) touchPosition[worker->touchSlot].x = (event.value - worker->absRange.x)*screenWidth/worker->absRange.width; // Scale acording to absRange } if (event.code == ABS_MT_POSITION_Y) { - if (worker->touchSlot < MAX_TOUCH_POINTS) - touchPosition[worker->touchSlot].y = (event.value - worker->absRange.y)*screenHeight/worker->absRange.height; // Scale acording to absRange + if (worker->touchSlot < MAX_TOUCH_POINTS) touchPosition[worker->touchSlot].y = (event.value - worker->absRange.y)*screenHeight/worker->absRange.height; // Scale acording to absRange } if (event.code == ABS_MT_TRACKING_ID) { - if ( (event.value < 0) && (worker->touchSlot < MAX_TOUCH_POINTS) ) + if ((event.value < 0) && (worker->touchSlot < MAX_TOUCH_POINTS)) { // Touch has ended for this point touchPosition[worker->touchSlot].x = -1; @@ -4577,7 +4572,6 @@ static void *EventThread(void *arg) // Button parsing if (event.type == EV_KEY) { - // Mouse button parsing if ((event.code == BTN_TOUCH) || (event.code == BTN_LEFT)) { @@ -4595,25 +4589,26 @@ static void *EventThread(void *arg) if (event.code == BTN_MIDDLE) currentMouseStateEvdev[MOUSE_MIDDLE_BUTTON] = event.value; // Keyboard button parsing - if((event.code >= 1) && (event.code <= 255)) //Keyboard keys appear for codes 1 to 255 + if ((event.code >= 1) && (event.code <= 255)) //Keyboard keys appear for codes 1 to 255 { keycode = keymap_US[event.code & 0xFF]; // The code we get is a scancode so we look up the apropriate keycode + // Make sure we got a valid keycode - if((keycode > 0) && (keycode < sizeof(currentKeyState))) + if ((keycode > 0) && (keycode < sizeof(currentKeyState))) { // Store the key information for raylib to later use currentKeyStateEvdev[keycode] = event.value; - if(event.value > 0) + if (event.value > 0) { // Add the key int the fifo lastKeyPressedEvdev.Contents[lastKeyPressedEvdev.Head] = keycode; // Put the data at the front of the fifo snake lastKeyPressedEvdev.Head = (lastKeyPressedEvdev.Head + 1) & 0x07; // Increment the head pointer forwards and binary wraparound after 7 (fifo is 8 elements long) // TODO: This fifo is not fully threadsafe with multiple writers, so multiple keyboards hitting a key at the exact same time could miss a key (double write to head before it was incremented) } + TraceLog(LOG_DEBUG, "KEY%s ScanCode: %4i KeyCode: %4i",event.value == 0 ? "UP":"DOWN", event.code, keycode); } } - } // Screen confinement diff --git a/src/rlgl.h b/src/rlgl.h index b067e5c78..e98c6dc31 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -831,9 +831,9 @@ static RenderTexture2D stereoFbo; // VR stereo rendering framebuffer static bool vrSimulatorReady = false; // VR simulator ready flag static bool vrStereoRender = false; // VR stereo rendering enabled/disabled flag // NOTE: This flag is useful to render data over stereo image (i.e. FPS) -#endif // defined(SUPPORT_VR_SIMULATOR) +#endif // SUPPORT_VR_SIMULATOR -#endif // defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) +#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2 static int blendMode = 0; // Track current blending mode @@ -864,7 +864,7 @@ static void GenDrawQuad(void); // Generate and draw quad static void SetStereoView(int eye, Matrix matProjection, Matrix matModelView); // Set internal projection and modelview matrix depending on eye #endif -#endif // defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) +#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2 #if defined(GRAPHICS_API_OPENGL_11) static int GenerateMipmaps(unsigned char *data, int baseWidth, int baseHeight); @@ -1691,7 +1691,7 @@ void rlglInit(int width, int height) projection = MatrixIdentity(); modelview = MatrixIdentity(); currentMatrix = &modelview; -#endif // defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) +#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2 // Initialize OpenGL default states //---------------------------------------------------------- @@ -1883,11 +1883,11 @@ unsigned int rlLoadTexture(void *data, int width, int height, int format, int mi return id; } #endif -#endif // defined(GRAPHICS_API_OPENGL_11) +#endif // GRAPHICS_API_OPENGL_11 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glGenTextures(1, &id); // Generate Pointer to the texture + glGenTextures(1, &id); // Generate texture id #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) //glActiveTexture(GL_TEXTURE0); // If not defined, using GL_TEXTURE0 by default (shader texture) @@ -4428,9 +4428,9 @@ static void SetStereoView(int eye, Matrix matProjection, Matrix matModelView) SetMatrixModelview(eyeModelView); SetMatrixProjection(eyeProjection); } -#endif // defined(SUPPORT_VR_SIMULATOR) +#endif // SUPPORT_VR_SIMULATOR -#endif //defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) +#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2 #if defined(GRAPHICS_API_OPENGL_11) // Mipmaps data is generated after image data diff --git a/src/utils.c b/src/utils.c index 52fd0b457..ee4be46d0 100644 --- a/src/utils.c +++ b/src/utils.c @@ -34,7 +34,7 @@ // Check if config flags have been externally provided on compilation line #if !defined(EXTERNAL_CONFIG_FLAGS) - #include "config.h" // Defines module configuration flags + #include "config.h" // Defines module configuration flags #endif #include "utils.h" @@ -69,7 +69,7 @@ AAssetManager *assetManager; // Module specific Functions Declaration //---------------------------------------------------------------------------------- #if defined(PLATFORM_ANDROID) -/* This should be in , but Travis doesn't find it... */ +// This should be in , but Travis does not find it... FILE *funopen(const void *cookie, int (*readfn)(void *, char *, int), int (*writefn)(void *, const char *, int), fpos_t (*seekfn)(void *, fpos_t, int), int (*closefn)(void *)); @@ -173,7 +173,7 @@ FILE *android_fopen(const char *fileName, const char *mode) return funopen(asset, android_read, android_write, android_seek, android_close); } -#endif +#endif // PLATFORM_ANDROID //---------------------------------------------------------------------------------- // Module specific Functions Definition @@ -201,7 +201,7 @@ static int android_close(void *cookie) AAsset_close((AAsset *)cookie); return 0; } -#endif +#endif // PLATFORM_ANDROID #if defined(PLATFORM_UWP) @@ -276,4 +276,4 @@ UWPMessage* GetMessageFromUWP(void) return NULL; } -#endif // defined(PLATFORM_UWP) +#endif // PLATFORM_UWP