API Documentation
Static Public Member Functions | List of all members
nkAstraeus::nkMathsWrap::VectorWrapper Class Referencefinal

Wraps a nkMaths::Vector and offers functions for use in scripting. More...

Static Public Member Functions

static void updateEnvironment (nkScripts::Environment *env)
 
static void * constructor (const nkScripts::DataStack &stack)
 
static void destructor (void *toDestroy)
 
static nkScripts::OutputValue newVec2 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue newVec3 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue newVec4 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getX (void *vector)
 
static nkScripts::OutputValue getY (void *vector)
 
static nkScripts::OutputValue getZ (void *vector)
 
static nkScripts::OutputValue getW (void *vector)
 
static void setX (const nkScripts::DataStack &stack)
 
static void setY (const nkScripts::DataStack &stack)
 
static void setZ (const nkScripts::DataStack &stack)
 
static void setW (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getLengthVec2 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getLengthVec3 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getLengthVec4 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getLengthSquaredVec2 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getLengthSquaredVec3 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getLengthSquaredVec4 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getDistanceVec2 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getDistanceVec3 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getDistanceVec4 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getDistanceSquaredVec2 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getDistanceSquaredVec3 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getDistanceSquaredVec4 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue toString (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue normalizeVec2 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue normalizeVec3 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue normalizeVec4 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getNormalizedVec2 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getNormalizedVec3 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getNormalizedVec4 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue dotProductVec2 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue dotProductVec3 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue dotProductVec4 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue setAsCrossVec3 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue getCrossVec3 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue add (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue sub (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue mul (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue div (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue eq (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue distanceVec2 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue distanceVec3 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue distanceVec4 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue distanceSquaredVec2 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue distanceSquaredVec3 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue distanceSquaredVec4 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue dotVec2 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue dotVec3 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue dotVec4 (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue crossVec3 (const nkScripts::DataStack &stack)
 

Detailed Description

Wraps a nkMaths::Vector and offers functions for use in scripting.

Member Function Documentation

◆ updateEnvironment()

static void nkAstraeus::nkMathsWrap::VectorWrapper::updateEnvironment ( nkScripts::Environment env)
static

Updates a given environment and set it up to use all functions wrapped by this wrapper.

Parameters
envThe environment to set up.

◆ constructor()

static void* nkAstraeus::nkMathsWrap::VectorWrapper::constructor ( const nkScripts::DataStack stack)
static

Wrapper function for the constructor of the user type.

local t = nkMaths.Vector.new() ;
Parameters
stackThe parameter stack.
Returns
An output value with the user type and data allocated.

◆ destructor()

static void nkAstraeus::nkMathsWrap::VectorWrapper::destructor ( void *  toDestroy)
static

Wrapper function for the destructor of the user type.

Parameters
toDestroyThe data that has to be freed.

◆ newVec2()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::newVec2 ( const nkScripts::DataStack stack)
static

Wrapper function for the constructor of the user type. Will map to the vector 2 constructor.

local t = nkMaths.Vector.newVec2(x, y) ;
Parameters
stackThe parameter stack.
Returns
An output value with the user type and data allocated.

◆ newVec3()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::newVec3 ( const nkScripts::DataStack stack)
static

Wrapper function for the constructor of the user type. Will map to the vector 3 constructor.

local t = nkMaths.Vector.newVec3(x, y, z) ;
Parameters
stackThe parameter stack.
Returns
An output value with the user type and data allocated.

◆ newVec4()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::newVec4 ( const nkScripts::DataStack stack)
static

Wrapper function for the constructor of the user type. Will map to the vector 4 constructor.

local t = nkMaths.Vector.newVec4(x, y, z, w) ;
Parameters
stackThe parameter stack.
Returns
An output value with the user type and data allocated.

◆ getX()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getX ( void *  vector)
static

Wrapper function for the nkMaths::Vector::getX(), exposed as an attribute getter.

local d = v._x ;
Parameters
vectorThe data from which the attribute will be retrieved.
Returns
The attribute value, as a float.

◆ getY()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getY ( void *  vector)
static

Wrapper function for the nkMaths::Vector::getY(), exposed as an attribute getter.

local d = v._y ;
Parameters
vectorThe data from which the attribute will be retrieved.
Returns
The attribute value, as a float.

◆ getZ()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getZ ( void *  vector)
static

Wrapper function for the nkMaths::Vector::getZ(), exposed as an attribute getter.

local d = v._z ;
Parameters
vectorThe data from which the attribute will be retrieved.
Returns
The attribute value, as a float.

◆ getW()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getW ( void *  vector)
static

Wrapper function for the nkMaths::Vector::getW(), exposed as an attribute getter.

local d = v._w ;
Parameters
vectorThe data from which the attribute will be retrieved.
Returns
The attribute value, as a float.

◆ setX()

static void nkAstraeus::nkMathsWrap::VectorWrapper::setX ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::setX(), exposed as an attribute setter.

v._x = 0.2 ;
Parameters
stackThe parameter stack.
Returns
The output value, empty.

◆ setY()

static void nkAstraeus::nkMathsWrap::VectorWrapper::setY ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::setY(), exposed as an attribute setter.

v._y = 0.2 ;
Parameters
stackThe parameter stack.
Returns
The output value, empty.

◆ setZ()

static void nkAstraeus::nkMathsWrap::VectorWrapper::setZ ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::setZ(), exposed as an attribute setter.

v._z = 0.2 ;
Parameters
stackThe parameter stack.
Returns
The output value, empty.

◆ setW()

static void nkAstraeus::nkMathsWrap::VectorWrapper::setW ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::setW(), exposed as an attribute setter.

v._w = 0.2 ;
Parameters
stackThe parameter stack.
Returns
The output value, empty.

◆ getLengthVec2()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getLengthVec2 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getLengthVec2().

local l = v:getLengthVec2() ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ getLengthVec3()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getLengthVec3 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getLengthVec3().

local l = v:getLengthVec3() ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ getLengthVec4()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getLengthVec4 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getLengthVec4().

local l = v:getLengthVec4() ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ getLengthSquaredVec2()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getLengthSquaredVec2 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getLengthSquaredVec2().

local l = v:getLengthSquaredVec2() ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ getLengthSquaredVec3()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getLengthSquaredVec3 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getLengthSquaredVec3().

local l = v:getLengthSquaredVec3() ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ getLengthSquaredVec4()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getLengthSquaredVec4 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getLengthSquaredVec4().

local l = v:getLengthSquaredVec4() ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ getDistanceVec2()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getDistanceVec2 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getDistanceVec2().

local d = v:getDistanceVec2(p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ getDistanceVec3()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getDistanceVec3 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getDistanceVec3().

local d = v:getDistanceVec3(p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ getDistanceVec4()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getDistanceVec4 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getDistanceVec4().

local d = v:getDistanceVec4(p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ getDistanceSquaredVec2()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getDistanceSquaredVec2 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getDistanceSquaredVec2().

local d = v:getDistanceSquaredVec2(p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ getDistanceSquaredVec3()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getDistanceSquaredVec3 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getDistanceSquaredVec3().

local d = v:getDistanceSquaredVec3(p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ getDistanceSquaredVec4()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getDistanceSquaredVec4 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getDistanceSquaredVec4().

local d = v:getDistanceSquaredVec4(p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ toString()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::toString ( const nkScripts::DataStack stack)
static

Overrides the default string conversion function.

local s = tostring(v) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a string, in the format Vec(_x, _y, _z, _w).

◆ normalizeVec2()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::normalizeVec2 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::normalizeVec2().

Parameters
stackThe parameter stack.
Returns
The output value, empty.
Remarks
This function differs from the C++ variant in the fact that it does not return the vector as a reference. This helps in avoiding ownership issues for new references returned.

◆ normalizeVec3()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::normalizeVec3 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::normalizeVec3().

Parameters
stackThe parameter stack.
Returns
The output value, empty.
Remarks
This function differs from the C++ variant in the fact that it does not return the vector as a reference. This helps in avoiding ownership issues for new references returned.

◆ normalizeVec4()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::normalizeVec4 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::normalizeVec4().

Parameters
stackThe parameter stack.
Returns
The output value, empty.
Remarks
This function differs from the C++ variant in the fact that it does not return the vector as a reference. This helps in avoiding ownership issues for new references returned.

◆ getNormalizedVec2()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getNormalizedVec2 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getNormalizedVec2().

local vn = v:getNormalizedVec2() ;
Parameters
stackThe parameter stack.
Returns
The output value, as a nkMaths::Vector.

◆ getNormalizedVec3()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getNormalizedVec3 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getNormalizedVec3().

local vn = v:getNormalizedVec3() ;
Parameters
stackThe parameter stack.
Returns
The output value, as a nkMaths::Vector.

◆ getNormalizedVec4()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getNormalizedVec4 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getNormalizedVec4().

local vn = v:getNormalizedVec4() ;
Parameters
stackThe parameter stack.
Returns
The output value, as a nkMaths::Vector.

◆ dotProductVec2()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::dotProductVec2 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::dotProductVec2().

local dp = v0:dotProductVec2(v1) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ dotProductVec3()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::dotProductVec3 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::dotProductVec3().

local dp = v0:dotProductVec3(v1) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ dotProductVec4()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::dotProductVec4 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::dotProductVec4().

local dp = v0:dotProductVec4(v1) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ setAsCrossVec3()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::setAsCrossVec3 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::setAsCrossVec3().

Parameters
stackThe parameter stack.
Returns
The output value, empty.
Remarks
This function differs from the C++ variant in the fact that it does not return the vector as a reference. This helps in avoiding ownership issues for new references returned.

◆ getCrossVec3()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::getCrossVec3 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::getCrossVec3().

local c = v:getCrossVec3() ;
Parameters
stackThe parameter stack.
Returns
The output value, as a nkMaths::Vector.

◆ add()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::add ( const nkScripts::DataStack stack)
static

Overrides the default add operation for the user type.

local v = p + t ;
Parameters
stackThe parameter stack.
Returns
The output value, as a nkMaths::Vector.

◆ sub()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::sub ( const nkScripts::DataStack stack)
static

Overrides the default subtract operation for the user type.

local v = p - t ;
Parameters
stackThe parameter stack.
Returns
The output value, as a nkMaths::Vector.

◆ mul()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::mul ( const nkScripts::DataStack stack)
static

Overrides the default multiply operation for the user type.

local v = p * t ;
Parameters
stackThe parameter stack.
Returns
The output value, as a nkMaths::Vector.

◆ div()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::div ( const nkScripts::DataStack stack)
static

Overrides the default divide operation for the user type.

local v = p / t ;
Parameters
stackThe parameter stack.
Returns
The output value, as a nkMaths::Vector.

◆ eq()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::eq ( const nkScripts::DataStack stack)
static

Overrides the default equality operation for the user type.

local v = p == t ;
Parameters
stackThe parameter stack.
Returns
The output value, as a bool.

◆ distanceVec2()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::distanceVec2 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::distanceVec2().

local d = nkMaths.Vector.distanceVec2(v, p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ distanceVec3()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::distanceVec3 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::distanceVec3().

local d = nkMaths.Vector.distanceVec3(v, p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ distanceVec4()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::distanceVec4 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::distanceVec4().

local d = nkMaths.Vector.distanceVec4(v, p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ distanceSquaredVec2()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::distanceSquaredVec2 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::distanceSquaredVec2().

local d = nkMaths.Vector.distanceSquaredVec2(v, p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ distanceSquaredVec3()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::distanceSquaredVec3 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::distanceSquaredVec3().

local d = nkMaths.Vector.distanceSquaredVec3(v, p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ distanceSquaredVec4()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::distanceSquaredVec4 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::distanceSquaredVec4().

local d = nkMaths.Vector.distanceSquaredVec4(v, p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ dotVec2()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::dotVec2 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::dotVec2().

local d = nkMaths.Vector.dotVec2(v, p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ dotVec3()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::dotVec3 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::dotVec3().

local d = nkMaths.Vector.dotVec3(v, p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ dotVec4()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::dotVec4 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::dotVec4().

local d = nkMaths.Vector.dotVec4(v, p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a float.

◆ crossVec3()

static nkScripts::OutputValue nkAstraeus::nkMathsWrap::VectorWrapper::crossVec3 ( const nkScripts::DataStack stack)
static

Wrapper function for nkMaths::Vector::crossVec3().

local c = nkMaths.Vector.crossVec3(v, p) ;
Parameters
stackThe parameter stack.
Returns
The output value, as a nkMaths::Vector.

The documentation for this class was generated from the following file: