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