Repository navigation
feat(core,lang): add glTF COLOR_0 vertex color export and vcolor baking op - #213
Open
morelandjo wants to merge 1 commit into
Open
morelandjo wants to merge 1 commit into
morelandjo wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #65
Summary
Adds zero-dependency per-face-corner vertex colors (
Face::colors), glTF 2.0COLOR_0export & import, and a composablevcolor(aliasbake_color) op supporting solid face painting, height/axis gradients, directional shading, stepped toon ramps, and underside/base ambient occlusion darkening.What Changed
forma-core:mesh.rs: Added#[serde(default)] pub colors: Vec<[f32; 4]>(display sRGB RGBA, empty = 0 bytes when unused) toFace, preserved throughtriangulated(),flip_winding(), anddedup_face_verts().ops.rs: AddedVColorParamsandop_vcolorsupporting solidcolor,low/highgradient alongaxis(x/y/z), directionalsun+shadow/ambient, stepped toonsteps(>= 2), underside/baseao,FaceSelectorfiltering, andmultiplylayering.export.rs: ExportedCOLOR_0in both single-part and multi-part scene.glbas compact normalizedUNSIGNED_SHORTVEC4(componentType: 5123,"normalized": true, 8 bytes/vertex, sRGB → linear per glTF 2.0 spec). Omitted completely on uncolored meshes (zero bloat). Included quantized color in the vertex weld key.import.rs: AddedCOLOR_0import (FLOAT,UNSIGNED_SHORT,UNSIGNED_BYTE;VEC3andVEC4) converting linear → sRGB back intoFace::colors.instancing.rs: IncludedFace::colorsincompute_mesh_signatureso differently vertex-colored meshes do not falsely deduplicate.render.rs: Modulated software PNG preview face colors byFace::colorswhen present.forma-lang:pipeline.rs,lib.rs: Wiredvcolor(...)/bake_color(...)pipe & functional op; advertised in the existing progressiveuvtopic (uv(unwrap,decimate,vcolor), +1 token inSPEC_PIPE, zero new dependencies).crates/forma-core/tests/vertex_colors.rs: Height gradient +COLOR_0GLB accessor & roundtrip accuracy, uncolored mesh omission, 3-step toon ramp + AO, selective face painting +multiplylayering, multi-part scene GLB, and parameter validation.crates/forma-lang/tests/validation.rs: Pipe DSL evaluation understrict_manifold = trueand error cases.Verification
cargo clippy --locked --workspace --all-targets --all-features -- -D warnings— cleancargo test --locked --release -p forma-core -p forma-lang -p forma-cli -p forma-mcp -p forma-server -- --skip test_10000_fuzzed_modeling_operations_zero_crashes_zero_nans— all passednpm run build:wasm && npm test— 5/5 passedpython3 scripts/check_local_paths.py— clean