Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
1578a27d
T
three.js
项目概览
车家大少爷
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1578a27d
编写于
8月 03, 2011
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated constructor position and buils.
上级
1e152e5b
变更
18
展开全部
隐藏空白更改
内联
并排
Showing
18 changed file
with
829 addition
and
768 deletion
+829
-768
build/Three.js
build/Three.js
+476
-416
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+76
-76
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+40
-40
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+9
-8
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+41
-41
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+39
-39
src/core/Color.js
src/core/Color.js
+10
-10
src/core/Geometry.js
src/core/Geometry.js
+3
-3
src/core/Matrix3.js
src/core/Matrix3.js
+5
-5
src/core/Matrix4.js
src/core/Matrix4.js
+28
-28
src/core/Object3D.js
src/core/Object3D.js
+8
-8
src/core/Quaternion.js
src/core/Quaternion.js
+12
-12
src/core/Ray.js
src/core/Ray.js
+3
-3
src/core/UV.js
src/core/UV.js
+5
-5
src/core/Vector2.js
src/core/Vector2.js
+22
-22
src/core/Vector3.js
src/core/Vector3.js
+30
-30
src/core/Vector4.js
src/core/Vector4.js
+19
-19
src/materials/Texture.js
src/materials/Texture.js
+3
-3
未找到文件。
build/Three.js
浏览文件 @
1578a27d
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
build/custom/ThreeCanvas.js
浏览文件 @
1578a27d
此差异已折叠。
点击以展开。
build/custom/ThreeDOM.js
浏览文件 @
1578a27d
此差异已折叠。
点击以展开。
build/custom/ThreeExtras.js
浏览文件 @
1578a27d
此差异已折叠。
点击以展开。
build/custom/ThreeSVG.js
浏览文件 @
1578a27d
此差异已折叠。
点击以展开。
build/custom/ThreeWebGL.js
浏览文件 @
1578a27d
此差异已折叠。
点击以展开。
src/core/Color.js
浏览文件 @
1578a27d
...
...
@@ -10,7 +10,9 @@ THREE.Color = function ( hex ) {
THREE
.
Color
.
prototype
=
{
copy
:
function
(
color
)
{
constructor
:
THREE
.
Color
,
copy
:
function
(
color
)
{
this
.
r
=
color
.
r
;
this
.
g
=
color
.
g
;
...
...
@@ -19,14 +21,14 @@ THREE.Color.prototype = {
},
setHex
:
function
(
hex
)
{
setHex
:
function
(
hex
)
{
this
.
hex
=
(
~~
hex
)
&
0xffffff
;
this
.
updateRGB
();
},
setRGB
:
function
(
r
,
g
,
b
)
{
setRGB
:
function
(
r
,
g
,
b
)
{
this
.
r
=
r
;
this
.
g
=
g
;
...
...
@@ -36,7 +38,7 @@ THREE.Color.prototype = {
},
setHSV
:
function
(
h
,
s
,
v
)
{
setHSV
:
function
(
h
,
s
,
v
)
{
// based on MochiKit implementation by Bob Ippolito
// h,s,v ranges are < 0.0 - 1.0 >
...
...
@@ -73,13 +75,13 @@ THREE.Color.prototype = {
},
updateHex
:
function
()
{
updateHex
:
function
()
{
this
.
hex
=
~~
(
this
.
r
*
255
)
<<
16
^
~~
(
this
.
g
*
255
)
<<
8
^
~~
(
this
.
b
*
255
);
},
updateRGB
:
function
()
{
updateRGB
:
function
()
{
this
.
r
=
(
this
.
hex
>>
16
&
255
)
/
255
;
this
.
g
=
(
this
.
hex
>>
8
&
255
)
/
255
;
...
...
@@ -87,12 +89,10 @@ THREE.Color.prototype = {
},
clone
:
function
()
{
clone
:
function
()
{
return
new
THREE
.
Color
(
this
.
hex
);
},
constructor
:
THREE
.
Color
}
};
src/core/Geometry.js
浏览文件 @
1578a27d
...
...
@@ -34,6 +34,8 @@ THREE.Geometry = function () {
THREE
.
Geometry
.
prototype
=
{
constructor
:
THREE
.
Geometry
,
computeCentroids
:
function
()
{
var
f
,
fl
,
face
;
...
...
@@ -502,9 +504,7 @@ THREE.Geometry.prototype = {
}
},
constructor
:
THREE
.
Geometry
}
};
...
...
src/core/Matrix3.js
浏览文件 @
1578a27d
...
...
@@ -6,7 +6,9 @@ THREE.Matrix3 = function () {
THREE
.
Matrix3
.
prototype
=
{
transpose
:
function
()
{
constructor
:
THREE
.
Matrix3
,
transpose
:
function
()
{
var
tmp
,
m
=
this
.
m
;
...
...
@@ -18,7 +20,7 @@ THREE.Matrix3.prototype = {
},
transposeIntoArray
:
function
(
r
)
{
transposeIntoArray
:
function
(
r
)
{
var
m
=
this
.
m
;
...
...
@@ -34,8 +36,6 @@ THREE.Matrix3.prototype = {
return
this
;
},
constructor
:
THREE
.
Matrix3
}
};
src/core/Matrix4.js
浏览文件 @
1578a27d
...
...
@@ -26,7 +26,9 @@ THREE.Matrix4 = function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33
THREE
.
Matrix4
.
prototype
=
{
set
:
function
(
n11
,
n12
,
n13
,
n14
,
n21
,
n22
,
n23
,
n24
,
n31
,
n32
,
n33
,
n34
,
n41
,
n42
,
n43
,
n44
)
{
constructor
:
THREE
.
Matrix4
,
set
:
function
(
n11
,
n12
,
n13
,
n14
,
n21
,
n22
,
n23
,
n24
,
n31
,
n32
,
n33
,
n34
,
n41
,
n42
,
n43
,
n44
)
{
this
.
n11
=
n11
;
this
.
n12
=
n12
;
this
.
n13
=
n13
;
this
.
n14
=
n14
;
this
.
n21
=
n21
;
this
.
n22
=
n22
;
this
.
n23
=
n23
;
this
.
n24
=
n24
;
...
...
@@ -37,7 +39,7 @@ THREE.Matrix4.prototype = {
},
identity
:
function
()
{
identity
:
function
()
{
this
.
set
(
...
...
@@ -52,7 +54,7 @@ THREE.Matrix4.prototype = {
},
copy
:
function
(
m
)
{
copy
:
function
(
m
)
{
this
.
set
(
...
...
@@ -67,7 +69,7 @@ THREE.Matrix4.prototype = {
},
lookAt
:
function
(
eye
,
center
,
up
)
{
lookAt
:
function
(
eye
,
center
,
up
)
{
var
x
=
THREE
.
Matrix4
.
__v1
,
y
=
THREE
.
Matrix4
.
__v2
,
z
=
THREE
.
Matrix4
.
__v3
;
...
...
@@ -99,7 +101,7 @@ THREE.Matrix4.prototype = {
},
multiplyVector3
:
function
(
v
)
{
multiplyVector3
:
function
(
v
)
{
var
vx
=
v
.
x
,
vy
=
v
.
y
,
vz
=
v
.
z
,
d
=
1
/
(
this
.
n41
*
vx
+
this
.
n42
*
vy
+
this
.
n43
*
vz
+
this
.
n44
);
...
...
@@ -112,7 +114,7 @@ THREE.Matrix4.prototype = {
},
multiplyVector4
:
function
(
v
)
{
multiplyVector4
:
function
(
v
)
{
var
vx
=
v
.
x
,
vy
=
v
.
y
,
vz
=
v
.
z
,
vw
=
v
.
w
;
...
...
@@ -125,7 +127,7 @@ THREE.Matrix4.prototype = {
},
rotateAxis
:
function
(
v
)
{
rotateAxis
:
function
(
v
)
{
var
vx
=
v
.
x
,
vy
=
v
.
y
,
vz
=
v
.
z
;
...
...
@@ -139,7 +141,7 @@ THREE.Matrix4.prototype = {
},
crossVector
:
function
(
a
)
{
crossVector
:
function
(
a
)
{
var
v
=
new
THREE
.
Vector4
();
...
...
@@ -153,7 +155,7 @@ THREE.Matrix4.prototype = {
},
multiply
:
function
(
a
,
b
)
{
multiply
:
function
(
a
,
b
)
{
var
a11
=
a
.
n11
,
a12
=
a
.
n12
,
a13
=
a
.
n13
,
a14
=
a
.
n14
,
a21
=
a
.
n21
,
a22
=
a
.
n22
,
a23
=
a
.
n23
,
a24
=
a
.
n24
,
...
...
@@ -189,7 +191,7 @@ THREE.Matrix4.prototype = {
},
multiplyToArray
:
function
(
a
,
b
,
r
)
{
multiplyToArray
:
function
(
a
,
b
,
r
)
{
this
.
multiply
(
a
,
b
);
...
...
@@ -202,7 +204,7 @@ THREE.Matrix4.prototype = {
},
multiplySelf
:
function
(
m
)
{
multiplySelf
:
function
(
m
)
{
this
.
multiply
(
this
,
m
);
...
...
@@ -210,7 +212,7 @@ THREE.Matrix4.prototype = {
},
multiplyScalar
:
function
(
s
)
{
multiplyScalar
:
function
(
s
)
{
this
.
n11
*=
s
;
this
.
n12
*=
s
;
this
.
n13
*=
s
;
this
.
n14
*=
s
;
this
.
n21
*=
s
;
this
.
n22
*=
s
;
this
.
n23
*=
s
;
this
.
n24
*=
s
;
...
...
@@ -221,7 +223,7 @@ THREE.Matrix4.prototype = {
},
determinant
:
function
()
{
determinant
:
function
()
{
var
n11
=
this
.
n11
,
n12
=
this
.
n12
,
n13
=
this
.
n13
,
n14
=
this
.
n14
,
n21
=
this
.
n21
,
n22
=
this
.
n22
,
n23
=
this
.
n23
,
n24
=
this
.
n24
,
...
...
@@ -264,7 +266,7 @@ THREE.Matrix4.prototype = {
},
transpose
:
function
()
{
transpose
:
function
()
{
var
tmp
;
...
...
@@ -280,7 +282,7 @@ THREE.Matrix4.prototype = {
},
clone
:
function
()
{
clone
:
function
()
{
var
m
=
new
THREE
.
Matrix4
();
...
...
@@ -293,7 +295,7 @@ THREE.Matrix4.prototype = {
},
flatten
:
function
()
{
flatten
:
function
()
{
this
.
flat
[
0
]
=
this
.
n11
;
this
.
flat
[
1
]
=
this
.
n21
;
this
.
flat
[
2
]
=
this
.
n31
;
this
.
flat
[
3
]
=
this
.
n41
;
this
.
flat
[
4
]
=
this
.
n12
;
this
.
flat
[
5
]
=
this
.
n22
;
this
.
flat
[
6
]
=
this
.
n32
;
this
.
flat
[
7
]
=
this
.
n42
;
...
...
@@ -304,7 +306,7 @@ THREE.Matrix4.prototype = {
},
flattenToArray
:
function
(
flat
)
{
flattenToArray
:
function
(
flat
)
{
flat
[
0
]
=
this
.
n11
;
flat
[
1
]
=
this
.
n21
;
flat
[
2
]
=
this
.
n31
;
flat
[
3
]
=
this
.
n41
;
flat
[
4
]
=
this
.
n12
;
flat
[
5
]
=
this
.
n22
;
flat
[
6
]
=
this
.
n32
;
flat
[
7
]
=
this
.
n42
;
...
...
@@ -315,7 +317,7 @@ THREE.Matrix4.prototype = {
},
flattenToArrayOffset
:
function
(
flat
,
offset
)
{
flattenToArrayOffset
:
function
(
flat
,
offset
)
{
flat
[
offset
]
=
this
.
n11
;
flat
[
offset
+
1
]
=
this
.
n21
;
...
...
@@ -341,7 +343,7 @@ THREE.Matrix4.prototype = {
},
setTranslation
:
function
(
x
,
y
,
z
)
{
setTranslation
:
function
(
x
,
y
,
z
)
{
this
.
set
(
...
...
@@ -356,7 +358,7 @@ THREE.Matrix4.prototype = {
},
setScale
:
function
(
x
,
y
,
z
)
{
setScale
:
function
(
x
,
y
,
z
)
{
this
.
set
(
...
...
@@ -371,7 +373,7 @@ THREE.Matrix4.prototype = {
},
setRotationX
:
function
(
theta
)
{
setRotationX
:
function
(
theta
)
{
var
c
=
Math
.
cos
(
theta
),
s
=
Math
.
sin
(
theta
);
...
...
@@ -388,7 +390,7 @@ THREE.Matrix4.prototype = {
},
setRotationY
:
function
(
theta
)
{
setRotationY
:
function
(
theta
)
{
var
c
=
Math
.
cos
(
theta
),
s
=
Math
.
sin
(
theta
);
...
...
@@ -405,7 +407,7 @@ THREE.Matrix4.prototype = {
},
setRotationZ
:
function
(
theta
)
{
setRotationZ
:
function
(
theta
)
{
var
c
=
Math
.
cos
(
theta
),
s
=
Math
.
sin
(
theta
);
...
...
@@ -422,7 +424,7 @@ THREE.Matrix4.prototype = {
},
setRotationAxis
:
function
(
axis
,
angle
)
{
setRotationAxis
:
function
(
axis
,
angle
)
{
// Based on http://www.gamedev.net/reference/articles/article1199.asp
...
...
@@ -445,7 +447,7 @@ THREE.Matrix4.prototype = {
},
setPosition
:
function
(
v
)
{
setPosition
:
function
(
v
)
{
this
.
n14
=
v
.
x
;
this
.
n24
=
v
.
y
;
...
...
@@ -689,9 +691,7 @@ THREE.Matrix4.prototype = {
this
.
n23
=
m
.
n23
*
invScaleZ
;
this
.
n33
=
m
.
n33
*
invScaleZ
;
},
constructor
:
THREE
.
Matrix4
}
};
...
...
src/core/Object3D.js
浏览文件 @
1578a27d
...
...
@@ -52,32 +52,34 @@ THREE.Object3D = function() {
THREE
.
Object3D
.
prototype
=
{
translate
:
function
(
distance
,
axis
)
{
constructor
:
THREE
.
Object3D
,
translate
:
function
(
distance
,
axis
)
{
this
.
matrix
.
rotateAxis
(
axis
);
this
.
position
.
addSelf
(
axis
.
multiplyScalar
(
distance
)
);
},
translateX
:
function
(
distance
)
{
translateX
:
function
(
distance
)
{
this
.
translate
(
distance
,
this
.
_vector
.
set
(
1
,
0
,
0
)
);
},
translateY
:
function
(
distance
)
{
translateY
:
function
(
distance
)
{
this
.
translate
(
distance
,
this
.
_vector
.
set
(
0
,
1
,
0
)
);
},
translateZ
:
function
(
distance
)
{
translateZ
:
function
(
distance
)
{
this
.
translate
(
distance
,
this
.
_vector
.
set
(
0
,
0
,
1
)
);
},
lookAt
:
function
(
vector
)
{
lookAt
:
function
(
vector
)
{
// TODO: Add hierarchy support.
...
...
@@ -228,8 +230,6 @@ THREE.Object3D.prototype = {
}
},
constructor
:
THREE
.
Object3D
}
};
src/core/Quaternion.js
浏览文件 @
1578a27d
...
...
@@ -18,7 +18,9 @@ THREE.Quaternion = function( x, y, z, w ) {
THREE
.
Quaternion
.
prototype
=
{
set
:
function
(
x
,
y
,
z
,
w
)
{
constructor
:
THREE
.
Quaternion
,
set
:
function
(
x
,
y
,
z
,
w
)
{
this
.
x
=
x
;
this
.
y
=
y
;
...
...
@@ -29,7 +31,7 @@ THREE.Quaternion.prototype = {
},
copy
:
function
(
q
)
{
copy
:
function
(
q
)
{
this
.
x
=
q
.
x
;
this
.
y
=
q
.
y
;
...
...
@@ -40,7 +42,7 @@ THREE.Quaternion.prototype = {
},
setFromEuler
:
function
(
vec3
)
{
setFromEuler
:
function
(
vec3
)
{
var
c
=
0.5
*
Math
.
PI
/
360
,
// 0.5 is an optimization
x
=
vec3
.
x
*
c
,
...
...
@@ -83,7 +85,7 @@ THREE.Quaternion.prototype = {
},
calculateW
:
function
()
{
calculateW
:
function
()
{
this
.
w
=
-
Math
.
sqrt
(
Math
.
abs
(
1.0
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
)
);
...
...
@@ -91,7 +93,7 @@ THREE.Quaternion.prototype = {
},
inverse
:
function
()
{
inverse
:
function
()
{
this
.
x
*=
-
1
;
this
.
y
*=
-
1
;
...
...
@@ -101,13 +103,13 @@ THREE.Quaternion.prototype = {
},
length
:
function
()
{
length
:
function
()
{
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
},
normalize
:
function
()
{
normalize
:
function
()
{
var
l
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
...
...
@@ -133,7 +135,7 @@ THREE.Quaternion.prototype = {
},
multiplySelf
:
function
(
quat2
)
{
multiplySelf
:
function
(
quat2
)
{
var
qax
=
this
.
x
,
qay
=
this
.
y
,
qaz
=
this
.
z
,
qaw
=
this
.
w
,
qbx
=
quat2
.
x
,
qby
=
quat2
.
y
,
qbz
=
quat2
.
z
,
qbw
=
quat2
.
w
;
...
...
@@ -160,7 +162,7 @@ THREE.Quaternion.prototype = {
},
multiplyVector3
:
function
(
vec
,
dest
)
{
multiplyVector3
:
function
(
vec
,
dest
)
{
if
(
!
dest
)
{
dest
=
vec
;
}
...
...
@@ -182,9 +184,7 @@ THREE.Quaternion.prototype = {
return
dest
;
},
constructor
:
THREE
.
Quaternion
}
}
...
...
src/core/Ray.js
浏览文件 @
1578a27d
...
...
@@ -11,6 +11,8 @@ THREE.Ray = function ( origin, direction ) {
THREE
.
Ray
.
prototype
=
{
constructor
:
THREE
.
Ray
,
intersectScene
:
function
(
scene
)
{
return
this
.
intersectObjects
(
scene
.
objects
);
...
...
@@ -180,8 +182,6 @@ THREE.Ray.prototype = {
}
},
constructor
:
THREE
.
Ray
}
};
src/core/UV.js
浏览文件 @
1578a27d
...
...
@@ -15,7 +15,9 @@ THREE.UV = function ( u, v ) {
THREE
.
UV
.
prototype
=
{
set
:
function
(
u
,
v
)
{
constructor
:
THREE
.
UV
,
set
:
function
(
u
,
v
)
{
this
.
u
=
u
;
this
.
v
=
v
;
...
...
@@ -24,7 +26,7 @@ THREE.UV.prototype = {
},
copy
:
function
(
uv
)
{
copy
:
function
(
uv
)
{
this
.
set
(
...
...
@@ -35,8 +37,6 @@ THREE.UV.prototype = {
return
this
;
},
constructor
:
THREE
.
UV
}
};
src/core/Vector2.js
浏览文件 @
1578a27d
...
...
@@ -18,7 +18,9 @@ THREE.Vector2 = function ( x, y ) {
THREE
.
Vector2
.
prototype
=
{
set
:
function
(
x
,
y
)
{
constructor
:
THREE
.
Vector2
,
set
:
function
(
x
,
y
)
{
this
.
x
=
x
;
this
.
y
=
y
;
...
...
@@ -27,7 +29,7 @@ THREE.Vector2.prototype = {
},
copy
:
function
(
v
)
{
copy
:
function
(
v
)
{
this
.
x
=
v
.
x
;
this
.
y
=
v
.
y
;
...
...
@@ -36,14 +38,14 @@ THREE.Vector2.prototype = {
},
clone
:
function
()
{
clone
:
function
()
{
return
new
THREE
.
Vector2
(
this
.
x
,
this
.
y
);
},
add
:
function
(
v1
,
v2
)
{
add
:
function
(
v1
,
v2
)
{
this
.
x
=
v1
.
x
+
v2
.
x
;
this
.
y
=
v1
.
y
+
v2
.
y
;
...
...
@@ -52,7 +54,7 @@ THREE.Vector2.prototype = {
},
addSelf
:
function
(
v
)
{
addSelf
:
function
(
v
)
{
this
.
x
+=
v
.
x
;
this
.
y
+=
v
.
y
;
...
...
@@ -61,7 +63,7 @@ THREE.Vector2.prototype = {
},
sub
:
function
(
v1
,
v2
)
{
sub
:
function
(
v1
,
v2
)
{
this
.
x
=
v1
.
x
-
v2
.
x
;
this
.
y
=
v1
.
y
-
v2
.
y
;
...
...
@@ -70,7 +72,7 @@ THREE.Vector2.prototype = {
},
subSelf
:
function
(
v
)
{
subSelf
:
function
(
v
)
{
this
.
x
-=
v
.
x
;
this
.
y
-=
v
.
y
;
...
...
@@ -79,7 +81,7 @@ THREE.Vector2.prototype = {
},
multiplyScalar
:
function
(
s
)
{
multiplyScalar
:
function
(
s
)
{
this
.
x
*=
s
;
this
.
y
*=
s
;
...
...
@@ -88,7 +90,7 @@ THREE.Vector2.prototype = {
},
divideScalar
:
function
(
s
)
{
divideScalar
:
function
(
s
)
{
if
(
s
)
{
...
...
@@ -106,43 +108,43 @@ THREE.Vector2.prototype = {
},
negate
:
function
()
{
negate
:
function
()
{
return
this
.
multiplyScalar
(
-
1
);
},
dot
:
function
(
v
)
{
dot
:
function
(
v
)
{
return
this
.
x
*
v
.
x
+
this
.
y
*
v
.
y
;
},
lengthSq
:
function
()
{
lengthSq
:
function
()
{
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
;
},
length
:
function
()
{
length
:
function
()
{
return
Math
.
sqrt
(
this
.
lengthSq
()
);
},
normalize
:
function
()
{
normalize
:
function
()
{
return
this
.
divideScalar
(
this
.
length
()
);
},
distanceTo
:
function
(
v
)
{
distanceTo
:
function
(
v
)
{
return
Math
.
sqrt
(
this
.
distanceToSquared
(
v
)
);
},
distanceToSquared
:
function
(
v
)
{
distanceToSquared
:
function
(
v
)
{
var
dx
=
this
.
x
-
v
.
x
,
dy
=
this
.
y
-
v
.
y
;
return
dx
*
dx
+
dy
*
dy
;
...
...
@@ -150,7 +152,7 @@ THREE.Vector2.prototype = {
},
setLength
:
function
(
l
)
{
setLength
:
function
(
l
)
{
return
this
.
normalize
().
multiplyScalar
(
l
);
...
...
@@ -158,7 +160,7 @@ THREE.Vector2.prototype = {
// deprecated: same as normalize
unit
:
function
()
{
unit
:
function
()
{
return
this
.
normalize
();
...
...
@@ -168,12 +170,10 @@ THREE.Vector2.prototype = {
// (which may be not what is expected thanks to floating point precision)
// (should be probably using some tiny epsilon instead of equality)
equals
:
function
(
v
)
{
equals
:
function
(
v
)
{
return
(
(
v
.
x
==
this
.
x
)
&&
(
v
.
y
==
this
.
y
)
);
},
constructor
:
THREE
.
Vector2
}
};
src/core/Vector3.js
浏览文件 @
1578a27d
...
...
@@ -21,7 +21,9 @@ THREE.Vector3 = function ( x, y, z ) {
THREE
.
Vector3
.
prototype
=
{
set
:
function
(
x
,
y
,
z
)
{
constructor
:
THREE
.
Vector3
,
set
:
function
(
x
,
y
,
z
)
{
this
.
x
=
x
;
this
.
y
=
y
;
...
...
@@ -31,7 +33,7 @@ THREE.Vector3.prototype = {
},
copy
:
function
(
v
)
{
copy
:
function
(
v
)
{
this
.
x
=
v
.
x
;
this
.
y
=
v
.
y
;
...
...
@@ -41,14 +43,14 @@ THREE.Vector3.prototype = {
},
clone
:
function
()
{
clone
:
function
()
{
return
new
THREE
.
Vector3
(
this
.
x
,
this
.
y
,
this
.
z
);
},
add
:
function
(
v1
,
v2
)
{
add
:
function
(
v1
,
v2
)
{
this
.
x
=
v1
.
x
+
v2
.
x
;
this
.
y
=
v1
.
y
+
v2
.
y
;
...
...
@@ -58,7 +60,7 @@ THREE.Vector3.prototype = {
},
addSelf
:
function
(
v
)
{
addSelf
:
function
(
v
)
{
this
.
x
+=
v
.
x
;
this
.
y
+=
v
.
y
;
...
...
@@ -68,7 +70,7 @@ THREE.Vector3.prototype = {
},
addScalar
:
function
(
s
)
{
addScalar
:
function
(
s
)
{
this
.
x
+=
s
;
this
.
y
+=
s
;
...
...
@@ -78,7 +80,7 @@ THREE.Vector3.prototype = {
},
sub
:
function
(
v1
,
v2
)
{
sub
:
function
(
v1
,
v2
)
{
this
.
x
=
v1
.
x
-
v2
.
x
;
this
.
y
=
v1
.
y
-
v2
.
y
;
...
...
@@ -88,7 +90,7 @@ THREE.Vector3.prototype = {
},
subSelf
:
function
(
v
)
{
subSelf
:
function
(
v
)
{
this
.
x
-=
v
.
x
;
this
.
y
-=
v
.
y
;
...
...
@@ -98,7 +100,7 @@ THREE.Vector3.prototype = {
},
multiply
:
function
(
a
,
b
)
{
multiply
:
function
(
a
,
b
)
{
this
.
x
=
a
.
x
*
b
.
x
;
this
.
y
=
a
.
y
*
b
.
y
;
...
...
@@ -108,7 +110,7 @@ THREE.Vector3.prototype = {
},
multiplySelf
:
function
(
v
)
{
multiplySelf
:
function
(
v
)
{
this
.
x
*=
v
.
x
;
this
.
y
*=
v
.
y
;
...
...
@@ -118,7 +120,7 @@ THREE.Vector3.prototype = {
},
multiplyScalar
:
function
(
s
)
{
multiplyScalar
:
function
(
s
)
{
this
.
x
*=
s
;
this
.
y
*=
s
;
...
...
@@ -128,13 +130,13 @@ THREE.Vector3.prototype = {
},
divideSelf
:
function
(
v
)
{
divideSelf
:
function
(
v
)
{
return
this
.
divide
(
this
,
v
);
},
divideScalar
:
function
(
s
)
{
divideScalar
:
function
(
s
)
{
if
(
s
)
{
...
...
@@ -153,31 +155,31 @@ THREE.Vector3.prototype = {
},
negate
:
function
()
{
negate
:
function
()
{
return
this
.
multiplyScalar
(
-
1
);
},
dot
:
function
(
v
)
{
dot
:
function
(
v
)
{
return
this
.
x
*
v
.
x
+
this
.
y
*
v
.
y
+
this
.
z
*
v
.
z
;
},
lengthSq
:
function
()
{
lengthSq
:
function
()
{
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
;
},
length
:
function
()
{
length
:
function
()
{
return
Math
.
sqrt
(
this
.
lengthSq
()
);
},
lengthManhattan
:
function
()
{
lengthManhattan
:
function
()
{
// correct version
// return Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );
...
...
@@ -186,20 +188,20 @@ THREE.Vector3.prototype = {
},
normalize
:
function
()
{
normalize
:
function
()
{
return
this
.
divideScalar
(
this
.
length
()
);
},
setLength
:
function
(
l
)
{
setLength
:
function
(
l
)
{
return
this
.
normalize
().
multiplyScalar
(
l
);
},
cross
:
function
(
a
,
b
)
{
cross
:
function
(
a
,
b
)
{
this
.
x
=
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
;
this
.
y
=
a
.
z
*
b
.
x
-
a
.
x
*
b
.
z
;
...
...
@@ -209,7 +211,7 @@ THREE.Vector3.prototype = {
},
crossSelf
:
function
(
v
)
{
crossSelf
:
function
(
v
)
{
return
this
.
set
(
...
...
@@ -222,20 +224,20 @@ THREE.Vector3.prototype = {
},
distanceTo
:
function
(
v
)
{
distanceTo
:
function
(
v
)
{
return
Math
.
sqrt
(
this
.
distanceToSquared
(
v
)
);
},
distanceToSquared
:
function
(
v
)
{
distanceToSquared
:
function
(
v
)
{
return
new
THREE
.
Vector3
().
sub
(
this
,
v
).
lengthSq
();
},
setPositionFromMatrix
:
function
(
m
)
{
setPositionFromMatrix
:
function
(
m
)
{
this
.
x
=
m
.
n14
;
this
.
y
=
m
.
n24
;
...
...
@@ -243,7 +245,7 @@ THREE.Vector3.prototype = {
},
setRotationFromMatrix
:
function
(
m
)
{
setRotationFromMatrix
:
function
(
m
)
{
var
cosY
=
Math
.
cos
(
this
.
y
);
...
...
@@ -263,12 +265,10 @@ THREE.Vector3.prototype = {
},
isZero
:
function
()
{
isZero
:
function
()
{
return
(
this
.
lengthSq
()
<
0.0001
/* almostZero */
);
},
constructor
:
THREE
.
Vector3
}
};
src/core/Vector4.js
浏览文件 @
1578a27d
...
...
@@ -20,7 +20,9 @@ THREE.Vector4 = function ( x, y, z, w ) {
THREE
.
Vector4
.
prototype
=
{
set
:
function
(
x
,
y
,
z
,
w
)
{
constructor
:
THREE
.
Vector4
,
set
:
function
(
x
,
y
,
z
,
w
)
{
this
.
x
=
x
;
this
.
y
=
y
;
...
...
@@ -31,7 +33,7 @@ THREE.Vector4.prototype = {
},
copy
:
function
(
v
)
{
copy
:
function
(
v
)
{
return
this
.
set
(
...
...
@@ -44,14 +46,14 @@ THREE.Vector4.prototype = {
},
clone
:
function
()
{
clone
:
function
()
{
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
);
},
add
:
function
(
v1
,
v2
)
{
add
:
function
(
v1
,
v2
)
{
this
.
x
=
v1
.
x
+
v2
.
x
;
this
.
y
=
v1
.
y
+
v2
.
y
;
...
...
@@ -62,7 +64,7 @@ THREE.Vector4.prototype = {
},
addSelf
:
function
(
v
)
{
addSelf
:
function
(
v
)
{
this
.
x
+=
v
.
x
;
this
.
y
+=
v
.
y
;
...
...
@@ -73,7 +75,7 @@ THREE.Vector4.prototype = {
},
sub
:
function
(
v1
,
v2
)
{
sub
:
function
(
v1
,
v2
)
{
this
.
x
=
v1
.
x
-
v2
.
x
;
this
.
y
=
v1
.
y
-
v2
.
y
;
...
...
@@ -84,7 +86,7 @@ THREE.Vector4.prototype = {
},
subSelf
:
function
(
v
)
{
subSelf
:
function
(
v
)
{
this
.
x
-=
v
.
x
;
this
.
y
-=
v
.
y
;
...
...
@@ -95,7 +97,7 @@ THREE.Vector4.prototype = {
},
multiplyScalar
:
function
(
s
)
{
multiplyScalar
:
function
(
s
)
{
this
.
x
*=
s
;
this
.
y
*=
s
;
...
...
@@ -106,7 +108,7 @@ THREE.Vector4.prototype = {
},
divideScalar
:
function
(
s
)
{
divideScalar
:
function
(
s
)
{
if
(
s
)
{
...
...
@@ -126,44 +128,44 @@ THREE.Vector4.prototype = {
},
negate
:
function
()
{
negate
:
function
()
{
return
this
.
multiplyScalar
(
-
1
);
},
dot
:
function
(
v
)
{
dot
:
function
(
v
)
{
return
this
.
x
*
v
.
x
+
this
.
y
*
v
.
y
+
this
.
z
*
v
.
z
+
this
.
w
*
v
.
w
;
},
lengthSq
:
function
()
{
lengthSq
:
function
()
{
return
this
.
dot
(
this
);
},
length
:
function
()
{
length
:
function
()
{
return
Math
.
sqrt
(
this
.
lengthSq
()
);
},
normalize
:
function
()
{
normalize
:
function
()
{
return
this
.
divideScalar
(
this
.
length
()
);
},
setLength
:
function
(
l
)
{
setLength
:
function
(
l
)
{
return
this
.
normalize
().
multiplyScalar
(
l
);
},
lerpSelf
:
function
(
v
,
alpha
)
{
lerpSelf
:
function
(
v
,
alpha
)
{
this
.
x
+=
(
v
.
x
-
this
.
x
)
*
alpha
;
this
.
y
+=
(
v
.
y
-
this
.
y
)
*
alpha
;
...
...
@@ -172,8 +174,6 @@ THREE.Vector4.prototype = {
return
this
;
},
constructor
:
THREE
.
Vector4
}
};
src/materials/Texture.js
浏览文件 @
1578a27d
...
...
@@ -25,13 +25,13 @@ THREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter )
THREE
.
Texture
.
prototype
=
{
constructor
:
THREE
.
Texture
,
clone
:
function
()
{
return
new
THREE
.
Texture
(
this
.
image
,
this
.
mapping
,
this
.
wrapS
,
this
.
wrapT
,
this
.
magFilter
,
this
.
minFilter
);
},
constructor
:
THREE
.
Texture
}
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录