Merge remote-tracking branch 'origin/main' into fix/environment-light-no-effect-cast-shadows

This commit is contained in:
Z User
2026-10-27 08:54:33 +00:00
488 changed files with 42290 additions and 40792 deletions
+1 -1
View File
@@ -230,7 +230,7 @@ const PLANE_SLOPE_MAX: f32 = 64.0;
/// Fraction of light reaching `p` through shadow map `m` (1 = lit). `ng` is the
/// receiver's geometric (not normal-mapped) normal facing the viewer.
///
/// PCF over an N×N tap grid (5 ≤ N ≤ [`PCF_MAX_TAPS`]) spread over a reach derived
/// PCF over an N×N tap grid (5 ≤ N ≤ `PCF_MAX_TAPS`) spread over a reach derived
/// from `radius` (the wanted penumbra in output pixels) divided by the receiver's
/// texel footprint, each tap jittered by an integer hash of the receiver's
/// sub-texel cell and the tap index, and each tap comparing against the four
+2 -2
View File
@@ -703,7 +703,7 @@ fn occlusion(c: &Item, p: Vec3, l: &LightState) -> [f32; 3] {
/// A Classic 3D run prepared for an accelerator ([`Renderer::prepare_3d_run`]): every plane
/// with its geometry, material and buffer, ready for the per-pixel depth sort, lighting and
/// ray-cast shadows of [`draw_run`] on another device.
/// ray-cast shadows of `draw_run` on another device.
#[derive(Clone, Debug)]
pub struct Run3d {
/// Drawn planes in stack order, then shadow casters from outside the run (`draw` false).
@@ -971,7 +971,7 @@ pub(crate) fn environment_rotation(ctx: &EvalCtx) -> f32 {
.to_radians() as f32
}
/// An Environment Light Background layer ready to draw (see [`draw_sky`]): the layer's
/// An Environment Light Background layer ready to draw (see `draw_sky`): the layer's
/// buffer in the blending space, its opacity and the camera's view rays. Also handed to an
/// accelerator's compositor (`Renderer::sky_draw`).
#[derive(Clone)]
-41
View File
@@ -1,41 +0,0 @@
//! Classic 3D: cameras, 3D views, lights, materials and the depth-sorted, lit, shadowed
//! compositor for runs of 3D layers.
//!
//! The 2D compositor (`Renderer::comp_frame`) walks the layer stack bottom-to-top; each run of
//! consecutive 3D layers is handed to [`compose::draw_run`] as a group (2D layers break 3D
//! groups, as in After Effects).
pub mod adv;
pub mod bokeh;
pub mod camera;
pub(crate) mod compose;
pub mod light;
#[cfg(test)]
mod tests;
#[cfg(test)]
mod tests_orient;
pub use camera::{CameraState, Dof, Rig, View3D, ViewCam, Views3D, active_camera, default_camera, default_view_cam};
pub use compose::{Geo as PlaneGeo, Plane3d, PlaneDof, Run3d, SkyDraw};
pub use light::{LightState, Material, lights_at};
use effectcraft_geom::Mat3;
use effectcraft_project::Layer;
use crate::EvalCtx;
/// Layer space → comp pixels through `cam` (2D projective), for viewer overlays and picking in
/// any 3D view. 2D layers ignore the camera.
pub fn layer_to_view(ctx: &EvalCtx, layer: &Layer, cam: &CameraState) -> Mat3 {
if !layer.is_3d() {
return ctx.layer_to_comp(layer).0;
}
let (w, h) = (ctx.comp.width as f64, ctx.comp.height as f64);
(cam.projection(w, h) * ctx.world_matrix(layer)).plane_to_mat3()
}
/// Project a world point into comp pixels through `cam` (None behind a perspective camera).
pub fn project_point(ctx: &EvalCtx, cam: &CameraState, p: [f64; 3]) -> Option<[f64; 2]> {
cam.project(ctx.comp.width as f64, ctx.comp.height as f64, p.into()).map(|v| [v.x, v.y])
}