https://github.com/KorolevSoftware/defold-faststream
This library help fast push vector vector 3, vector 4, to buffer stream
https://github.com/KorolevSoftware/defold-faststream
buffer defold extension
Last synced: about 2 months ago
JSON representation
This library help fast push vector vector 3, vector 4, to buffer stream
- Host: GitHub
- URL: https://github.com/KorolevSoftware/defold-faststream
- Owner: KorolevSoftware
- License: apache-2.0
- Created: 2023-01-30T09:39:20.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-15T09:55:20.000Z (over 2 years ago)
- Last Synced: 2024-10-17T13:54:04.763Z (about 1 year ago)
- Topics: buffer, defold, extension
- Language: C++
- Homepage:
- Size: 8.09 MB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-defold - Fast Stream
README

# FastStream Defold Extension
FastStream is a Defold extension that provides efficient buffer stream operations for handling vector data.
## API Reference
### Functions
#### `faststream.set_table_raw(stream, table)`
Sets multiple vector values from a table to the buffer stream without converting values to stream type. The table should contain either Vector3 or Vector4 values.
**Parameters:**
- `stream` (userdata) - The buffer stream to modify
- `table` (table) - Table containing Vector3 or Vector4 values to set
#### `faststream.set_table_universal(stream, table)`
Sets multiple values from a table to the buffer stream. Supports Vector3, Vector4, or number values.
**Parameters:**
- `stream` (userdata) - The buffer stream to modify
- `table` (table) - Table containing Vector3, Vector4, or number values to set
#### `faststream.set_vector2(stream, index, vector)`
Sets a Vector3 value at the specified index in the buffer stream.
**Parameters:**
- `stream` (userdata) - The buffer stream to modify
- `index` (number) - The 1-based index where to set the vector
- `vector` (vector3) - The Vector3 value to set (x,y components will be used)
#### `faststream.set_vector3(stream, index, vector)`
Sets a Vector3 value at the specified index in the buffer stream.
**Parameters:**
- `stream` (userdata) - The buffer stream to modify
- `index` (number) - The 1-based index where to set the vector
- `vector` (vector3) - The Vector3 value to set
#### `faststream.set_vector4(stream, index, vector)`
Sets a Vector4 value at the specified index in the buffer stream.
**Parameters:**
- `stream` (userdata) - The buffer stream to modify
- `index` (number) - The 1-based index where to set the vector
- `vector` (vector4) - The Vector4 value to set
## Usage Examples
```lua
-- Set a single Vector3 value
local stream = ... -- your buffer stream, like buffer.get_stream(buf, "position")
local vector = vmath.vector3(1, 2, 3)
faststream.set_vector3(stream, 1, vector)
-- Set multiple values using a table
local values = {
vmath.vector3(1, 2, 3),
vmath.vector3(4, 5, 6),
vmath.vector3(7, 8, 9)
}
faststream.set_table_universal(stream, values)
-- Set raw vector values without conversion
local raw_values = {
vmath.vector4(1, 2, 3, 4),
vmath.vector4(5, 6, 7, 8)
}
faststream.set_table_raw(stream, raw_values)
```