|
Nebula
|
#include <assetpreview.h>
The 3D preview the asset documents draw what they edit in: a material on a knob, a model, a particle system.
One preview is shared by all of them, because only the tab in front shows it. A document puts its objects in the preview's stage and takes them out of it when its tab goes behind another one, so the preview shows the front tab's objects only.
The preview renders its own view with the preview frame script, lit by a directional light of its own, into a fixed size target that is drawn stretched over the space it is given. The camera's aspect is that space's, so what is shown keeps its proportions. The camera orbits a pivot: a left drag swings around it, a middle drag slides across, and the wheel moves in and out. The View button in the corner switches to an orthographic projection, looks from a side, and shades the preview as a wireframe, like the viewport's View popup.
The view only renders while a document draws the preview, it is turned off when the document's tab goes behind another one.
The render contexts register their compute subgraphs for the game's script only, so the preview's light and decal passes do nothing. The directional light is set per view, which is what lights the preview.