WIP
This commit is contained in:
parent
9d5259767c
commit
25fcefcb50
68 changed files with 2982 additions and 307 deletions
|
|
@ -1,5 +1,7 @@
|
|||
// most of the functions are from https://webglfundamentals.org/webgl/resources/m4.js! but i doesnt want to use them all and make some adjustment to them!
|
||||
class TDUtils {
|
||||
static lastMatrix = {m: null};
|
||||
|
||||
static multiply(a, b) {
|
||||
let b00 = b[0];
|
||||
let b01 = b[1];
|
||||
|
|
@ -93,9 +95,10 @@ class TDUtils {
|
|||
return dst;
|
||||
}
|
||||
|
||||
static xRotation(angleInRadians) {
|
||||
let c = Math.cos(angleInRadians);
|
||||
let s = Math.sin(angleInRadians);
|
||||
static xRotation(angle) {
|
||||
angle = TDUtils.degToRad(angle);
|
||||
let c = Math.cos(angle);
|
||||
let s = Math.sin(angle);
|
||||
|
||||
return [
|
||||
1, 0, 0, 0,
|
||||
|
|
@ -105,9 +108,10 @@ class TDUtils {
|
|||
];
|
||||
}
|
||||
|
||||
static yRotation(angleInRadians) {
|
||||
let c = Math.cos(angleInRadians);
|
||||
let s = Math.sin(angleInRadians);
|
||||
static yRotation(angle) {
|
||||
angle = TDUtils.degToRad(angle);
|
||||
let c = Math.cos(angle);
|
||||
let s = Math.sin(angle);
|
||||
|
||||
return [
|
||||
c, 0, -s, 0,
|
||||
|
|
@ -117,9 +121,10 @@ class TDUtils {
|
|||
];
|
||||
}
|
||||
|
||||
static zRotation(angleInRadians) {
|
||||
let c = Math.cos(angleInRadians);
|
||||
let s = Math.sin(angleInRadians);
|
||||
static zRotation(angle) {
|
||||
angle = TDUtils.degToRad(angle);
|
||||
let c = Math.cos(angle);
|
||||
let s = Math.sin(angle);
|
||||
|
||||
return [
|
||||
c, s, 0, 0,
|
||||
|
|
@ -300,8 +305,6 @@ class TDUtils {
|
|||
]
|
||||
}
|
||||
|
||||
static lastMatrix = {m: null};
|
||||
|
||||
static getMatrix(fov, aspect, near, far, camAngle, radius) {
|
||||
let lMat = this.lastMatrix,
|
||||
u = TDUtils;
|
||||
|
|
@ -330,4 +333,14 @@ class TDUtils {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static updateRotate(rotation, def) {
|
||||
let value = vConf.get(rotation, def) + vConf.get(rotation + '-inc', 0)
|
||||
if (value > 360) {
|
||||
value -= 360;
|
||||
} else if (value < -360) {
|
||||
value += 360;
|
||||
}
|
||||
vConf.set(rotation, value);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue