-
Notifications
You must be signed in to change notification settings - Fork 12
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
Stage: Introduce 2D and 3D for stages. #241
Conversation
WalkthroughThe changes encompass updates to multiple files, primarily focusing on the Changes
Sequence Diagram(s)sequenceDiagram
participant AppBase
participant Stage
participant EventPtrArray
AppBase->>Stage: Create Stage("test", StageMode::Stage2D)
Stage->>Stage: Initialize mStageMode
AppBase->>EventPtrArray: attachMouseEventPtrs(eventArray)
AppBase->>EventPtrArray: attachKeyboardEventPtrs(eventArray)
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Additional comments not posted (6)
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Outside diff range and nitpick comments (2)
test/UnitTests/src/App/StageTest.cpp (2)
35-43
: LGTM! Consider adding more test cases.The test case is correctly checking if a
Stage
object can be created without throwing an exception. However, consider adding more test cases to improve coverage:
- Test case to check if the
Stage
object is created with the correct name and mode.- Test case to check the behavior of the
Stage
object in case of invalid inputs (e.g., empty name, invalid mode).Tools
cppcheck
[error] 35-35: syntax error
(syntaxError)
55-61
: LGTM! Consider adding a test case for invalid input.The test case is correctly checking if the
getStageMode
method of theStage
class returns the correct stage mode for eachStage
object. However, consider adding a test case to check the behavior of thegetStageMode
method in case of an invalid stage mode.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (9)
- contrib/assimp (1 hunks)
- src/Engine/Animation/AnimatorComponent.h (1 hunks)
- src/Engine/App/AppBase.cpp (3 hunks)
- src/Engine/App/AppBase.h (2 hunks)
- src/Engine/App/Stage.cpp (1 hunks)
- src/Engine/App/Stage.h (5 hunks)
- test/UnitTests/CMakeLists.txt (1 hunks)
- test/UnitTests/src/App/ProjectTest.cpp (1 hunks)
- test/UnitTests/src/App/StageTest.cpp (1 hunks)
Files skipped from review due to trivial changes (1)
- contrib/assimp
Additional context used
cppcheck
test/UnitTests/src/App/StageTest.cpp
[error] 35-35: syntax error
(syntaxError)
Additional comments not posted (19)
test/UnitTests/src/App/StageTest.cpp (1)
45-53
: LGTM!The test case is correctly checking if the
clear
method of theStage
class works as expected. It checks if the number of worlds is 0 and if theStage
object is empty after calling theclear
method.src/Engine/Animation/AnimatorComponent.h (1)
57-57
: LGTM!The addition of the
override
specifier for the destructor is a good practice. It improves code clarity and helps catch potential errors related to virtual function overriding.test/UnitTests/src/App/ProjectTest.cpp (1)
77-77
: Verify the test's behavior with the explicit stage mode.The
Stage
constructor call has been correctly updated to match the new constructor signature that includes theStageMode
argument.Please review the test's behavior and assertions to ensure they are still valid with the stage explicitly set to
Stage3D
mode. Update the test as needed.src/Engine/App/Stage.cpp (4)
41-42
: LGTM!Calling
clear()
in the destructor is a good practice to ensure proper resource management.
44-50
: LGTM!The
clear()
method is a good addition to improve resource management. It ensures that resources are properly released and the arrays are cleared.
52-53
: LGTM!The
getStageMode()
method is a useful addition that provides access to the current stage mode. It aligns with the PR objective and can be helpful for other parts of the codebase.
32-34
: Verify the constructor usage across the codebase.The constructor change aligns with the PR objective of introducing explicit support for 2D and 3D modes. However, it is a breaking change that would require updates to all existing code that instantiates the
Stage
class.Run the following script to verify the constructor usage:
test/UnitTests/CMakeLists.txt (1)
33-33
: LGTM!The addition of the
src/App/StageTest.cpp
file to theunittest_app_src
variable is consistent with the PR objective of adding unit tests for theStage
class. This change ensures that the new unit test file is included in the build process.src/Engine/App/Stage.h (5)
39-44
: LGTM!The
StageMode
enum class is well-defined and follows a clear naming convention. TheInvalid
value set to -1 is a good practice to indicate an invalid state, and theCount
value can be used to determine the total number of valid enum values.
59-60
: LGTM!The constructor change aligns with the PR objective of introducing 2D and 3D modes for stages. The additional
mode
parameter of typeStageMode
allows specifying the stage mode during instantiation, which is a good design choice.
65-70
: Ensure proper implementation of theclear()
method.The addition of the
clear()
andgetStageMode()
methods is a good design choice. Theclear()
method provides a way to reset the stage to its initial state, while thegetStageMode()
method allows retrieving the current stage mode.Please ensure that the
clear()
method is properly implemented in the corresponding source file to perform the necessary cleanup and reset operations.
99-101
: Verify the usage of theindex
parameter.The change to the
getActiveWorld()
method to accept anindex
parameter is a good addition, as it suggests support for multiple active worlds in a stage. Returning a pointer is appropriate to handle cases where no active world exists at the given index.Please ensure that the
index
parameter is properly validated and handled in the implementation to avoid out-of-bounds access.
Line range hint
111-129
: LGTM!Moving the implementation of the
isEmpty()
method outside the class definition is a valid coding style choice and doesn't affect the functionality. The method relies on theisEmpty()
method of themRenderWorlds
array to determine if the stage is empty, which is a straightforward and easy-to-understand approach.src/Engine/App/AppBase.cpp (4)
61-65
: LGTM!The
attachMouseEventPtrs
function correctly adds the necessary mouse event pointers to the providedEventPtrArray
, improving code organization.
67-70
: LGTM!The
attachKeyboardEventPtrs
function correctly adds the necessary keyboard event pointers to the providedEventPtrArray
, improving code organization.
86-86
: LGTM!The constructor change correctly initializes the
mStageMode
member variable toStageMode::Stage3D
, indicating the default stage mode for the application.
283-283
: LGTM!The
mStage
object instantiation correctly passes themStageMode
as an argument to theStage
constructor, allowing the stage to be configured based on the specified mode.src/Engine/App/AppBase.h (2)
27-27
: LGTM!The inclusion of the
Stage.h
header file inAppBase.h
is necessary to enable theAppBase
class to access and manage theStage
instances, which aligns with the PR objective of introducing 2D and 3D modes for stages.
293-293
: Verify the usage ofmStageMode
in the codebase.The addition of the
mStageMode
member variable to theAppBase
class is necessary to keep track of the current stage mode (2D or 3D), which aligns with the PR objective. Please ensure that themStageMode
is properly initialized and used throughout the codebase to influence the behavior or interactions of theAppBase
class based on the current stage mode.Run the following script to verify the usage of
mStageMode
:Verification successful
Approval:
mStageMode
is properly initialized and usedThe verification process confirms that
mStageMode
is correctly implemented and utilized in the codebase:
- Initialized in
AppBase
constructor withStageMode::Stage3D
- Used to create the
Stage
object inAppBase
- Present in both
AppBase
andStage
classes for consistent stage mode handling- Accessible through a getter method in
Stage
classThese findings indicate that the
mStageMode
member variable is well-integrated into the relevant parts of the codebase, supporting the PR objective of introducing explicit 2D and 3D mode support.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `mStageMode` in the codebase. # Test: Search for the initialization of `mStageMode`. Expect: At least one occurrence. rg --type cpp $'mStageMode\s*=' # Test: Search for the usage of `mStageMode`. Expect: Multiple occurrences. rg --type cpp $'mStageMode'Length of output: 397
@@ -49,12 +49,12 @@ struct AnimationTrack { | |||
//------------------------------------------------------------------------------------------------- | |||
/// @ingroup Engine | |||
/// | |||
/// @brief Describes the base class for all components. | |||
/// @brief |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a brief description for the class.
The brief comment for the class AnimatorComponent
has been left empty. It's important to provide a concise description of the class to help readers understand its purpose and functionality.
Consider adding a brief description, such as:
/// @brief Represents a component that manages animation tracks and updates the owner entity's animation state.
- Add debug statements for better debugging cabs.
Summary by CodeRabbit
Release Notes
New Features
StageMode
enumeration with options forStage2D
,Stage3D
, andInvalid
.Stage
class to support different stage modes upon instantiation.Stage3D
in the application.Bug Fixes
Stage
class with a newclear()
method.Tests
Stage
class, covering creation, clearing, and mode retrieval.