pub struct MeshInfo {
pub vertices: Vec<Vec3>,
pub normals: Vec<Vec3>,
pub uvs: Vec<Vec2>,
pub indices: Vec<u16>,
}Expand description
Hexagonal mesh information.
§Usage
Use:
ColumnMeshBuilderfor 3d hexagonal column meshesPlaneMeshBuilderfor hexagonal plane meshes
The mesh info has some customization options:
let layout = HexLayout::default();
// Build the mesh info
let info: MeshInfo = ColumnMeshBuilder::new(&layout, 2.0).build();
// Customize the generated mesh
let info = info
.rotated(Quat::IDENTITY)
.with_offset(Vec3::new(12.0, 34.2, -43.54));§Merging
MeshInfo can be merged with other meshes using Self::merge_with.
Don’t forget to offset the meshes in the mesh builder using:
ColumnMeshBuilder::atPlaneMeshBuilder::atSelf::with_offsetfor a custom offset
Otherwise you might end up with meshes at the same coordinates
Fields§
§vertices: Vec<Vec3>All vertices positions information (Vertex_Position attribute)
normals: Vec<Vec3>Normals for each vertex (You might need to swap y and z)
(Vertex_Normal attribute)
uvs: Vec<Vec2>UV coordinates of each vertex (Vertex_Uv attribute)
indices: Vec<u16>Vertex indices for triangles
Implementations§
source§impl MeshInfo
impl MeshInfo
sourcepub fn rotated(self, rotation: Quat) -> Self
pub fn rotated(self, rotation: Quat) -> Self
Returns a new MeshInfo but with vertex positions and normals rotated
sourcepub fn with_offset(self, offset: Vec3) -> Self
pub fn with_offset(self, offset: Vec3) -> Self
Returns a new MeshInfo but with offset applied to vertex positions
sourcepub fn merge_with(&mut self, rhs: Self)
pub fn merge_with(&mut self, rhs: Self)
sourcepub fn hexagonal_plane(layout: &HexLayout, hex: Hex) -> Self
👎Deprecated since 0.13.0: Use PlaneMeshBuilder instead
pub fn hexagonal_plane(layout: &HexLayout, hex: Hex) -> Self
PlaneMeshBuilder insteadComputes mesh data for an hexagonal plane facing Vec3::Y with 6
vertices and 4 triangles
§Note
Prefer using PlaneMeshBuilder for additional customization like:
- UV options
- Offsets
- rotation
- etc
sourcepub fn cheap_hexagonal_column(
layout: &HexLayout,
hex: Hex,
column_height: f32
) -> Self
pub fn cheap_hexagonal_column( layout: &HexLayout, hex: Hex, column_height: f32 ) -> Self
Computes cheap mesh data for an hexagonal column facing Vec3::Y
without the bottom face.
This mesh has only 12 vertices, as no vertex is duplicated. As a consequence the normals will behave strangely and the UV mapping will be extremely simplistic and stretched on the sides.
Use this mesh if you don’t care about lighting and texturing, like for convex hull collision shapes.
Prefer using ColumnMeshBuilder in most cases