pub struct OrientedBlockFace { /* private fields */ }
Expand description

Metadata that’s used to aid in the geometric calculations for one of the 6 possible cube faces.

Implementations

A cube face, using axes with an even permutation.

Returns the 4 corners of the quad in this order:

        2 ----> 3
          ^
    ^       \
    |         \
 +V |   0 ----> 1
    |
     -------->
       +U

(+N pointing out of the screen)

Note that this is natural when UV coordinates have (0,0) at the bottom left, but when (0,0) is at the top left, V must be flipped.

Returns the 6 vertex indices for the quad in order to make two triangles in a mesh. Winding order depends on both the sign of the surface normal and the permutation of the UVs.

Front faces will be wound counterclockwise, and back faces clockwise, as per convention.

Returns the UV coordinates of the 4 corners of the quad. Returns vertices in the same order as OrientedBlockFace::quad_corners.

u_flip_face should correspond to the field on QuadCoordinateConfig. See the docs there for more info.

This is just one way of assigning UVs to voxel quads. It assumes that each material has a single tile texture with wrapping coordinates, and each voxel face should show the entire texture. It also assumes a particular orientation for the texture. This should be sufficient for minecraft-style meshing.

If you need to use a texture atlas, you must calculate your own coordinates from the Quad.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.