Browse Source

[godot] Fix for 4.0/4.1, different API.

Mario Zechner 1 year ago
parent
commit
38fa8800f3

+ 4 - 0
spine-godot/spine_godot/SpineSprite.cpp

@@ -146,7 +146,11 @@ void SpineMesh2D::update_mesh(const Vector<Point2> &vertices,
 		uint32_t skin_stride;
 		uint32_t skin_stride;
 		RS::get_singleton()->mesh_create_surface_data_from_arrays(&surface, (RS::PrimitiveType) Mesh::PRIMITIVE_TRIANGLES, arrays, TypedArray<Array>(), Dictionary(), Mesh::ArrayFormat::ARRAY_FLAG_USE_DYNAMIC_UPDATE);
 		RS::get_singleton()->mesh_create_surface_data_from_arrays(&surface, (RS::PrimitiveType) Mesh::PRIMITIVE_TRIANGLES, arrays, TypedArray<Array>(), Dictionary(), Mesh::ArrayFormat::ARRAY_FLAG_USE_DYNAMIC_UPDATE);
 		RS::get_singleton()->mesh_add_surface(mesh, surface);
 		RS::get_singleton()->mesh_add_surface(mesh, surface);
+#if VERSION_MINOR > 1
 		RS::get_singleton()->mesh_surface_make_offsets_from_format(surface.format, surface.vertex_count, surface.index_count, surface_offsets, vertex_stride, normal_tangent_stride, attribute_stride, skin_stride);
 		RS::get_singleton()->mesh_surface_make_offsets_from_format(surface.format, surface.vertex_count, surface.index_count, surface_offsets, vertex_stride, normal_tangent_stride, attribute_stride, skin_stride);
+#else
+		RS::get_singleton()->mesh_surface_make_offsets_from_format(surface.format, surface.vertex_count, surface.index_count, surface_offsets, vertex_stride, attribute_stride, skin_stride);
+#endif
 		num_vertices = vertices.size();
 		num_vertices = vertices.size();
 		num_indices = indices.size();
 		num_indices = indices.size();
 		vertex_buffer = surface.vertex_data;
 		vertex_buffer = surface.vertex_data;

+ 1 - 1
spine-godot/spine_godot/SpineSprite.h

@@ -81,7 +81,7 @@ protected:
 
 
 public:
 public:
 #if VERSION_MAJOR > 3
 #if VERSION_MAJOR > 3
-	SpineMesh2D() : renderer_object(nullptr), indices_changed(true), num_vertices(0), num_indices(0), vertex_stride(0), attribute_stride(0){};
+	SpineMesh2D() : renderer_object(nullptr), indices_changed(true), num_vertices(0), num_indices(0), vertex_stride(0), normal_tangent_stride(0), attribute_stride(0){};
 	~SpineMesh2D() {
 	~SpineMesh2D() {
 		if (mesh.is_valid()) {
 		if (mesh.is_valid()) {
 			RS::get_singleton()->free(mesh);
 			RS::get_singleton()->free(mesh);