Struct kiss3d::resource::Mesh [−][src]
pub struct Mesh { /* fields omitted */ }
Aggregation of vertices, indices, normals and texture coordinates.
It also contains the GPU location of those buffers.
Methods
impl Mesh
[src]
impl Mesh
pub fn new(
coords: Vec<Point3<f32>>,
faces: Vec<Point3<u16>>,
normals: Option<Vec<Vector3<f32>>>,
uvs: Option<Vec<Point2<f32>>>,
dynamic_draw: bool
) -> Mesh
[src]
pub fn new(
coords: Vec<Point3<f32>>,
faces: Vec<Point3<u16>>,
normals: Option<Vec<Vector3<f32>>>,
uvs: Option<Vec<Point2<f32>>>,
dynamic_draw: bool
) -> Mesh
Creates a new mesh.
If the normals and uvs are not given, they are automatically computed.
pub fn from_trimesh(mesh: TriMesh<f32>, dynamic_draw: bool) -> Mesh
[src]
pub fn from_trimesh(mesh: TriMesh<f32>, dynamic_draw: bool) -> Mesh
Creates a new mesh from a mesh descr.
In the normals and uvs are not given, they are automatically computed.
pub fn to_trimesh(&self) -> Option<TriMesh<f32>>
[src]
pub fn to_trimesh(&self) -> Option<TriMesh<f32>>
Creates a triangle mesh from this mesh.
Return None
if the mesh data is not available on the CPU.
pub fn new_with_gpu_vectors(
coords: Arc<RwLock<GPUVec<Point3<f32>>>>,
faces: Arc<RwLock<GPUVec<Point3<u16>>>>,
normals: Arc<RwLock<GPUVec<Vector3<f32>>>>,
uvs: Arc<RwLock<GPUVec<Point2<f32>>>>
) -> Mesh
[src]
pub fn new_with_gpu_vectors(
coords: Arc<RwLock<GPUVec<Point3<f32>>>>,
faces: Arc<RwLock<GPUVec<Point3<u16>>>>,
normals: Arc<RwLock<GPUVec<Vector3<f32>>>>,
uvs: Arc<RwLock<GPUVec<Point2<f32>>>>
) -> Mesh
Creates a new mesh. Arguments set to None
are automatically computed.
pub fn bind_coords(&mut self, coords: &mut ShaderAttribute<Point3<f32>>)
[src]
pub fn bind_coords(&mut self, coords: &mut ShaderAttribute<Point3<f32>>)
Binds this mesh vertex coordinates buffer to a vertex attribute.
pub fn bind_normals(&mut self, normals: &mut ShaderAttribute<Vector3<f32>>)
[src]
pub fn bind_normals(&mut self, normals: &mut ShaderAttribute<Vector3<f32>>)
Binds this mesh vertex normals buffer to a vertex attribute.
pub fn bind_uvs(&mut self, uvs: &mut ShaderAttribute<Point2<f32>>)
[src]
pub fn bind_uvs(&mut self, uvs: &mut ShaderAttribute<Point2<f32>>)
Binds this mesh vertex uvs buffer to a vertex attribute.
pub fn bind_faces(&mut self)
[src]
pub fn bind_faces(&mut self)
Binds this mesh index buffer to a vertex attribute.
pub fn bind(
&mut self,
coords: &mut ShaderAttribute<Point3<f32>>,
normals: &mut ShaderAttribute<Vector3<f32>>,
uvs: &mut ShaderAttribute<Point2<f32>>
)
[src]
pub fn bind(
&mut self,
coords: &mut ShaderAttribute<Point3<f32>>,
normals: &mut ShaderAttribute<Vector3<f32>>,
uvs: &mut ShaderAttribute<Point2<f32>>
)
Binds this mesh buffers to vertex attributes.
pub fn bind_edges(&mut self)
[src]
pub fn bind_edges(&mut self)
Binds this mesh buffers to vertex attributes.
pub fn unbind(&self)
[src]
pub fn unbind(&self)
Unbind this mesh buffers to vertex attributes.
pub fn num_pts(&self) -> usize
[src]
pub fn num_pts(&self) -> usize
Number of points needed to draw this mesh.
pub fn recompute_normals(&mut self)
[src]
pub fn recompute_normals(&mut self)
Recompute this mesh normals.
pub fn faces(&self) -> &Arc<RwLock<GPUVec<Point3<u16>>>>
[src]
pub fn faces(&self) -> &Arc<RwLock<GPUVec<Point3<u16>>>>
This mesh faces.
pub fn normals(&self) -> &Arc<RwLock<GPUVec<Vector3<f32>>>>
[src]
pub fn normals(&self) -> &Arc<RwLock<GPUVec<Vector3<f32>>>>
This mesh normals.
pub fn coords(&self) -> &Arc<RwLock<GPUVec<Point3<f32>>>>
[src]
pub fn coords(&self) -> &Arc<RwLock<GPUVec<Point3<f32>>>>
This mesh vertex coordinates.
pub fn uvs(&self) -> &Arc<RwLock<GPUVec<Point2<f32>>>>
[src]
pub fn uvs(&self) -> &Arc<RwLock<GPUVec<Point2<f32>>>>
This mesh texture coordinates.
pub fn compute_normals_array(
coordinates: &[Point3<f32>],
faces: &[Point3<u16>]
) -> Vec<Vector3<f32>>
[src]
pub fn compute_normals_array(
coordinates: &[Point3<f32>],
faces: &[Point3<u16>]
) -> Vec<Vector3<f32>>
Computes normals from a set of faces.
pub fn compute_normals(
coordinates: &[Point3<f32>],
faces: &[Point3<u16>],
normals: &mut Vec<Vector3<f32>>
)
[src]
pub fn compute_normals(
coordinates: &[Point3<f32>],
faces: &[Point3<u16>],
normals: &mut Vec<Vector3<f32>>
)
Computes normals from a set of faces.