-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). |