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