Function gl_utils::mesh::sphere_3d_instanced_lines_list[][src]

pub fn sphere_3d_instanced_lines_list(
    index_offset: u32,
    latitude_divisions: u16,
    longitude_divisions: u16
) -> (Vec<Vert3dInstanced>, Vec<u32>)

Produces vertices and indices for a 3D lines list unit sphere (radius $1.0$) with the given number of latitudinal divisions rounded down to the nearest even number (ensuring the sphere always has an 'equator'), and with the given number of longitudinal divisions.

The number of parallels will be equal to $latitude_divisions - (latitude_divisions % 2) - 1$ and the number of meridians will be equal to $longitude_divisions$.

There will be $2 + (latitude_divisions-1) * longitude_divisions$ vertices and $4 * longitude_divisions * latitude_divisions - 2 * longitude_divisions$ indices.

The first $4 * (latitude_divisions / 2) * longitude_divisions$ indices can be used to render only the top hemisphere (the sphere itself is computed progressively by adding more vertices and indices onto a base hemisphere to form the southern hemisphere).

Panics

Panics if latitude_divisions or longitude_divisions are less than two (i.e. there must be at least an equator latitude dividing the north and south hemispheres and a prime meridian dividing the east and west hemispheres.