-
Notifications
You must be signed in to change notification settings - Fork 268
Expand file tree
/
Copy pathvector4.js
More file actions
175 lines (167 loc) · 4.54 KB
/
Copy pathvector4.js
File metadata and controls
175 lines (167 loc) · 4.54 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*
*
* xxxxxxx xxxxxxx
* x:::::x x:::::x
* x:::::x x:::::x
* x:::::xx:::::x
* x::::::::::x
* x::::::::x
* x::::::::x
* x::::::::::x
* x:::::xx:::::x
* x:::::x x:::::x
* x:::::x x:::::x
* THE xxxxxxx xxxxxxx TOOLKIT
*
* http://www.goXTK.com
*
* Copyright (c) 2012 The X Toolkit Developers <dev@goXTK.com>
*
* The X Toolkit (XTK) is licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
* "Free software" is a matter of liberty, not price.
* "Free" as in "free speech", not as in "free beer".
* - Richard M. Stallman
*
*
*/
// provides
goog.provide('X.vector4');
// requires
goog.require('goog.vec.Vec4');
// expose the following goog.math.Vec3 functionality
/**
* @constructor
* @see goog.math.Vec3
*/
X.vector4 = goog.vec.Vec4;
// /**
// * @see goog.math.Vec3.prototype.clone
// */
// X.vector.prototype.clone = goog.math.Vec3.prototype.clone;
//
//
// /**
// * @see goog.math.Vec3.prototype.magnitude
// */
// X.vector.prototype.magnitude = goog.math.Vec3.prototype.magnitude;
//
//
// /**
// * @see goog.math.Vec3.prototype.scale
// */
// X.vector.prototype.scale = goog.math.Vec3.prototype.scale;
//
//
// /**
// * @see goog.math.Vec3.prototype.invert
// */
// X.vector.prototype.invert = goog.math.Vec3.prototype.invert;
//
//
// /**
// * @see goog.math.Vec3.prototype.add
// */
// X.vector.prototype.add = goog.math.Vec3.prototype.add;
//
//
// /**
// * @see goog.math.Vec3.prototype.subtract
// */
// X.vector.prototype.subtract = goog.math.Vec3.prototype.subtract;
//
//
// /**
// * Normalize the vector. The goog.math.Vec3.prototype.normalize
// * did not check on a magnitude of 0 resulting in an error.
// *
// * @return {!X.vector|!goog.math.Vec3} The normalized vector.
// */
// X.vector.prototype.normalize = function() {
// // add a special check if the magnitude is 0
// var _magnitude = this.magnitude();
// if (_magnitude == 0) {
// return this.scale(0);
// }
// return this.scale(1 / _magnitude);
// };
//
//
// /**
// * @see goog.math.Vec3.dot
// */
// X.vector.dot = goog.math.Vec3.dot;
//
//
// /**
// * @see goog.math.Vec3.cross
// */
// X.vector.cross = goog.math.Vec3.cross;
//
//
// /**
// * @see goog.math.Vec3.distance
// */
// X.vector.distance = goog.math.Vec3.distance;
//
//
// /**
// * @see goog.math.Vec3.lerp
// */
// X.vector.lerp = goog.math.Vec3.lerp;
// // now we need to make sure we can access the x,y,z
// // components of a goog.math.Vec3 which might be renamed
// // during the compilation. we don't want to modify the goog.math.Vec3
// // class so this is the easiest workaround.
// /**
// * Get the x component of this vector.
// *
// * @return {number} The x component of this vector.
// * @public
// */
// X.vector4.prototype.__defineGetter__('xx', function() {
//
// return this.x;
//
// });
//
//
// /**
// * Get the y component of this vector.
// *
// * @return {number} The y component of this vector.
// * @public
// */
// X.vector4.prototype.__defineGetter__('yy', function() {
//
// return this.y;
//
// });
//
//
// /**
// * Get the z component of this vector.
// *
// * @return {number} The z component of this vector.
// * @public
// */
// X.vector4.prototype.__defineGetter__('zz', function() {
//
// return this.z;
//
// });
goog.exportSymbol('X.vector4', X.vector4);
goog.exportSymbol('X.vector4.createFloat32FromValues', X.vector4.createFloat32FromValues);
goog.exportSymbol('X.vector4.createFloat32', X.vector4.createFloat32);
// goog.exportSymbol('X.vector.prototype.clone', X.vector.prototype.clone);
// goog.exportSymbol('X.vector.prototype.magnitude', X.vector.prototype.magnitude);
// goog.exportSymbol('X.vector.prototype.scale', X.vector.prototype.scale);
// goog.exportSymbol('X.vector.prototype.invert', X.vector.prototype.invert);
// goog.exportSymbol('X.vector.prototype.normalize', X.vector.prototype.normalize);
// goog.exportSymbol('X.vector.prototype.add', X.vector.prototype.add);
// goog.exportSymbol('X.vector.prototype.subtract', X.vector.prototype.subtract);
// goog.exportSymbol('X.vector.dot', X.vector.dot);
// goog.exportSymbol('X.vector.cross', X.vector.cross);
// goog.exportSymbol('X.vector.distance', X.vector.distance);
// goog.exportSymbol('X.vector.lerp', X.vector.lerp);