Struct rust_raylib::model::Mesh

source ·
pub struct Mesh { /* private fields */ }
Expand description

Mesh, vertex data and vao/vbo

Implementations§

source§

impl Mesh

source

pub fn vertices(&self) -> &[Vector3]

Vertex positions (XYZ - 3 components per vertex) (shader-location = 0)

source

pub fn vertices_mut(&mut self) -> &mut [Vector3]

Vertex positions (XYZ - 3 components per vertex) (shader-location = 0)

source

pub fn texcoords(&self) -> &[Vector2]

Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)

source

pub fn texcoords_mut(&mut self) -> &mut [Vector2]

Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)

source

pub fn texcoords2(&self) -> &[Vector2]

Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5)

source

pub fn texcoords2_mut(&mut self) -> &mut [Vector2]

Vertex texture second coordinates (UV - 2 components per vertex) (shader-location = 5)

source

pub fn normals(&self) -> &[Vector3]

Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)

source

pub fn normals_mut(&mut self) -> &mut [Vector3]

Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)

source

pub fn tangents(&self) -> &[Vector4]

Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)

source

pub fn tangents_mut(&mut self) -> &mut [Vector4]

Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)

source

pub fn colors(&self) -> &[Color]

Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)

source

pub fn colors_mut(&mut self) -> &mut [Color]

Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)

source

pub fn indices(&self) -> &[u16]

Vertex indices (in case vertex data comes indexed)

source

pub fn indices_mut(&mut self) -> &mut [u16]

Vertex indices (in case vertex data comes indexed)

source

pub fn upload(&mut self, dynamic: bool)

Upload mesh vertex data in GPU and provide VAO/VBO ids

source

pub fn update_buffer(&self, index: u32, data: &[u8], offset: u32)

Update mesh vertex data in GPU for a specific buffer index

source

pub fn export(&self, file_name: &str) -> bool

Export mesh data to file, returns true on success

source

pub fn get_bounding_box(&self) -> BoundingBox

Compute mesh bounding box limits

source

pub fn generate_tangents(&mut self)

Compute mesh tangents

source

pub fn generate_polygon(sides: u32, radius: f32) -> Self

Generate polygonal mesh

source

pub fn generate_plane(width: f32, length: f32, res_x: u32, res_z: u32) -> Self

Generate plane mesh (with subdivisions)

source

pub fn generate_cube(width: f32, height: f32, length: f32) -> Self

Generate cuboid mesh

source

pub fn generate_sphere(radius: f32, rings: u32, slices: u32) -> Self

Generate sphere mesh (standard sphere)

source

pub fn generate_hemisphere(radius: f32, rings: u32, slices: u32) -> Self

Generate half-sphere mesh (no bottom cap)

source

pub fn generate_cylinder(radius: f32, height: f32, slices: u32) -> Self

Generate cylinder mesh

source

pub fn generate_cone(radius: f32, height: f32, slices: u32) -> Self

Generate cone/pyramid mesh

source

pub fn generate_torus(radius: f32, size: f32, rad_seg: u32, sides: u32) -> Self

Generate torus mesh

source

pub fn generate_knot(radius: f32, size: f32, rad_seg: u32, sides: u32) -> Self

Generate trefoil knot mesh

source

pub fn generate_heightmap(heightmap: &Image, size: Vector3) -> Self

Generate heightmap mesh from image data

source

pub fn generate_cubicmap(cubicmap: &Image, cube_size: Vector3) -> Self

Generate cubes-based map mesh from image data

source

pub fn as_raw(&self) -> &Mesh

Get the ‘raw’ ffi type Take caution when cloning so it doesn’t outlive the original

source

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

source

pub unsafe fn from_raw(raw: Mesh) -> Self

Convert a ‘raw’ ffi object to a safe wrapper

Safety
  • The raw object must be correctly initialized
  • The raw object should be unique. Otherwise, make sure its clones don’t outlive the newly created object.

Trait Implementations§

source§

impl Debug for Mesh

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Mesh

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Mesh

§

impl !Send for Mesh

§

impl !Sync for Mesh

§

impl Unpin for Mesh

§

impl UnwindSafe for Mesh

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.