pub struct GlassPanel {
pub asset_id: AssetId,
pub centre: [f32; 3],
pub normal: [f32; 3],
pub half_size: [f32; 2],
pub tint: [f32; 3],
pub opacity: f32,
pub refraction_strength: f32,
pub fresnel_power: f32,
pub visible: bool,
}Expand description
A flat translucent panel of coloured glass. A fixed-orientation rectangular quad that refracts and tints the scene behind it and brightens the grazing-angle rim with a Fresnel highlight.
Unlike WaterSurface it has no animation, no surface displacement, and no depth-based colour. It’s a simple building block for translucent surfaces such as windows, ice, holograms, or force fields.
The panel is positioned by centre, oriented by normal (the facing
direction), and sized by half_size (half-width along the panel’s tangent,
half-height along its bitangent).
GlassPanel {
centre: [0.0, 2.0, -3.0],
normal: [0.0, 0.0, 1.0],
half_size: [2.0, 1.5],
tint: [0.6, 0.85, 0.9],
opacity: 0.45,
refraction_strength: 0.04,
..Default::default()
};Fields§
§asset_id: AssetIdAsset identity; injected via inject_name. Not part of args.
centre: [f32; 3]World-space position of the panel’s centre.
normal: [f32; 3]Facing direction of the panel. Normalised on load; defaults to +Z when degenerate.
half_size: [f32; 2]Half-width and half-height of the panel, in world units.
tint: [f32; 3]Linear-space RGB colour the glass tints the scene behind it.
opacity: f32How opaque the glass is, in [0, 1]. 0 = clear, 1 = fully opaque tint.
refraction_strength: f32How strongly the glass bends the view of what’s behind it. 0 = no refraction.
fresnel_power: f32Sharpness of the grazing-angle rim highlight. Higher values confine the brightening to steeper viewing angles.
visible: boolWhen false the panel is skipped each frame.
Trait Implementations§
Source§impl Clone for GlassPanel
impl Clone for GlassPanel
Source§fn clone(&self) -> GlassPanel
fn clone(&self) -> GlassPanel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Component for GlassPanel
impl Component for GlassPanel
Source§const NAME: &'static str = "GlassPanel"
const NAME: &'static str = "GlassPanel"
Source§fn inject_name(&mut self, id: AssetId)
fn inject_name(&mut self, id: AssetId)
Source§fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
Source§fn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Source§impl ComponentSlot for GlassPanel
impl ComponentSlot for GlassPanel
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.Source§fn slot(s: &ComponentStorage) -> &Column<Self>
fn slot(s: &ComponentStorage) -> &Column<Self>
Source§fn slot_mut(s: &mut ComponentStorage) -> &mut Column<Self>
fn slot_mut(s: &mut ComponentStorage) -> &mut Column<Self>
Source§impl Debug for GlassPanel
impl Debug for GlassPanel
Source§impl Default for GlassPanel
impl Default for GlassPanel
Source§fn default() -> GlassPanel
fn default() -> GlassPanel
Source§impl<'de> Deserialize<'de> for GlassPanelwhere
GlassPanel: Default,
impl<'de> Deserialize<'de> for GlassPanelwhere
GlassPanel: Default,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<GlassPanel, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<GlassPanel, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<GlassPanel> for ComponentAsset
impl From<GlassPanel> for ComponentAsset
Source§fn from(c: GlassPanel) -> Self
fn from(c: GlassPanel) -> Self
Source§impl GlassPanelGeometry for GlassPanel
impl GlassPanelGeometry for GlassPanel
Source§fn unit_normal(&self) -> [f32; 3]
fn unit_normal(&self) -> [f32; 3]
Unit-length facing direction, falling back to +Z when the authored
normal is degenerate. The build-time quad generator and the runtime
shader both rely on a usable normal.