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]
fn new(coords: Vec<Point3<GLfloat>>,
faces: Vec<Point3<GLuint>>,
normals: Option<Vec<Vector3<GLfloat>>>,
uvs: Option<Vec<Point2<GLfloat>>>,
dynamic_draw: bool)
-> Mesh
faces: Vec<Point3<GLuint>>,
normals: Option<Vec<Vector3<GLfloat>>>,
uvs: Option<Vec<Point2<GLfloat>>>,
dynamic_draw: bool)
-> Mesh
Creates a new mesh.
If the normals and uvs are not given, they are automatically computed.
fn from_trimesh(mesh: TriMesh3<GLfloat>, dynamic_draw: bool) -> Mesh
Creates a new mesh from a mesh descr.
In the normals and uvs are not given, they are automatically computed.
fn to_trimesh(&self) -> Option<TriMesh3<GLfloat>>
Creates a triangle mesh from this mesh.
fn new_with_gpu_vectors(coords: Arc<RwLock<GPUVec<Point3<GLfloat>>>>,
faces: Arc<RwLock<GPUVec<Point3<GLuint>>>>,
normals: Arc<RwLock<GPUVec<Vector3<GLfloat>>>>,
uvs: Arc<RwLock<GPUVec<Point2<GLfloat>>>>)
-> Mesh
faces: Arc<RwLock<GPUVec<Point3<GLuint>>>>,
normals: Arc<RwLock<GPUVec<Vector3<GLfloat>>>>,
uvs: Arc<RwLock<GPUVec<Point2<GLfloat>>>>)
-> Mesh
Creates a new mesh. Arguments set to None
are automatically computed.
fn bind_coords(&mut self, coords: &mut ShaderAttribute<Point3<GLfloat>>)
Binds this mesh vertex coordinates buffer to a vertex attribute.
fn bind_normals(&mut self, normals: &mut ShaderAttribute<Vector3<GLfloat>>)
Binds this mesh vertex normals buffer to a vertex attribute.
fn bind_uvs(&mut self, uvs: &mut ShaderAttribute<Point2<GLfloat>>)
Binds this mesh vertex uvs buffer to a vertex attribute.
fn bind_faces(&mut self)
Binds this mesh vertex uvs buffer to a vertex attribute.
fn bind(&mut self,
coords: &mut ShaderAttribute<Point3<GLfloat>>,
normals: &mut ShaderAttribute<Vector3<GLfloat>>,
uvs: &mut ShaderAttribute<Point2<GLfloat>>)
coords: &mut ShaderAttribute<Point3<GLfloat>>,
normals: &mut ShaderAttribute<Vector3<GLfloat>>,
uvs: &mut ShaderAttribute<Point2<GLfloat>>)
Binds this mesh buffers to vertex attributes.
fn unbind(&self)
Unbind this mesh buffers to vertex attributes.
fn num_pts(&self) -> usize
Number of points needed to draw this mesh.
fn recompute_normals(&mut self)
Recompute this mesh normals.
fn faces(&self) -> &Arc<RwLock<GPUVec<Point3<GLuint>>>>
This mesh faces.
fn normals(&self) -> &Arc<RwLock<GPUVec<Vector3<GLfloat>>>>
This mesh normals.
fn coords(&self) -> &Arc<RwLock<GPUVec<Point3<GLfloat>>>>
This mesh vertex coordinates.
fn uvs(&self) -> &Arc<RwLock<GPUVec<Point2<GLfloat>>>>
This mesh texture coordinates.
fn compute_normals_array(coordinates: &[Point3<GLfloat>],
faces: &[Point3<GLuint>])
-> Vec<Vector3<GLfloat>>
faces: &[Point3<GLuint>])
-> Vec<Vector3<GLfloat>>
Computes normals from a set of faces.
fn compute_normals(coordinates: &[Point3<GLfloat>],
faces: &[Point3<GLuint>],
normals: &mut Vec<Vector3<GLfloat>>)
faces: &[Point3<GLuint>],
normals: &mut Vec<Vector3<GLfloat>>)
Computes normals from a set of faces.