You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: building-a-renderer.md
+42-9Lines changed: 42 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,19 +12,26 @@ This data is sent to you through a series of `DrawCmd` instances.
12
12
13
13
```d
14
14
struct DrawCmd {
15
-
Texture[8] sources;
16
-
uint32_t state;
17
-
float opacity;
18
-
uint32_t blendMode;
19
-
uint32_t maskMode;
20
-
uint32_t vtxOffset;
21
-
uint32_t idxOffset;
22
-
uint32_t elemCount;
15
+
in_texture_t*[8] sources;
16
+
in_drawstate_t state;
17
+
in_blend_mode_t blendMode;
18
+
in_mask_mode_t maskMode;
19
+
uint32_t vtxOffset;
20
+
uint32_t idxOffset;
21
+
uint type;
22
+
void[64] vars;
23
23
}
24
24
```
25
25
26
26
Inochi2D is capable of providing these draw lists with the assumption that your renderer supports index/element data, and optionally, vertex offsets. If your API does not support vertex offsets, set `useBaseVertex` in the Draw List to `false`.
27
27
28
+
### Variables
29
+
30
+
Some nodes in Inochi2D provide further data needed to render the the node, these are provided in
31
+
`vars`, up to 64 bytes of variable space is allocated per draw command. Read the individual Node's
32
+
documentation for which variables are stored within. The `type` variable can be used to determine which
33
+
node type the data pertains to.
34
+
28
35
## DrawState
29
36
30
37
Inochi2D's rendering pipeline is rather complex, the framework supports masking and multi-layered compositing. As such, `DrawState` supplies flags for you to determine how to handle individual commands.
@@ -44,4 +51,30 @@ Inochi2D's rendering pipeline is rather complex, the framework supports masking
44
51
You can then during `maskedDraw` add this texture to your pass, multiply `rgba` with `rrrr` from the mask texture.
45
52
* On the transition from `maskedDraw` to `normal`, if you are not using unique shaders for `normal` you may want to clear the mask texture with all `0xFF`.
46
53
*`compositeEnd`**may** be followed by `defineMask`, ensure that `compsiteBlit` is able to use the defined mask.
47
-
*`compositeBlit`*should* be implemented by drawing a viewport-filling quad, an NDC mesh is provided for you in this DrawState to make it easier.
54
+
*`compositeBlit`*should* be implemented by drawing a viewport-filling quad, an NDC mesh is provided for you in this DrawState to make it easier.
55
+
56
+
## Registered Types
57
+
58
+
Following is a list of all currently registered types, all types have a 32 bit type ID,
59
+
with `0x00000000` to `0x0000FFFF` being reserved by Inochi2D.
60
+
61
+
Following is a table of all the base node types of Inochi2D.
62
+
63
+
| ID | Name |
64
+
| ---------: | :-------------- |
65
+
| 0x00000000 | Node |
66
+
| 0x00000001 | Drawable |
67
+
| 0x00000101 | Part |
68
+
| 0x00000201 | AnimatedPart |
69
+
| 0x00000002 | Deformer |
70
+
| 0x00000102 | MeshGroup |
71
+
| 0x00000202 | LatticeDeformer |
72
+
| 0x00000003 | Driver |
73
+
| 0x00000103 | SimplePhysics |
74
+
| 0x00000004 | Composite |
75
+
76
+
All Inochi2D node types follow a numeric ID sequence of `0x0000SSBB` where
77
+
*`SS` is the subnode id
78
+
*`BB` is the supernode id
79
+
80
+
Part has ID 0x00000101, as it's type `01` (Part), derived from type `01` (Drawable)
0 commit comments