-
Notifications
You must be signed in to change notification settings - Fork 4
/
ColorRgb.ts
92 lines (71 loc) · 1.78 KB
/
ColorRgb.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import { Vector3 } from './Vector3';
import {IVector3} from './IVector';
import {IColorRgb} from './IColor';
/**
* A RGB color.
*/
export class ColorRgb extends Vector3 implements IVector3, IColorRgb {
constructor(r: Float32Array) {
super(r);
}
get x() {
return this._v[0];
}
get y() {
return this._v[1];
}
get z() {
return this._v[2];
}
get w() {
return 1;
}
get r() {
return this._v[0];
}
get g() {
return this._v[1];
}
get b() {
return this._v[2];
}
get a() {
return 1;
}
static zero() {
return super._zero(Float32Array) as ColorRgb;
}
static one() {
return super._one(Float32Array) as ColorRgb;
}
static dummy() {
return super._dummy(Float32Array) as ColorRgb;
}
static normalize(vec: IVector3) {
return super._normalize(vec, Float32Array) as ColorRgb;
}
static add(l_vec: IVector3, r_vec: IVector3) {
return super._add(l_vec, r_vec, Float32Array) as ColorRgb;
}
static subtract(l_vec: IVector3, r_vec: IVector3) {
return super._subtract(l_vec, r_vec, Float32Array) as ColorRgb;
}
static multiply(vec: IVector3, value: number) {
return super._multiply(vec, value, Float32Array) as ColorRgb;
}
static multiplyVector(l_vec: IVector3, r_vec: IVector3) {
return super._multiplyVector(l_vec, r_vec, Float32Array) as ColorRgb;
}
static divide(vec: IVector3, value: number) {
return super._divide(vec, value, Float32Array) as ColorRgb;
}
static divideVector(l_vec: IVector3, r_vec: IVector3) {
return super._divideVector(l_vec, r_vec, Float32Array) as ColorRgb;
}
static cross(l_vec: IVector3, r_vec: IVector3) {
return super._cross(l_vec, r_vec, Float32Array) as ColorRgb;
}
clone(): ColorRgb {
return super.clone() as ColorRgb;
}
}