Documentation
¶
Overview ¶
Package Mesh provides methods for working with Mesh object instances.
Index ¶
- type Advanced
- type Any
- type ArrayCustomFormat
- type ArrayFormat
- type ArrayType
- type BlendShapeMode
- type Implementation
- type Instance
- func (self Instance) AsMesh() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) CreateConvexShape() [1]gdclass.ConvexPolygonShape3D
- func (self Instance) CreateOutline(margin Float.X) [1]gdclass.Mesh
- func (self Instance) CreatePlaceholder() [1]gdclass.Resource
- func (self Instance) CreateTrimeshShape() [1]gdclass.ConcavePolygonShape3D
- func (self Instance) GenerateTriangleMesh() [1]gdclass.TriangleMesh
- func (self Instance) GetAabb() AABB.PositionSize
- func (self Instance) GetFaces() []Vector3.XYZ
- func (self Instance) GetSurfaceCount() int
- func (self Instance) LightmapSizeHint() Vector2i.XY
- func (self Instance) SetLightmapSizeHint(value Vector2i.XY)
- func (self Instance) SurfaceGetArrays(surf_idx int) []any
- func (self Instance) SurfaceGetBlendShapeArrays(surf_idx int) [][]any
- func (self Instance) SurfaceGetMaterial(surf_idx int) [1]gdclass.Material
- func (self Instance) SurfaceSetMaterial(surf_idx int, material [1]gdclass.Material)
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) Virtual(name string) reflect.Value
- type Interface
- type PrimitiveType
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 ArrayCustomFormat ¶
type ArrayCustomFormat = gdclass.MeshArrayCustomFormat //gd:Mesh.ArrayCustomFormat
const ( /*Indicates this custom channel contains unsigned normalized byte colors from 0 to 1, encoded as [PackedByteArray].*/ ArrayCustomRgba8Unorm ArrayCustomFormat = 0 /*Indicates this custom channel contains signed normalized byte colors from -1 to 1, encoded as [PackedByteArray].*/ ArrayCustomRgba8Snorm ArrayCustomFormat = 1 /*Indicates this custom channel contains half precision float colors, encoded as [PackedByteArray]. Only red and green channels are used.*/ ArrayCustomRgHalf ArrayCustomFormat = 2 /*Indicates this custom channel contains half precision float colors, encoded as [PackedByteArray].*/ ArrayCustomRgbaHalf ArrayCustomFormat = 3 /*Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only the red channel is used.*/ ArrayCustomRFloat ArrayCustomFormat = 4 /*Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only red and green channels are used.*/ ArrayCustomRgFloat ArrayCustomFormat = 5 /*Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only red, green and blue channels are used.*/ ArrayCustomRgbFloat ArrayCustomFormat = 6 /*Indicates this custom channel contains full float colors, in a [PackedFloat32Array].*/ ArrayCustomRgbaFloat ArrayCustomFormat = 7 /*Represents the size of the [enum ArrayCustomFormat] enum.*/ ArrayCustomMax ArrayCustomFormat = 8 )
type ArrayFormat ¶
type ArrayFormat = gdclass.MeshArrayFormat //gd:Mesh.ArrayFormat
const ( /*Mesh array contains vertices. All meshes require a vertex array so this should always be present.*/ ArrayFormatVertex ArrayFormat = 1 /*Mesh array contains normals.*/ ArrayFormatNormal ArrayFormat = 2 /*Mesh array contains tangents.*/ ArrayFormatTangent ArrayFormat = 4 /*Mesh array contains colors.*/ ArrayFormatColor ArrayFormat = 8 /*Mesh array contains UVs.*/ ArrayFormatTexUv ArrayFormat = 16 /*Mesh array contains second UV.*/ ArrayFormatTexUv2 ArrayFormat = 32 /*Mesh array contains custom channel index 0.*/ ArrayFormatCustom0 ArrayFormat = 64 /*Mesh array contains custom channel index 1.*/ ArrayFormatCustom1 ArrayFormat = 128 /*Mesh array contains custom channel index 2.*/ ArrayFormatCustom2 ArrayFormat = 256 /*Mesh array contains custom channel index 3.*/ ArrayFormatCustom3 ArrayFormat = 512 /*Mesh array contains bones.*/ ArrayFormatBones ArrayFormat = 1024 /*Mesh array contains bone weights.*/ ArrayFormatWeights ArrayFormat = 2048 /*Mesh array uses indices.*/ ArrayFormatIndex ArrayFormat = 4096 /*Mask of mesh channels permitted in blend shapes.*/ ArrayFormatBlendShapeMask ArrayFormat = 7 /*Shift of first custom channel.*/ ArrayFormatCustomBase ArrayFormat = 13 /*Number of format bits per custom channel. See [enum ArrayCustomFormat].*/ ArrayFormatCustomBits ArrayFormat = 3 /*Amount to shift [enum ArrayCustomFormat] for custom channel index 0.*/ ArrayFormatCustom0Shift ArrayFormat = 13 /*Amount to shift [enum ArrayCustomFormat] for custom channel index 1.*/ ArrayFormatCustom1Shift ArrayFormat = 16 /*Amount to shift [enum ArrayCustomFormat] for custom channel index 2.*/ ArrayFormatCustom2Shift ArrayFormat = 19 /*Amount to shift [enum ArrayCustomFormat] for custom channel index 3.*/ ArrayFormatCustom3Shift ArrayFormat = 22 /*Mask of custom format bits per custom channel. Must be shifted by one of the SHIFT constants. See [enum ArrayCustomFormat].*/ ArrayFormatCustomMask ArrayFormat = 7 /*Shift of first compress flag. Compress flags should be passed to [method ArrayMesh.add_surface_from_arrays] and [method SurfaceTool.commit].*/ ArrayCompressFlagsBase ArrayFormat = 25 /*Flag used to mark that the array contains 2D vertices.*/ ArrayFlagUse2dVertices ArrayFormat = 33554432 /*Flag indices that the mesh data will use [code]GL_DYNAMIC_DRAW[/code] on GLES. Unused on Vulkan.*/ ArrayFlagUseDynamicUpdate ArrayFormat = 67108864 /*Flag used to mark that the mesh contains up to 8 bone influences per vertex. This flag indicates that [constant ARRAY_BONES] and [constant ARRAY_WEIGHTS] elements will have double length.*/ ArrayFlagUse8BoneWeights ArrayFormat = 134217728 /*Flag used to mark that the mesh intentionally contains no vertex array.*/ ArrayFlagUsesEmptyVertexArray ArrayFormat = 268435456 /*Flag used to mark that a mesh is using compressed attributes (vertices, normals, tangents, UVs). When this form of compression is enabled, vertex positions will be packed into an RGBA16UNORM attribute and scaled in the vertex shader. The normal and tangent will be packed into an RG16UNORM representing an axis, and a 16-bit float stored in the A-channel of the vertex. UVs will use 16-bit normalized floats instead of full 32-bit signed floats. When using this compression mode you must use either vertices, normals, and tangents or only vertices. You cannot use normals without tangents. Importers will automatically enable this compression if they can.*/ ArrayFlagCompressAttributes ArrayFormat = 536870912 )
type ArrayType ¶
type ArrayType = gdclass.MeshArrayType //gd:Mesh.ArrayType
const ( /*[PackedVector3Array], [PackedVector2Array], or [Array] of vertex positions.*/ ArrayVertex ArrayType = 0 /*[PackedVector3Array] of vertex normals. [b]Note:[/b] The array has to consist of normal vectors, otherwise they will be normalized by the engine, potentially causing visual discrepancies.*/ ArrayNormal ArrayType = 1 /*[PackedFloat32Array] of vertex tangents. Each element in groups of 4 floats, first 3 floats determine the tangent, and the last the binormal direction as -1 or 1.*/ ArrayTangent ArrayType = 2 /*[PackedColorArray] of vertex colors.*/ ArrayColor ArrayType = 3 /*[PackedVector2Array] for UV coordinates.*/ ArrayTexUv ArrayType = 4 /*[PackedVector2Array] for second UV coordinates.*/ ArrayTexUv2 ArrayType = 5 /*Contains custom color channel 0. [PackedByteArray] if [code](format >> Mesh.ARRAY_FORMAT_CUSTOM0_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK[/code] is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_SNORM], [constant ARRAY_CUSTOM_RG_HALF], or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise.*/ ArrayCustom0 ArrayType = 6 /*Contains custom color channel 1. [PackedByteArray] if [code](format >> Mesh.ARRAY_FORMAT_CUSTOM1_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK[/code] is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_SNORM], [constant ARRAY_CUSTOM_RG_HALF], or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise.*/ ArrayCustom1 ArrayType = 7 /*Contains custom color channel 2. [PackedByteArray] if [code](format >> Mesh.ARRAY_FORMAT_CUSTOM2_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK[/code] is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_SNORM], [constant ARRAY_CUSTOM_RG_HALF], or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise.*/ ArrayCustom2 ArrayType = 8 /*Contains custom color channel 3. [PackedByteArray] if [code](format >> Mesh.ARRAY_FORMAT_CUSTOM3_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK[/code] is [constant ARRAY_CUSTOM_RGBA8_UNORM], [constant ARRAY_CUSTOM_RGBA8_SNORM], [constant ARRAY_CUSTOM_RG_HALF], or [constant ARRAY_CUSTOM_RGBA_HALF]. [PackedFloat32Array] otherwise.*/ ArrayCustom3 ArrayType = 9 /*[PackedFloat32Array] or [PackedInt32Array] of bone indices. Contains either 4 or 8 numbers per vertex depending on the presence of the [constant ARRAY_FLAG_USE_8_BONE_WEIGHTS] flag.*/ ArrayBones ArrayType = 10 /*[PackedFloat32Array] or [PackedFloat64Array] of bone weights in the range [code]0.0[/code] to [code]1.0[/code] (inclusive). Contains either 4 or 8 numbers per vertex depending on the presence of the [constant ARRAY_FLAG_USE_8_BONE_WEIGHTS] flag.*/ ArrayWeights ArrayType = 11 /*[PackedInt32Array] of integers used as indices referencing vertices, colors, normals, tangents, and textures. All of those arrays must have the same number of elements as the vertex array. No index can be beyond the vertex array size. When this index array is present, it puts the function into "index mode," where the index selects the [i]i[/i]'th vertex, normal, tangent, color, UV, etc. This means if you want to have different normals or colors along an edge, you have to duplicate the vertices. For triangles, the index array is interpreted as triples, referring to the vertices of each triangle. For lines, the index array is in pairs indicating the start and end of each line.*/ ArrayIndex ArrayType = 12 /*Represents the size of the [enum ArrayType] enum.*/ ArrayMax ArrayType = 13 )
type BlendShapeMode ¶
type BlendShapeMode = gdclass.MeshBlendShapeMode //gd:Mesh.BlendShapeMode
const ( /*Blend shapes are normalized.*/ BlendShapeModeNormalized BlendShapeMode = 0 /*Blend shapes are relative to base weight.*/ BlendShapeModeRelative BlendShapeMode = 1 )
type Implementation ¶
type Implementation = implementation
Implementation implements Interface with empty methods.
type Instance ¶
Mesh is a type of [Resource] that contains vertex array-based geometry, divided in [i]surfaces[/i]. Each surface contains a completely separate array and a material used to draw it. Design wise, a mesh with multiple surfaces is preferred to a single surface, because objects created in 3D editing software commonly contain multiple materials. The maximum number of surfaces per mesh is [constant RenderingServer.MAX_MESH_SURFACES].
See [Interface] for methods that can be overridden by a [Class] that extends it.
%!(EXTRA string=Mesh)
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) CreateConvexShape ¶
func (self Instance) CreateConvexShape() [1]gdclass.ConvexPolygonShape3D
Calculate a [ConvexPolygonShape3D] from the mesh. If [param clean] is [code]true[/code] (default), duplicate and interior vertices are removed automatically. You can set it to [code]false[/code] to make the process faster if not needed. If [param simplify] is [code]true[/code], the geometry can be further simplified to reduce the number of vertices. Disabled by default.
func (Instance) CreateOutline ¶
Calculate an outline mesh at a defined offset (margin) from the original mesh. [b]Note:[/b] This method typically returns the vertices in reverse order (e.g. clockwise to counterclockwise).
func (Instance) CreatePlaceholder ¶
Creates a placeholder version of this resource ([PlaceholderMesh]).
func (Instance) CreateTrimeshShape ¶
func (self Instance) CreateTrimeshShape() [1]gdclass.ConcavePolygonShape3D
Calculate a [ConcavePolygonShape3D] from the mesh.
func (Instance) GenerateTriangleMesh ¶
func (self Instance) GenerateTriangleMesh() [1]gdclass.TriangleMesh
Generate a [TriangleMesh] from the mesh. Considers only surfaces using one of these primitive types: [constant PRIMITIVE_TRIANGLES], [constant PRIMITIVE_TRIANGLE_STRIP].
func (Instance) GetAabb ¶
func (self Instance) GetAabb() AABB.PositionSize
Returns the smallest [AABB] enclosing this mesh in local space. Not affected by [code]custom_aabb[/code]. [b]Note:[/b] This is only implemented for [ArrayMesh] and [PrimitiveMesh].
func (Instance) GetFaces ¶
Returns all the vertices that make up the faces of the mesh. Each three vertices represent one triangle.
func (Instance) GetSurfaceCount ¶
Returns the number of surfaces that the [Mesh] holds. This is equivalent to [method MeshInstance3D.get_surface_override_material_count].
func (Instance) LightmapSizeHint ¶
func (Instance) SetLightmapSizeHint ¶
func (Instance) SurfaceGetArrays ¶
Returns the arrays for the vertices, normals, UVs, etc. that make up the requested surface (see [method ArrayMesh.add_surface_from_arrays]).
func (Instance) SurfaceGetBlendShapeArrays ¶
Returns the blend shape arrays for the requested surface.
func (Instance) SurfaceGetMaterial ¶
Returns a [Material] in a given surface. Surface is rendered using this material. [b]Note:[/b] This returns the material within the [Mesh] resource, not the [Material] associated to the [MeshInstance3D]'s Surface Material Override properties. To get the [Material] associated to the [MeshInstance3D]'s Surface Material Override properties, use [method MeshInstance3D.get_surface_override_material] instead.
func (Instance) SurfaceSetMaterial ¶
Sets a [Material] for a given surface. Surface will be rendered using this material. [b]Note:[/b] This assigns the material within the [Mesh] resource, not the [Material] associated to the [MeshInstance3D]'s Surface Material Override properties. To set the [Material] associated to the [MeshInstance3D]'s Surface Material Override properties, use [method MeshInstance3D.set_surface_override_material] instead.
func (*Instance) UnsafePointer ¶
type Interface ¶
type Interface interface { //Virtual method to override the surface count for a custom class extending [Mesh]. GetSurfaceCount() int //Virtual method to override the surface array length for a custom class extending [Mesh]. SurfaceGetArrayLen(index int) int //Virtual method to override the surface array index length for a custom class extending [Mesh]. SurfaceGetArrayIndexLen(index int) int //Virtual method to override the surface arrays for a custom class extending [Mesh]. SurfaceGetArrays(index int) []any //Virtual method to override the blend shape arrays for a custom class extending [Mesh]. SurfaceGetBlendShapeArrays(index int) [][]any //Virtual method to override the surface LODs for a custom class extending [Mesh]. SurfaceGetLods(index int) map[any]any //Virtual method to override the surface format for a custom class extending [Mesh]. SurfaceGetFormat(index int) int //Virtual method to override the surface primitive type for a custom class extending [Mesh]. SurfaceGetPrimitiveType(index int) int //Virtual method to override the setting of a [param material] at the given [param index] for a custom class extending [Mesh]. SurfaceSetMaterial(index int, material [1]gdclass.Material) //Virtual method to override the surface material for a custom class extending [Mesh]. SurfaceGetMaterial(index int) [1]gdclass.Material //Virtual method to override the number of blend shapes for a custom class extending [Mesh]. GetBlendShapeCount() int //Virtual method to override the retrieval of blend shape names for a custom class extending [Mesh]. GetBlendShapeName(index int) string //Virtual method to override the names of blend shapes for a custom class extending [Mesh]. SetBlendShapeName(index int, name string) //Virtual method to override the [AABB] for a custom class extending [Mesh]. GetAabb() AABB.PositionSize }
type PrimitiveType ¶
type PrimitiveType = gdclass.MeshPrimitiveType //gd:Mesh.PrimitiveType
const ( /*Render array as points (one vertex equals one point).*/ PrimitivePoints PrimitiveType = 0 /*Render array as lines (every two vertices a line is created).*/ PrimitiveLines PrimitiveType = 1 /*Render array as line strip.*/ PrimitiveLineStrip PrimitiveType = 2 /*Render array as triangles (every three vertices a triangle is created).*/ PrimitiveTriangles PrimitiveType = 3 /*Render array as triangle strips.*/ PrimitiveTriangleStrip PrimitiveType = 4 )