Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kimkulling/use own UI #227

Merged
merged 4 commits into from
Sep 4, 2024
Merged

Kimkulling/use own UI #227

merged 4 commits into from
Sep 4, 2024

Conversation

kimkulling
Copy link
Owner

@kimkulling kimkulling commented Sep 3, 2024

Summary by CodeRabbit

  • New Features

    • Streamlined asset loading process with direct file dialog integration.
    • Enhanced texture management through updated naming conventions and resource handling.
  • Bug Fixes

    • Removed unnecessary initialization and cleanup code for textures, improving memory management.
  • Refactor

    • Significant restructuring of build configurations and project architecture, particularly regarding ImGui integration.
    • Improved clarity and maintainability of texture-related code with standardized naming conventions.

Copy link

coderabbitai bot commented Sep 3, 2024

Walkthrough

The changes involve significant modifications across multiple files, focusing on restructuring the project’s build configuration, particularly regarding the ImGui library. Updates include the removal of SDL and OpenGL initialization in the application, alterations in resource management for textures, and a consistent renaming of member variables in the Texture class. Overall, these changes reflect a shift in how dependencies and resources are handled within the project.

Changes

Files Change Summary
contrib/cppcore Updated subproject commit reference from 3ea6da79... to d4f32ce5....
src/Editor_imgui/CMakeLists.txt Removed ImGui-related variable declarations and source files, restructuring the build configuration.
src/Editor_imgui/src/main.cpp Eliminated SDL and OpenGL initialization; simplified main loop and asset loading process.
src/Engine/App/AssimpWrapper.cpp Removed mDefaultTexture initialization and destructor in AssetContext, altering resource management.
src/Engine/App/AssimpWrapper.h Deleted mDefaultTexture member variable and changed destructor to default.
src/Engine/RenderBackend/OGLRenderer/... Updated texture property access with a new naming convention, improving code clarity.
src/Engine/RenderBackend/RenderCommon... Refactored Texture class to standardize member variable naming and added a clear() method.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AssetManager
    participant Renderer

    User->>AssetManager: Select Asset
    AssetManager->>Renderer: Load Asset
    Renderer->>Renderer: Initialize Rendering
    Renderer->>User: Display Asset
Loading

🐇 "In the garden, I hop with glee,
Changes abound, oh what a spree!
Textures and assets, all align,
A world of wonders, oh how divine!
With each new line, we dance and play,
Hooray for changes, hip-hip-hooray!" 🐇


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (2)
src/Editor_imgui/CMakeLists.txt (1)

Remaining ImGui References Detected

The recent changes in src/Editor_imgui/CMakeLists.txt have not fully removed all ImGui-related references. The following references were found:

  • ${CMAKE_HOME_DIRECTORY}/contrib/imgui in src/Editor_imgui/CMakeLists.txt
  • ADD_EXECUTABLE( osre_ed_imgui ... ) in src/Editor_imgui/CMakeLists.txt
  • osre_ed_imgui references in the root CMakeLists.txt

Please ensure that these references are either removed or properly replaced to reflect the shift away from using ImGui. Verify that all dependencies and configurations are updated accordingly to prevent any potential issues with the application's build process or functionality.

Analysis chain

Line range hint 1-88: Verify the impact of removing ImGui dependencies.

The changes in this file indicate a significant shift away from using ImGui for the graphical components of the project. This is evident from the removal of ImGui-related variables (platform_backend and imgui_src), the SOURCE_GROUP directive for contrib\Imgui, and the ${imgui_src} variable from the ADD_EXECUTABLE command.

Please ensure that:

  1. The necessary changes have been made in other parts of the codebase to accommodate this shift away from ImGui.
  2. The functionality and appearance of the application's user interface are not adversely affected by this change.
  3. Any new dependencies or libraries introduced as a replacement for ImGui are properly integrated and configured.

You can use the following script to search for any remaining ImGui references in the codebase:

If there are any remaining references to ImGui, please ensure that they are properly removed or replaced.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any remaining ImGui references in the codebase.

# Test: Search for ImGui references in C++ files. Expect: No occurrences.
rg --type cpp -i 'imgui'

# Test: Search for ImGui references in CMake files. Expect: No occurrences.
rg --type cmake -i 'imgui'

Length of output: 558

src/Editor_imgui/src/main.cpp (1)

39-39: Cross-platform compatibility likely impacted by Windows-specific code

The inclusion of the Windows-specific header Platform/win32/Win32Window.h in src/Editor_imgui/src/main.cpp and other files suggests a reliance on Windows-specific functionality. The presence of conditional compilation directives and platform-specific code paths indicates that the project's cross-platform compatibility may be affected. Further investigation or testing on other platforms is recommended to assess the full impact.

  • src/Editor_imgui/src/main.cpp: Includes Platform/win32/Win32Window.h
  • src/Editor_imgui/src/ProgressReporter.cpp: Includes and uses Platform/win32/Win32Window.h
  • src/Engine/Threading/TaskThread.h: Contains #ifdef WIN32 and similar directives
Analysis chain

Verify the impact of including the Windows-specific header on cross-platform compatibility.

The inclusion of the Windows-specific header file Platform/win32/Win32Window.h suggests a potential shift towards Windows-specific functionality. This change may impact the project's cross-platform compatibility.

Please ensure that the inclusion of this header does not introduce any platform-specific dependencies or break the build on other supported platforms.

Run the following script to verify the project's cross-platform compatibility:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the project's cross-platform compatibility.

# Test: Search for platform-specific code. Expect: No platform-specific code outside of the designated platform directories.
rg --type cpp -i -g '!Platform' -e 'win32|linux|macos'

Length of output: 22408

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5afb92c and f1d2f67.

Files selected for processing (9)
  • contrib/cppcore (1 hunks)
  • src/Editor_imgui/CMakeLists.txt (3 hunks)
  • src/Editor_imgui/src/main.cpp (3 hunks)
  • src/Engine/App/AssimpWrapper.cpp (2 hunks)
  • src/Engine/App/AssimpWrapper.h (2 hunks)
  • src/Engine/RenderBackend/OGLRenderer/OGLRenderBackend.cpp (1 hunks)
  • src/Engine/RenderBackend/OGLRenderer/OGLRenderCommands.cpp (1 hunks)
  • src/Engine/RenderBackend/RenderCommon.cpp (5 hunks)
  • src/Engine/RenderBackend/RenderCommon.h (1 hunks)
Files skipped from review due to trivial changes (3)
  • contrib/cppcore
  • src/Engine/App/AssimpWrapper.h
  • src/Engine/RenderBackend/OGLRenderer/OGLRenderCommands.cpp
Additional comments not posted (15)
src/Editor_imgui/src/main.cpp (3)

60-63: LGTM!

The changes to streamline the asset loading process by directly invoking a file dialog and loading the selected asset are approved. This modification aligns with the goal of focusing more on asset handling and less on the graphical setup, as mentioned in the AI-generated summary.


74-76: Clarify the intended usage of the retrieved stage and world pointers.

The code segment retrieves the active stage and world from the osreApp object, but the retrieved pointers are not utilized in the provided context. This may indicate incomplete or placeholder code.

Please provide more information about the intended usage of the retrieved stage and world pointers. If this code segment is a work in progress, consider adding TODO comments to clarify the planned functionality.


82-84: LGTM!

The added function calls to handleEvents(), update(), and requestNextFrame() ensure that the application can handle events, update its state, and request the next frame, which aligns with the modified main loop structure mentioned in the AI-generated summary. The changes are approved.

src/Engine/RenderBackend/RenderCommon.cpp (7)

299-308: LGTM!

The member variable renaming improves code readability and maintainability.


313-314: LGTM!

The changes to the destructor and the addition of the clear() method improve resource management by ensuring proper cleanup of the texture data.

Also applies to: 316-318


323-323: LGTM!

The changes are consistent with the member variable renaming in the Texture class.

Also applies to: 336-337, 341-343, 350-352


323-323: Verify the return type change.

The function now returns 0l instead of 0 when the texture pointer is nullptr. Ensure that this change is intentional and does not affect the caller's behavior.


366-385: LGTM!

The changes improve the function's efficiency by avoiding unnecessary texture creation and provide a more structured approach to initializing the default texture. The initialization logic is consistent with the member variable renaming in the Texture class.


396-400: LGTM!

The changes are consistent with the member variable renaming in the Texture class, ensuring proper cleanup of texture resources.


438-439: LGTM!

The changes are consistent with the member variable renaming in the Texture class, ensuring proper initialization of texture resources.

Also applies to: 446-446

src/Engine/App/AssimpWrapper.cpp (2)

99-99: LGTM!

The code changes are approved.


99-99: LGTM!

The code changes are approved.

src/Engine/RenderBackend/RenderCommon.h (2)

416-425: Approve the renaming of member variables to PascalCase.

The change from snake_case to PascalCase for member variable names improves readability and aligns with common C++ naming conventions for public members. This is a good refactoring.


429-429: Verify the implementation of the new clear() method.

The addition of the clear() method indicates new functionality to manage or reset the texture data.

Please provide the implementation of the clear() method. I'll review it to ensure correctness and suggest any necessary improvements.

src/Engine/RenderBackend/OGLRenderer/OGLRenderBackend.cpp (1)

805-806: LGTM!

The changes to the texture property access naming convention improve consistency and readability without altering functionality.

@@ -328,23 +333,23 @@

i32 width = 0, height = 0, channels = 0;

tex->m_data = stbi_load(path.c_str(), &width, &height, &channels, 0);
if (nullptr == tex->m_data) {
tex->Data = stbi_load(path.c_str(), &width, &height, &channels, 0);

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This argument to a file access function is derived from
user input (string read by fgets)
and then passed to stbi_load(filename), which calls stbi__fopen(filename), which calls fopen(__filename).
src/Engine/RenderBackend/RenderCommon.cpp Fixed Show fixed Hide fixed
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f1d2f67 and f1ee82f.

Files selected for processing (1)
  • src/Engine/RenderBackend/RenderCommon.cpp (5 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/Engine/RenderBackend/RenderCommon.cpp

@kimkulling kimkulling merged commit cb2cec8 into master Sep 4, 2024
2 of 3 checks passed
@kimkulling kimkulling deleted the kimkulling/use_own_ui branch September 4, 2024 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant