Trait WorldDrawContext
pub trait WorldDrawContext {
// Provided methods
fn draw_instance_group(
&mut self,
group: InstanceGroupRef,
) -> Result<(), GroupError> { ... }
fn lines(&mut self, lines: &[WorldLine]) -> Result<(), DrawError> { ... }
fn quads(&mut self, quads: &[WorldQuad]) -> Result<(), DrawError> { ... }
fn pipeline_quads(
&mut self,
pipeline: RenderPipelineRef,
quads: &[PipelineQuad],
) -> Result<(), PipelineDrawError> { ... }
fn usage(&self) -> WorldDrawUsage { ... }
fn draw_model_instances(
&mut self,
model: ModelRef,
instances: &[ModelInstance],
) -> Result<(), InstanceError> { ... }
}Expand description
Per-view untextured geometry, cleared even without listeners; usage reports fixed setup-time limits shared across listeners and depth modes.
Provided Methods§
fn draw_instance_group(
&mut self,
group: InstanceGroupRef,
) -> Result<(), GroupError>
fn draw_instance_group( &mut self, group: InstanceGroupRef, ) -> Result<(), GroupError>
Draw a retained group once per view, with per-view culling and the batch route rules.
Repeated submissions in one view are ignored. Only visible copies consume its budget.
The shared limit is 16,384 visible copies and 16,384 groups per view. Refusal is atomic.
Shader packs and overlays use the same CPU path as transient model batches.
Retired or foreign groups return GroupError::Stale, even if drawn earlier this view.
fn lines(&mut self, lines: &[WorldLine]) -> Result<(), DrawError>
fn lines(&mut self, lines: &[WorldLine]) -> Result<(), DrawError>
Submit unlit ARGB world lines atomically. Invalid coordinates or widths, or a batch exceeding the view’s fixed capacity, leave the batch unchanged.
fn quads(&mut self, quads: &[WorldQuad]) -> Result<(), DrawError>
fn quads(&mut self, quads: &[WorldQuad]) -> Result<(), DrawError>
Submit unlit, alpha-blended world quads atomically, using the white atlas texel.
fn pipeline_quads(
&mut self,
pipeline: RenderPipelineRef,
quads: &[PipelineQuad],
) -> Result<(), PipelineDrawError>
fn pipeline_quads( &mut self, pipeline: RenderPipelineRef, quads: &[PipelineQuad], ) -> Result<(), PipelineDrawError>
Submit world quads drawn by the mod pipeline pipeline, atomically: its shader gets each
quad’s texture coordinate and colour, and its blend and depth modes apply. The quads
count against the same per-view capacity as quads, and within a stage
they draw after its plain quads and lines, in the order submitted. On Err, nothing
from this call is drawn.
fn usage(&self) -> WorldDrawUsage
fn usage(&self) -> WorldDrawUsage
Queued counts and fixed capacities, shared by both depth modes and all listeners. Capacity is allocated during setup, never grown during submission.
fn draw_model_instances(
&mut self,
model: ModelRef,
instances: &[ModelInstance],
) -> Result<(), InstanceError>
fn draw_model_instances( &mut self, model: ModelRef, instances: &[ModelInstance], ) -> Result<(), InstanceError>
Draw every copy in instances of the resolved model.
One batch per model. The engine uploads only the instance records on the opaque
and cutout route, and bakes the same prepared geometry on the CPU when a shader
pack, a copy with an Overlay, or another route cannot take instances. A
shaders/ pack shades those copies as block entities, with the program that shades
BlockEntityDrawContext::model. A model with a translucent face is refused with
InstanceError::Translucent and is never drawn as solid.
Tint is 0xAARRGGBB and light is LightCoords: both stay in
vanilla’s space, and the engine converts them to the frame. A tint’s alpha
multiplies only faces that have a tint index, the same as vanilla’s model
renderer. The view budget is 16,384 copies. Pass at most that many: a longer
list is refused with InstanceError::CapacityExceeded before any copy is
examined. On wasm the guest pays for the list it passes, because the runtime
lifts the slice before that check. Within the bound, copies outside the frustum
are omitted and do not count. On Err, nothing from this call is drawn.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".