mirror of
https://github.com/bevyengine/bevy
synced 2024-11-26 06:30:19 +00:00
9a2eb878a2
# Objective - Fix #14874 ## Solution - Change the place where a panic occurs from `t < iNrTrianglesIn - 1` to `t + 1 < iNrTrianglesIn`. ## Testing - After the fix, the following code runs successfully without any panic. ```rust use bevy::prelude::Mesh; use bevy_render::{ mesh::{Indices, PrimitiveTopology}, render_asset::RenderAssetUsages, }; const POSITIONS: &[[f32; 3]] = &[[0.0, 1.0, 0.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0]]; const NORMALS: &[[f32; 3]] = &[[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]; const INDICES: &[u32] = &[0, 1, 2]; const UVS: &[[f32; 2]] = &[[0.0, 1.0], [0.0, 0.0], [0.0, 1.0]]; fn main() { let mut mesh = Mesh::new( PrimitiveTopology::TriangleList, RenderAssetUsages::default(), ); mesh.insert_attribute(Mesh::ATTRIBUTE_POSITION, POSITIONS.to_vec()); mesh.insert_attribute(Mesh::ATTRIBUTE_UV_0, UVS.to_vec()); mesh.insert_attribute(Mesh::ATTRIBUTE_NORMAL, NORMALS.to_vec()); mesh.insert_indices(Indices::U32(INDICES.to_vec())); mesh.generate_tangents().ok(); } ``` ## Migration Guide - No breaking changes introduced. |
||
---|---|---|
.. | ||
bevy_a11y | ||
bevy_animation | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_color | ||
bevy_core | ||
bevy_core_pipeline | ||
bevy_derive | ||
bevy_dev_tools | ||
bevy_diagnostic | ||
bevy_dylib | ||
bevy_ecs | ||
bevy_encase_derive | ||
bevy_gilrs | ||
bevy_gizmos | ||
bevy_gltf | ||
bevy_hierarchy | ||
bevy_input | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_math | ||
bevy_mikktspace | ||
bevy_pbr | ||
bevy_picking | ||
bevy_ptr | ||
bevy_reflect | ||
bevy_render | ||
bevy_scene | ||
bevy_sprite | ||
bevy_state | ||
bevy_tasks | ||
bevy_text | ||
bevy_time | ||
bevy_transform | ||
bevy_ui | ||
bevy_utils | ||
bevy_window | ||
bevy_winit |