pub struct CesBuilder {
pub device: BuilderDevice,
pub builtin_shader: BuiltinShader,
pub shader_file: GString,
pub water_height: f32,
pub water_enabled: bool,
pub water_deep_color: Color,
pub water_shallow_color: Color,
pub water_wave_strength: f32,
pub water_wave_scale: f32,
pub water_wave_speed: f32,
pub water_underwater_color: Color,
pub water_underwater_density: f32,
/* private fields */
}Expand description
The terrain source: a Resource you assign to Celestial::builder. It answers
“what does this planet’s surface look like?” — height, colour, and (since it also
owns the water_* group) the ocean.
A planet has exactly one. Sub-class it in GDScript (extends CesBuilder) to write
your own terrain, or use one of the shipped example builders; leave the property
empty and the planet renders a plain white sphere. Every edit — a knob, the
shader file, the water level — reshades the resident chunks live.
The routing between the built-in noise, a custom .glsl and custom GDScript is
described in the module docs; user-facing guides live at
https://celestialsim.github.io/CelestialSim/.
Fields§
§device: BuilderDeviceWhich device produces the surface. BuilderDevice::GPU (the default) is the
fast path: thousands of threads realize and bake each chunk with no readback.
BuilderDevice::CPU bakes chunk surfaces from Rust worker threads (built-in
noise) or from your GDScript height/color (custom) — far slower, and the
synchronous GDScript route runs on the main thread, so keep tile_res
moderate there. Switching this reshapes the inspector (only the relevant
fields stay visible) via on_validate_property.
builtin_shader: BuiltinShaderHIDDEN (STORAGE-only) selector for WHICH built-in library shader this
builder runs. None = custom (user .glsl/GDScript); Terrain = the
built-in noise. Set by the example GDScripts’ _init; combined with
device it selects the BuilderRoute.
shader_file: GStringGPU-device custom only: res:// path to your terrain .glsl
(defines terrain_height / terrain_color, optional terrain_normal).
water_height: f32Water level — normalized sea level (0..1). A NATIVE field (was a
per-subclass GDScript @export) so EVERY builder — noise or custom —
carries the same water level. Also drives terrain shore colouring and is
surfaced to custom shaders as CELS_WATER_HEIGHT. 0.5 = sea at the
planet radius (noise midpoint / custom h = 0 baseline); raise to flood
low land. Always visible. A changed-emitting setter (below) reshades the
WHOLE terrain on edit — the water level controls the land/sea split, not
just the sphere — so a plain field would leave the terrain stale.
water_enabled: boolWater toggle — draw the analytic ocean at water_height (default on).
Off removes the sea surface entirely (the land/sea colouring of the terrain
still follows water_height) and hides the appearance params below, which
reappear — with their stored values — when it is switched back on.
water_deep_color: ColorBody colour of deep water, far from shore; blended toward
water_shallow_color as the sea floor rises. Default a dark blue.
water_shallow_color: ColorBody colour of shallow water near the shoreline — the coastal tint. Default a light teal.
water_wave_strength: f32How strongly the wave normals perturb the surface: 0 = a flat mirror, 1 = maximum choppiness. Default 0.55.
water_wave_scale: f32Spatial frequency of the wave pattern — higher = smaller, tighter waves. Default 0.15.
water_wave_speed: f32How fast the wave pattern scrolls; 0 freezes the sea. Default 0.04.
water_underwater_color: ColorTint of the underwater fog (Beer–Lambert) applied when the camera is below the surface. Default a murky blue.
water_underwater_density: f32Underwater fog density, per world unit of water column: higher = visibility drops off faster once submerged; 0 = perfectly clear water. Default 0.02.
Implementations§
Source§impl CesBuilder
impl CesBuilder
pub fn get_water_enabled(&self) -> <bool as GodotConvert>::Via
Auto-generated Rust getters/setters for #[var] are being phased out until v0.6.
If you need them, opt in with #[var(pub)].
pub fn set_water_enabled(&mut self, water_enabled: <bool as GodotConvert>::Via)
Auto-generated Rust getters/setters for #[var] are being phased out until v0.6.
If you need them, opt in with #[var(pub)].
pub fn get_water_deep_color(&self) -> <Color as GodotConvert>::Via
Auto-generated Rust getters/setters for #[var] are being phased out until v0.6.
If you need them, opt in with #[var(pub)].
pub fn set_water_deep_color( &mut self, water_deep_color: <Color as GodotConvert>::Via, )
Auto-generated Rust getters/setters for #[var] are being phased out until v0.6.
If you need them, opt in with #[var(pub)].
pub fn get_water_shallow_color(&self) -> <Color as GodotConvert>::Via
Auto-generated Rust getters/setters for #[var] are being phased out until v0.6.
If you need them, opt in with #[var(pub)].
pub fn set_water_shallow_color( &mut self, water_shallow_color: <Color as GodotConvert>::Via, )
Auto-generated Rust getters/setters for #[var] are being phased out until v0.6.
If you need them, opt in with #[var(pub)].
pub fn get_water_wave_strength(&self) -> <f32 as GodotConvert>::Via
Auto-generated Rust getters/setters for #[var] are being phased out until v0.6.
If you need them, opt in with #[var(pub)].
pub fn set_water_wave_strength( &mut self, water_wave_strength: <f32 as GodotConvert>::Via, )
Auto-generated Rust getters/setters for #[var] are being phased out until v0.6.
If you need them, opt in with #[var(pub)].
pub fn get_water_wave_scale(&self) -> <f32 as GodotConvert>::Via
Auto-generated Rust getters/setters for #[var] are being phased out until v0.6.
If you need them, opt in with #[var(pub)].
pub fn set_water_wave_scale( &mut self, water_wave_scale: <f32 as GodotConvert>::Via, )
Auto-generated Rust getters/setters for #[var] are being phased out until v0.6.
If you need them, opt in with #[var(pub)].
pub fn get_water_wave_speed(&self) -> <f32 as GodotConvert>::Via
Auto-generated Rust getters/setters for #[var] are being phased out until v0.6.
If you need them, opt in with #[var(pub)].
pub fn set_water_wave_speed( &mut self, water_wave_speed: <f32 as GodotConvert>::Via, )
Auto-generated Rust getters/setters for #[var] are being phased out until v0.6.
If you need them, opt in with #[var(pub)].
pub fn get_water_underwater_color(&self) -> <Color as GodotConvert>::Via
Auto-generated Rust getters/setters for #[var] are being phased out until v0.6.
If you need them, opt in with #[var(pub)].
pub fn set_water_underwater_color( &mut self, water_underwater_color: <Color as GodotConvert>::Via, )
Auto-generated Rust getters/setters for #[var] are being phased out until v0.6.
If you need them, opt in with #[var(pub)].
pub fn get_water_underwater_density(&self) -> <f32 as GodotConvert>::Via
Auto-generated Rust getters/setters for #[var] are being phased out until v0.6.
If you need them, opt in with #[var(pub)].
pub fn set_water_underwater_density( &mut self, water_underwater_density: <f32 as GodotConvert>::Via, )
Auto-generated Rust getters/setters for #[var] are being phased out until v0.6.
If you need them, opt in with #[var(pub)].
Source§impl CesBuilder
impl CesBuilder
Sourcepub fn params(&self) -> BuilderParams
pub fn params(&self) -> BuilderParams
Collect the noise knobs (declared as @exports on the example GDScripts)
into the plain params struct, defaulting to the HQ terrain when absent.
Sourcepub fn to_height_gpu(&self) -> HeightGpu
pub fn to_height_gpu(&self) -> HeightGpu
Geometry (height) params for the inline example shader.
Sourcepub fn to_texture_gpu(&self) -> TextureGpu
pub fn to_texture_gpu(&self) -> TextureGpu
Surface (texture) params for the inline example shader.
Sourcepub fn to_noise_params(&self, radius: f32) -> NoiseParams
pub fn to_noise_params(&self, radius: f32) -> NoiseParams
CPU-noise params for crate::noise_provider::NoiseProvider
(CpuNoise). radius is the planet radius (for the FD normal).
Sourcepub fn water_height(&self) -> f32
pub fn water_height(&self) -> f32
The builder’s normalized sea level (0..1). Read as a knob so a custom
GPU builder (no water_height @export) falls back to the default.
Sourcepub fn height_scale(&self) -> f32
pub fn height_scale(&self) -> f32
The builder’s geometry displacement multiplier. Read as a knob so a
custom GPU builder (no height_scale @export) falls back to the default.
Sourcepub fn submits(&self) -> Arc<SubmitQueue>
pub fn submits(&self) -> Arc<SubmitQueue>
The async-bake hand-back queue (the planet drains it each frame).
Source§impl CesBuilder
impl CesBuilder
Sourcepub fn submit_chunk(
&self,
handle: i64,
heights: PackedFloat32Array,
colors: PackedColorArray,
normals: PackedVector3Array,
)
pub fn submit_chunk( &self, handle: i64, heights: PackedFloat32Array, colors: PackedColorArray, normals: PackedVector3Array, )
Hand a finished chunk surface back to the planet. Callable from any thread (it takes a mutex and returns; the planet drains next frame).
handle— thehandlefrom the matching_bake_requestedentry.heights—tile_res²displacements in YOUR vertical unit, row-major (theheight_scaleproperty converts them to displaced radius).colors—tile_res²albedos, row-major.normals— optional; leave empty to have the library finite-difference the height grid for you.
Idempotent: call it again for the same handle to refine that chunk (a coarse
tile now, a finer one when the download lands). A submission for a chunk that
has left the view is simply dropped — that is the whole cancellation story.
Wrong-length arrays are rejected (one error is printed, then silence);
non-finite heights are sanitized to 0.0.
The full contract (the _bake_requested request format, _base_ready) is in
the “Advanced: async bake” section of the custom-CPU-terrain guide at
https://celestialsim.github.io/CelestialSim/.
Sourcepub fn chunk_dirs(
&self,
corners: PackedVector3Array,
tile_res: i64,
) -> PackedVector3Array
pub fn chunk_dirs( &self, corners: PackedVector3Array, tile_res: i64, ) -> PackedVector3Array
The tile_res² texel-centre world directions of a chunk, row-major —
the same mapping the shaders use.
Not included in a bake request (786 KB per chunk at tile_res = 256, and
a streaming builder wants a lat/lon box, not directions), so materialize
them only if you need them. Pure: safe to call from a worker thread.
pub fn get_device(&self) -> BuilderDevice
pub fn set_device(&mut self, v: BuilderDevice)
pub fn get_builtin_shader(&self) -> BuiltinShader
pub fn set_builtin_shader(&mut self, v: BuiltinShader)
pub fn get_shader_file(&self) -> GString
pub fn set_shader_file(&mut self, v: GString)
pub fn get_water_height(&self) -> f32
pub fn set_water_height(&mut self, v: f32)
Trait Implementations§
Source§impl Bounds for CesBuilder
impl Bounds for CesBuilder
Source§impl GodotClass for CesBuilder
impl GodotClass for CesBuilder
Source§impl IResource for CesBuilder
impl IResource for CesBuilder
Source§fn on_validate_property(&self, property: &mut PropertyInfo)
fn on_validate_property(&self, property: &mut PropertyInfo)
Reshape the inspector by (device, builtin_shader) — read as plain
fields, NEVER via self.to_gd() (which would free a refcount-0
introspection object and crash). builtin_shader is always hidden
(STORAGE only). shader_file shows ONLY for the GPU-custom route. Every
other property (including the example GDScripts’ @export knobs) is left
visible. Hidden fields keep STORAGE so values still persist.
§fn init(base: Base<Self::Base>) -> Self
fn init(base: Base<Self::Base>) -> Self
base object. Read more§fn on_notification(&mut self, what: ObjectNotification)
fn on_notification(&mut self, what: ObjectNotification)
§fn on_get_property_list(&mut self) -> Vec<PropertyInfo>
fn on_get_property_list(&mut self) -> Vec<PropertyInfo>
get_property_list() is called, the returned vector here is
appended to the existing list of properties. Read more§fn on_property_get_revert(&self, property: StringName) -> Option<Variant>
fn on_property_get_revert(&self, property: StringName) -> Option<Variant>
§fn setup_local_to_scene(&mut self)
fn setup_local_to_scene(&mut self)
instantiate][crate::classes::PackedScene::instantiate], if the original’s [member resource_local_to_scene] is set to true. Read more§fn get_rid(&self) -> Rid
fn get_rid(&self) -> Rid
RID][crate::builtin::Rid] when [get_rid][crate::classes::Resource::get_rid] is called.§fn reset_state(&mut self)
fn reset_state(&mut self)
on_validate_property][crate::classes::IObject::on_validate_property] or [on_get_property_list][crate::classes::IObject::on_get_property_list], this method must be implemented to clear them.§fn set_path_cache(&self, path: GString)
fn set_path_cache(&self, path: GString)
set_path_cache][crate::classes::Resource::set_path_cache] is called on this object.Source§impl Inherits<Object> for CesBuilder
impl Inherits<Object> for CesBuilder
§const IS_SAME_CLASS: bool = false
const IS_SAME_CLASS: bool = false
Self == Base. Read moreSource§impl Inherits<RefCounted> for CesBuilder
impl Inherits<RefCounted> for CesBuilder
§const IS_SAME_CLASS: bool = false
const IS_SAME_CLASS: bool = false
Self == Base. Read moreSource§impl Inherits<Resource> for CesBuilder
impl Inherits<Resource> for CesBuilder
§const IS_SAME_CLASS: bool = false
const IS_SAME_CLASS: bool = false
Self == Base. Read moreSource§impl WithBaseField for CesBuilder
impl WithBaseField for CesBuilder
Source§fn to_gd(&self) -> Gd<CesBuilder>
fn to_gd(&self) -> Gd<CesBuilder>
Gd pointer containing this object. Read more§fn base(&self) -> BaseRef<'_, Self>
fn base(&self) -> BaseRef<'_, Self>
&self engine methods on this object. Read more§fn base_mut(&mut self) -> BaseMut<'_, Self>
fn base_mut(&mut self) -> BaseMut<'_, Self>
&self/&mut self engine methods on this object. Read more§fn run_deferred<F>(&mut self, mut_self_method: F)where
F: FnOnce(&mut Self) + 'static,
fn run_deferred<F>(&mut self, mut_self_method: F)where
F: FnOnce(&mut Self) + 'static,
§fn run_deferred_gd<F>(&mut self, gd_function: F)where
F: FnOnce(Gd<Self>) + 'static,
fn run_deferred_gd<F>(&mut self, gd_function: F)where
F: FnOnce(Gd<Self>) + 'static,
Source§impl WithSignals for CesBuilder
impl WithSignals for CesBuilder
Source§type SignalCollection<'c, C: WithSignals> = __godot_Signals_CesBuilder<'c, C>
type SignalCollection<'c, C: WithSignals> = __godot_Signals_CesBuilder<'c, C>
Source§impl WithUserSignals for CesBuilder
impl WithUserSignals for CesBuilder
impl GodotDefault for CesBuilder
impl ImplementsGodotApi for CesBuilder
impl ImplementsGodotExports for CesBuilder
impl ImplementsGodotVirtual for CesBuilder
impl You_forgot_the_attribute__godot_api for CesBuilder
Auto Trait Implementations§
impl Freeze for CesBuilder
impl !RefUnwindSafe for CesBuilder
impl !Send for CesBuilder
impl !Sync for CesBuilder
impl Unpin for CesBuilder
impl UnsafeUnpin for CesBuilder
impl !UnwindSafe for CesBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Inherits<T> for Twhere
T: GodotClass,
impl<T> Inherits<T> for Twhere
T: GodotClass,
§const IS_SAME_CLASS: bool = true
const IS_SAME_CLASS: bool = true
Self == Base. Read more§impl<T> NewGd for Twhere
T: GodotDefault<Memory = MemRefCounted> + Bounds,
impl<T> NewGd for Twhere
T: GodotDefault<Memory = MemRefCounted> + Bounds,
§impl<C> ObjectToOwned<C> for Cwhere
C: WithBaseField,
impl<C> ObjectToOwned<C> for Cwhere
C: WithBaseField,
§fn object_to_owned(&self) -> Gd<C>
fn object_to_owned(&self) -> Gd<C>
Gd<T>.