mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
494fe2fe21
"Raycast Normals" was introduced in 4.4 dev and defaulted to "false". The limited testing results at the time suggested that raycasting generally reduces normal quality compared to native simplifier results, at the same time increasing vertex memory and import time. To play it safe, we introduced a setting that defaulted to false, with the goal of removing it later in 4.4 development cycle if no regressions are noticed. Since we already had three dev snapshots and no reports, this change removes the setting and associated code. "Normal Split Angle" was only used when raycast normals were enabled; this change removes it from the settings, but keeps it in the script binding for compatibility. Existing meshes import exactly the same after this change (unless they chose to override raycasting which would be surprising). split_normals helper was only used in this code path and is also removed for simplicity; it is unlikely that this code will be useful as is, as it can only regenerate normals without fixing tangents or updating positions.
196 lines
10 KiB
XML
196 lines
10 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<class name="ImporterMesh" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
|
<brief_description>
|
|
A [Resource] that contains vertex array-based geometry during the import process.
|
|
</brief_description>
|
|
<description>
|
|
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.
|
|
</description>
|
|
<tutorials>
|
|
</tutorials>
|
|
<methods>
|
|
<method name="add_blend_shape">
|
|
<return type="void" />
|
|
<param index="0" name="name" type="String" />
|
|
<description>
|
|
Adds name for a blend shape that will be added with [method add_surface]. Must be called before surface is added.
|
|
</description>
|
|
</method>
|
|
<method name="add_surface">
|
|
<return type="void" />
|
|
<param index="0" name="primitive" type="int" enum="Mesh.PrimitiveType" />
|
|
<param index="1" name="arrays" type="Array" />
|
|
<param index="2" name="blend_shapes" type="Array[]" default="[]" />
|
|
<param index="3" name="lods" type="Dictionary" default="{}" />
|
|
<param index="4" name="material" type="Material" default="null" />
|
|
<param index="5" name="name" type="String" default="""" />
|
|
<param index="6" name="flags" type="int" default="0" />
|
|
<description>
|
|
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.
|
|
</description>
|
|
</method>
|
|
<method name="clear">
|
|
<return type="void" />
|
|
<description>
|
|
Removes all surfaces and blend shapes from this [ImporterMesh].
|
|
</description>
|
|
</method>
|
|
<method name="generate_lods">
|
|
<return type="void" />
|
|
<param index="0" name="normal_merge_angle" type="float" />
|
|
<param index="1" name="normal_split_angle" type="float" />
|
|
<param index="2" name="bone_transform_array" type="Array" />
|
|
<description>
|
|
Generates all lods for this ImporterMesh.
|
|
[param normal_merge_angle] is in degrees and used in the same way as the importer settings in [code]lods[/code].
|
|
[param normal_split_angle] is not used and only remains for compatibility with older versions of the API.
|
|
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.
|
|
</description>
|
|
</method>
|
|
<method name="get_blend_shape_count" qualifiers="const">
|
|
<return type="int" />
|
|
<description>
|
|
Returns the number of blend shapes that the mesh holds.
|
|
</description>
|
|
</method>
|
|
<method name="get_blend_shape_mode" qualifiers="const">
|
|
<return type="int" enum="Mesh.BlendShapeMode" />
|
|
<description>
|
|
Returns the blend shape mode for this Mesh.
|
|
</description>
|
|
</method>
|
|
<method name="get_blend_shape_name" qualifiers="const">
|
|
<return type="String" />
|
|
<param index="0" name="blend_shape_idx" type="int" />
|
|
<description>
|
|
Returns the name of the blend shape at this index.
|
|
</description>
|
|
</method>
|
|
<method name="get_lightmap_size_hint" qualifiers="const">
|
|
<return type="Vector2i" />
|
|
<description>
|
|
Returns the size hint of this mesh for lightmap-unwrapping in UV-space.
|
|
</description>
|
|
</method>
|
|
<method name="get_mesh">
|
|
<return type="ArrayMesh" />
|
|
<param index="0" name="base_mesh" type="ArrayMesh" default="null" />
|
|
<description>
|
|
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.
|
|
</description>
|
|
</method>
|
|
<method name="get_surface_arrays" qualifiers="const">
|
|
<return type="Array" />
|
|
<param index="0" name="surface_idx" type="int" />
|
|
<description>
|
|
Returns the arrays for the vertices, normals, UVs, etc. that make up the requested surface. See [method add_surface].
|
|
</description>
|
|
</method>
|
|
<method name="get_surface_blend_shape_arrays" qualifiers="const">
|
|
<return type="Array" />
|
|
<param index="0" name="surface_idx" type="int" />
|
|
<param index="1" name="blend_shape_idx" type="int" />
|
|
<description>
|
|
Returns a single set of blend shape arrays for the requested blend shape index for a surface.
|
|
</description>
|
|
</method>
|
|
<method name="get_surface_count" qualifiers="const">
|
|
<return type="int" />
|
|
<description>
|
|
Returns the number of surfaces that the mesh holds.
|
|
</description>
|
|
</method>
|
|
<method name="get_surface_format" qualifiers="const">
|
|
<return type="int" />
|
|
<param index="0" name="surface_idx" type="int" />
|
|
<description>
|
|
Returns the format of the surface that the mesh holds.
|
|
</description>
|
|
</method>
|
|
<method name="get_surface_lod_count" qualifiers="const">
|
|
<return type="int" />
|
|
<param index="0" name="surface_idx" type="int" />
|
|
<description>
|
|
Returns the number of lods that the mesh holds on a given surface.
|
|
</description>
|
|
</method>
|
|
<method name="get_surface_lod_indices" qualifiers="const">
|
|
<return type="PackedInt32Array" />
|
|
<param index="0" name="surface_idx" type="int" />
|
|
<param index="1" name="lod_idx" type="int" />
|
|
<description>
|
|
Returns the index buffer of a lod for a surface.
|
|
</description>
|
|
</method>
|
|
<method name="get_surface_lod_size" qualifiers="const">
|
|
<return type="float" />
|
|
<param index="0" name="surface_idx" type="int" />
|
|
<param index="1" name="lod_idx" type="int" />
|
|
<description>
|
|
Returns the screen ratio which activates a lod for a surface.
|
|
</description>
|
|
</method>
|
|
<method name="get_surface_material" qualifiers="const">
|
|
<return type="Material" />
|
|
<param index="0" name="surface_idx" type="int" />
|
|
<description>
|
|
Returns a [Material] in a given surface. Surface is rendered using this material.
|
|
</description>
|
|
</method>
|
|
<method name="get_surface_name" qualifiers="const">
|
|
<return type="String" />
|
|
<param index="0" name="surface_idx" type="int" />
|
|
<description>
|
|
Gets the name assigned to this surface.
|
|
</description>
|
|
</method>
|
|
<method name="get_surface_primitive_type">
|
|
<return type="int" enum="Mesh.PrimitiveType" />
|
|
<param index="0" name="surface_idx" type="int" />
|
|
<description>
|
|
Returns the primitive type of the requested surface (see [method add_surface]).
|
|
</description>
|
|
</method>
|
|
<method name="set_blend_shape_mode">
|
|
<return type="void" />
|
|
<param index="0" name="mode" type="int" enum="Mesh.BlendShapeMode" />
|
|
<description>
|
|
Sets the blend shape mode to one of [enum Mesh.BlendShapeMode].
|
|
</description>
|
|
</method>
|
|
<method name="set_lightmap_size_hint">
|
|
<return type="void" />
|
|
<param index="0" name="size" type="Vector2i" />
|
|
<description>
|
|
Sets the size hint of this mesh for lightmap-unwrapping in UV-space.
|
|
</description>
|
|
</method>
|
|
<method name="set_surface_material">
|
|
<return type="void" />
|
|
<param index="0" name="surface_idx" type="int" />
|
|
<param index="1" name="material" type="Material" />
|
|
<description>
|
|
Sets a [Material] for a given surface. Surface will be rendered using this material.
|
|
</description>
|
|
</method>
|
|
<method name="set_surface_name">
|
|
<return type="void" />
|
|
<param index="0" name="surface_idx" type="int" />
|
|
<param index="1" name="name" type="String" />
|
|
<description>
|
|
Sets a name for a given surface.
|
|
</description>
|
|
</method>
|
|
</methods>
|
|
</class>
|