2023-08-29 14:33:44 +02:00
|
|
|
function __vertex(_x = 0, _y = _x, _z = _x, color = c_white, alpha = 1) constructor {
|
|
|
|
x = _x;
|
|
|
|
y = _y;
|
|
|
|
z = _z;
|
|
|
|
|
|
|
|
nx = 0;
|
|
|
|
ny = 0;
|
|
|
|
nz = 0;
|
|
|
|
|
|
|
|
u = 0;
|
|
|
|
v = 0;
|
2023-08-22 20:10:09 +02:00
|
|
|
|
|
|
|
self.color = color;
|
|
|
|
self.alpha = alpha;
|
|
|
|
|
2024-06-16 05:27:57 +02:00
|
|
|
static set = function(_x, _y, _z, _nx, _ny, _nz, _u, _v) {
|
|
|
|
INLINE
|
|
|
|
|
|
|
|
x = _x;
|
|
|
|
y = _y;
|
|
|
|
z = _z;
|
|
|
|
|
|
|
|
nx = _nx;
|
|
|
|
ny = _ny;
|
|
|
|
nz = _nz;
|
|
|
|
|
|
|
|
u = _u;
|
|
|
|
v = _v;
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2023-08-22 20:10:09 +02:00
|
|
|
static setNormal = function(_nx = 0, _ny = _nx, _nz = _nx) {
|
2023-11-08 08:38:04 +01:00
|
|
|
INLINE
|
2023-08-29 14:33:44 +02:00
|
|
|
|
|
|
|
nx = _nx;
|
|
|
|
ny = _ny;
|
|
|
|
nz = _nz;
|
|
|
|
|
2023-08-22 20:10:09 +02:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
static setUV = function(_u = 0, _v = _u) {
|
2023-11-08 08:38:04 +01:00
|
|
|
INLINE
|
2023-08-29 14:33:44 +02:00
|
|
|
|
|
|
|
u = _u;
|
|
|
|
v = _v;
|
|
|
|
|
2023-08-22 20:10:09 +02:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2023-10-05 06:29:20 +02:00
|
|
|
static toString = function() { return $"[__vertex] ( pos: ({x}, {y}, {z}), nor: ({nx}, {ny}, {nz}), uv: ({u}, {v}), {color}, {alpha} )"; }
|
2023-08-22 20:10:09 +02:00
|
|
|
|
|
|
|
static clone = function() {
|
2023-11-08 08:38:04 +01:00
|
|
|
INLINE
|
2023-10-24 02:09:04 +02:00
|
|
|
var _v = new __vertex(x, y, z, color, alpha);
|
|
|
|
|
|
|
|
_v.nx = nx;
|
|
|
|
_v.ny = ny;
|
|
|
|
_v.nz = nz;
|
|
|
|
|
|
|
|
_v.u = u;
|
|
|
|
_v.v = v;
|
|
|
|
|
|
|
|
return _v;
|
2023-08-22 20:10:09 +02:00
|
|
|
}
|
|
|
|
}
|