| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- function Quaternion(w,x,y,z) {
- if(arguments[0] != "__skip_ptr__") {
- this.__ptr = Polycode.Quaternion(w,x,y,z)
- }
- Object.defineProperties(this, {
- 'x': { enumerable: true, configurable: true, get: Quaternion.prototype.__get_x, set: Quaternion.prototype.__set_x},
- 'y': { enumerable: true, configurable: true, get: Quaternion.prototype.__get_y, set: Quaternion.prototype.__set_y},
- 'z': { enumerable: true, configurable: true, get: Quaternion.prototype.__get_z, set: Quaternion.prototype.__set_z},
- 'w': { enumerable: true, configurable: true, get: Quaternion.prototype.__get_w, set: Quaternion.prototype.__set_w}
- })
- }
- Quaternion.prototype.__get_x = function() {
- return Polycode.Quaternion__get_x(this.__ptr)
- }
- Quaternion.prototype.__set_x = function(val) {
- Polycode.Quaternion__set_x(this.__ptr, val)
- }
- Quaternion.prototype.__get_y = function() {
- return Polycode.Quaternion__get_y(this.__ptr)
- }
- Quaternion.prototype.__set_y = function(val) {
- Polycode.Quaternion__set_y(this.__ptr, val)
- }
- Quaternion.prototype.__get_z = function() {
- return Polycode.Quaternion__get_z(this.__ptr)
- }
- Quaternion.prototype.__set_z = function(val) {
- Polycode.Quaternion__set_z(this.__ptr, val)
- }
- Quaternion.prototype.__get_w = function() {
- return Polycode.Quaternion__get_w(this.__ptr)
- }
- Quaternion.prototype.__set_w = function(val) {
- Polycode.Quaternion__set_w(this.__ptr, val)
- }
- Duktape.fin(Quaternion.prototype, function (x) {
- if (x === Quaternion.prototype) {
- return;
- }
- Polycode.Quaternion__delete(x.__ptr)
- })
- Quaternion.prototype.setFromMatrix = function(_mat) {
- Polycode.Quaternion_setFromMatrix(this.__ptr, _mat)
- }
- Quaternion.prototype.Slerp = function(fT,rkP,rkQ,shortestPath) {
- var retVal = new Quaternion("__skip_ptr__")
- retVal.__ptr = Polycode.Quaternion_Slerp(fT, rkP, rkQ, shortestPath)
- return retVal
- }
- Quaternion.prototype.Dot = function(rkQ) {
- return Polycode.Quaternion_Dot(this.__ptr, rkQ)
- }
- Quaternion.prototype.Log = function() {
- var retVal = new Quaternion("__skip_ptr__")
- retVal.__ptr = Polycode.Quaternion_Log(this.__ptr)
- return retVal
- }
- Quaternion.prototype.Exp = function() {
- var retVal = new Quaternion("__skip_ptr__")
- retVal.__ptr = Polycode.Quaternion_Exp(this.__ptr)
- return retVal
- }
- Quaternion.prototype.Norm = function() {
- return Polycode.Quaternion_Norm(this.__ptr)
- }
- Quaternion.prototype.Normalize = function() {
- return Polycode.Quaternion_Normalize(this.__ptr)
- }
- Quaternion.prototype.lookAt = function(D,upVector) {
- Polycode.Quaternion_lookAt(this.__ptr, D, upVector)
- }
- Quaternion.prototype.createFromMatrix = function(matrix) {
- Polycode.Quaternion_createFromMatrix(this.__ptr, matrix)
- }
- Quaternion.prototype.Squad = function(fT,rkP,rkA,rkB,rkQ,shortestPath) {
- var retVal = new Quaternion("__skip_ptr__")
- retVal.__ptr = Polycode.Quaternion_Squad(fT, rkP, rkA, rkB, rkQ, shortestPath)
- return retVal
- }
- Quaternion.prototype.Inverse = function() {
- var retVal = new Quaternion("__skip_ptr__")
- retVal.__ptr = Polycode.Quaternion_Inverse(this.__ptr)
- return retVal
- }
- Quaternion.prototype.set = function(w,x,y,z) {
- Polycode.Quaternion_set(this.__ptr, w, x, y, z)
- }
- Quaternion.prototype.InvSqrt = function(x) {
- return Polycode.Quaternion_InvSqrt(this.__ptr, x)
- }
- Quaternion.prototype.fromAxes = function(az,ay,ax) {
- Polycode.Quaternion_fromAxes(this.__ptr, az, ay, ax)
- }
- Quaternion.prototype.fromAngleAxis = function(rfAngle,rkAxis) {
- Polycode.Quaternion_fromAngleAxis(this.__ptr, rfAngle, rkAxis)
- }
- Quaternion.prototype.toEulerAngles = function() {
- var retVal = new Vector3("__skip_ptr__")
- retVal.__ptr = Polycode.Quaternion_toEulerAngles(this.__ptr)
- return retVal
- }
- Quaternion.prototype.toAngleAxis = function(rfAngle,rkAxis) {
- Polycode.Quaternion_toAngleAxis(this.__ptr, rfAngle, rkAxis)
- }
- Quaternion.prototype.createFromAxisAngle = function(x,y,z,degrees) {
- Polycode.Quaternion_createFromAxisAngle(this.__ptr, x, y, z, degrees)
- }
- Quaternion.prototype.createMatrix = function() {
- var retVal = new Matrix4("__skip_ptr__")
- retVal.__ptr = Polycode.Quaternion_createMatrix(this.__ptr)
- return retVal
- }
- Quaternion.prototype.applyTo = function(v) {
- var retVal = new Vector3("__skip_ptr__")
- retVal.__ptr = Polycode.Quaternion_applyTo(this.__ptr, v)
- return retVal
- }
|