-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add boolean operator nodes in 2D (CSG) #39
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Xrayez
added
enhancement
Improvement of existing features
discussion
Further information is requested
breaks compat
Compatibility breakage
feature 💡
New feature proposal
labels
Nov 22, 2020
This is only done in C++, the binding code still constructs a new node.
Fixes drawing with final transform, introduces color property per each node. Added a bunch of other methods to collect polygons and polylines.
Greatly simplifies boolean operations, `is_hole` renamed to `is_inner` to denote hierarchical representation of nodes, and not necessarily geometrical meaning.
Some of these may still make sense, but can be reimplemented later.
Drawing is per node now, but mostly parent is responsible. Outlines from operations such as difference can be implemented in canvas editor plugin instead.
Allows to edit points.
The warning suggests that such nodes should be converted to `PolyNode2D` instead, this will be implemented. One issue still persists: I haven't found a way to move `PolyCircle2D` in the editor unless you use the move tool explicitly.
No `PolyShape2D` icon is added, because it's only used as a base for implementing other classes, as the case with `PolyCollisionShape2D`.
"Path" may be misleading because there's `Path/Path2D` nodes...
Had to fix poly tests as well.
I think I'm done feature-wise, there are certainly things which can be improved and even added, especially documentation, but that's good enough to use, I encourage anyone to test those classes out. If those are not intuitive to use, then perhaps the usage could be documented at https://goost.readthedocs.io/en/gd3/components/geometry.html. |
This was referenced Feb 16, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaks compat
Compatibility breakage
component:geometry 📐
enhancement
Improvement of existing features
feature 💡
New feature proposal
topic:core
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes godotengine/godot-proposals#200, helps goostengine/goost-examples#1.
This implements CSG-like behavior as seen in Godot's CSG system: https://docs.godotengine.org/en/stable/tutorials/3d/csg_tools.html
The core behavior is provided by
PolyNode2D
class which does have boolean operators (including XOR, which Godot doesn't have). The node can also be used for representing polygons with hierarchical structure, with inner and outer relationships between them.PolyNode2D
does not provide methods/properties to use it as a collision object. Instead, a newPolyCollisionShape2D
is added (inherits newPolyShape2D
which just builds convex/concave geometry), and which acts analogously toCollisionPolygon2D
, except that it usesPolyNode2D
as children to build collision shapes from. This makes it quite flexible to use, and not necessarily restricted to static bodies, but also things like defining area/navigation/light occluders which also may reuse those.Primitives are implemented as geometry generators. For now that's
PolyCircle2D
andPolyRectangle2D
. Again, unlike in Godot, those are not named asPolyCircleShape2D
, because "Shape" terminology is reserved to lean closer to collision shapes or other similar functionality.PolyNode2D
may be set as open (polylines) or closed (polygons). Clipping lines with polygons is also possible, but the support for such operations is not priority to make perfect.Geometry can be edited just like
CollisionPolygon2D
when you selectPolyNode2D
. Textures (with normalmap) and color for drawing can also be set.I believe this feature is the most powerful behind Goost out of all at this point. 🙂
To-do
There are quite a bunch of things which has to be ironed out, but current implementation is more or less usable so I'd appreciate any feedback at this point.