Merge pull request #57044 from Calinou/doc-csgpolygon3d-points

This commit is contained in:
Rémi Verschelde 2022-01-23 00:30:03 +01:00 committed by GitHub
commit 00f8b56f1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View file

@ -1694,7 +1694,7 @@ CSGBrush *CSGPolygon3D::_build_brush() {
} }
int shape_sides = shape_polygon.size(); int shape_sides = shape_polygon.size();
Vector<int> shape_faces = Geometry2D::triangulate_polygon(shape_polygon); Vector<int> shape_faces = Geometry2D::triangulate_polygon(shape_polygon);
ERR_FAIL_COND_V_MSG(shape_faces.size() < 3, brush, "Failed to triangulate CSGPolygon"); ERR_FAIL_COND_V_MSG(shape_faces.size() < 3, brush, "Failed to triangulate CSGPolygon. Make sure the polygon doesn't have any intersecting edges.");
// Get polygon enclosing Rect2. // Get polygon enclosing Rect2.
Rect2 shape_rect(shape_polygon[0], Vector2()); Rect2 shape_rect(shape_polygon[0], Vector2());

View file

@ -4,7 +4,7 @@
A CSG Mesh shape that uses a mesh resource. A CSG Mesh shape that uses a mesh resource.
</brief_description> </brief_description>
<description> <description>
This CSG node allows you to use any mesh resource as a CSG shape, provided it is closed, does not self-intersect, does not contain internal faces and has no edges that connect to more than two faces. This CSG node allows you to use any mesh resource as a CSG shape, provided it is closed, does not self-intersect, does not contain internal faces and has no edges that connect to more than two faces. See also [CSGPolygon3D] for drawing 2D extruded polygons to be used as CSG nodes.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>

View file

@ -4,7 +4,7 @@
Extrudes a 2D polygon shape to create a 3D mesh. Extrudes a 2D polygon shape to create a 3D mesh.
</brief_description> </brief_description>
<description> <description>
An array of 2D points is extruded to quickly and easily create a variety of 3D meshes. An array of 2D points is extruded to quickly and easily create a variety of 3D meshes. See also [CSGMesh3D] for using 3D meshes as CSG nodes.
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
@ -46,7 +46,8 @@
When [member mode] is [constant MODE_PATH], this is the distance along the path, in meters, the texture coordinates will tile. When set to 0, texture coordinates will match geometry exactly with no tiling. When [member mode] is [constant MODE_PATH], this is the distance along the path, in meters, the texture coordinates will tile. When set to 0, texture coordinates will match geometry exactly with no tiling.
</member> </member>
<member name="polygon" type="PackedVector2Array" setter="set_polygon" getter="get_polygon" default="PackedVector2Array(0, 0, 0, 1, 1, 1, 1, 0)"> <member name="polygon" type="PackedVector2Array" setter="set_polygon" getter="get_polygon" default="PackedVector2Array(0, 0, 0, 1, 1, 1, 1, 0)">
The point array that defines the 2D polygon that is extruded. The point array that defines the 2D polygon that is extruded. This can be a convex or concave polygon with 3 or more points. The polygon must [i]not[/i] have any intersecting edges. Otherwise, triangulation will fail and no mesh will be generated.
[b]Note:[/b] If only 1 or 2 points are defined in [member polygon], no mesh will be generated.
</member> </member>
<member name="smooth_faces" type="bool" setter="set_smooth_faces" getter="get_smooth_faces" default="false"> <member name="smooth_faces" type="bool" setter="set_smooth_faces" getter="get_smooth_faces" default="false">
If [code]true[/code], applies smooth shading to the extrusions. If [code]true[/code], applies smooth shading to the extrusions.