Struct ark_api::world::Environment

source ·
pub struct Environment { /* private fields */ }
Expand description

Environment component accessor.

An environment is represented by an entity with the Environment component. It lets you control the sun direction (and in the future other sky and environmental properties).

Currently, the last created environment is the one that will be used.

Implementations§

source§

impl Environment

source

pub fn create(name: &str) -> Self

Creates an environment entity.

  • name - Just a name, to keep track of the entity during development.
source

pub fn sun_direction(&self) -> ValueAccessorReadWriteAnimate<Vec3>

Returns a ValueAccessor for the sun direction of the environment.

Used to set/get/animate where the sun shines from. Note: World-space direction (extended to infinity).

source

pub fn sun_size_multiplier(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the sun size muliplier of the environment.

Used to set/get/animate the sun color. The base of the sun size is based on real life values.

source

pub fn gravity_vector(&self) -> ValueAccessorReadWriteAnimate<Vec3>

Returns a ValueAccessor for the gravity vector of the environment.

Used to set/get/animate the gravity vector.

Will be used for objects that have dynamic physics enabled.

source

pub fn fog_density(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the fog density of the environment.

Used to set/get/animate the fog density. Fog density means the tickness of the fog where zero is no fog and infinity means infinitely thick fog.

source

pub fn fog_height(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the fog height of the environment.

Used to set/get/animate the fog height. The world height at which the base of the exponential falloff starts

source

pub fn fog_height_falloff(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the fog height falloff of the environment.

Used to set/get/animate the fog height falloff. The exponential rate of falloff. Zero means no falloff, and infinity means a sharp boundary

source

pub fn fog_start(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the minimum fog distance of the environment.

Used to set/get/animate the minimum fog distance. Fog within this distance does not contribute.

source

pub fn fog_color(&self) -> ValueAccessorReadWriteAnimate<Vec4>

Returns a ValueAccessor for the fog color of the environment.

Used to set/get/animate the fog color. The alpha component can be used to specify a maximum opacity for the final fog result.

source

pub fn exposure(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the camera exposure multiplier.

Used to set/get/animate the camera exposure.

source

pub fn gi_volume_size(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the global illumination volume size.

Used to set/get/animate the global illumination volume size. The square size of the global illumination region around the world origin.

source

pub fn sun_color_multiplier(&self) -> ValueAccessorReadWriteAnimate<Vec3>

Returns a ValueAccessor for the sun color multiplier.

Used to set/get/animate the sun color multiplier.

source

pub fn ambient_color(&self) -> ValueAccessorReadWriteAnimate<Vec3>

Returns a ValueAccessor for the ambient color.

Used to set/get/animate the ambient color. The tint of the sky

source

pub fn planet_radius(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the planet radius.

Used to set/get/animate the planet radius.

source

pub fn atmosphere_density(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the atmosphere density.

Used to set/get/animate the atmosphere density.

source

pub fn atmosphere_height(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the atmosphere height.

Used to set/get/animate the atmosphere height in meters. The highest point of the atmosphere.

source

pub fn rayleigh_height(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the rayleigh height.

Used to set/get/animate the rayleigh height in meters. The highest point of the gas molecule layer. Should always be less then the atmosphere height.

source

pub fn ozone_height(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the ozone height.

Used to set/get/animate the ozone height in meters. The highest point of the ozone layer. Should always be less then the atmosphere height.

source

pub fn mie_height(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the mie height.

Used to set/get/animate the mie height. The highest point of the aerosol layer in meters. Should always be less then the atmosphere height.

source

pub fn ozone_width(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the ozone width.

Used to set/get/animate the ozone width. The width of the ozone layer in meters.

source

pub fn sky_intensity(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the sky intensity.

Used to set/get/animate the sky intensity. Default value is 20.0 and has theoretically infinite range from [0.0, inf), however reasonably should stay between 0 and 100 or so based on how our rendering and asset architecture is designed.

source

pub fn sun_intensity(&self) -> ValueAccessorReadWriteAnimate<f32>

Returns a ValueAccessor for the sun intensity.

Used to set/get/animate the sun intensity. Default value is 20.0 and has theoretically infinite range from [0.0, inf), however reasonably should stay between 0 and 100 or so based on how our rendering and asset architecture is designed.

source

pub fn set_collision_matrix(&self, matrix: &CollisionMatrix)

Sets a global collision matrix.

Currently not actually bound to the environment. Can be set at any time to change collision behavior of entities with matching layers.

source

pub fn set_active(&self)

Makes this the active environment.

Simplified wrapper for EntityMessenger::set_active.

Trait Implementations§

source§

impl ComponentTrait for Environment

source§

fn get_type() -> ComponentType

The type of the component, as a ComponentType enum.
source§

fn from_entity(handle: Entity) -> Self

Adopt an Entity, wrap in a component struct.
source§

fn try_from_entity(handle: Entity) -> Option<Self>

Try to adopt an Entity, wrapping it in a component struct.
source§

fn entity(&self) -> Entity

Get the entity that the component belongs to.
source§

impl Debug for Environment

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.