Repository navigation
geometry::merge grows face materials in place, so model::merged stays linear - #881
Merged
Merged
Conversation
… linear merge() rebuilt the whole face-material array on every call, so folding n meshes into one was quadratic in the face count. load_city_bundle merges austin_south's 11272 building meshes after giving each its material: merged() took 56 s, and every physics plant in cvcdbg's demo3 waited on it before its window opened. Ours now grow in place: its triangles' materials go in after ours (moving only our quads'), its quads' at the end, zeros for a side without them. Same order, same results; merged() takes 0.11 s and load_city_bundle 0.8 s.
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.
Why
cvcdbg's demo3 took 75-86 s to open its window on any physics plant (dynamic, dynamic4w, humvee) and 9 s on the kinematic one, printing nothing in between. Nearly all of the difference is
cvc::world::load_city_bundle, which demo3 calls to give the plant the bundle's buildings:read_model(buildings.glb)model::merged()with a material on every facemodel::merged()without materialsload_city_bundle(terrain and buildings)geometry::mergerebuilt the whole face-material array on every call, somodel::merged(), which folds the file's meshes in one at a time, did about n^2/2 copies: roughly 5.5 billion for austin_south.What changes
merge()grows our material array in place instead. Its triangles' materials go in after ours, which moves only our quads' entries; its quads' go at the end; a side without materials contributes zeros. The face order and the results are the same as before. A self-merge copies its materials first, since they are the ones that grow.Measured
demo3, time to window (native Windows build of CVC-DBG/cvcdbg main with
--radio csma, against thiscvc.dll):Tests (MSVC Release): geometry_height_field_test, geometry_test, geometry_attributes_test, model_test, world_geometry_test, lod_tiles_test and nav_world_planes_test all pass. The new
GeometryFaceMaterials.AFoldOfManyMergesKeepsEveryFacesMaterialfolds 300 meshes, with and without materials and with and without a quad, and checks every face's material against the documented order.The wasm demo loads the same bundle the same way, so its physics plants should start faster too. That hasn't been measured in a browser yet.