dear-implot3d 0.12.0

High-level Rust bindings to ImPlot3D with dear-imgui-rs integration
Documentation
//! Predefined mesh data for common 3D shapes
//!
//! This module provides vertex and index data for common 3D meshes that can be used
//! with `Plot3DUi::mesh()`. These meshes are exported from the upstream ImPlot3D library.
//!
//! # Example
//!
//! ```no_run
//! use dear_implot3d::*;
//! use dear_implot3d::meshes::*;
//!
//! # let plot_ui: Plot3DUi = todo!();
//! if let Some(_token) = plot_ui.begin_plot("Mesh Demo").build() {
//!     plot_ui.setup_axes_limits(-1.5, 1.5, -1.5, 1.5, -1.5, 1.5, Plot3DCond::Once);
//!     
//!     // Plot a cube mesh
//!     plot_ui.mesh("Cube", CUBE_VERTICES, CUBE_INDICES)
//!         .flags(Mesh3DFlags::NONE)
//!         .plot();
//! }
//! ```

/// Cube mesh vertices (8 vertices)
///
/// A unit cube centered at the origin with vertices at (±1, ±1, ±1).
pub const CUBE_VERTICES: &[[f32; 3]] = &[
    [-1.0, -1.0, -1.0], // 0: Bottom-back-left
    [1.0, -1.0, -1.0],  // 1: Bottom-back-right
    [1.0, 1.0, -1.0],   // 2: Top-back-right
    [-1.0, 1.0, -1.0],  // 3: Top-back-left
    [-1.0, -1.0, 1.0],  // 4: Bottom-front-left
    [1.0, -1.0, 1.0],   // 5: Bottom-front-right
    [1.0, 1.0, 1.0],    // 6: Top-front-right
    [-1.0, 1.0, 1.0],   // 7: Top-front-left
];

/// Cube mesh indices (36 indices = 12 triangles)
///
/// Triangle indices for rendering the cube faces.
pub const CUBE_INDICES: &[u32] = &[
    // Back face
    0, 1, 2, 0, 2, 3, // Front face
    4, 5, 6, 4, 6, 7, // Left face
    0, 3, 7, 0, 7, 4, // Right face
    1, 5, 6, 1, 6, 2, // Top face
    3, 2, 6, 3, 6, 7, // Bottom face
    0, 1, 5, 0, 5, 4,
];

/// Sphere mesh vertices (162 vertices)
///
/// A unit sphere centered at the origin, created using icosphere subdivision.
pub const SPHERE_VERTICES: &[[f32; 3]] = &[
    [-0.525731, 0.850651, 0.000000],
    [0.525731, 0.850651, 0.000000],
    [-0.525731, -0.850651, 0.000000],
    [0.525731, -0.850651, 0.000000],
    [0.000000, -0.525731, 0.850651],
    [0.000000, 0.525731, 0.850651],
    [0.000000, -0.525731, -0.850651],
    [0.000000, 0.525731, -0.850651],
    [0.850651, 0.000000, -0.525731],
    [0.850651, 0.000000, 0.525731],
    [-0.850651, 0.000000, -0.525731],
    [-0.850651, 0.000000, 0.525731],
    [-0.809017, 0.500000, 0.309017],
    [-0.500000, 0.309017, 0.809017],
    [-0.309017, 0.809017, 0.500000],
    [0.309017, 0.809017, 0.500000],
    [0.000000, 1.000000, 0.000000],
    [0.309017, 0.809017, -0.500000],
    [-0.309017, 0.809017, -0.500000],
    [-0.500000, 0.309017, -0.809017],
    [-0.809017, 0.500000, -0.309017],
    [-1.000000, 0.000000, 0.000000],
    [0.500000, 0.309017, 0.809017],
    [0.809017, 0.500000, 0.309017],
    [-0.500000, -0.309017, 0.809017],
    [0.000000, 0.000000, 1.000000],
    [-0.809017, -0.500000, -0.309017],
    [-0.809017, -0.500000, 0.309017],
    [0.000000, 0.000000, -1.000000],
    [-0.500000, -0.309017, -0.809017],
    [0.809017, 0.500000, -0.309017],
    [0.500000, 0.309017, -0.809017],
    [0.809017, -0.500000, 0.309017],
    [0.500000, -0.309017, 0.809017],
    [0.309017, -0.809017, 0.500000],
    [-0.309017, -0.809017, 0.500000],
    [0.000000, -1.000000, 0.000000],
    [-0.309017, -0.809017, -0.500000],
    [0.309017, -0.809017, -0.500000],
    [0.500000, -0.309017, -0.809017],
    [0.809017, -0.500000, -0.309017],
    [1.000000, 0.000000, 0.000000],
    [-0.693780, 0.702046, 0.160622],
    [-0.587785, 0.688191, 0.425325],
    [-0.433889, 0.862668, 0.259892],
    [-0.862668, 0.259892, 0.433889],
    [-0.702046, 0.160622, 0.693780],
    [-0.688191, 0.425325, 0.587785],
    [-0.425325, 0.587785, 0.688191],
    [-0.259892, 0.433889, 0.862668],
    [-0.160622, 0.693780, 0.702046],
    [-0.162460, 0.951057, 0.262866],
    [-0.273267, 0.961938, 0.000000],
    [0.160622, 0.693780, 0.702046],
    [0.000000, 0.850651, 0.525731],
    [0.162460, 0.951057, 0.262866],
    [0.433889, 0.862668, 0.259892],
    [0.273267, 0.961938, 0.000000],
    [-0.162460, 0.951057, -0.262866],
    [-0.433889, 0.862668, -0.259892],
    [0.433889, 0.862668, -0.259892],
    [0.162460, 0.951057, -0.262866],
    [0.000000, 0.850651, -0.525731],
    [0.160622, 0.693780, -0.702046],
    [-0.160622, 0.693780, -0.702046],
    [-0.587785, 0.688191, -0.425325],
    [-0.693780, 0.702046, -0.160622],
    [-0.259892, 0.433889, -0.862668],
    [-0.425325, 0.587785, -0.688191],
    [-0.688191, 0.425325, -0.587785],
    [-0.702046, 0.160622, -0.693780],
    [-0.862668, 0.259892, -0.433889],
    [-0.850651, 0.525731, 0.000000],
    [-0.961938, 0.000000, -0.273267],
    [-0.951057, 0.262866, -0.162460],
    [-0.951057, 0.262866, 0.162460],
    [-0.961938, 0.000000, 0.273267],
    [0.587785, 0.688191, 0.425325],
    [0.693780, 0.702046, 0.160622],
    [0.259892, 0.433889, 0.862668],
    [0.425325, 0.587785, 0.688191],
    [0.688191, 0.425325, 0.587785],
    [0.702046, 0.160622, 0.693780],
    [0.862668, 0.259892, 0.433889],
    [-0.262866, 0.162460, 0.951057],
    [0.000000, 0.273267, 0.961938],
    [-0.702046, -0.160622, 0.693780],
    [-0.525731, 0.000000, 0.850651],
    [-0.262866, -0.162460, 0.951057],
    [-0.259892, -0.433889, 0.862668],
    [-0.425325, -0.587785, 0.688191],
    [-0.688191, -0.425325, 0.587785],
    [-0.587785, -0.688191, 0.425325],
    [-0.693780, -0.702046, 0.160622],
    [-0.862668, -0.259892, 0.433889],
    [-0.951057, -0.262866, 0.162460],
    [-0.961938, 0.000000, 0.273267],
    [-0.951057, -0.262866, -0.162460],
    [-0.961938, 0.000000, -0.273267],
    [-0.862668, -0.259892, -0.433889],
    [-0.693780, -0.702046, -0.160622],
    [-0.587785, -0.688191, -0.425325],
    [-0.688191, -0.425325, -0.587785],
    [-0.425325, -0.587785, -0.688191],
    [-0.259892, -0.433889, -0.862668],
    [-0.262866, -0.162460, -0.951057],
    [0.000000, -0.273267, -0.961938],
    [-0.702046, -0.160622, -0.693780],
    [-0.525731, 0.000000, -0.850651],
    [-0.262866, 0.162460, -0.951057],
    [0.262866, 0.162460, -0.951057],
    [0.000000, 0.273267, -0.961938],
    [0.525731, 0.000000, -0.850651],
    [0.702046, -0.160622, -0.693780],
    [0.262866, -0.162460, -0.951057],
    [0.259892, -0.433889, -0.862668],
    [0.425325, -0.587785, -0.688191],
    [0.688191, -0.425325, -0.587785],
    [0.587785, -0.688191, -0.425325],
    [0.693780, -0.702046, -0.160622],
    [0.862668, -0.259892, -0.433889],
    [0.951057, -0.262866, -0.162460],
    [0.961938, 0.000000, -0.273267],
    [0.951057, -0.262866, 0.162460],
    [0.961938, 0.000000, 0.273267],
    [0.862668, -0.259892, 0.433889],
    [0.693780, -0.702046, 0.160622],
    [0.587785, -0.688191, 0.425325],
    [0.688191, -0.425325, 0.587785],
    [0.425325, -0.587785, 0.688191],
    [0.259892, -0.433889, 0.862668],
    [0.262866, -0.162460, 0.951057],
    [0.000000, -0.273267, 0.961938],
    [0.702046, -0.160622, 0.693780],
    [0.525731, 0.000000, 0.850651],
    [0.262866, 0.162460, 0.951057],
    [0.850651, 0.525731, 0.000000],
    [0.951057, 0.262866, 0.162460],
    [0.961938, 0.000000, 0.273267],
    [0.951057, 0.262866, -0.162460],
    [0.961938, 0.000000, -0.273267],
    [0.862668, 0.259892, -0.433889],
    [0.693780, 0.702046, -0.160622],
    [0.587785, 0.688191, -0.425325],
    [0.688191, 0.425325, -0.587785],
    [0.425325, 0.587785, -0.688191],
    [0.259892, 0.433889, -0.862668],
    [0.262866, 0.162460, -0.951057],
    [0.000000, 0.273267, -0.961938],
    [0.702046, 0.160622, -0.693780],
    [0.525731, 0.000000, -0.850651],
    [-0.160622, -0.693780, 0.702046],
    [0.000000, -0.850651, 0.525731],
    [0.160622, -0.693780, 0.702046],
    [0.433889, -0.862668, 0.259892],
    [0.162460, -0.951057, 0.262866],
    [0.273267, -0.961938, 0.000000],
    [-0.162460, -0.951057, 0.262866],
    [-0.433889, -0.862668, 0.259892],
    [-0.273267, -0.961938, 0.000000],
    [-0.433889, -0.862668, -0.259892],
    [-0.162460, -0.951057, -0.262866],
    [0.162460, -0.951057, -0.262866],
    [0.433889, -0.862668, -0.259892],
    [0.000000, -0.850651, -0.525731],
    [0.160622, -0.693780, -0.702046],
    [-0.160622, -0.693780, -0.702046],
    [0.850651, -0.525731, 0.000000],
];

/// Sphere mesh indices (960 indices = 320 triangles)
///
/// Triangle indices for rendering the sphere faces.
pub const SPHERE_INDICES: &[u32] = &[
    0, 42, 44, 42, 12, 43, 44, 43, 14, 42, 43, 44, 12, 45, 47, 45, 11, 46, 47, 46, 13, 45, 46, 47,
    14, 48, 50, 48, 13, 49, 50, 49, 5, 48, 49, 50, 12, 47, 43, 47, 13, 48, 43, 48, 14, 47, 48, 43,
    0, 44, 52, 44, 14, 51, 52, 51, 16, 44, 51, 52, 14, 50, 54, 50, 5, 53, 54, 53, 15, 50, 53, 54,
    16, 55, 57, 55, 15, 56, 57, 56, 1, 55, 56, 57, 14, 54, 51, 54, 15, 55, 51, 55, 16, 54, 55, 51,
    0, 52, 59, 52, 16, 58, 59, 58, 18, 52, 58, 59, 16, 57, 61, 57, 1, 60, 61, 60, 17, 57, 60, 61,
    18, 62, 64, 62, 17, 63, 64, 63, 7, 62, 63, 64, 16, 61, 58, 61, 17, 62, 58, 62, 18, 61, 62, 58,
    0, 59, 66, 59, 18, 65, 66, 65, 20, 59, 65, 66, 18, 64, 68, 64, 7, 67, 68, 67, 19, 64, 67, 68,
    20, 69, 71, 69, 19, 70, 71, 70, 10, 69, 70, 71, 18, 68, 65, 68, 19, 69, 65, 69, 20, 68, 69, 65,
    0, 66, 42, 66, 20, 72, 42, 72, 12, 66, 72, 42, 20, 71, 74, 71, 10, 73, 74, 73, 21, 71, 73, 74,
    12, 75, 45, 75, 21, 76, 45, 76, 11, 75, 76, 45, 20, 74, 72, 74, 21, 75, 72, 75, 12, 74, 75, 72,
    1, 56, 78, 56, 15, 77, 78, 77, 23, 56, 77, 78, 15, 53, 80, 53, 5, 79, 80, 79, 22, 53, 79, 80,
    23, 81, 83, 81, 22, 82, 83, 82, 9, 81, 82, 83, 15, 80, 77, 80, 22, 81, 77, 81, 23, 80, 81, 77,
    5, 49, 85, 49, 13, 84, 85, 84, 25, 49, 84, 85, 13, 46, 87, 46, 11, 86, 87, 86, 24, 46, 86, 87,
    25, 88, 90, 88, 24, 89, 90, 89, 4, 88, 89, 90, 13, 87, 84, 87, 24, 88, 84, 88, 25, 87, 88, 84,
    11, 76, 92, 76, 21, 91, 92, 91, 27, 76, 91, 92, 21, 73, 94, 73, 10, 93, 94, 93, 26, 73, 93, 94,
    27, 95, 97, 95, 26, 96, 97, 96, 2, 95, 96, 97, 21, 94, 91, 94, 26, 95, 91, 95, 27, 94, 95, 91,
    10, 70, 99, 70, 19, 98, 99, 98, 29, 70, 98, 99, 19, 67, 101, 67, 7, 100, 101, 100, 28, 67, 100,
    101, 29, 102, 104, 102, 28, 103, 104, 103, 6, 102, 103, 104, 19, 101, 98, 101, 28, 102, 98,
    102, 29, 101, 102, 98, 7, 63, 106, 63, 17, 105, 106, 105, 31, 63, 105, 106, 17, 60, 108, 60, 1,
    107, 108, 107, 30, 60, 107, 108, 31, 109, 111, 109, 30, 110, 111, 110, 8, 109, 110, 111, 17,
    108, 105, 108, 30, 109, 105, 109, 31, 108, 109, 105, 3, 112, 114, 112, 32, 113, 114, 113, 34,
    112, 113, 114, 32, 115, 117, 115, 9, 116, 117, 116, 33, 115, 116, 117, 34, 118, 120, 118, 33,
    119, 120, 119, 4, 118, 119, 120, 32, 117, 113, 117, 33, 118, 113, 118, 34, 117, 118, 113, 3,
    114, 122, 114, 34, 121, 122, 121, 36, 114, 121, 122, 34, 120, 124, 120, 4, 123, 124, 123, 35,
    120, 123, 124, 36, 125, 127, 125, 35, 126, 127, 126, 2, 125, 126, 127, 34, 124, 121, 124, 35,
    125, 121, 125, 36, 124, 125, 121, 3, 122, 129, 122, 36, 128, 129, 128, 38, 122, 128, 129, 36,
    127, 131, 127, 2, 130, 131, 130, 37, 127, 130, 131, 38, 132, 134, 132, 37, 133, 134, 133, 6,
    132, 133, 134, 36, 131, 128, 131, 37, 132, 128, 132, 38, 131, 132, 128, 3, 129, 136, 129, 38,
    135, 136, 135, 40, 129, 135, 136, 38, 134, 138, 134, 6, 137, 138, 137, 39, 134, 137, 138, 40,
    139, 141, 139, 39, 140, 141, 140, 8, 139, 140, 141, 38, 138, 135, 138, 39, 139, 135, 139, 40,
    138, 139, 135, 3, 136, 112, 136, 40, 142, 112, 142, 32, 136, 142, 112, 40, 141, 144, 141, 8,
    143, 144, 143, 41, 141, 143, 144, 32, 145, 115, 145, 41, 146, 115, 146, 9, 145, 146, 115, 40,
    144, 142, 144, 41, 145, 142, 145, 32, 144, 145, 142, 4, 119, 90, 119, 33, 147, 90, 147, 25,
    119, 147, 90, 33, 116, 148, 116, 9, 82, 148, 82, 22, 116, 82, 148, 25, 149, 85, 149, 22, 79,
    85, 79, 5, 149, 79, 85, 33, 148, 147, 148, 22, 149, 147, 149, 25, 148, 149, 147, 2, 126, 97,
    126, 35, 150, 97, 150, 27, 126, 150, 97, 35, 123, 151, 123, 4, 89, 151, 89, 24, 123, 89, 151,
    27, 152, 92, 152, 24, 86, 92, 86, 11, 152, 86, 92, 35, 151, 150, 151, 24, 152, 150, 152, 27,
    151, 152, 150, 6, 133, 104, 133, 37, 153, 104, 153, 29, 133, 153, 104, 37, 130, 154, 130, 2,
    96, 154, 96, 26, 130, 96, 154, 29, 155, 99, 155, 26, 93, 99, 93, 10, 155, 93, 99, 37, 154, 153,
    154, 26, 155, 153, 155, 29, 154, 155, 153, 8, 140, 111, 140, 39, 156, 111, 156, 31, 140, 156,
    111, 39, 137, 157, 137, 6, 103, 157, 103, 28, 137, 103, 157, 31, 158, 106, 158, 28, 100, 106,
    100, 7, 158, 100, 106, 39, 157, 156, 157, 28, 158, 156, 158, 31, 157, 158, 156, 9, 146, 83,
    146, 41, 159, 83, 159, 23, 146, 159, 83, 41, 143, 160, 143, 8, 110, 160, 110, 30, 143, 110,
    160, 23, 161, 78, 161, 30, 107, 78, 107, 1, 161, 107, 78, 41, 160, 159, 160, 30, 161, 159, 161,
    23, 160, 161, 159,
];

/// Number of cube vertices
pub const CUBE_VTX_COUNT: usize = 8;

/// Number of cube indices
pub const CUBE_IDX_COUNT: usize = 36;

/// Number of sphere vertices
pub const SPHERE_VTX_COUNT: usize = 162;

/// Number of sphere indices
pub const SPHERE_IDX_COUNT: usize = 960;