mirror of
https://github.com/luau-lang/rfcs.git
synced 2025-04-19 19:34:00 +01:00
remove ncg stuff, add buffer stuff
This commit is contained in:
parent
a98da0992d
commit
7de8372d80
1 changed files with 11 additions and 5 deletions
|
@ -30,7 +30,7 @@ Calculates the magnitude of a given vector.
|
|||
|
||||
`vector.normalized(vec: vector): vector`
|
||||
|
||||
Returns the normalized version (aka unit vector) of a given vector. If a zero vector is passed, return zero. For further clarification, `vector.normalized(vector(0, 0, 0))` should return zero.
|
||||
Returns the normalized version (aka unit vector) of a given vector.
|
||||
|
||||
`vector.cross(vecA: vector, vecB: vector): vector`
|
||||
|
||||
|
@ -84,14 +84,20 @@ Vector where `x=1, y=1, z=1, w?=1`.
|
|||
|
||||
---
|
||||
|
||||
### Buffer Library
|
||||
|
||||
`buffer.writevector(b: buffer, offset: number, vec: vector)`
|
||||
|
||||
Writes the vector into the buffer at the offset. Each component will be written as a f32. In four component mode, it will write all four components and write 16 bytes. In three component mode, it will write 12 bytes.
|
||||
|
||||
`buffer.readvector(b: buffer, offset: number): vector`
|
||||
|
||||
Reads a vector from the buffer at the offset. In four component mode it will read 16 bytes and in three component mode it will read 12 bytes.
|
||||
|
||||
### Arithmetic operations
|
||||
|
||||
Primitive operators for vectors are already implemented, so this RFC doesn't concern vector arithmetic.
|
||||
|
||||
### Native codegen
|
||||
|
||||
In the future, vectors will have special treatment in native codegen. This creates an expectation that the vector library will also have special treatment in codegen, but it isn't clear what that will look like, or if the performance benefits make sense.
|
||||
|
||||
### Compiler options
|
||||
|
||||
Currently, there are 2 compiler options relating to vectors, `vectorLib` & `vectorCtor`. This poses an interesting problem: a builtin library would remove the _requirement_ for such compiler options, however these options still need to be supported. The intuitive solution to this is to leave both compiler options working and maintained, but provide the built-in vector library by default, allowing two vector libraries and two vector constructors.
|
||||
|
|
Loading…
Add table
Reference in a new issue