Skip to content

Commit

Permalink
Added short doc about buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
britzl committed Feb 6, 2024
1 parent cd3e78d commit c65b97a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,10 @@
"path": "/manuals/atlas",
"name": "Atlas"
},
{
"path": "/manuals/buffer",
"name": "Buffer"
},
{
"path": "/manuals/font",
"name": "Font"
Expand Down
33 changes: 33 additions & 0 deletions docs/en/manuals/buffer.md
Original file line number Diff line number Diff line change
@@ -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).

0 comments on commit c65b97a

Please sign in to comment.