ImporterMesh

package
v0.0.0-...-7325ca5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package ImporterMesh provides methods for working with ImporterMesh object instances.

Index

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 Any

type Any interface {
	gd.IsClass
	AsImporterMesh() Instance
}

type Instance

type Instance [1]gdclass.ImporterMesh

ImporterMesh is a type of [Resource] analogous to [ArrayMesh]. It 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. Unlike its runtime counterpart, [ImporterMesh] contains mesh data before various import steps, such as lod and shadow mesh generation, have taken place. Modify surface data by calling [method clear], followed by [method add_surface] for each surface.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddBlendShape

func (self Instance) AddBlendShape(name string)

Adds name for a blend shape that will be added with [method add_surface]. Must be called before surface is added.

func (Instance) AddSurface

func (self Instance) AddSurface(primitive gdclass.MeshPrimitiveType, arrays []any)

Creates a new surface. [method Mesh.get_surface_count] will become the [code]surf_idx[/code] for this new surface. Surfaces are created to be rendered using a [param primitive], which may be any of the values defined in [enum Mesh.PrimitiveType]. The [param arrays] argument is an array of arrays. Each of the [constant Mesh.ARRAY_MAX] elements contains an array with some of the mesh data for this surface as described by the corresponding member of [enum Mesh.ArrayType] or [code]null[/code] if it is not used by the surface. For example, [code]arrays[0][/code] is the array of vertices. That first vertex sub-array is always required; the others are optional. Adding an index array puts this surface into "index mode" where the vertex and other arrays become the sources of data and the index array defines the vertex order. All sub-arrays must have the same length as the vertex array (or be an exact multiple of the vertex array's length, when multiple elements of a sub-array correspond to a single vertex) or be empty, except for [constant Mesh.ARRAY_INDEX] if it is used. The [param blend_shapes] argument is an array of vertex data for each blend shape. Each element is an array of the same structure as [param arrays], but [constant Mesh.ARRAY_VERTEX], [constant Mesh.ARRAY_NORMAL], and [constant Mesh.ARRAY_TANGENT] are set if and only if they are set in [param arrays] and all other entries are [code]null[/code]. The [param lods] argument is a dictionary with [float] keys and [PackedInt32Array] values. Each entry in the dictionary represents an LOD level of the surface, where the value is the [constant Mesh.ARRAY_INDEX] array to use for the LOD level and the key is roughly proportional to the distance at which the LOD stats being used. I.e., increasing the key of an LOD also increases the distance that the objects has to be from the camera before the LOD is used. The [param flags] argument is the bitwise or of, as required: One value of [enum Mesh.ArrayCustomFormat] left shifted by [code]ARRAY_FORMAT_CUSTOMn_SHIFT[/code] for each custom channel in use, [constant Mesh.ARRAY_FLAG_USE_DYNAMIC_UPDATE], [constant Mesh.ARRAY_FLAG_USE_8_BONE_WEIGHTS], or [constant Mesh.ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY]. [b]Note:[/b] When using indices, it is recommended to only use points, lines, or triangles.

func (Instance) AsImporterMesh

func (self Instance) AsImporterMesh() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) Clear

func (self Instance) Clear()

Removes all surfaces and blend shapes from this [ImporterMesh].

func (Instance) GenerateLods

func (self Instance) GenerateLods(normal_merge_angle Float.X, normal_split_angle Float.X, bone_transform_array []any)

Generates all lods for this ImporterMesh. [param normal_merge_angle] and [param normal_split_angle] are in degrees and used in the same way as the importer settings in [code]lods[/code]. As a good default, use 25 and 60 respectively. The number of generated lods can be accessed using [method get_surface_lod_count], and each LOD is available in [method get_surface_lod_size] and [method get_surface_lod_indices]. [param bone_transform_array] is an [Array] which can be either empty or contain [Transform3D]s which, for each of the mesh's bone IDs, will apply mesh skinning when generating the LOD mesh variations. This is usually used to account for discrepancies in scale between the mesh itself and its skinning data.

func (Instance) GetBlendShapeCount

func (self Instance) GetBlendShapeCount() int

Returns the number of blend shapes that the mesh holds.

func (Instance) GetBlendShapeMode

func (self Instance) GetBlendShapeMode() gdclass.MeshBlendShapeMode

Returns the blend shape mode for this Mesh.

func (Instance) GetBlendShapeName

func (self Instance) GetBlendShapeName(blend_shape_idx int) string

Returns the name of the blend shape at this index.

func (Instance) GetLightmapSizeHint

func (self Instance) GetLightmapSizeHint() Vector2i.XY

Returns the size hint of this mesh for lightmap-unwrapping in UV-space.

func (Instance) GetMesh

func (self Instance) GetMesh() [1]gdclass.ArrayMesh

Returns the mesh data represented by this [ImporterMesh] as a usable [ArrayMesh]. This method caches the returned mesh, and subsequent calls will return the cached data until [method clear] is called. If not yet cached and [param base_mesh] is provided, [param base_mesh] will be used and mutated.

func (Instance) GetSurfaceArrays

func (self Instance) GetSurfaceArrays(surface_idx int) []any

Returns the arrays for the vertices, normals, UVs, etc. that make up the requested surface. See [method add_surface].

func (Instance) GetSurfaceBlendShapeArrays

func (self Instance) GetSurfaceBlendShapeArrays(surface_idx int, blend_shape_idx int) []any

Returns a single set of blend shape arrays for the requested blend shape index for a surface.

func (Instance) GetSurfaceCount

func (self Instance) GetSurfaceCount() int

Returns the number of surfaces that the mesh holds.

func (Instance) GetSurfaceFormat

func (self Instance) GetSurfaceFormat(surface_idx int) int

Returns the format of the surface that the mesh holds.

func (Instance) GetSurfaceLodCount

func (self Instance) GetSurfaceLodCount(surface_idx int) int

Returns the number of lods that the mesh holds on a given surface.

func (Instance) GetSurfaceLodIndices

func (self Instance) GetSurfaceLodIndices(surface_idx int, lod_idx int) []int32

Returns the index buffer of a lod for a surface.

func (Instance) GetSurfaceLodSize

func (self Instance) GetSurfaceLodSize(surface_idx int, lod_idx int) Float.X

Returns the screen ratio which activates a lod for a surface.

func (Instance) GetSurfaceMaterial

func (self Instance) GetSurfaceMaterial(surface_idx int) [1]gdclass.Material

Returns a [Material] in a given surface. Surface is rendered using this material.

func (Instance) GetSurfaceName

func (self Instance) GetSurfaceName(surface_idx int) string

Gets the name assigned to this surface.

func (Instance) GetSurfacePrimitiveType

func (self Instance) GetSurfacePrimitiveType(surface_idx int) gdclass.MeshPrimitiveType

Returns the primitive type of the requested surface (see [method add_surface]).

func (Instance) SetBlendShapeMode

func (self Instance) SetBlendShapeMode(mode gdclass.MeshBlendShapeMode)

Sets the blend shape mode to one of [enum Mesh.BlendShapeMode].

func (Instance) SetLightmapSizeHint

func (self Instance) SetLightmapSizeHint(size Vector2i.XY)

Sets the size hint of this mesh for lightmap-unwrapping in UV-space.

func (Instance) SetSurfaceMaterial

func (self Instance) SetSurfaceMaterial(surface_idx int, material [1]gdclass.Material)

Sets a [Material] for a given surface. Surface will be rendered using this material.

func (Instance) SetSurfaceName

func (self Instance) SetSurfaceName(surface_idx int, name string)

Sets a name for a given surface.

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL