PlaneMesh constructor
Represents a 2D Plane's geometry with a single surface.
Implementation
PlaneMesh({
required Vector2 size,
Material? material,
}) {
final Vector2(:x, :y) = size / 2;
final vertices = [
Vertex(
position: Vector3(-x, 0, -y),
texCoord: Vector2(0, 0),
normal: Vector3(0, 1, 0),
),
Vertex(
position: Vector3(x, 0, -y),
texCoord: Vector2(1, 0),
normal: Vector3(0, 1, 0),
),
Vertex(
position: Vector3(x, 0, y),
texCoord: Vector2(1, 1),
normal: Vector3(0, 1, 0),
),
Vertex(
position: Vector3(-x, 0, y),
texCoord: Vector2(0, 1),
normal: Vector3(0, 1, 0),
),
];
addSurface(
Surface(
vertices: vertices,
indices: [0, 1, 2, 2, 3, 0],
material: material,
),
);
}