Squash of 25 work commits (Sep 1–12):237da90render: the sprite lane hands the screen draw back the way it found it895b9a7particles: an emitter can ride a body's own frame914471fai-hub: a feed session whose last socket left ends on its idle timeout; skin: parent, skinned centroid and a nodes-only rig for retargets3fcccf3sim: the whole world is implicitly editable, and one seam says where the ground is5692fabsim: the landform world proves itself — walker through the tunnel includedf4af6dfsim: terrain knows who changed it — a plan layer over player historyadbb078render: a water volume can be physics without a picturec17480frender: a non-rigid body may carry its own orientationacad401sim: an agent with no route holds and retries instead of walking into the wall22b2bf9sim + chat: the composed world surface takes a map floor; the chat gets plan toolsfaf8112web path: the tessellator's lap timer, the trace span and the fusion cycle timer have no clock on the webd3472ebtsdf: the clock-taking XR helpers are native-only — the browser has no depth camera and no Instant4946c9esim + render: a repaint is not a world edit — colour and glow restyles never rebake the lightmap4317f58sim + render + chat: walk decks as a surface, the filmed body is no obstruction, the brief never asks9791279render: support rigged models and custom materials across viewers3ce2792sim: use deck geometry for collision and sensing c8b79ff Add portable PBR, rig and soft-body authoring support 108d423 Add transactional polygon modeling and editable asset documents 38f4d3b Refine editable modeling and firm yarn character behavior 08a2637 sim: add entity-owned lights and vehicle headlights 00d96a7 render: add clustered lights, local shadows and incremental GI cf916af render: import glTF asset extensions and wire clustered GI c6d2cca model: cut transaction memory and raise capacity limits 41af47a raytrace: add a CPU probe-ray BVH budget example c963d0a libs: the game sim splits into makepad-scene and makepad-soft-body; render, model, fab and the asset importer retarget Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
65 lines
3.3 KiB
Rust
65 lines
3.3 KiB
Rust
use makepad_mesh_edit::*;
|
|
|
|
#[test]
|
|
fn flipping_shell_changes_inside_outside_and_preserves_every_attribute() {
|
|
let mut mesh = Mesh::cube([2.; 3], &mut Context::default()).unwrap();
|
|
let faces = mesh.faces().iter().map(|f|f.id).collect::<Vec<_>>();
|
|
let corner = mesh.corners()[0].id;
|
|
let vertex = mesh.vertices()[0].id;
|
|
let edge = *mesh.adjacency(&mut Context::default()).unwrap().edges.keys().next().unwrap();
|
|
mesh.set_vertex_weights(vertex, &[JointWeight {joint: 2, weight: 1.}], &mut Context::default()).unwrap();
|
|
mesh.set_face_material(faces[0], 7, &mut Context::default()).unwrap();
|
|
mesh.set_corner_uv(corner, [0.2, 0.7], &mut Context::default()).unwrap();
|
|
mesh.pin_uv(&[corner], true, &mut Context::default()).unwrap();
|
|
mesh.set_edge_attributes(edge, EdgeAttributes {seam: true, crease: 0.8}, &mut Context::default()).unwrap();
|
|
mesh.recalculate_normals(false, 0., &mut Context::default()).unwrap();
|
|
let original = mesh.clone();
|
|
assert!(mesh.validate_global(&mut Context::default()).unwrap().is_valid_solid);
|
|
let changes = mesh.flip_faces(&faces, &mut Context::default()).unwrap();
|
|
assert!(changes.created.is_empty() && changes.deleted.is_empty());
|
|
assert_eq!(mesh.vertices(), original.vertices());
|
|
assert_eq!(mesh.faces(), original.faces());
|
|
assert_eq!(mesh.edge_attributes(), original.edge_attributes());
|
|
assert_eq!(mesh.uv_pins(), original.uv_pins());
|
|
for old in original.corners() {
|
|
let new = mesh.corner(old.id).unwrap();
|
|
assert_eq!((new.vertex,new.uv), (old.vertex,old.uv));
|
|
assert_eq!(new.normal, old.normal.map(|v|v.map(|x|-x)));
|
|
}
|
|
let report = mesh.validate_global(&mut Context::default()).unwrap();
|
|
assert!(report.is_embedded_surface);
|
|
assert_eq!(report.orientation_errors, 1);
|
|
assert!(!report.is_valid_solid);
|
|
let bytes = mesh.to_bytes(&mut Context::default()).unwrap();
|
|
mesh = Mesh::from_bytes(&bytes, &mut Context::default()).unwrap();
|
|
mesh.flip_faces(&faces, &mut Context::default()).unwrap();
|
|
assert_eq!(mesh, original);
|
|
}
|
|
|
|
#[test]
|
|
fn invalid_selections_budget_and_cancellation_leave_winding_unchanged() {
|
|
let mut mesh = Mesh::cube([1.; 3], &mut Context::default()).unwrap();
|
|
let original = mesh.clone();
|
|
let face = mesh.faces()[0].id;
|
|
for ids in [vec![face,face],vec![FaceId(u64::MAX)]] {
|
|
assert!(mesh.flip_faces(&ids, &mut Context::default()).is_err());
|
|
assert_eq!(mesh, original);
|
|
}
|
|
let mut budget = Limits::default();
|
|
budget.max_work = 2;
|
|
assert!(mesh.flip_faces(&[face], &mut Context::new(budget,None)).is_err());
|
|
assert_eq!(mesh, original);
|
|
assert_eq!(mesh.flip_faces(&[face], &mut Context::new(Limits::default(),Some(&||true))).unwrap_err(), MeshError::Cancelled);
|
|
assert_eq!(mesh, original);
|
|
}
|
|
|
|
#[test]
|
|
fn flipping_an_open_pane_changes_its_visible_side_without_inventing_a_solid() {
|
|
let mut mesh = Mesh::plane([2.,3.], &mut Context::default()).unwrap();
|
|
let faces = mesh.faces().iter().map(|f|f.id).collect::<Vec<_>>();
|
|
let before = mesh.triangulate(&mut Context::default()).unwrap();
|
|
mesh.flip_faces(&faces, &mut Context::default()).unwrap();
|
|
let after = mesh.triangulate(&mut Context::default()).unwrap();
|
|
assert_eq!(before.vertices[0].normal.map(|v|-v),after.vertices[0].normal);
|
|
assert!(!mesh.validate(&mut Context::default()).unwrap().is_closed);
|
|
}
|