@@ -243,6 +243,27 @@ void SpriteBase3D::draw_texture_rect(Ref<Texture2D> p_texture, Rect2 p_dst_rect,
243243 memcpy (&attribute_write_buffer[i * attrib_stride + mesh_surface_offsets[RS::ARRAY_COLOR]], v_color, 4 );
244244 }
245245
246+ switch (get_billboard_mode ()) {
247+ case StandardMaterial3D::BILLBOARD_ENABLED: {
248+ real_t size_new = MAX (Math::abs (final_rect.position .x ) * px_size, (final_rect.position .x + final_rect.size .x ) * px_size);
249+ size_new = MAX (size_new, MAX (Math::abs (final_rect.position .y ) * px_size, (final_rect.position .y + final_rect.size .y ) * px_size));
250+ aabb_new.position = Vector3 (-size_new, -size_new, -size_new);
251+ aabb_new.size = Vector3 (size_new * 2.0 , size_new * 2.0 , size_new * 2.0 );
252+ } break ;
253+ case StandardMaterial3D::BILLBOARD_FIXED_Y: {
254+ real_t size_new = MAX (Math::abs (final_rect.position .x ) * px_size, (final_rect.position .x + final_rect.size .x ) * px_size);
255+ if (ax == Vector3::AXIS_Y) {
256+ size_new = MAX (size_new, MAX (Math::abs (final_rect.position .y ) * px_size, (final_rect.position .y + final_rect.size .y ) * px_size));
257+ }
258+ aabb_new.position .x = -size_new;
259+ aabb_new.position .z = -size_new;
260+ aabb_new.size .x = size_new * 2.0 ;
261+ aabb_new.size .z = size_new * 2.0 ;
262+ } break ;
263+ default :
264+ break ;
265+ }
266+
246267 RID mesh_new = get_mesh ();
247268 RS::get_singleton ()->mesh_surface_update_vertex_region (mesh_new, 0 , 0 , vertex_buffer);
248269 RS::get_singleton ()->mesh_surface_update_attribute_region (mesh_new, 0 , 0 , attribute_buffer);
0 commit comments