Documentation
¶
Overview ¶
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.
Note: CSG nodes are intended to be used for level prototyping. Creating CSG nodes has a significant CPU cost compared to creating a MeshInstance3D with a PrimitiveMesh. Moving a CSG node within another CSG node also has a significant CPU cost, so it should be avoided during gameplay.
Index ¶
- type Advanced
- type Any
- type Extension
- func (self *Extension[T]) AsCSGPolygon3D() Instance
- func (self *Extension[T]) AsCSGPrimitive3D() CSGPrimitive3D.Instance
- func (self *Extension[T]) AsCSGShape3D() CSGShape3D.Instance
- func (self *Extension[T]) AsGeometryInstance3D() GeometryInstance3D.Instance
- func (self *Extension[T]) AsNode() Node.Instance
- func (self *Extension[T]) AsNode3D() Node3D.Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsVisualInstance3D() VisualInstance3D.Instance
- type ID
- type Instance
- func (self Instance) AsCSGPolygon3D() Instance
- func (self Instance) AsCSGPrimitive3D() CSGPrimitive3D.Instance
- func (self Instance) AsCSGShape3D() CSGShape3D.Instance
- func (self Instance) AsGeometryInstance3D() GeometryInstance3D.Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
- func (self Instance) Depth() Float.X
- func (self Instance) ID() ID
- func (self Instance) Material() Material.Instance
- func (self Instance) Mode() Mode
- func (self Instance) PathContinuousU() bool
- func (self Instance) PathInterval() Float.X
- func (self Instance) PathIntervalType() PathIntervalType
- func (self Instance) PathJoined() bool
- func (self Instance) PathLocal() bool
- func (self Instance) PathNode() string
- func (self Instance) PathRotation() PathRotation
- func (self Instance) PathRotationAccurate() bool
- func (self Instance) PathSimplifyAngle() Angle.Radians
- func (self Instance) PathUDistance() Float.X
- func (self Instance) Polygon() []Vector2.XY
- func (self Instance) SetDepth(value Float.X)
- func (self Instance) SetMaterial(value Material.Instance)
- func (self Instance) SetMode(value Mode)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetPathContinuousU(value bool)
- func (self Instance) SetPathInterval(value Float.X)
- func (self Instance) SetPathIntervalType(value PathIntervalType)
- func (self Instance) SetPathJoined(value bool)
- func (self Instance) SetPathLocal(value bool)
- func (self Instance) SetPathNode(value string)
- func (self Instance) SetPathRotation(value PathRotation)
- func (self Instance) SetPathRotationAccurate(value bool)
- func (self Instance) SetPathSimplifyAngle(value Angle.Radians)
- func (self Instance) SetPathUDistance(value Float.X)
- func (self Instance) SetPolygon(value []Vector2.XY)
- func (self Instance) SetSmoothFaces(value bool)
- func (self Instance) SetSpinDegrees(value Float.X)
- func (self Instance) SetSpinSides(value int)
- func (self Instance) SmoothFaces() bool
- func (self Instance) SpinDegrees() Float.X
- func (self Instance) SpinSides() int
- func (self Instance) Virtual(name string) reflect.Value
- type Mode
- type PathIntervalType
- type PathRotation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsCSGPolygon3D ¶
func (*Extension[T]) AsCSGPrimitive3D ¶
func (self *Extension[T]) AsCSGPrimitive3D() CSGPrimitive3D.Instance
func (*Extension[T]) AsCSGShape3D ¶
func (self *Extension[T]) AsCSGShape3D() CSGShape3D.Instance
func (*Extension[T]) AsGeometryInstance3D ¶
func (self *Extension[T]) AsGeometryInstance3D() GeometryInstance3D.Instance
func (*Extension[T]) AsVisualInstance3D ¶
func (self *Extension[T]) AsVisualInstance3D() VisualInstance3D.Instance
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.CSGPolygon3D
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsCSGPolygon3D ¶
func (Instance) AsCSGPrimitive3D ¶
func (self Instance) AsCSGPrimitive3D() CSGPrimitive3D.Instance
func (Instance) AsCSGShape3D ¶
func (self Instance) AsCSGShape3D() CSGShape3D.Instance
func (Instance) AsGeometryInstance3D ¶
func (self Instance) AsGeometryInstance3D() GeometryInstance3D.Instance
func (Instance) AsVisualInstance3D ¶
func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
func (Instance) Material ¶
Material to use for the resulting mesh. The UV maps the top half of the material to the extruded shape (U along the length of the extrusions and V around the outline of the Polygon), the bottom-left quarter to the front end face, and the bottom-right quarter to the back end face.
func (Instance) PathContinuousU ¶
When Mode is ModePath, by default, the top half of the Material is stretched along the entire length of the extruded shape. If false the top half of the material is repeated every step of the extrusion.
func (Instance) PathInterval ¶
When Mode is ModePath, the path interval or ratio of path points to extrusions.
func (Instance) PathIntervalType ¶
func (self Instance) PathIntervalType() PathIntervalType
When Mode is ModePath, this will determine if the interval should be by distance (PathIntervalDistance) or subdivision fractions (PathIntervalSubdivide).
func (Instance) PathJoined ¶
When Mode is ModePath, if true the ends of the path are joined, by adding an extrusion between the last and first points of the path.
func (Instance) PathLocal ¶
When Mode is ModePath, if true the Transform3D.BasisOrigin of the CSGPolygon3D is used as the starting point for the extrusions, not the Transform3D.BasisOrigin of the PathNode.
func (Instance) PathNode ¶
When Mode is ModePath, the location of the Path3D object used to extrude the Polygon.
func (Instance) PathRotation ¶
func (self Instance) PathRotation() PathRotation
When Mode is ModePath, the path rotation method used to rotate the Polygon as it is extruded.
func (Instance) PathRotationAccurate ¶
When Mode is ModePath, if true the polygon will be rotated according to the proper tangent of the path at the sampled points. If false an approximation is used, which decreases in accuracy as the number of subdivisions decreases.
func (Instance) PathSimplifyAngle ¶
When Mode is ModePath, extrusions that are less than this angle, will be merged together to reduce polygon count.
func (Instance) PathUDistance ¶
When Mode is ModePath, 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.
func (Instance) Polygon ¶
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 not have any intersecting edges. Otherwise, triangulation will fail and no mesh will be generated.
Note: If only 1 or 2 points are defined in Polygon, no mesh will be generated.
func (Instance) SetMaterial ¶
SetMaterial sets the property returned by [GetMaterial].
func (Instance) SetPathContinuousU ¶
SetPathContinuousU sets the property returned by [IsPathContinuousU].
func (Instance) SetPathInterval ¶
SetPathInterval sets the property returned by [GetPathInterval].
func (Instance) SetPathIntervalType ¶
func (self Instance) SetPathIntervalType(value PathIntervalType)
SetPathIntervalType sets the property returned by [GetPathIntervalType].
func (Instance) SetPathJoined ¶
SetPathJoined sets the property returned by [IsPathJoined].
func (Instance) SetPathLocal ¶
SetPathLocal sets the property returned by [IsPathLocal].
func (Instance) SetPathNode ¶
SetPathNode sets the property returned by [GetPathNode].
func (Instance) SetPathRotation ¶
func (self Instance) SetPathRotation(value PathRotation)
SetPathRotation sets the property returned by [GetPathRotation].
func (Instance) SetPathRotationAccurate ¶
SetPathRotationAccurate sets the property returned by [GetPathRotationAccurate].
func (Instance) SetPathSimplifyAngle ¶
SetPathSimplifyAngle sets the property returned by [GetPathSimplifyAngle].
func (Instance) SetPathUDistance ¶
SetPathUDistance sets the property returned by [GetPathUDistance].
func (Instance) SetPolygon ¶
SetPolygon sets the property returned by [GetPolygon].
func (Instance) SetSmoothFaces ¶
SetSmoothFaces sets the property returned by [GetSmoothFaces].
func (Instance) SetSpinDegrees ¶
SetSpinDegrees sets the property returned by [GetSpinDegrees].
func (Instance) SetSpinSides ¶
SetSpinSides sets the property returned by [GetSpinSides].
func (Instance) SmoothFaces ¶
If true, applies smooth shading to the extrusions.
func (Instance) SpinDegrees ¶
When Mode is ModeSpin, the total number of degrees the Polygon is rotated when extruding.
type Mode ¶
type Mode int //gd:CSGPolygon3D.Mode
const ( // The [Polygon] shape is extruded along the negative Z axis. // // [Polygon]: https://pkg.go.dev/graphics.gd/classdb/#Instance.Polygon ModeDepth Mode = 0 // The [Polygon] shape is extruded by rotating it around the Y axis. // // [Polygon]: https://pkg.go.dev/graphics.gd/classdb/#Instance.Polygon ModeSpin Mode = 1 // The [Polygon] shape is extruded along the [Path3D] specified in [PathNode]. // // [Path3D]: https://pkg.go.dev/graphics.gd/classdb/Path3D // [PathNode]: https://pkg.go.dev/graphics.gd/classdb/#Instance.PathNode // [Polygon]: https://pkg.go.dev/graphics.gd/classdb/#Instance.Polygon ModePath Mode = 2 )
type PathIntervalType ¶
type PathIntervalType int //gd:CSGPolygon3D.PathIntervalType
const ( // When [Mode] is set to [ModePath], [PathInterval] will determine the distance, in meters, each interval of the path will extrude. // // [Mode]: https://pkg.go.dev/graphics.gd/classdb/#Instance.Mode // [PathInterval]: https://pkg.go.dev/graphics.gd/classdb/#Instance.PathInterval PathIntervalDistance PathIntervalType = 0 // When [Mode] is set to [ModePath], [PathInterval] will subdivide the polygons along the path. // // [Mode]: https://pkg.go.dev/graphics.gd/classdb/#Instance.Mode // [PathInterval]: https://pkg.go.dev/graphics.gd/classdb/#Instance.PathInterval PathIntervalSubdivide PathIntervalType = 1 )
type PathRotation ¶
type PathRotation int //gd:CSGPolygon3D.PathRotation
const ( // The [Polygon] shape is not rotated. // // Note: Requires the path Z coordinates to continually decrease to ensure viable shapes. // // [Polygon]: https://pkg.go.dev/graphics.gd/classdb/#Instance.Polygon PathRotationPolygon PathRotation = 0 // The [Polygon] shape is rotated along the path, but it is not rotated around the path axis. // // Note: Requires the path Z coordinates to continually decrease to ensure viable shapes. // // [Polygon]: https://pkg.go.dev/graphics.gd/classdb/#Instance.Polygon PathRotationPath PathRotation = 1 // The [Polygon] shape follows the path and its rotations around the path axis. // // [Polygon]: https://pkg.go.dev/graphics.gd/classdb/#Instance.Polygon PathRotationPathFollow PathRotation = 2 )