Skip to content

Commit 23a73f7

Browse files
committed
What is all this
- Begin work on API concept reference page
1 parent 22acaaf commit 23a73f7

File tree

3 files changed

+52
-9
lines changed

3 files changed

+52
-9
lines changed

docs/.vitepress/config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// noinspection JSUnusedGlobalSymbols
22

3-
import { defineConfig } from "vitepress";
3+
import {defineConfig} from "vitepress";
44

55
// https://vitepress.dev/reference/site-config
66
export default defineConfig({
@@ -56,8 +56,9 @@ export default defineConfig({
5656
"/flywheel/api": [
5757
{
5858
text: "Flywheel API",
59+
link: "/flywheel/api/",
5960
items: [
60-
{ text: "Index", link: "/flywheel/api" },
61+
{text: "Concept Reference", link: "/flywheel/api/concepts"},
6162
{ text: "GLSL API", link: "/flywheel/api/glsl-api" },
6263
]
6364
},

docs/flywheel/api/concepts.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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.

docs/flywheel/api/index.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
---
2-
description: Documentation related to Flywheel's API.
3-
4-
next: false
5-
---
6-
7-
# API Docs {#api-docs}
1+
# Flywheel API
82

93
This section of the wiki has information that is useful for developers wanting to interact with Flywheel in any way.
104

0 commit comments

Comments
 (0)