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>
30 lines
2.9 KiB
Rust
30 lines
2.9 KiB
Rust
//! Source-preserving material/normal revision for the authored workshop car.
|
|
//! No beam/steering/collider or vertex positions are changed.
|
|
use makepad_model::*;
|
|
fn main()->std::result::Result<(),Box<dyn std::error::Error>>{
|
|
let args=std::env::args().skip(1).collect::<Vec<_>>();
|
|
if args.len()!=2{return Err("usage: polish_headlights <source.mpmodel> <output.mpmodel>".into());}
|
|
let mut doc=Document::from_bytes(&std::fs::read(&args[0])?,Limits{max_joints:128,..Default::default()},None)?;
|
|
let before=doc.head();let scene=doc.scene().clone();
|
|
let before_positions=doc.objects().map(|(name,m)|(name.to_string(),m.vertices().iter().map(|v|(v.id,v.position)).collect::<Vec<_>>())).collect::<Vec<_>>();
|
|
let lens=doc.object("headlamp-lens").ok_or("expected headlamp-lens source object")?;
|
|
let faces=lens.faces().iter().map(|f|f.id).collect();
|
|
let material=doc.materials().keys().copied().max().unwrap_or(0)+1;
|
|
let mut operations=vec![Operation::SetMaterial{material,value:Material{color:[1.,0.88,0.68],base_color_png:Vec::new()}},
|
|
Operation::Surface(SurfaceOperation::Material{material,value:SurfaceMaterial{base_color:[1.,0.91,0.76,1.],metallic:0.,roughness:0.14,
|
|
emissive:[1.,0.80,0.52],emissive_strength:3.5,..Default::default()}}),
|
|
Operation::AssignMaterial{object:"headlamp-lens".into(),faces,material}];
|
|
let curved=doc.objects().filter(|(name,_)|name.starts_with("headlamp")||*name=="hubcap"||name.contains("fender")||name.contains("tire")).map(|(name,_)|name.to_string()).collect::<Vec<_>>();
|
|
for name in &curved {
|
|
let args=json::obj(vec![("op",json::s("normals")),("object",json::s(name)),("smooth",json::Value::Bool(true)),("angle",json::Value::F64(1.2))]);
|
|
operations.extend(parse_operations(&json::Value::Arr(vec![args]),doc.limits())?);
|
|
}
|
|
doc.apply(Transaction{request_id:"warm-luminous-headlamp-lenses".into(),expected:before,operations},None)?;
|
|
assert_eq!(doc.scene(),&scene,"beam lights, wheel contracts and placement must stay identical");
|
|
for(name,vertices)in before_positions{assert_eq!(vertices,doc.object(&name).unwrap().vertices().iter().map(|v|(v.id,v.position)).collect::<Vec<_>>());}
|
|
let checks=doc.publication_checks(None)?;if checks.get("valid")!=Some(&json::Value::Bool(true)){return Err(checks.to_json().into());}
|
|
let compiled=doc.compile(None)?;let source=doc.to_snapshot_bytes(None)?;
|
|
std::fs::write(&args[1],&source)?;
|
|
let output=std::path::Path::new(&args[1]);std::fs::write(output.with_extension("glb"),&compiled.glb)?;
|
|
println!("{}",json::obj(vec![("head",head_json(doc.head())),("lens_material",json::Value::Int(material as i64)),("emissive_strength",json::Value::F64(3.5)),("smoothed",json::Value::Arr(curved.into_iter().map(json::s).collect())),("triangles",json::Value::Int(compiled.triangles as i64)),("vertices_unchanged",json::Value::Bool(true)),("lights_wheels_scene_unchanged",json::Value::Bool(true))]).to_json());Ok(())
|
|
}
|