mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 12:58:00 +03:00
lua - add swizzling to vector types
This commit is contained in:
parent
91d37c16af
commit
19c0cebb27
3 changed files with 95 additions and 10 deletions
|
@ -94,6 +94,7 @@
|
|||
-- @type Vector2
|
||||
-- @field #number x
|
||||
-- @field #number y
|
||||
-- @field #string xy swizzle support, any combination of fields can be used to construct a new vector
|
||||
-- @usage
|
||||
-- v = util.vector2(3, 4)
|
||||
-- v.x, v.y -- 3.0, 4.0
|
||||
|
@ -108,6 +109,7 @@
|
|||
-- v1 - v2 -- vector subtraction
|
||||
-- v1 * x -- multiplication by a number
|
||||
-- v1 / x -- division by a number
|
||||
-- v1.xx, v1.xyx -- new vectors can be created with swizzles
|
||||
|
||||
---
|
||||
-- Creates a new 2D vector. Vectors are immutable and can not be changed after creation.
|
||||
|
@ -195,6 +197,7 @@
|
|||
-- @field #number x
|
||||
-- @field #number y
|
||||
-- @field #number z
|
||||
-- @field #string xyz swizzle support, any combination of fields can be used to construct a new vector
|
||||
-- @usage
|
||||
-- v = util.vector3(3, 4, 5)
|
||||
-- v.x, v.y, v.z -- 3.0, 4.0, 5.0
|
||||
|
@ -210,6 +213,7 @@
|
|||
-- v1 - v2 -- vector subtraction
|
||||
-- v1 * x -- multiplication by a number
|
||||
-- v1 / x -- division by a number
|
||||
-- v1.zyz, v1.yx -- new vectors can be created with swizzles
|
||||
|
||||
---
|
||||
-- Creates a new 3D vector. Vectors are immutable and can not be changed after creation.
|
||||
|
@ -304,19 +308,21 @@
|
|||
-- @field #number y
|
||||
-- @field #number z
|
||||
-- @field #number w
|
||||
-- @field #string xyzw swizzle support, any combination of fields can be used to construct a new vector
|
||||
-- @usage
|
||||
-- v = util.vector4(3, 4, 5, 6)
|
||||
-- v.x, v.y, v.z, v.w -- 3.0, 4.0, 5.0, 6.0
|
||||
-- str(v) -- "(3.0, 4.0, 5.0, 6.0)"
|
||||
-- v:length() -- length
|
||||
-- v:length2() -- square of the length
|
||||
-- v:normalize() -- normalized vector
|
||||
-- v1:dot(v2) -- dot product (returns a number)
|
||||
-- v1 * v2 -- dot product (returns a number)
|
||||
-- v1 + v2 -- vector addition
|
||||
-- v1 - v2 -- vector subtraction
|
||||
-- v1 * x -- multiplication by a number
|
||||
-- v1 / x -- division by a number
|
||||
-- str(v) -- "(3.0, 4.0, 5.0, 6.0)"
|
||||
-- v:length() -- length
|
||||
-- v:length2() -- square of the length
|
||||
-- v:normalize() -- normalized vector
|
||||
-- v1:dot(v2) -- dot product (returns a number)
|
||||
-- v1 * v2 -- dot product (returns a number)
|
||||
-- v1 + v2 -- vector addition
|
||||
-- v1 - v2 -- vector subtraction
|
||||
-- v1 * x -- multiplication by a number
|
||||
-- v1 / x -- division by a number
|
||||
-- v1.zzzz, v1.zyz -- new vectors can be created with swizzles
|
||||
|
||||
---
|
||||
-- Creates a new 4D vector. Vectors are immutable and can not be changed after creation.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue