Browse Source

Added short doc about buffers

Björn Ritzl 1 year ago
parent
commit
c65b97aafc
2 changed files with 37 additions and 0 deletions
  1. 4 0
      docs/en/en.json
  2. 33 0
      docs/en/manuals/buffer.md

+ 4 - 0
docs/en/en.json

@@ -745,6 +745,10 @@
                         "path": "/manuals/atlas",
                         "name": "Atlas"
                     },
+                    {
+                        "path": "/manuals/buffer",
+                        "name": "Buffer"
+                    },
                     {
                         "path": "/manuals/font",
                         "name": "Font"

+ 33 - 0
docs/en/manuals/buffer.md

@@ -0,0 +1,33 @@
+---
+title: Buffer manual
+brief: This manual explains how Buffer resources work in Defold.
+---
+
+# Buffer
+
+The Buffer resource is used to describe one or more streams of values, for instance positions or colours. Each stream has a name, data type, count and the data itself. Example:
+
+```
+[
+  {
+    "name": "position",
+    "type": "float32",
+    "count": 3,
+    "data": [
+      -1.0,
+      -1.0,
+      -1.0,
+      -1.0,
+      -1.0,
+      1.0,
+      ...
+    ]
+  }
+]
+```
+
+The above example describes a stream of positions in three dimensions, represented as 32-bit floating point numbers. The format of a Buffer file is JSON, with file extension `.buffer`.
+
+Buffer resources are typically created using external tools or scripts, for instance when exporting from modeling tools such as Blender. 
+
+A Buffer resource can be used as input to a [Mesh component](/manuals/mesh). Buffers resources can also be created at runtime using the `buffer.create()` and [related API functions](/ref/stable/buffer/#buffer.create:element_count-declaration).