Tree
- x, y
- mesh (2 MB)
- texture (3 MB)
A million heavy objects
1class Tree {2 int x, y;3 Mesh mesh; // 2 MB4 Texture texture; // 3 MB — copied into EVERY tree5}
When you need a HUGE number of similar objects, share their common heavy data instead of duplicating it — keep only the per-object differences.
1class Tree {2 int x, y;3 Mesh mesh; // 2 MB4 Texture texture; // 3 MB — copied into EVERY tree5}
Each Tree carries its own mesh and texture — 5 MB of heavy geometry baked right into the object alongside its x, y.