bevy/crates
Kumikaya 9a2eb878a2
Fix underflow panic in InitTriInfo (#14893)
# 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.
2024-08-25 14:13:23 +00:00
..
bevy_a11y Add Reflect derive to bevy_a11y::Focus (#14763) 2024-08-15 17:33:20 +00:00
bevy_animation Make ActiveAnimation::set_weight return &mut Self (#14914) 2024-08-25 13:44:52 +00:00
bevy_app Allow ordering variable timesteps around fixed timesteps (#14881) 2024-08-23 16:19:42 +00:00
bevy_asset Fix Gizmos warnings and doc errors when a subset of features are selected (#14887) 2024-08-23 16:19:06 +00:00
bevy_audio Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_color Apply unused_qualifications lint (#14828) 2024-08-21 12:29:33 +00:00
bevy_core Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_core_pipeline Ignore PipelineCache ambiguities (#14772) 2024-08-16 23:43:40 +00:00
bevy_derive Remove deprecated bevy_dynamic_plugin (#14534) 2024-07-30 15:31:08 +00:00
bevy_dev_tools Enables bevy_render feature for bevy_gizmos dependency in bevy_dev_tools (#14765) 2024-08-15 21:53:55 +00:00
bevy_diagnostic Apply unused_qualifications lint (#14828) 2024-08-21 12:29:33 +00:00
bevy_dylib Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_ecs Make the field of ParamSetBuilder pub so it's actually usable. (#14896) 2024-08-25 14:12:24 +00:00
bevy_encase_derive Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_gilrs Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_gizmos Allow ordering variable timesteps around fixed timesteps (#14881) 2024-08-23 16:19:42 +00:00
bevy_gltf Apply unused_qualifications lint (#14828) 2024-08-21 12:29:33 +00:00
bevy_hierarchy Add link to with_children in with_child doc (#14604) 2024-08-04 13:36:52 +00:00
bevy_input Fix common capitalization errors in documentation (#14562) 2024-07-31 21:16:05 +00:00
bevy_internal hooking up observers and clicking for ui node (#14695) 2024-08-15 14:43:55 +00:00
bevy_log Fix common capitalization errors in documentation (#14562) 2024-07-31 21:16:05 +00:00
bevy_macro_utils Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_math Expose bevy math ops (#14863) 2024-08-22 17:07:00 +00:00
bevy_mikktspace Fix underflow panic in InitTriInfo (#14893) 2024-08-25 14:13:23 +00:00
bevy_pbr Fix fog density texture offset seam (#14900) 2024-08-24 00:56:39 +00:00
bevy_picking hooking up observers and clicking for ui node (#14695) 2024-08-15 14:43:55 +00:00
bevy_ptr Apply unused_qualifications lint (#14828) 2024-08-21 12:29:33 +00:00
bevy_reflect Implement Reflect for std::ops::Bound (#14861) 2024-08-22 23:01:38 +00:00
bevy_render Fix tiny seam in Annulus geometry. (#14913) 2024-08-25 14:11:58 +00:00
bevy_scene reflect: implement the unique reflect rfc (#7207) 2024-08-12 17:01:41 +00:00
bevy_sprite Added Sprite::sized(custom_size) (#14849) 2024-08-21 12:24:16 +00:00
bevy_state Apply unused_qualifications lint (#14828) 2024-08-21 12:29:33 +00:00
bevy_tasks Fix common capitalization errors in documentation (#14562) 2024-07-31 21:16:05 +00:00
bevy_text Apply unused_qualifications lint (#14828) 2024-08-21 12:29:33 +00:00
bevy_time Allow ordering variable timesteps around fixed timesteps (#14881) 2024-08-23 16:19:42 +00:00
bevy_transform Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_ui check sampler type in as_bind_group derives (#12637) 2024-08-21 01:41:31 +00:00
bevy_utils Apply unused_qualifications lint (#14828) 2024-08-21 12:29:33 +00:00
bevy_window Apply unused_qualifications lint (#14828) 2024-08-21 12:29:33 +00:00
bevy_winit Apply unused_qualifications lint (#14828) 2024-08-21 12:29:33 +00:00