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
The Sample Buffer Operator enables you to fetch and sample a structured buffer. A structured buffer is a [GraphicsBuffer](https://docs.unity3d.com/ScriptReference/GraphicsBuffer.html) created using the [Structured](https://docs.unity3d.com/ScriptReference/GraphicsBuffer.Target.Structured.html) target.
7
+
The Sample Graphics Buffer Operator enables you to fetch and sample a structured buffer. A structured buffer is a [GraphicsBuffer](https://docs.unity3d.com/ScriptReference/GraphicsBuffer.html) created using the [Structured](https://docs.unity3d.com/ScriptReference/GraphicsBuffer.Target.Structured.html) target.
8
8
9
9
## Operator settings
10
10
@@ -17,7 +17,7 @@ The Sample Buffer Operator enables you to fetch and sample a structured buffer.
|**Input**|[Configurable](#operator-configuration)| The structure type. |
20
-
|**Buffer**|GraphicsBuffer | The structured buffer to fetch. You can only connect an exposed property to this input port. |
20
+
|**Buffer**|Graphics Buffer [property](Properties.md)| The structured buffer to fetch. You can only connect an exposed property to this input port. |
21
21
|**Index**| uint | The index of the element to fetch. |
22
22
23
23
|**Output**|**Type**|**Description**|
@@ -26,33 +26,35 @@ The Sample Buffer Operator enables you to fetch and sample a structured buffer.
26
26
27
27
## Operator configuration
28
28
29
-
To view the Operator's configuration, click the **cog** icon in the Operator's header.
29
+
To set the struct type, select the cog icon. The available types are:
30
30
31
-
### Available types
32
-
This Operator supports sampling structured buffers that use blittable types. The list of built-in blittable types is:
33
-
- bool
34
-
- float*
35
-
- int
36
-
- uint
37
-
- Vector2
38
-
- Vector3
39
-
- Vector4
40
-
- Matrix4x4
31
+
- bool
32
+
- float
33
+
- int
34
+
- uint
35
+
- Vector2
36
+
- Vector3
37
+
- Vector4
38
+
- Matrix4x4
41
39
42
-
You can also declare custom types. To do this, add the `[VFXType]` attribute to a struct, and use the `VFXTypeAttribute.Usage.GraphicsBuffer` type. For example:
40
+
### Add a custom type
41
+
42
+
To add a custom type to the list, add the `[VFXType(VFXTypeAttribute.Usage.GraphicsBuffer)]` attribute to a struct. For example, the following script adds a **MyCustomData** type:
43
43
44
44
```c#
45
45
usingUnityEngine;
46
46
usingUnityEngine.VFX;
47
47
48
48
[VFXType(VFXTypeAttribute.Usage.GraphicsBuffer)]
49
-
structCustomData
49
+
structMyCustomData
50
50
{
51
-
publicVector3color;
52
-
publicVector3position;
51
+
publicVector3myColor;
52
+
publicVector3myPosition;
53
53
}
54
54
```
55
55
56
+
After you set a custom type, open the **s** dropdown to display the properties of the struct and connect them to other Operators and [Contexts](Contexts.md).
0 commit comments