Class Primitives
Mesh primitives. Every primitive uses the
VertexFormat.POSITION_NORMAL_TEXCOORD layout so it can be drawn with any of
the built in materials, lit or unlit, textured or not.-
Method Summary
Modifier and TypeMethodDescriptionstatic Meshcube(GraphicsDevice device, float size) Builds a unit-normal axis aligned cube centered at the origin with the supplied edge length.static Meshquad(GraphicsDevice device, float size) Builds a flat quad in the XY plane centered at the origin facing +Z.static Meshsphere(float radius, int latBands, int lonBands, boolean insideOut) Builds a UV sphere without aGraphicsDevice, allocating the buffers directly.static Meshsphere(GraphicsDevice device, float radius, int latBands, int lonBands, boolean insideOut) Builds a UV sphere centered at the origin with equirectangular texture coordinates:uwraps the longitude from 0 to 1 andvruns from 0 at the north pole (+Y) to 1 at the south pole.
-
Method Details
-
cube
Builds a unit-normal axis aligned cube centered at the origin with the supplied edge length. Each face has its own normals and a full 0..1 texture coordinate quad.
Parameters
-
device: the device that allocates the buffers -
size: the edge length of the cube
Returns
an indexed triangle mesh
-
-
quad
Builds a flat quad in the XY plane centered at the origin facing +Z.
Parameters
-
device: the device that allocates the buffers -
size: the edge length of the quad
Returns
an indexed triangle mesh
-
-
sphere
public static Mesh sphere(GraphicsDevice device, float radius, int latBands, int lonBands, boolean insideOut) Builds a UV sphere centered at the origin with equirectangular texture coordinates:
uwraps the longitude from 0 to 1 andvruns from 0 at the north pole (+Y) to 1 at the south pole. This is the mapping used by 360 degree panorama images. The seam column and the pole rows duplicate vertices so texture coordinates stay continuous.Parameters
-
device: the device that allocates the buffers -
radius: the sphere radius -
latBands: the number of latitude subdivisions, at least 2 -
lonBands: the number of longitude subdivisions, at least 3 -
insideOut: when true the normals point toward the center and the winding is flipped so the inner surface faces the viewer, as needed when rendering a panorama from inside the sphere
Returns
an indexed triangle mesh
-
-
sphere
Builds a UV sphere without a
GraphicsDevice, allocating the buffers directly. Behaves exactly likesphere(GraphicsDevice, float, int, int, boolean); useful for preparing geometry off the render thread or handing meshes to non GPU consumers such as the AR content pipeline.Parameters
-
radius: the sphere radius -
latBands: the number of latitude subdivisions, at least 2 -
lonBands: the number of longitude subdivisions, at least 3 -
insideOut: when true the normals point toward the center and the winding is flipped
Returns
an indexed triangle mesh
-
-