Struct rust_raylib::model::Mesh
source · pub struct Mesh { /* private fields */ }
Expand description
Mesh, vertex data and vao/vbo
Implementations§
source§impl Mesh
impl Mesh
sourcepub fn vertices(&self) -> &[Vector3]
pub fn vertices(&self) -> &[Vector3]
Vertex positions (XYZ - 3 components per vertex) (shader-location = 0)
sourcepub fn vertices_mut(&mut self) -> &mut [Vector3]
pub fn vertices_mut(&mut self) -> &mut [Vector3]
Vertex positions (XYZ - 3 components per vertex) (shader-location = 0)
sourcepub fn texcoords(&self) -> &[Vector2]
pub fn texcoords(&self) -> &[Vector2]
Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
sourcepub fn texcoords_mut(&mut self) -> &mut [Vector2]
pub fn texcoords_mut(&mut self) -> &mut [Vector2]
Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
sourcepub fn texcoords2(&self) -> &[Vector2]
pub fn texcoords2(&self) -> &[Vector2]
Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5)
sourcepub fn texcoords2_mut(&mut self) -> &mut [Vector2]
pub fn texcoords2_mut(&mut self) -> &mut [Vector2]
Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5)
sourcepub fn normals(&self) -> &[Vector3]
pub fn normals(&self) -> &[Vector3]
Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
sourcepub fn normals_mut(&mut self) -> &mut [Vector3]
pub fn normals_mut(&mut self) -> &mut [Vector3]
Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
sourcepub fn tangents(&self) -> &[Vector4]
pub fn tangents(&self) -> &[Vector4]
Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
sourcepub fn tangents_mut(&mut self) -> &mut [Vector4]
pub fn tangents_mut(&mut self) -> &mut [Vector4]
Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
sourcepub fn colors(&self) -> &[Color]
pub fn colors(&self) -> &[Color]
Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
sourcepub fn colors_mut(&mut self) -> &mut [Color]
pub fn colors_mut(&mut self) -> &mut [Color]
Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
sourcepub fn indices_mut(&mut self) -> &mut [u16]
pub fn indices_mut(&mut self) -> &mut [u16]
Vertex indices (in case vertex data comes indexed)
sourcepub fn update_buffer(&self, index: u32, data: &[u8], offset: u32)
pub fn update_buffer(&self, index: u32, data: &[u8], offset: u32)
Update mesh vertex data in GPU for a specific buffer index
sourcepub fn export(&self, file_name: &str) -> bool
pub fn export(&self, file_name: &str) -> bool
Export mesh data to file, returns true on success
sourcepub fn get_bounding_box(&self) -> BoundingBox
pub fn get_bounding_box(&self) -> BoundingBox
Compute mesh bounding box limits
sourcepub fn generate_tangents(&mut self)
pub fn generate_tangents(&mut self)
Compute mesh tangents
sourcepub fn generate_polygon(sides: u32, radius: f32) -> Self
pub fn generate_polygon(sides: u32, radius: f32) -> Self
Generate polygonal mesh
sourcepub fn generate_plane(width: f32, length: f32, res_x: u32, res_z: u32) -> Self
pub fn generate_plane(width: f32, length: f32, res_x: u32, res_z: u32) -> Self
Generate plane mesh (with subdivisions)
sourcepub fn generate_cube(width: f32, height: f32, length: f32) -> Self
pub fn generate_cube(width: f32, height: f32, length: f32) -> Self
Generate cuboid mesh
sourcepub fn generate_sphere(radius: f32, rings: u32, slices: u32) -> Self
pub fn generate_sphere(radius: f32, rings: u32, slices: u32) -> Self
Generate sphere mesh (standard sphere)
sourcepub fn generate_hemisphere(radius: f32, rings: u32, slices: u32) -> Self
pub fn generate_hemisphere(radius: f32, rings: u32, slices: u32) -> Self
Generate half-sphere mesh (no bottom cap)
sourcepub fn generate_cylinder(radius: f32, height: f32, slices: u32) -> Self
pub fn generate_cylinder(radius: f32, height: f32, slices: u32) -> Self
Generate cylinder mesh
sourcepub fn generate_cone(radius: f32, height: f32, slices: u32) -> Self
pub fn generate_cone(radius: f32, height: f32, slices: u32) -> Self
Generate cone/pyramid mesh
sourcepub fn generate_torus(radius: f32, size: f32, rad_seg: u32, sides: u32) -> Self
pub fn generate_torus(radius: f32, size: f32, rad_seg: u32, sides: u32) -> Self
Generate torus mesh
sourcepub fn generate_knot(radius: f32, size: f32, rad_seg: u32, sides: u32) -> Self
pub fn generate_knot(radius: f32, size: f32, rad_seg: u32, sides: u32) -> Self
Generate trefoil knot mesh
sourcepub fn generate_heightmap(heightmap: &Image, size: Vector3) -> Self
pub fn generate_heightmap(heightmap: &Image, size: Vector3) -> Self
Generate heightmap mesh from image data
sourcepub fn generate_cubicmap(cubicmap: &Image, cube_size: Vector3) -> Self
pub fn generate_cubicmap(cubicmap: &Image, cube_size: Vector3) -> Self
Generate cubes-based map mesh from image data
sourcepub fn as_raw(&self) -> &Mesh
pub fn as_raw(&self) -> &Mesh
Get the ‘raw’ ffi type Take caution when cloning so it doesn’t outlive the original
sourcepub fn as_raw_mut(&mut self) -> &mut Mesh
pub fn as_raw_mut(&mut self) -> &mut Mesh
Get the ‘raw’ ffi type Take caution when cloning so it doesn’t outlive the original