@luma.gl/shadertools 9.0.6 → 9.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +75 -199
- package/dist/dist.min.js +8 -8
- package/dist/modules-webgl1/project/project.d.ts +1 -1
- package/dist/modules-webgl1/project/project.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/.DS_Store +0 -0
- package/src/lib/.DS_Store +0 -0
- package/src/modules/.DS_Store +0 -0
- package/src/modules-webgl1/project/project.ts +1 -1
- package/dist.min.js +0 -3758
package/dist/dist.dev.js
CHANGED
|
@@ -7845,11 +7845,17 @@ vec3 geometry_getNormal() {
|
|
|
7845
7845
|
printRowMajor: true,
|
|
7846
7846
|
_cartographicRadians: false
|
|
7847
7847
|
};
|
|
7848
|
-
globalThis.mathgl = globalThis.mathgl || {
|
|
7848
|
+
globalThis.mathgl = globalThis.mathgl || {
|
|
7849
|
+
config: {
|
|
7850
|
+
...DEFAULT_CONFIG
|
|
7851
|
+
}
|
|
7852
|
+
};
|
|
7849
7853
|
var config = globalThis.mathgl.config;
|
|
7850
|
-
function formatValue(value, {
|
|
7854
|
+
function formatValue(value, {
|
|
7855
|
+
precision = config.precision
|
|
7856
|
+
} = {}) {
|
|
7851
7857
|
value = round(value);
|
|
7852
|
-
return
|
|
7858
|
+
return "".concat(parseFloat(value.toPrecision(precision)));
|
|
7853
7859
|
}
|
|
7854
7860
|
function isArray(value) {
|
|
7855
7861
|
return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
@@ -7893,12 +7899,28 @@ vec3 geometry_getNormal() {
|
|
|
7893
7899
|
}
|
|
7894
7900
|
|
|
7895
7901
|
// ../../node_modules/@math.gl/core/dist/classes/base/math-array.js
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
+
function _extendableBuiltin(cls) {
|
|
7903
|
+
function ExtendableBuiltin() {
|
|
7904
|
+
var instance = Reflect.construct(cls, Array.from(arguments));
|
|
7905
|
+
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
|
|
7906
|
+
return instance;
|
|
7907
|
+
}
|
|
7908
|
+
ExtendableBuiltin.prototype = Object.create(cls.prototype, {
|
|
7909
|
+
constructor: {
|
|
7910
|
+
value: cls,
|
|
7911
|
+
enumerable: false,
|
|
7912
|
+
writable: true,
|
|
7913
|
+
configurable: true
|
|
7914
|
+
}
|
|
7915
|
+
});
|
|
7916
|
+
if (Object.setPrototypeOf) {
|
|
7917
|
+
Object.setPrototypeOf(ExtendableBuiltin, cls);
|
|
7918
|
+
} else {
|
|
7919
|
+
ExtendableBuiltin.__proto__ = cls;
|
|
7920
|
+
}
|
|
7921
|
+
return ExtendableBuiltin;
|
|
7922
|
+
}
|
|
7923
|
+
var MathArray = class extends _extendableBuiltin(Array) {
|
|
7902
7924
|
clone() {
|
|
7903
7925
|
return new this.constructor().copy(this);
|
|
7904
7926
|
}
|
|
@@ -7918,10 +7940,7 @@ vec3 geometry_getNormal() {
|
|
|
7918
7940
|
return targetObject;
|
|
7919
7941
|
}
|
|
7920
7942
|
from(arrayOrObject) {
|
|
7921
|
-
return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : (
|
|
7922
|
-
// @ts-ignore
|
|
7923
|
-
this.fromObject(arrayOrObject)
|
|
7924
|
-
);
|
|
7943
|
+
return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
|
|
7925
7944
|
}
|
|
7926
7945
|
to(arrayOrObject) {
|
|
7927
7946
|
if (arrayOrObject === this) {
|
|
@@ -7932,20 +7951,18 @@ vec3 geometry_getNormal() {
|
|
|
7932
7951
|
toTarget(target) {
|
|
7933
7952
|
return target ? this.to(target) : this;
|
|
7934
7953
|
}
|
|
7935
|
-
/** @deprecated */
|
|
7936
7954
|
toFloat32Array() {
|
|
7937
7955
|
return new Float32Array(this);
|
|
7938
7956
|
}
|
|
7939
7957
|
toString() {
|
|
7940
7958
|
return this.formatString(config);
|
|
7941
7959
|
}
|
|
7942
|
-
/** Formats string according to options */
|
|
7943
7960
|
formatString(opts) {
|
|
7944
7961
|
let string = "";
|
|
7945
7962
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
7946
7963
|
string += (i > 0 ? ", " : "") + formatValue(this[i], opts);
|
|
7947
7964
|
}
|
|
7948
|
-
return
|
|
7965
|
+
return "".concat(opts.printTypes ? this.constructor.name : "", "[").concat(string, "]");
|
|
7949
7966
|
}
|
|
7950
7967
|
equals(array) {
|
|
7951
7968
|
if (!array || this.length !== array.length) {
|
|
@@ -7969,8 +7986,6 @@ vec3 geometry_getNormal() {
|
|
|
7969
7986
|
}
|
|
7970
7987
|
return true;
|
|
7971
7988
|
}
|
|
7972
|
-
// Modifiers
|
|
7973
|
-
/** Negates all values in this object */
|
|
7974
7989
|
negate() {
|
|
7975
7990
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
7976
7991
|
this[i] = -this[i];
|
|
@@ -7988,14 +8003,12 @@ vec3 geometry_getNormal() {
|
|
|
7988
8003
|
}
|
|
7989
8004
|
return this.check();
|
|
7990
8005
|
}
|
|
7991
|
-
/** Minimal */
|
|
7992
8006
|
min(vector) {
|
|
7993
8007
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
7994
8008
|
this[i] = Math.min(vector[i], this[i]);
|
|
7995
8009
|
}
|
|
7996
8010
|
return this.check();
|
|
7997
8011
|
}
|
|
7998
|
-
/** Maximal */
|
|
7999
8012
|
max(vector) {
|
|
8000
8013
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
8001
8014
|
this[i] = Math.max(vector[i], this[i]);
|
|
@@ -8036,25 +8049,18 @@ vec3 geometry_getNormal() {
|
|
|
8036
8049
|
}
|
|
8037
8050
|
return this.check();
|
|
8038
8051
|
}
|
|
8039
|
-
/**
|
|
8040
|
-
* Multiplies all elements by `scale`
|
|
8041
|
-
* Note: `Matrix4.multiplyByScalar` only scales its 3x3 "minor"
|
|
8042
|
-
*/
|
|
8043
8052
|
multiplyByScalar(scalar) {
|
|
8044
8053
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
8045
8054
|
this[i] *= scalar;
|
|
8046
8055
|
}
|
|
8047
8056
|
return this.check();
|
|
8048
8057
|
}
|
|
8049
|
-
// Debug checks
|
|
8050
|
-
/** Throws an error if array length is incorrect or contains illegal values */
|
|
8051
8058
|
check() {
|
|
8052
8059
|
if (config.debug && !this.validate()) {
|
|
8053
|
-
throw new Error(
|
|
8060
|
+
throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
|
|
8054
8061
|
}
|
|
8055
8062
|
return this;
|
|
8056
8063
|
}
|
|
8057
|
-
/** Returns false if the array length is incorrect or contains illegal values */
|
|
8058
8064
|
validate() {
|
|
8059
8065
|
let valid = this.length === this.ELEMENTS;
|
|
8060
8066
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
@@ -8062,48 +8068,39 @@ vec3 geometry_getNormal() {
|
|
|
8062
8068
|
}
|
|
8063
8069
|
return valid;
|
|
8064
8070
|
}
|
|
8065
|
-
// three.js compatibility
|
|
8066
|
-
/** @deprecated */
|
|
8067
8071
|
sub(a) {
|
|
8068
8072
|
return this.subtract(a);
|
|
8069
8073
|
}
|
|
8070
|
-
/** @deprecated */
|
|
8071
8074
|
setScalar(a) {
|
|
8072
8075
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
8073
8076
|
this[i] = a;
|
|
8074
8077
|
}
|
|
8075
8078
|
return this.check();
|
|
8076
8079
|
}
|
|
8077
|
-
/** @deprecated */
|
|
8078
8080
|
addScalar(a) {
|
|
8079
8081
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
8080
8082
|
this[i] += a;
|
|
8081
8083
|
}
|
|
8082
8084
|
return this.check();
|
|
8083
8085
|
}
|
|
8084
|
-
/** @deprecated */
|
|
8085
8086
|
subScalar(a) {
|
|
8086
8087
|
return this.addScalar(-a);
|
|
8087
8088
|
}
|
|
8088
|
-
/** @deprecated */
|
|
8089
8089
|
multiplyScalar(scalar) {
|
|
8090
8090
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
8091
8091
|
this[i] *= scalar;
|
|
8092
8092
|
}
|
|
8093
8093
|
return this.check();
|
|
8094
8094
|
}
|
|
8095
|
-
/** @deprecated */
|
|
8096
8095
|
divideScalar(a) {
|
|
8097
8096
|
return this.multiplyByScalar(1 / a);
|
|
8098
8097
|
}
|
|
8099
|
-
/** @deprecated */
|
|
8100
8098
|
clampScalar(min, max) {
|
|
8101
8099
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
8102
8100
|
this[i] = Math.min(Math.max(this[i], min), max);
|
|
8103
8101
|
}
|
|
8104
8102
|
return this.check();
|
|
8105
8103
|
}
|
|
8106
|
-
/** @deprecated */
|
|
8107
8104
|
get elements() {
|
|
8108
8105
|
return this;
|
|
8109
8106
|
}
|
|
@@ -8123,13 +8120,13 @@ vec3 geometry_getNormal() {
|
|
|
8123
8120
|
}
|
|
8124
8121
|
function checkNumber(value) {
|
|
8125
8122
|
if (!Number.isFinite(value)) {
|
|
8126
|
-
throw new Error(
|
|
8123
|
+
throw new Error("Invalid number ".concat(JSON.stringify(value)));
|
|
8127
8124
|
}
|
|
8128
8125
|
return value;
|
|
8129
8126
|
}
|
|
8130
8127
|
function checkVector(v, length, callerName = "") {
|
|
8131
8128
|
if (config.debug && !validateVector(v, length)) {
|
|
8132
|
-
throw new Error(
|
|
8129
|
+
throw new Error("math.gl: ".concat(callerName, " some fields set to invalid numbers'"));
|
|
8133
8130
|
}
|
|
8134
8131
|
return v;
|
|
8135
8132
|
}
|
|
@@ -8254,29 +8251,19 @@ vec3 geometry_getNormal() {
|
|
|
8254
8251
|
|
|
8255
8252
|
// ../../node_modules/@math.gl/core/dist/classes/base/matrix.js
|
|
8256
8253
|
var Matrix = class extends MathArray {
|
|
8257
|
-
// fromObject(object) {
|
|
8258
|
-
// const array = object.elements;
|
|
8259
|
-
// return this.fromRowMajor(array);
|
|
8260
|
-
// }
|
|
8261
|
-
// toObject(object) {
|
|
8262
|
-
// const array = object.elements;
|
|
8263
|
-
// this.toRowMajor(array);
|
|
8264
|
-
// return object;
|
|
8265
|
-
// }
|
|
8266
|
-
// TODO better override formatString?
|
|
8267
8254
|
toString() {
|
|
8268
8255
|
let string = "[";
|
|
8269
8256
|
if (config.printRowMajor) {
|
|
8270
8257
|
string += "row-major:";
|
|
8271
8258
|
for (let row = 0; row < this.RANK; ++row) {
|
|
8272
8259
|
for (let col = 0; col < this.RANK; ++col) {
|
|
8273
|
-
string +=
|
|
8260
|
+
string += " ".concat(this[col * this.RANK + row]);
|
|
8274
8261
|
}
|
|
8275
8262
|
}
|
|
8276
8263
|
} else {
|
|
8277
8264
|
string += "column-major:";
|
|
8278
8265
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
8279
|
-
string +=
|
|
8266
|
+
string += " ".concat(this[i]);
|
|
8280
8267
|
}
|
|
8281
8268
|
}
|
|
8282
8269
|
string += "]";
|
|
@@ -8285,11 +8272,9 @@ vec3 geometry_getNormal() {
|
|
|
8285
8272
|
getElementIndex(row, col) {
|
|
8286
8273
|
return col * this.RANK + row;
|
|
8287
8274
|
}
|
|
8288
|
-
// By default assumes row major indices
|
|
8289
8275
|
getElement(row, col) {
|
|
8290
8276
|
return this[col * this.RANK + row];
|
|
8291
8277
|
}
|
|
8292
|
-
// By default assumes row major indices
|
|
8293
8278
|
setElement(row, col, value) {
|
|
8294
8279
|
this[col * this.RANK + row] = checkNumber(value);
|
|
8295
8280
|
return this;
|
|
@@ -9055,7 +9040,6 @@ vec3 geometry_getNormal() {
|
|
|
9055
9040
|
this[15] = array[15];
|
|
9056
9041
|
return this.check();
|
|
9057
9042
|
}
|
|
9058
|
-
// eslint-disable-next-line max-params
|
|
9059
9043
|
set(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33) {
|
|
9060
9044
|
this[0] = m00;
|
|
9061
9045
|
this[1] = m10;
|
|
@@ -9075,8 +9059,6 @@ vec3 geometry_getNormal() {
|
|
|
9075
9059
|
this[15] = m33;
|
|
9076
9060
|
return this.check();
|
|
9077
9061
|
}
|
|
9078
|
-
// accepts row major order, stores as column major
|
|
9079
|
-
// eslint-disable-next-line max-params
|
|
9080
9062
|
setRowMajor(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
|
|
9081
9063
|
this[0] = m00;
|
|
9082
9064
|
this[1] = m10;
|
|
@@ -9115,41 +9097,25 @@ vec3 geometry_getNormal() {
|
|
|
9115
9097
|
result[15] = this[15];
|
|
9116
9098
|
return result;
|
|
9117
9099
|
}
|
|
9118
|
-
// Constructors
|
|
9119
|
-
/** Set to identity matrix */
|
|
9120
9100
|
identity() {
|
|
9121
9101
|
return this.copy(IDENTITY_MATRIX);
|
|
9122
9102
|
}
|
|
9123
|
-
/**
|
|
9124
|
-
*
|
|
9125
|
-
* @param object
|
|
9126
|
-
* @returns self
|
|
9127
|
-
*/
|
|
9128
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9129
9103
|
fromObject(object) {
|
|
9130
9104
|
return this.check();
|
|
9131
9105
|
}
|
|
9132
|
-
/**
|
|
9133
|
-
* Calculates a 4x4 matrix from the given quaternion
|
|
9134
|
-
* @param quaternion Quaternion to create matrix from
|
|
9135
|
-
* @returns self
|
|
9136
|
-
*/
|
|
9137
9106
|
fromQuaternion(quaternion) {
|
|
9138
9107
|
fromQuat(this, quaternion);
|
|
9139
9108
|
return this.check();
|
|
9140
9109
|
}
|
|
9141
|
-
/**
|
|
9142
|
-
* Generates a frustum matrix with the given bounds
|
|
9143
|
-
* @param view.left - Left bound of the frustum
|
|
9144
|
-
* @param view.right - Right bound of the frustum
|
|
9145
|
-
* @param view.bottom - Bottom bound of the frustum
|
|
9146
|
-
* @param view.top - Top bound of the frustum
|
|
9147
|
-
* @param view.near - Near bound of the frustum
|
|
9148
|
-
* @param view.far - Far bound of the frustum. Can be set to Infinity.
|
|
9149
|
-
* @returns self
|
|
9150
|
-
*/
|
|
9151
9110
|
frustum(view) {
|
|
9152
|
-
const {
|
|
9111
|
+
const {
|
|
9112
|
+
left,
|
|
9113
|
+
right,
|
|
9114
|
+
bottom,
|
|
9115
|
+
top,
|
|
9116
|
+
near = DEFAULT_NEAR,
|
|
9117
|
+
far = DEFAULT_FAR
|
|
9118
|
+
} = view;
|
|
9153
9119
|
if (far === Infinity) {
|
|
9154
9120
|
computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
|
|
9155
9121
|
} else {
|
|
@@ -9157,47 +9123,35 @@ vec3 geometry_getNormal() {
|
|
|
9157
9123
|
}
|
|
9158
9124
|
return this.check();
|
|
9159
9125
|
}
|
|
9160
|
-
/**
|
|
9161
|
-
* Generates a look-at matrix with the given eye position, focal point,
|
|
9162
|
-
* and up axis
|
|
9163
|
-
* @param view.eye - (vector) Position of the viewer
|
|
9164
|
-
* @param view.center - (vector) Point the viewer is looking at
|
|
9165
|
-
* @param view.up - (vector) Up axis
|
|
9166
|
-
* @returns self
|
|
9167
|
-
*/
|
|
9168
9126
|
lookAt(view) {
|
|
9169
|
-
const {
|
|
9127
|
+
const {
|
|
9128
|
+
eye,
|
|
9129
|
+
center = [0, 0, 0],
|
|
9130
|
+
up = [0, 1, 0]
|
|
9131
|
+
} = view;
|
|
9170
9132
|
lookAt(this, eye, center, up);
|
|
9171
9133
|
return this.check();
|
|
9172
9134
|
}
|
|
9173
|
-
/**
|
|
9174
|
-
* Generates a orthogonal projection matrix with the given bounds
|
|
9175
|
-
* from "traditional" view space parameters
|
|
9176
|
-
* @param view.left - Left bound of the frustum
|
|
9177
|
-
* @param view.right number Right bound of the frustum
|
|
9178
|
-
* @param view.bottom - Bottom bound of the frustum
|
|
9179
|
-
* @param view.top number Top bound of the frustum
|
|
9180
|
-
* @param view.near - Near bound of the frustum
|
|
9181
|
-
* @param view.far number Far bound of the frustum
|
|
9182
|
-
* @returns self
|
|
9183
|
-
*/
|
|
9184
9135
|
ortho(view) {
|
|
9185
|
-
const {
|
|
9136
|
+
const {
|
|
9137
|
+
left,
|
|
9138
|
+
right,
|
|
9139
|
+
bottom,
|
|
9140
|
+
top,
|
|
9141
|
+
near = DEFAULT_NEAR,
|
|
9142
|
+
far = DEFAULT_FAR
|
|
9143
|
+
} = view;
|
|
9186
9144
|
ortho(this, left, right, bottom, top, near, far);
|
|
9187
9145
|
return this.check();
|
|
9188
9146
|
}
|
|
9189
|
-
/**
|
|
9190
|
-
* Generates an orthogonal projection matrix with the same parameters
|
|
9191
|
-
* as a perspective matrix (plus focalDistance)
|
|
9192
|
-
* @param view.fovy Vertical field of view in radians
|
|
9193
|
-
* @param view.aspect Aspect ratio. Typically viewport width / viewport height
|
|
9194
|
-
* @param view.focalDistance Distance in the view frustum used for extent calculations
|
|
9195
|
-
* @param view.near Near bound of the frustum
|
|
9196
|
-
* @param view.far Far bound of the frustum
|
|
9197
|
-
* @returns self
|
|
9198
|
-
*/
|
|
9199
9147
|
orthographic(view) {
|
|
9200
|
-
const {
|
|
9148
|
+
const {
|
|
9149
|
+
fovy = DEFAULT_FOVY,
|
|
9150
|
+
aspect = DEFAULT_ASPECT,
|
|
9151
|
+
focalDistance = 1,
|
|
9152
|
+
near = DEFAULT_NEAR,
|
|
9153
|
+
far = DEFAULT_FAR
|
|
9154
|
+
} = view;
|
|
9201
9155
|
checkRadians(fovy);
|
|
9202
9156
|
const halfY = fovy / 2;
|
|
9203
9157
|
const top = focalDistance * Math.tan(halfY);
|
|
@@ -9211,53 +9165,32 @@ vec3 geometry_getNormal() {
|
|
|
9211
9165
|
far
|
|
9212
9166
|
});
|
|
9213
9167
|
}
|
|
9214
|
-
/**
|
|
9215
|
-
* Generates a perspective projection matrix with the given bounds
|
|
9216
|
-
* @param view.fovy Vertical field of view in radians
|
|
9217
|
-
* @param view.aspect Aspect ratio. typically viewport width/height
|
|
9218
|
-
* @param view.near Near bound of the frustum
|
|
9219
|
-
* @param view.far Far bound of the frustum
|
|
9220
|
-
* @returns self
|
|
9221
|
-
*/
|
|
9222
9168
|
perspective(view) {
|
|
9223
|
-
const {
|
|
9169
|
+
const {
|
|
9170
|
+
fovy = 45 * Math.PI / 180,
|
|
9171
|
+
aspect = 1,
|
|
9172
|
+
near = 0.1,
|
|
9173
|
+
far = 500
|
|
9174
|
+
} = view;
|
|
9224
9175
|
checkRadians(fovy);
|
|
9225
9176
|
perspective(this, fovy, aspect, near, far);
|
|
9226
9177
|
return this.check();
|
|
9227
9178
|
}
|
|
9228
|
-
// Accessors
|
|
9229
9179
|
determinant() {
|
|
9230
9180
|
return determinant(this);
|
|
9231
9181
|
}
|
|
9232
|
-
/**
|
|
9233
|
-
* Extracts the non-uniform scale assuming the matrix is an affine transformation.
|
|
9234
|
-
* The scales are the "lengths" of the column vectors in the upper-left 3x3 matrix.
|
|
9235
|
-
* @param result
|
|
9236
|
-
* @returns self
|
|
9237
|
-
*/
|
|
9238
9182
|
getScale(result = [-0, -0, -0]) {
|
|
9239
9183
|
result[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]);
|
|
9240
9184
|
result[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]);
|
|
9241
9185
|
result[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]);
|
|
9242
9186
|
return result;
|
|
9243
9187
|
}
|
|
9244
|
-
/**
|
|
9245
|
-
* Gets the translation portion, assuming the matrix is a affine transformation matrix.
|
|
9246
|
-
* @param result
|
|
9247
|
-
* @returns self
|
|
9248
|
-
*/
|
|
9249
9188
|
getTranslation(result = [-0, -0, -0]) {
|
|
9250
9189
|
result[0] = this[12];
|
|
9251
9190
|
result[1] = this[13];
|
|
9252
9191
|
result[2] = this[14];
|
|
9253
9192
|
return result;
|
|
9254
9193
|
}
|
|
9255
|
-
/**
|
|
9256
|
-
* Gets upper left 3x3 pure rotation matrix (non-scaling), assume affine transformation matrix
|
|
9257
|
-
* @param result
|
|
9258
|
-
* @param scaleResult
|
|
9259
|
-
* @returns self
|
|
9260
|
-
*/
|
|
9261
9194
|
getRotation(result, scaleResult) {
|
|
9262
9195
|
result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
|
|
9263
9196
|
scaleResult = scaleResult || [-0, -0, -0];
|
|
@@ -9283,12 +9216,6 @@ vec3 geometry_getNormal() {
|
|
|
9283
9216
|
result[15] = 1;
|
|
9284
9217
|
return result;
|
|
9285
9218
|
}
|
|
9286
|
-
/**
|
|
9287
|
-
*
|
|
9288
|
-
* @param result
|
|
9289
|
-
* @param scaleResult
|
|
9290
|
-
* @returns self
|
|
9291
|
-
*/
|
|
9292
9219
|
getRotationMatrix3(result, scaleResult) {
|
|
9293
9220
|
result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
|
|
9294
9221
|
scaleResult = scaleResult || [-0, -0, -0];
|
|
@@ -9307,7 +9234,6 @@ vec3 geometry_getNormal() {
|
|
|
9307
9234
|
result[8] = this[10] * inverseScale2;
|
|
9308
9235
|
return result;
|
|
9309
9236
|
}
|
|
9310
|
-
// Modifiers
|
|
9311
9237
|
transpose() {
|
|
9312
9238
|
transpose(this, this);
|
|
9313
9239
|
return this.check();
|
|
@@ -9316,7 +9242,6 @@ vec3 geometry_getNormal() {
|
|
|
9316
9242
|
invert(this, this);
|
|
9317
9243
|
return this.check();
|
|
9318
9244
|
}
|
|
9319
|
-
// Operations
|
|
9320
9245
|
multiplyLeft(a) {
|
|
9321
9246
|
multiply(this, a, this);
|
|
9322
9247
|
return this.check();
|
|
@@ -9325,68 +9250,33 @@ vec3 geometry_getNormal() {
|
|
|
9325
9250
|
multiply(this, this, a);
|
|
9326
9251
|
return this.check();
|
|
9327
9252
|
}
|
|
9328
|
-
// Rotates a matrix by the given angle around the X axis
|
|
9329
9253
|
rotateX(radians) {
|
|
9330
9254
|
rotateX(this, this, radians);
|
|
9331
9255
|
return this.check();
|
|
9332
9256
|
}
|
|
9333
|
-
// Rotates a matrix by the given angle around the Y axis.
|
|
9334
9257
|
rotateY(radians) {
|
|
9335
9258
|
rotateY(this, this, radians);
|
|
9336
9259
|
return this.check();
|
|
9337
9260
|
}
|
|
9338
|
-
/**
|
|
9339
|
-
* Rotates a matrix by the given angle around the Z axis.
|
|
9340
|
-
* @param radians
|
|
9341
|
-
* @returns self
|
|
9342
|
-
*/
|
|
9343
9261
|
rotateZ(radians) {
|
|
9344
9262
|
rotateZ(this, this, radians);
|
|
9345
9263
|
return this.check();
|
|
9346
9264
|
}
|
|
9347
|
-
/**
|
|
9348
|
-
*
|
|
9349
|
-
* @param param0
|
|
9350
|
-
* @returns self
|
|
9351
|
-
*/
|
|
9352
9265
|
rotateXYZ(angleXYZ) {
|
|
9353
9266
|
return this.rotateX(angleXYZ[0]).rotateY(angleXYZ[1]).rotateZ(angleXYZ[2]);
|
|
9354
9267
|
}
|
|
9355
|
-
/**
|
|
9356
|
-
*
|
|
9357
|
-
* @param radians
|
|
9358
|
-
* @param axis
|
|
9359
|
-
* @returns self
|
|
9360
|
-
*/
|
|
9361
9268
|
rotateAxis(radians, axis) {
|
|
9362
9269
|
rotate(this, this, radians, axis);
|
|
9363
9270
|
return this.check();
|
|
9364
9271
|
}
|
|
9365
|
-
/**
|
|
9366
|
-
*
|
|
9367
|
-
* @param factor
|
|
9368
|
-
* @returns self
|
|
9369
|
-
*/
|
|
9370
9272
|
scale(factor) {
|
|
9371
9273
|
scale(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
|
|
9372
9274
|
return this.check();
|
|
9373
9275
|
}
|
|
9374
|
-
/**
|
|
9375
|
-
*
|
|
9376
|
-
* @param vec
|
|
9377
|
-
* @returns self
|
|
9378
|
-
*/
|
|
9379
9276
|
translate(vector) {
|
|
9380
9277
|
translate(this, this, vector);
|
|
9381
9278
|
return this.check();
|
|
9382
9279
|
}
|
|
9383
|
-
// Transforms
|
|
9384
|
-
/**
|
|
9385
|
-
* Transforms any 2, 3 or 4 element vector. 2 and 3 elements are treated as points
|
|
9386
|
-
* @param vector
|
|
9387
|
-
* @param result
|
|
9388
|
-
* @returns self
|
|
9389
|
-
*/
|
|
9390
9280
|
transform(vector, result) {
|
|
9391
9281
|
if (vector.length === 4) {
|
|
9392
9282
|
result = transformMat43(result || [-0, -0, -0, -0], vector, this);
|
|
@@ -9395,14 +9285,10 @@ vec3 geometry_getNormal() {
|
|
|
9395
9285
|
}
|
|
9396
9286
|
return this.transformAsPoint(vector, result);
|
|
9397
9287
|
}
|
|
9398
|
-
/**
|
|
9399
|
-
* Transforms any 2 or 3 element array as point (w implicitly 1)
|
|
9400
|
-
* @param vector
|
|
9401
|
-
* @param result
|
|
9402
|
-
* @returns self
|
|
9403
|
-
*/
|
|
9404
9288
|
transformAsPoint(vector, result) {
|
|
9405
|
-
const {
|
|
9289
|
+
const {
|
|
9290
|
+
length
|
|
9291
|
+
} = vector;
|
|
9406
9292
|
let out;
|
|
9407
9293
|
switch (length) {
|
|
9408
9294
|
case 2:
|
|
@@ -9417,12 +9303,6 @@ vec3 geometry_getNormal() {
|
|
|
9417
9303
|
checkVector(out, vector.length);
|
|
9418
9304
|
return out;
|
|
9419
9305
|
}
|
|
9420
|
-
/**
|
|
9421
|
-
* Transforms any 2 or 3 element array as vector (w implicitly 0)
|
|
9422
|
-
* @param vector
|
|
9423
|
-
* @param result
|
|
9424
|
-
* @returns self
|
|
9425
|
-
*/
|
|
9426
9306
|
transformAsVector(vector, result) {
|
|
9427
9307
|
let out;
|
|
9428
9308
|
switch (vector.length) {
|
|
@@ -9438,19 +9318,15 @@ vec3 geometry_getNormal() {
|
|
|
9438
9318
|
checkVector(out, vector.length);
|
|
9439
9319
|
return out;
|
|
9440
9320
|
}
|
|
9441
|
-
/** @deprecated */
|
|
9442
9321
|
transformPoint(vector, result) {
|
|
9443
9322
|
return this.transformAsPoint(vector, result);
|
|
9444
9323
|
}
|
|
9445
|
-
/** @deprecated */
|
|
9446
9324
|
transformVector(vector, result) {
|
|
9447
9325
|
return this.transformAsPoint(vector, result);
|
|
9448
9326
|
}
|
|
9449
|
-
/** @deprecated */
|
|
9450
9327
|
transformDirection(vector, result) {
|
|
9451
9328
|
return this.transformAsVector(vector, result);
|
|
9452
9329
|
}
|
|
9453
|
-
// three.js math API compatibility
|
|
9454
9330
|
makeRotationX(radians) {
|
|
9455
9331
|
return this.identity().rotateX(radians);
|
|
9456
9332
|
}
|