mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
Rebind Mesh/ArrayMesh enums
This commit is contained in:
parent
47f8ac7864
commit
40b81339d0
@ -209,13 +209,19 @@
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="blend_shape_mode" type="int" setter="set_blend_shape_mode" getter="get_blend_shape_mode" enum="Mesh.BlendShapeMode" default="1">
|
||||
Sets the blend shape mode to one of [enum Mesh.BlendShapeMode].
|
||||
<member name="blend_shape_mode" type="int" setter="set_blend_shape_mode" getter="get_blend_shape_mode" enum="ArrayMesh.BlendShapeMode" default="1">
|
||||
Sets the blend shape mode to one of [enum ArrayMesh.BlendShapeMode].
|
||||
</member>
|
||||
<member name="custom_aabb" type="AABB" setter="set_custom_aabb" getter="get_custom_aabb" default="AABB( 0, 0, 0, 0, 0, 0 )">
|
||||
Overrides the [AABB] with one defined by user for use with frustum culling. Especially useful to avoid unexpected culling when using a shader to offset vertices.
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
<constant name="BLEND_SHAPE_MODE_NORMALIZED" value="0" enum="BlendShapeMode">
|
||||
Blend shapes are normalized.
|
||||
</constant>
|
||||
<constant name="BLEND_SHAPE_MODE_RELATIVE" value="1" enum="BlendShapeMode">
|
||||
Blend shapes are relative to base weight.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
@ -126,29 +126,23 @@
|
||||
<constant name="PRIMITIVE_TRIANGLE_STRIP" value="4" enum="PrimitiveType">
|
||||
Render array as triangle strips.
|
||||
</constant>
|
||||
<constant name="BLEND_SHAPE_MODE_NORMALIZED" value="0" enum="BlendShapeMode">
|
||||
Blend shapes are normalized.
|
||||
</constant>
|
||||
<constant name="BLEND_SHAPE_MODE_RELATIVE" value="1" enum="BlendShapeMode">
|
||||
Blend shapes are relative to base weight.
|
||||
</constant>
|
||||
<constant name="ARRAY_VERTEX" value="0" enum="ArrayType">
|
||||
Array of vertices.
|
||||
[PackedVector3Array], [PackedVector2Array], or [Array] of vertex positions.
|
||||
</constant>
|
||||
<constant name="ARRAY_NORMAL" value="1" enum="ArrayType">
|
||||
Array of normals.
|
||||
[PackedVector3Array] of vertex normals.
|
||||
</constant>
|
||||
<constant name="ARRAY_TANGENT" value="2" enum="ArrayType">
|
||||
Array of tangents as an array of floats, 4 floats per tangent.
|
||||
[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.
|
||||
</constant>
|
||||
<constant name="ARRAY_COLOR" value="3" enum="ArrayType">
|
||||
Array of colors.
|
||||
[PackedColorArray] of vertex colors.
|
||||
</constant>
|
||||
<constant name="ARRAY_TEX_UV" value="4" enum="ArrayType">
|
||||
Array of UV coordinates.
|
||||
[PackedVector2Array] for UV coordinates.
|
||||
</constant>
|
||||
<constant name="ARRAY_TEX_UV2" value="5" enum="ArrayType">
|
||||
Array of second set of UV coordinates.
|
||||
[PackedVector2Array] for second UV coordinates.
|
||||
</constant>
|
||||
<constant name="ARRAY_CUSTOM0" value="6" enum="ArrayType">
|
||||
</constant>
|
||||
@ -159,13 +153,14 @@
|
||||
<constant name="ARRAY_CUSTOM3" value="9" enum="ArrayType">
|
||||
</constant>
|
||||
<constant name="ARRAY_BONES" value="10" enum="ArrayType">
|
||||
Array of bone data.
|
||||
[PackedFloat32Array] or [PackedInt32Array] of bone indices. Each element is a group of 4 numbers.
|
||||
</constant>
|
||||
<constant name="ARRAY_WEIGHTS" value="11" enum="ArrayType">
|
||||
Array of weights.
|
||||
[PackedFloat32Array] of bone weights. Each element in groups of 4 floats.
|
||||
</constant>
|
||||
<constant name="ARRAY_INDEX" value="12" enum="ArrayType">
|
||||
Array of indices.
|
||||
[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*'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.
|
||||
</constant>
|
||||
<constant name="ARRAY_MAX" value="13" enum="ArrayType">
|
||||
Represents the size of the [enum ArrayType] enum.
|
||||
@ -187,6 +182,7 @@
|
||||
<constant name="ARRAY_CUSTOM_RGBA_FLOAT" value="7" enum="ArrayCustomFormat">
|
||||
</constant>
|
||||
<constant name="ARRAY_CUSTOM_MAX" value="8" enum="ArrayCustomFormat">
|
||||
Represents the size of the [enum ArrayCustomFormat] enum.
|
||||
</constant>
|
||||
<constant name="ARRAY_FORMAT_VERTEX" value="1" enum="ArrayFormat">
|
||||
Mesh array contains vertices. All meshes require a vertex array so this should always be present.
|
||||
@ -223,7 +219,7 @@
|
||||
<constant name="ARRAY_FORMAT_INDEX" value="4096" enum="ArrayFormat">
|
||||
Mesh array uses indices.
|
||||
</constant>
|
||||
<constant name="ARRAY_FORMAT_BLEND_SHAPE_MASK" value="-8185" enum="ArrayFormat">
|
||||
<constant name="ARRAY_FORMAT_BLEND_SHAPE_MASK" value="2147475463" enum="ArrayFormat">
|
||||
</constant>
|
||||
<constant name="ARRAY_FORMAT_CUSTOM_BASE" value="13" enum="ArrayFormat">
|
||||
</constant>
|
||||
|
@ -3123,7 +3123,7 @@
|
||||
<constant name="ARRAY_FORMAT_INDEX" value="4096" enum="ArrayFormat">
|
||||
Flag used to mark an index array.
|
||||
</constant>
|
||||
<constant name="ARRAY_FORMAT_BLEND_SHAPE_MASK" value="-8185" enum="ArrayFormat">
|
||||
<constant name="ARRAY_FORMAT_BLEND_SHAPE_MASK" value="2147475463" enum="ArrayFormat">
|
||||
</constant>
|
||||
<constant name="ARRAY_FORMAT_CUSTOM_BASE" value="13" enum="ArrayFormat">
|
||||
</constant>
|
||||
|
@ -470,9 +470,9 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
|
||||
p_mesh->add_blend_shape(name);
|
||||
}
|
||||
if (p_morph_data->mode == "RELATIVE") {
|
||||
p_mesh->set_blend_shape_mode(Mesh::BLEND_SHAPE_MODE_RELATIVE);
|
||||
p_mesh->set_blend_shape_mode(ArrayMesh::BLEND_SHAPE_MODE_RELATIVE);
|
||||
} else if (p_morph_data->mode == "NORMALIZED") {
|
||||
p_mesh->set_blend_shape_mode(Mesh::BLEND_SHAPE_MODE_NORMALIZED);
|
||||
p_mesh->set_blend_shape_mode(ArrayMesh::BLEND_SHAPE_MODE_NORMALIZED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1112,7 +1112,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
|
||||
|
||||
//ideally BLEND_SHAPE_MODE_RELATIVE since gltf2 stores in displacement
|
||||
//but it could require a larger refactor?
|
||||
mesh.mesh->set_blend_shape_mode(Mesh::BLEND_SHAPE_MODE_NORMALIZED);
|
||||
mesh.mesh->set_blend_shape_mode(ArrayMesh::BLEND_SHAPE_MODE_NORMALIZED);
|
||||
|
||||
if (j == 0) {
|
||||
const Array &target_names = extras.has("targetNames") ? (Array)extras["targetNames"] : Array();
|
||||
|
@ -838,7 +838,7 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat
|
||||
String ai_anim_mesh_name = AssimpUtils::get_assimp_string(ai_mesh->mAnimMeshes[j]->mName);
|
||||
if (!morph_mesh_string_lookup.has(ai_anim_mesh_name)) {
|
||||
morph_mesh_string_lookup.insert(ai_anim_mesh_name, j);
|
||||
mesh->set_blend_shape_mode(Mesh::BLEND_SHAPE_MODE_NORMALIZED);
|
||||
mesh->set_blend_shape_mode(ArrayMesh::BLEND_SHAPE_MODE_NORMALIZED);
|
||||
if (ai_anim_mesh_name.empty()) {
|
||||
ai_anim_mesh_name = String("morph_") + itos(j);
|
||||
}
|
||||
|
@ -480,9 +480,6 @@ void Mesh::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(PRIMITIVE_TRIANGLES);
|
||||
BIND_ENUM_CONSTANT(PRIMITIVE_TRIANGLE_STRIP);
|
||||
|
||||
BIND_ENUM_CONSTANT(BLEND_SHAPE_MODE_NORMALIZED);
|
||||
BIND_ENUM_CONSTANT(BLEND_SHAPE_MODE_RELATIVE);
|
||||
|
||||
BIND_ENUM_CONSTANT(ARRAY_VERTEX);
|
||||
BIND_ENUM_CONSTANT(ARRAY_NORMAL);
|
||||
BIND_ENUM_CONSTANT(ARRAY_TANGENT);
|
||||
@ -1615,6 +1612,9 @@ void ArrayMesh::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "_surfaces", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_surfaces", "_get_surfaces");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "blend_shape_mode", PROPERTY_HINT_ENUM, "Normalized,Relative"), "set_blend_shape_mode", "get_blend_shape_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::AABB, "custom_aabb", PROPERTY_HINT_NONE, ""), "set_custom_aabb", "get_custom_aabb");
|
||||
|
||||
BIND_ENUM_CONSTANT(BLEND_SHAPE_MODE_NORMALIZED);
|
||||
BIND_ENUM_CONSTANT(BLEND_SHAPE_MODE_RELATIVE);
|
||||
}
|
||||
|
||||
void ArrayMesh::reload_from_file() {
|
||||
|
@ -125,11 +125,6 @@ public:
|
||||
PRIMITIVE_MAX = RenderingServer::PRIMITIVE_MAX,
|
||||
};
|
||||
|
||||
enum BlendShapeMode {
|
||||
BLEND_SHAPE_MODE_NORMALIZED = RS::BLEND_SHAPE_MODE_NORMALIZED,
|
||||
BLEND_SHAPE_MODE_RELATIVE = RS::BLEND_SHAPE_MODE_RELATIVE,
|
||||
};
|
||||
|
||||
virtual int get_surface_count() const = 0;
|
||||
virtual int surface_get_array_len(int p_idx) const = 0;
|
||||
virtual int surface_get_array_index_len(int p_idx) const = 0;
|
||||
@ -176,6 +171,12 @@ class ArrayMesh : public Mesh {
|
||||
Array _get_surfaces() const;
|
||||
void _set_surfaces(const Array &p_data);
|
||||
|
||||
public:
|
||||
enum BlendShapeMode {
|
||||
BLEND_SHAPE_MODE_NORMALIZED = RS::BLEND_SHAPE_MODE_NORMALIZED,
|
||||
BLEND_SHAPE_MODE_RELATIVE = RS::BLEND_SHAPE_MODE_RELATIVE,
|
||||
};
|
||||
|
||||
private:
|
||||
struct Surface {
|
||||
uint32_t format;
|
||||
@ -267,6 +268,6 @@ VARIANT_ENUM_CAST(Mesh::ArrayType);
|
||||
VARIANT_ENUM_CAST(Mesh::ArrayFormat);
|
||||
VARIANT_ENUM_CAST(Mesh::ArrayCustomFormat);
|
||||
VARIANT_ENUM_CAST(Mesh::PrimitiveType);
|
||||
VARIANT_ENUM_CAST(Mesh::BlendShapeMode);
|
||||
VARIANT_ENUM_CAST(ArrayMesh::BlendShapeMode);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user