|
| 1 | +# Concept Reference |
| 2 | + |
| 3 | +The Flywheel API has a few key differences from vanilla rendering that are important to understand. |
| 4 | + |
| 5 | +This page serves as a reference for concepts unique to Flywheel. |
| 6 | + |
| 7 | +[[toc]] |
| 8 | + |
| 9 | +## Game Objects |
| 10 | + |
| 11 | +A game object is an Entity, BlockEntity, or Effect in the level. This is not a unique concept to Flywheel, but Flywheel |
| 12 | +provides a unified rendering path for all game objects. |
| 13 | + |
| 14 | +### Effects |
| 15 | + |
| 16 | +An effect is a "free" game object. It is a concept unique to Flywheel and as such does not exist on the server. |
| 17 | +Effects allow users of Flywheel to access the Flywheel rendering system without needing to depend on a BlockEntity or |
| 18 | +Entity. The caveat is that the implementor of an Effect is responsible for managing its own lifecycle and |
| 19 | +client/server synchronization. |
| 20 | + |
| 21 | +## Visuals |
| 22 | + |
| 23 | +Visuals are the analog to Renderers in vanilla Minecraft. Each Entity/BlockEntity/Effect that is rendered will have a |
| 24 | +corresponding Visual. This way, Visuals can maintain state independent of the client representation of the game object, |
| 25 | +and update in parallel to other Visuals of the same type. |
| 26 | + |
| 27 | +Statefulness and parallelism are the core motivation behind this abstraction. |
| 28 | + |
| 29 | +## Instances |
| 30 | + |
| 31 | +An Instance is a single renderable object that is uploaded to the GPU. Visuals create, update, and delete Instances. |
| 32 | + |
| 33 | +Instances are stateful. If an Instance is not updated, it will continue to be rendered in its existing configuration, |
| 34 | +without being re-uploaded to the GPU. This allows for significant performance improvements and CPU->GPU bandwidth |
| 35 | +savings when Instances do not move (e.g. in the case of BlockEntities), or when the animation can be expressed in the |
| 36 | +instance shader. |
| 37 | + |
| 38 | +Users of Flywheel are encouraged to only update Instances when necessary. |
| 39 | + |
| 40 | +## Render Origin |
| 41 | + |
| 42 | +The render origin is an integer coordinate in world space which serves as the origin for rendering. |
| 43 | + |
| 44 | +This is different from vanilla entity/block entity rendering which uses the camera position as the origin. |
| 45 | +Such an approach is not viable for Flywheel, as that would require every instance to update every frame. Instead, |
| 46 | +Flywheel maintains a render origin that is nearby, but not necessarily exactly at, the camera position. As the camera |
| 47 | +moves in the level Flywheel will update the render origin once it gets too far away. All instances are deleted and all |
| 48 | +visuals are recreated when the render origin updates. |
0 commit comments