Struct TerrainModelOptions
#[non_exhaustive]pub struct TerrainModelOptions<'a> {
pub material: TerrainMaterial,
pub shade: TerrainShade,
pub uv_shift: Option<TerrainUvShift<'a>>,
pub uv_shrink_ratio: f32,
pub tint: u32,
}Expand description
How BlockEntityDrawContext::terrain_model
draws a model. The default is the model’s own materials and shading, its baked UVs and no
tint.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.material: TerrainMaterialThe material every quad uses, or each quad’s own.
shade: TerrainShadeDirectional shading.
uv_shift: Option<TerrainUvShift<'a>>One sprite drawn as another, with its UVs moved.
uv_shrink_ratio: f32How far each face’s UVs pull in towards their centre before the shift, 0.0..=1.0:
0.0 keeps the baked UVs. A model baked by an older FaceBakery passes the atlas shrink
ratio it was made with; a loader that doesn’t shrink keeps 0.0.
tint: u320xRRGGBB multiplied into quads with a tint index; other quads keep their colour.
Implementations§
§impl<'a> TerrainModelOptions<'a>
impl<'a> TerrainModelOptions<'a>
pub fn with_material(self, material: TerrainMaterial) -> TerrainModelOptions<'a>
pub fn with_material(self, material: TerrainMaterial) -> TerrainModelOptions<'a>
The same options with every quad in material.
pub fn with_shade(self, shade: TerrainShade) -> TerrainModelOptions<'a>
pub fn with_shade(self, shade: TerrainShade) -> TerrainModelOptions<'a>
The same options shaded by shade.
pub fn with_uv_shift(self, shift: TerrainUvShift<'a>) -> TerrainModelOptions<'a>
pub fn with_uv_shift(self, shift: TerrainUvShift<'a>) -> TerrainModelOptions<'a>
The same options with shift applied.
pub fn with_uv_shrink_ratio(self, ratio: f32) -> TerrainModelOptions<'a>
pub fn with_uv_shrink_ratio(self, ratio: f32) -> TerrainModelOptions<'a>
The same options with UVs shrunk by ratio. The draw call checks it.
pub fn with_tint(self, tint: u32) -> TerrainModelOptions<'a>
pub fn with_tint(self, tint: u32) -> TerrainModelOptions<'a>
The same options with tinted quads multiplied by 0xRRGGBB tint.
Trait Implementations§
§impl<'a> Clone for TerrainModelOptions<'a>
impl<'a> Clone for TerrainModelOptions<'a>
§fn clone(&self) -> TerrainModelOptions<'a>
fn clone(&self) -> TerrainModelOptions<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more