In this section, we will be looking into building efficient 3D visualizations that use multiple geometries. We will create a starfield simulation using TSphere and TObjectProxy components for sharing mesh data.
If we look into the source code of TSphere, TCone, TCylinder and other components in the FMX.Objects3D unit, we will see that their vertices and indices are hardcoded. If we want to build a 3D scene with many different objects, every object will occupy quite a lot of space in memory.
FireMonkey comes with a special TProxyObject 3D object. It does not hold its geometry, but instead has the SourceObject property that can be used to connect to any other 3D object which is used for rendering. In this way, we have just one copy of geometry data in memory and multiple objects rendered.
To illustrate this concept, let's build a starfield simulation with...