pub struct Engine { /* private fields */ }Expand description
Voxel engine state.
Implementations§
Source§impl Engine
impl Engine
pub fn set_camera(&mut self, camera: Camera)
pub fn camera(&self) -> Camera
Sourcepub fn set_sky_color(&mut self, color: u32)
pub fn set_sky_color(&mut self, color: u32)
Override the sky / background colour. Bytes are 0xAARRGGBB
where AA is the voxlap-style “brightness” channel (0x80 is
“normal” intensity, matching the engine’s other surface
colours).
pub fn sky_color(&self) -> u32
Sourcepub fn set_fog(&mut self, color: u32, max_scan_dist: i32)
pub fn set_fog(&mut self, color: u32, max_scan_dist: i32)
Configure fog. max_scan_dist <= 0 disables fog. Otherwise
pixels at the maximum scan distance blend fully to
fog_color (low 24 bits — alpha byte ignored). Voxlap’s
vx5.maxscandist-based foglut is rebuilt downstream by
ScanScratch::set_fog.
pub fn fog_color(&self) -> u32
pub fn fog_max_scan_dist(&self) -> i32
Sourcepub fn set_side_shades(
&mut self,
top: i8,
bot: i8,
left: i8,
right: i8,
up: i8,
down: i8,
)
pub fn set_side_shades( &mut self, top: i8, bot: i8, left: i8, right: i8, up: i8, down: i8, )
Voxlap’s setsideshades(top, bot, left, right, up, down)
— per-side voxel darkening intensities. Each i8 is stamped
onto the high byte of gcsub[2..7] (downstream by
ScanScratch::set_side_shades). Pass (0,…,0) to disable
(the oracle baseline); positive values like 15 / 31 give the
directional darkening typical of voxlap’s classic games.
pub fn side_shades(&self) -> [i8; 6]
Sourcepub fn set_kv6col(&mut self, color: u32)
pub fn set_kv6col(&mut self, color: u32)
Sprite material colour — packed BGRA bytes, voxlap’s
vx5.kv6col. R/G/B equal triggers update_reflects’s
nolighta fast path.
pub fn kv6col(&self) -> u32
Sourcepub fn set_lightmode(&mut self, mode: u32)
pub fn set_lightmode(&mut self, mode: u32)
Sprite lighting mode — voxlap’s vx5.lightmode. 0 / 1 →
directional tint; 2 → point-light shading from
Engine::lights. Other values clamp to 2 in voxlap.
pub fn lightmode(&self) -> u32
Sourcepub fn add_light(&mut self, light: LightSrc)
pub fn add_light(&mut self, light: LightSrc)
Append a light source. No upper bound enforced here —
voxlap’s MAXLIGHTS (16) is the practical limit, but the
rendering math just iterates whatever’s in the slice.
pub fn clear_lights(&mut self)
pub fn lights(&self) -> &[LightSrc]
Sourcepub fn set_sky(&mut self, sky: Option<Sky>)
pub fn set_sky(&mut self, sky: Option<Sky>)
Set the sky texture used by the textured-startsky path.
None reverts to the cheap solid-fill default.
pub fn sky(&self) -> Option<&Sky>
Sourcepub fn render(
&mut self,
pixels: &mut [u32],
width: u32,
height: u32,
pitch_pixels: u32,
)
pub fn render( &mut self, pixels: &mut [u32], width: u32, height: u32, pitch_pixels: u32, )
Render one frame into the caller-owned ARGB framebuffer.
pixels is a row-major u32 buffer; pitch_pixels is the row
stride in u32 elements (which equals width for a tightly-
packed buffer, but may be larger when the host is e.g. an SDL2
streaming texture with per-row padding).
R3 is a stub that fills the visible region with sky_color.
R4 replaces this with the real raycaster.
§Panics
Panics if pixels.len() < (height as usize) * (pitch_pixels as usize) or if width > pitch_pixels — i.e. when the buffer
would not contain height rows of pitch_pixels u32 each, or
when the visible width would overflow each row.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Engine
impl RefUnwindSafe for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
impl UnwindSafe for Engine
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more