Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
0cb62b71
T
three.js
项目概览
Ablesons
/
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,发现更多精彩内容 >>
提交
0cb62b71
编写于
3月 21, 2011
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added WebGL equirectangular panorama demo.
Merging with alteredq's branch.
上级
dd27dac1
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
157 addition
and
11 deletion
+157
-11
build/Three.js
build/Three.js
+4
-4
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+1
-1
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+1
-1
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+3
-3
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+1
-1
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+1
-1
examples/textures/2294472375_24a3b8ef46_o.jpg
examples/textures/2294472375_24a3b8ef46_o.jpg
+0
-0
examples/webgl_panorama_equirectangular.html
examples/webgl_panorama_equirectangular.html
+146
-0
未找到文件。
build/Three.js
浏览文件 @
0cb62b71
...
...
@@ -48,7 +48,7 @@ c,b)}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined?
THREE
.
Quaternion
.
prototype
=
{
set
:
function
(
a
,
c
,
b
,
d
){
this
.
x
=
a
;
this
.
y
=
c
;
this
.
z
=
b
;
this
.
w
=
d
;
return
this
},
setFromEuler
:
function
(
a
){
var
c
=
0.5
*
Math
.
PI
/
360
,
b
=
a
.
x
*
c
,
d
=
a
.
y
*
c
,
e
=
a
.
z
*
c
;
a
=
Math
.
cos
(
d
);
d
=
Math
.
sin
(
d
);
c
=
Math
.
cos
(
-
e
);
e
=
Math
.
sin
(
-
e
);
var
h
=
Math
.
cos
(
b
);
b
=
Math
.
sin
(
b
);
var
g
=
a
*
c
,
k
=
d
*
e
;
this
.
w
=
g
*
h
-
k
*
b
;
this
.
x
=
g
*
b
+
k
*
h
;
this
.
y
=
d
*
c
*
h
+
a
*
e
*
b
;
this
.
z
=
a
*
e
*
h
-
d
*
c
*
b
;
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=
-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
if
(
a
==
0
)
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
;
else
{
a
=
1
/
a
;
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
}
return
this
},
multiplySelf
:
function
(
a
){
var
c
=
this
.
x
,
b
=
this
.
y
,
d
=
this
.
z
,
e
=
this
.
w
,
h
=
a
.
x
,
g
=
a
.
y
,
k
=
a
.
z
;
a
=
a
.
w
;
this
.
x
=
c
*
a
+
e
*
h
+
b
*
k
-
d
*
g
;
this
.
y
=
b
*
a
+
e
*
g
+
d
*
h
-
c
*
k
;
this
.
z
=
d
*
a
+
e
*
k
+
c
*
g
-
b
*
h
;
this
.
w
=
e
*
a
-
c
*
h
-
b
*
g
-
d
*
k
;
return
this
},
multiplyVector3
:
function
(
a
,
c
){
c
||
(
c
=
a
);
var
b
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
h
=
this
.
x
,
g
=
this
.
y
,
k
=
this
.
z
,
j
=
this
.
w
,
m
=
j
*
b
+
g
*
e
-
k
*
d
,
t
=
j
*
d
+
k
*
b
-
h
*
e
,
x
=
j
*
e
+
h
*
d
-
g
*
b
;
b
=-
h
*
b
-
g
*
d
-
k
*
e
;
c
.
x
=
m
*
j
+
b
*-
h
+
t
*-
k
-
x
*-
g
;
c
.
y
=
t
*
j
+
b
*-
g
+
x
*-
h
-
m
*-
k
;
c
.
z
=
x
*
j
+
b
*-
k
+
m
*-
g
-
t
*-
h
;
return
c
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
c
,
b
,
d
){
var
e
=
a
.
w
*
c
.
w
+
a
.
x
*
c
.
x
+
a
.
y
*
c
.
y
+
a
.
z
*
c
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
){
b
.
w
=
a
.
w
;
b
.
x
=
a
.
x
;
b
.
y
=
a
.
y
;
b
.
z
=
a
.
z
;
return
b
}
var
h
=
Math
.
acos
(
e
),
g
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
g
)
<
0.001
){
b
.
w
=
0.5
*
(
a
.
w
+
c
.
w
);
b
.
x
=
0.5
*
(
a
.
x
+
c
.
x
);
b
.
y
=
0.5
*
(
a
.
y
+
c
.
y
);
b
.
z
=
0.5
*
(
a
.
z
+
c
.
z
);
return
b
}
e
=
Math
.
sin
((
1
-
d
)
*
h
)
/
g
;
d
=
Math
.
sin
(
d
*
h
)
/
g
;
b
.
w
=
a
.
w
*
e
+
c
.
w
*
d
;
b
.
x
=
a
.
x
*
e
+
c
.
x
*
d
;
b
.
y
=
a
.
y
*
e
+
c
.
y
*
d
;
b
.
z
=
a
.
z
*
e
+
c
.
z
*
d
;
return
b
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
c
,
b
,
d
){
var
e
=
a
.
w
*
c
.
w
+
a
.
x
*
c
.
x
+
a
.
y
*
c
.
y
+
a
.
z
*
c
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
){
b
.
w
=
a
.
w
;
b
.
x
=
a
.
x
;
b
.
y
=
a
.
y
;
b
.
z
=
a
.
z
;
return
b
}
var
h
=
Math
.
acos
(
e
),
g
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
g
)
<
0.001
0
){
b
.
w
=
0.5
*
(
a
.
w
+
c
.
w
);
b
.
x
=
0.5
*
(
a
.
x
+
c
.
x
);
b
.
y
=
0.5
*
(
a
.
y
+
c
.
y
);
b
.
z
=
0.5
*
(
a
.
z
+
c
.
z
);
return
b
}
e
=
Math
.
sin
((
1
-
d
)
*
h
)
/
g
;
d
=
Math
.
sin
(
d
*
h
)
/
g
;
b
.
w
=
a
.
w
*
e
+
c
.
w
*
d
;
b
.
x
=
a
.
x
*
e
+
c
.
x
*
d
;
b
.
y
=
a
.
y
*
e
+
c
.
y
*
d
;
b
.
z
=
a
.
z
*
e
+
c
.
z
*
d
;
return
b
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
c
,
b
,
d
,
e
,
h
){
this
.
a
=
a
;
this
.
b
=
c
;
this
.
c
=
b
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
materials
=
h
instanceof
Array
?
h
:[
h
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
c
,
b
,
d
,
e
,
h
,
g
){
this
.
a
=
a
;
this
.
b
=
c
;
this
.
c
=
b
;
this
.
d
=
d
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
h
instanceof
THREE
.
Color
?
h
:
new
THREE
.
Color
;
this
.
vertexColors
=
h
instanceof
Array
?
h
:[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
c
){
this
.
set
(
a
||
0
,
c
||
0
)};
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
c
){
this
.
u
=
a
;
this
.
v
=
c
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
...
...
@@ -323,7 +323,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
film
:{
uniforms
:{
tDiffuse
:{
type
:
"
t
"
,
value
:
0
,
texture
:
null
},
time
:{
type
:
"
f
"
,
value
:
0
},
nIntensity
:{
type
:
"
f
"
,
value
:
0.5
},
sIntensity
:{
type
:
"
f
"
,
value
:
0.05
},
sCount
:{
type
:
"
f
"
,
value
:
4096
},
grayscale
:{
type
:
"
i
"
,
value
:
1
}},
vertexShader
:
"
varying vec2 vUv;
\n
void main() {
\n
vUv = vec2( uv.x, 1.0 - uv.y );
\n
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
\n
}
"
,
fragmentShader
:
"
varying vec2 vUv;
\n
uniform sampler2D tDiffuse;
\n
uniform float time;
\n
uniform bool grayscale;
\n
uniform float nIntensity;
\n
uniform float sIntensity;
\n
uniform float sCount;
\n
void main() {
\n
vec4 cTextureScreen = texture2D( tDiffuse, vUv );
\n
float x = vUv.x * vUv.y * time * 1000.0;
\n
x = mod( x, 13.0 ) * mod( x, 123.0 );
\n
float dx = mod( x, 0.01 );
\n
vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );
\n
vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );
\n
cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;
\n
cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );
\n
if( grayscale ) {
\n
cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );
\n
}
\n
gl_FragColor = vec4( cResult, cTextureScreen.a );
\n
}
"
},
screen
:{
uniforms
:{
tDiffuse
:{
type
:
"
t
"
,
value
:
0
,
texture
:
null
},
opacity
:{
type
:
"
f
"
,
value
:
1
}},
vertexShader
:
"
varying vec2 vUv;
\n
void main() {
\n
vUv = vec2( uv.x, 1.0 - uv.y );
\n
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
\n
}
"
,
fragmentShader
:
"
varying vec2 vUv;
\n
uniform sampler2D tDiffuse;
\n
uniform float opacity;
\n
void main() {
\n
vec4 texel = texture2D( tDiffuse, vUv );
\n
gl_FragColor = opacity * texel;
\n
}
"
},
basic
:{
uniforms
:{},
vertexShader
:
"
void main() {
\n
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
\n
}
"
,
fragmentShader
:
"
void main() {
\n
gl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );
\n
}
"
}},
buildKernel
:
function
(
a
){
var
c
,
b
,
d
,
e
,
h
=
2
*
Math
.
ceil
(
a
*
3
)
+
1
;
h
>
25
&&
(
h
=
25
);
e
=
(
h
-
1
)
*
0.5
;
b
=
Array
(
h
);
for
(
c
=
d
=
0
;
c
<
h
;
++
c
){
b
[
c
]
=
Math
.
exp
(
-
((
c
-
e
)
*
(
c
-
e
))
/
(
2
*
a
*
a
));
d
+=
b
[
c
]}
for
(
c
=
0
;
c
<
h
;
++
c
)
b
[
c
]
/=
d
;
return
b
}};
THREE
.
QuakeCamera
=
function
(
a
){
function
c
(
b
,
d
){
return
function
(){
d
.
apply
(
b
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
movementSpeed
=
1
;
this
.
lookSpeed
=
0.005
;
this
.
noFly
=!
1
;
this
.
lookVertical
=!
0
;
this
.
autoForward
=!
1
;
this
.
dragToLook
=!
1
;
this
.
heightSpeed
=!
1
;
this
.
heightCoef
=
1
;
this
.
heightMin
=
0
;
this
.
domElement
=
document
;
if
(
a
){
if
(
a
.
movementSpeed
!==
undefined
)
this
.
movementSpeed
=
a
.
movementSpeed
;
if
(
a
.
lookSpeed
!==
undefined
)
this
.
lookSpeed
=
a
.
lookSpeed
;
if
(
a
.
noFly
!==
undefined
)
this
.
noFly
=
THREE
.
QuakeCamera
=
function
(
a
){
function
c
(
b
,
d
){
return
function
(){
d
.
apply
(
b
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
movementSpeed
=
1
;
this
.
lookSpeed
=
0.005
0
;
this
.
noFly
=!
1
;
this
.
lookVertical
=!
0
;
this
.
autoForward
=!
1
;
this
.
dragToLook
=!
1
;
this
.
heightSpeed
=!
1
;
this
.
heightCoef
=
1
;
this
.
heightMin
=
0
;
this
.
domElement
=
document
;
if
(
a
){
if
(
a
.
movementSpeed
!==
undefined
)
this
.
movementSpeed
=
a
.
movementSpeed
;
if
(
a
.
lookSpeed
!==
undefined
)
this
.
lookSpeed
=
a
.
lookSpeed
;
if
(
a
.
noFly
!==
undefined
)
this
.
noFly
=
a
.
noFly
;
if
(
a
.
lookVertical
!==
undefined
)
this
.
lookVertical
=
a
.
lookVertical
;
if
(
a
.
autoForward
!==
undefined
)
this
.
autoForward
=
a
.
autoForward
;
if
(
a
.
dragToLook
!==
undefined
)
this
.
dragToLook
=
a
.
dragToLook
;
if
(
a
.
heightSpeed
!==
undefined
)
this
.
heightSpeed
=
a
.
heightSpeed
;
if
(
a
.
heightCoef
!==
undefined
)
this
.
heightCoef
=
a
.
heightCoef
;
if
(
a
.
heightMin
!==
undefined
)
this
.
heightMin
=
a
.
heightMin
;
if
(
a
.
heightMax
!==
undefined
)
this
.
heightMax
=
a
.
heightMax
;
if
(
a
.
domElement
!==
undefined
)
this
.
domElement
=
a
.
domElement
}
this
.
theta
=
this
.
phi
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
this
.
autoSpeedFactor
=
0
;
this
.
moveForward
=!
1
;
this
.
moveBackward
=!
1
;
this
.
moveLeft
=!
1
;
this
.
moveRight
=!
1
;
this
.
mouseDragOn
=!
1
;
this
.
windowHalfX
=
window
.
innerWidth
/
2
;
this
.
windowHalfY
=
window
.
innerHeight
/
2
;
this
.
onMouseDown
=
function
(
b
){
b
.
preventDefault
();
b
.
stopPropagation
();
if
(
!
this
.
dragToLook
)
switch
(
b
.
button
){
case
0
:
this
.
moveForward
=!
0
;
break
;
case
2
:
this
.
moveBackward
=!
0
}
this
.
mouseDragOn
=!
0
};
this
.
onMouseUp
=
function
(
b
){
b
.
preventDefault
();
b
.
stopPropagation
();
if
(
!
this
.
dragToLook
)
switch
(
b
.
button
){
case
0
:
this
.
moveForward
=
!
1
;
break
;
case
2
:
this
.
moveBackward
=!
1
}
this
.
mouseDragOn
=!
1
};
this
.
onMouseMove
=
function
(
b
){
this
.
mouseX
=
b
.
clientX
-
this
.
windowHalfX
;
this
.
mouseY
=
b
.
clientY
-
this
.
windowHalfY
};
this
.
onKeyDown
=
function
(
b
){
switch
(
b
.
keyCode
){
case
38
:
case
87
:
this
.
moveForward
=!
0
;
break
;
case
37
:
case
65
:
this
.
moveLeft
=!
0
;
break
;
case
40
:
case
83
:
this
.
moveBackward
=!
0
;
break
;
case
39
:
case
68
:
this
.
moveRight
=!
0
}};
this
.
onKeyUp
=
function
(
b
){
switch
(
b
.
keyCode
){
case
38
:
case
87
:
this
.
moveForward
=!
1
;
break
;
case
37
:
case
65
:
this
.
moveLeft
=!
1
;
break
;
case
40
:
case
83
:
this
.
moveBackward
=
...
...
@@ -333,7 +333,7 @@ var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mo
THREE
.
QuakeCamera
.
prototype
.
translate
=
function
(
a
,
c
){
this
.
matrix
.
rotateAxis
(
c
);
if
(
this
.
noFly
)
c
.
y
=
0
;
this
.
position
.
addSelf
(
c
.
multiplyScalar
(
a
));
this
.
target
.
position
.
addSelf
(
c
.
multiplyScalar
(
a
))};
THREE
.
PathCamera
=
function
(
a
){
function
c
(
m
,
t
,
x
,
y
){
var
q
=
{
name
:
x
,
fps
:
0.6
,
length
:
y
,
hierarchy
:[]},
A
,
G
=
t
.
getControlPointsArray
(),
I
=
t
.
getLength
(),
E
=
G
.
length
,
H
=
0
;
A
=
E
-
1
;
t
=
{
parent
:
-
1
,
keys
:[]};
t
.
keys
[
0
]
=
{
time
:
0
,
pos
:
G
[
0
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
t
.
keys
[
A
]
=
{
time
:
y
,
pos
:
G
[
A
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
for
(
A
=
1
;
A
<
E
-
1
;
A
++
){
H
=
y
*
I
.
chunks
[
A
]
/
I
.
total
;
t
.
keys
[
A
]
=
{
time
:
H
,
pos
:
G
[
A
]}}
q
.
hierarchy
[
0
]
=
t
;
THREE
.
AnimationHandler
.
add
(
q
);
return
new
THREE
.
Animation
(
m
,
x
,
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
,
!
1
)}
function
b
(
m
,
t
){
var
x
,
y
,
q
=
new
THREE
.
Geometry
;
for
(
x
=
0
;
x
<
m
.
points
.
length
*
t
;
x
++
){
y
=
x
/
(
m
.
points
.
length
*
t
);
y
=
m
.
getPoint
(
y
);
q
.
vertices
[
x
]
=
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
y
.
x
,
y
.
y
,
y
.
z
))}
return
q
}
function
d
(
m
,
t
){
var
x
=
b
(
t
,
10
),
y
=
b
(
t
,
10
),
q
=
new
THREE
.
LineBasicMaterial
({
color
:
16711680
,
linewidth
:
3
});
lineObj
=
new
THREE
.
Line
(
x
,
q
);
particleObj
=
new
THREE
.
ParticleSystem
(
y
,
new
THREE
.
ParticleBasicMaterial
({
color
:
16755200
,
size
:
3
}));
lineObj
.
scale
.
set
(
1
,
1
,
1
);
m
.
addChild
(
lineObj
);
particleObj
.
scale
.
set
(
1
,
1
,
1
);
m
.
addChild
(
particleObj
);
y
=
new
Sphere
(
1
,
16
,
8
);
q
=
new
THREE
.
MeshBasicMaterial
({
color
:
65280
});
for
(
i
=
0
;
i
<
t
.
points
.
length
;
i
++
){
x
=
new
THREE
.
Mesh
(
y
,
q
);
x
.
position
.
copy
(
t
.
points
[
i
]);
x
.
updateMatrix
();
m
.
addChild
(
x
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
id
=
"
PathCamera
"
+
THREE
.
PathCameraIdCounter
++
;
this
.
duration
=
1
E4
;
this
.
waypoints
=
[];
this
.
useConstantSpeed
=!
0
;
this
.
resamplingCoef
=
50
;
this
.
debugPath
=
new
THREE
.
Object3D
;
this
.
debugDummy
=
new
THREE
.
Object3D
;
this
.
animationParent
=
new
THREE
.
Object3D
;
this
.
lookSpeed
=
0.005
;
this
.
lookVertical
=
16
,
8
);
q
=
new
THREE
.
MeshBasicMaterial
({
color
:
65280
});
for
(
i
=
0
;
i
<
t
.
points
.
length
;
i
++
){
x
=
new
THREE
.
Mesh
(
y
,
q
);
x
.
position
.
copy
(
t
.
points
[
i
]);
x
.
updateMatrix
();
m
.
addChild
(
x
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
id
=
"
PathCamera
"
+
THREE
.
PathCameraIdCounter
++
;
this
.
duration
=
1
E4
;
this
.
waypoints
=
[];
this
.
useConstantSpeed
=!
0
;
this
.
resamplingCoef
=
50
;
this
.
debugPath
=
new
THREE
.
Object3D
;
this
.
debugDummy
=
new
THREE
.
Object3D
;
this
.
animationParent
=
new
THREE
.
Object3D
;
this
.
lookSpeed
=
0.005
0
;
this
.
lookVertical
=
!
0
;
this
.
lookHorizontal
=!
0
;
this
.
verticalAngleMap
=
{
srcRange
:[
0
,
6.28
],
dstRange
:[
0
,
6.28
]};
this
.
horizontalAngleMap
=
{
srcRange
:[
0
,
6.28
],
dstRange
:[
0
,
6.28
]};
this
.
domElement
=
document
;
if
(
a
){
if
(
a
.
duration
!==
undefined
)
this
.
duration
=
a
.
duration
*
1
E3
;
if
(
a
.
waypoints
!==
undefined
)
this
.
waypoints
=
a
.
waypoints
;
if
(
a
.
useConstantSpeed
!==
undefined
)
this
.
useConstantSpeed
=
a
.
useConstantSpeed
;
if
(
a
.
resamplingCoef
!==
undefined
)
this
.
resamplingCoef
=
a
.
resamplingCoef
;
if
(
a
.
createDebugPath
!==
undefined
)
this
.
createDebugPath
=
a
.
createDebugPath
;
if
(
a
.
createDebugDummy
!==
undefined
)
this
.
createDebugDummy
=
a
.
createDebugDummy
;
if
(
a
.
lookSpeed
!==
undefined
)
this
.
lookSpeed
=
a
.
lookSpeed
;
if
(
a
.
lookVertical
!==
undefined
)
this
.
lookVertical
=
a
.
lookVertical
;
if
(
a
.
lookHorizontal
!==
undefined
)
this
.
lookHorizontal
=
a
.
lookHorizontal
;
if
(
a
.
verticalAngleMap
!==
undefined
)
this
.
verticalAngleMap
=
a
.
verticalAngleMap
;
if
(
a
.
horizontalAngleMap
!==
undefined
)
this
.
horizontalAngleMap
=
a
.
horizontalAngleMap
;
if
(
a
.
domElement
!==
undefined
)
this
.
domElement
=
a
.
domElement
}
this
.
theta
=
this
.
phi
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
0
;
this
.
windowHalfX
=
window
.
innerWidth
/
2
;
this
.
windowHalfY
=
window
.
innerHeight
/
2
;
var
e
=
Math
.
PI
*
2
,
h
=
Math
.
PI
/
180
;
this
.
update
=
function
(
m
,
t
,
x
){
var
y
,
q
;
this
.
lookHorizontal
&&
(
this
.
lon
+=
this
.
mouseX
*
this
.
lookSpeed
);
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
this
.
lookSpeed
);
this
.
lon
=
Math
.
max
(
0
,
Math
.
min
(
360
,
this
.
lon
));
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
h
;
this
.
theta
=
this
.
lon
*
h
;
y
=
this
.
phi
%
e
;
this
.
phi
=
y
>=
0
?
y
:
y
+
e
;
y
=
this
.
verticalAngleMap
.
srcRange
;
q
=
this
.
verticalAngleMap
.
dstRange
;
...
...
@@ -349,7 +349,7 @@ for(d=a+a/2;d<2*a;d++)k.faces.push(new THREE.Face4(2*a+1,(2*d-2*a+2)%a+a,(2*d-2*
var
Icosahedron
=
function
(
a
){
function
c
(
x
,
y
,
q
){
var
A
=
Math
.
sqrt
(
x
*
x
+
y
*
y
+
q
*
q
);
return
e
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
x
/
A
,
y
/
A
,
q
/
A
)))
-
1
}
function
b
(
x
,
y
,
q
,
A
){
A
.
faces
.
push
(
new
THREE
.
Face3
(
x
,
y
,
q
))}
function
d
(
x
,
y
){
var
q
=
e
.
vertices
[
x
].
position
,
A
=
e
.
vertices
[
y
].
position
;
return
c
((
q
.
x
+
A
.
x
)
/
2
,(
q
.
y
+
A
.
y
)
/
2
,(
q
.
z
+
A
.
z
)
/
2
)}
var
e
=
this
,
h
=
new
THREE
.
Geometry
,
g
;
this
.
subdivisions
=
a
||
0
;
THREE
.
Geometry
.
call
(
this
);
a
=
(
1
+
Math
.
sqrt
(
5
))
/
2
;
c
(
-
1
,
a
,
0
);
c
(
1
,
a
,
0
);
c
(
-
1
,
-
a
,
0
);
c
(
1
,
-
a
,
0
);
c
(
0
,
-
1
,
a
);
c
(
0
,
1
,
a
);
c
(
0
,
-
1
,
-
a
);
c
(
0
,
1
,
-
a
);
c
(
a
,
0
,
-
1
);
c
(
a
,
0
,
1
);
c
(
-
a
,
0
,
-
1
);
c
(
-
a
,
0
,
1
);
b
(
0
,
11
,
5
,
h
);
b
(
0
,
5
,
1
,
h
);
b
(
0
,
1
,
7
,
h
);
b
(
0
,
7
,
10
,
h
);
b
(
0
,
10
,
11
,
h
);
b
(
1
,
5
,
9
,
h
);
b
(
5
,
11
,
4
,
h
);
b
(
11
,
10
,
2
,
h
);
b
(
10
,
7
,
6
,
h
);
b
(
7
,
1
,
8
,
h
);
b
(
3
,
9
,
4
,
h
);
b
(
3
,
4
,
2
,
h
);
b
(
3
,
2
,
6
,
h
);
b
(
3
,
6
,
8
,
h
);
b
(
3
,
8
,
9
,
h
);
b
(
4
,
9
,
5
,
h
);
b
(
2
,
4
,
11
,
h
);
b
(
6
,
2
,
10
,
h
);
b
(
8
,
6
,
7
,
h
);
b
(
9
,
8
,
1
,
h
);
for
(
a
=
0
;
a
<
this
.
subdivisions
;
a
++
){
g
=
new
THREE
.
Geometry
;
for
(
var
k
in
h
.
faces
){
var
j
=
d
(
h
.
faces
[
k
].
a
,
h
.
faces
[
k
].
b
),
m
=
d
(
h
.
faces
[
k
].
b
,
h
.
faces
[
k
].
c
),
t
=
d
(
h
.
faces
[
k
].
c
,
h
.
faces
[
k
].
a
);
b
(
h
.
faces
[
k
].
a
,
j
,
t
,
g
);
b
(
h
.
faces
[
k
].
b
,
m
,
j
,
g
);
b
(
h
.
faces
[
k
].
c
,
t
,
m
,
g
);
b
(
j
,
m
,
t
,
g
)}
h
.
faces
=
g
.
faces
}
e
.
faces
=
h
.
faces
;
delete
h
;
delete
g
;
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()};
Icosahedron
.
prototype
=
new
THREE
.
Geometry
;
Icosahedron
.
prototype
.
constructor
=
Icosahedron
;
function
Lathe
(
a
,
c
,
b
){
THREE
.
Geometry
.
call
(
this
);
this
.
steps
=
c
||
12
;
this
.
angle
=
b
||
2
*
Math
.
PI
;
c
=
this
.
angle
/
this
.
steps
;
for
(
var
d
=
[],
e
=
[],
h
=
[],
g
=
[],
k
=
0
;
k
<
a
.
length
;
k
++
){
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
a
[
k
]));
d
[
k
]
=
a
[
k
].
clone
();
e
[
k
]
=
this
.
vertices
.
length
-
1
}
for
(
var
j
=
(
new
THREE
.
Matrix4
).
setRotationZ
(
c
),
m
=
0
;
m
<=
this
.
angle
+
0.001
;
m
+=
c
){
for
(
k
=
0
;
k
<
d
.
length
;
k
++
)
if
(
m
<
this
.
angle
){
d
[
k
]
=
j
.
multiplyVector3
(
d
[
k
].
clone
());
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
d
[
k
]));
h
[
k
]
=
this
.
vertices
.
length
-
1
}
else
h
=
g
;
m
==
0
&&
(
g
=
e
);
for
(
k
=
function
Lathe
(
a
,
c
,
b
){
THREE
.
Geometry
.
call
(
this
);
this
.
steps
=
c
||
12
;
this
.
angle
=
b
||
2
*
Math
.
PI
;
c
=
this
.
angle
/
this
.
steps
;
for
(
var
d
=
[],
e
=
[],
h
=
[],
g
=
[],
k
=
0
;
k
<
a
.
length
;
k
++
){
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
a
[
k
]));
d
[
k
]
=
a
[
k
].
clone
();
e
[
k
]
=
this
.
vertices
.
length
-
1
}
for
(
var
j
=
(
new
THREE
.
Matrix4
).
setRotationZ
(
c
),
m
=
0
;
m
<=
this
.
angle
+
0.001
0
;
m
+=
c
){
for
(
k
=
0
;
k
<
d
.
length
;
k
++
)
if
(
m
<
this
.
angle
){
d
[
k
]
=
j
.
multiplyVector3
(
d
[
k
].
clone
());
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
d
[
k
]));
h
[
k
]
=
this
.
vertices
.
length
-
1
}
else
h
=
g
;
m
==
0
&&
(
g
=
e
);
for
(
k
=
0
;
k
<
e
.
length
-
1
;
k
++
){
this
.
faces
.
push
(
new
THREE
.
Face4
(
h
[
k
],
h
[
k
+
1
],
e
[
k
+
1
],
e
[
k
]));
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
m
/
b
,
k
/
a
.
length
),
new
THREE
.
UV
(
m
/
b
,(
k
+
1
)
/
a
.
length
),
new
THREE
.
UV
((
m
-
c
)
/
b
,(
k
+
1
)
/
a
.
length
),
new
THREE
.
UV
((
m
-
c
)
/
b
,
k
/
a
.
length
)])}
e
=
h
;
h
=
[]}
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()}
Lathe
.
prototype
=
new
THREE
.
Geometry
;
Lathe
.
prototype
.
constructor
=
Lathe
;
var
Plane
=
function
(
a
,
c
,
b
,
d
){
THREE
.
Geometry
.
call
(
this
);
var
e
,
h
=
a
/
2
,
g
=
c
/
2
;
b
=
b
||
1
;
d
=
d
||
1
;
var
k
=
b
+
1
,
j
=
d
+
1
;
a
/=
b
;
var
m
=
c
/
d
;
for
(
e
=
0
;
e
<
j
;
e
++
)
for
(
c
=
0
;
c
<
k
;
c
++
)
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
c
*
a
-
h
,
-
(
e
*
m
-
g
),
0
)));
for
(
e
=
0
;
e
<
d
;
e
++
)
for
(
c
=
0
;
c
<
b
;
c
++
){
this
.
faces
.
push
(
new
THREE
.
Face4
(
c
+
k
*
e
,
c
+
k
*
(
e
+
1
),
c
+
1
+
k
*
(
e
+
1
),
c
+
1
+
k
*
e
));
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
c
/
b
,
e
/
d
),
new
THREE
.
UV
(
c
/
b
,(
e
+
1
)
/
d
),
new
THREE
.
UV
((
c
+
1
)
/
b
,(
e
+
1
)
/
d
),
new
THREE
.
UV
((
c
+
1
)
/
b
,
e
/
d
)])}
this
.
computeCentroids
();
this
.
computeFaceNormals
()};
Plane
.
prototype
=
new
THREE
.
Geometry
;
Plane
.
prototype
.
constructor
=
Plane
;
...
...
build/custom/ThreeCanvas.js
浏览文件 @
0cb62b71
...
...
@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?
THREE
.
Quaternion
.
prototype
=
{
set
:
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
d
;
return
this
},
setFromEuler
:
function
(
a
){
var
b
=
0.5
*
Math
.
PI
/
360
,
c
=
a
.
x
*
b
,
d
=
a
.
y
*
b
,
e
=
a
.
z
*
b
;
a
=
Math
.
cos
(
d
);
d
=
Math
.
sin
(
d
);
b
=
Math
.
cos
(
-
e
);
e
=
Math
.
sin
(
-
e
);
var
f
=
Math
.
cos
(
c
);
c
=
Math
.
sin
(
c
);
var
g
=
a
*
b
,
j
=
d
*
e
;
this
.
w
=
g
*
f
-
j
*
c
;
this
.
x
=
g
*
c
+
j
*
f
;
this
.
y
=
d
*
b
*
f
+
a
*
e
*
c
;
this
.
z
=
a
*
e
*
f
-
d
*
b
*
c
;
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=
-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
if
(
a
==
0
)
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
;
else
{
a
=
1
/
a
;
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
}
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
,
e
=
this
.
w
,
f
=
a
.
x
,
g
=
a
.
y
,
j
=
a
.
z
;
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
f
+
c
*
j
-
d
*
g
;
this
.
y
=
c
*
a
+
e
*
g
+
d
*
f
-
b
*
j
;
this
.
z
=
d
*
a
+
e
*
j
+
b
*
g
-
c
*
f
;
this
.
w
=
e
*
a
-
b
*
f
-
c
*
g
-
d
*
j
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
f
=
this
.
x
,
g
=
this
.
y
,
j
=
this
.
z
,
h
=
this
.
w
,
i
=
h
*
c
+
g
*
e
-
j
*
d
,
n
=
h
*
d
+
j
*
c
-
f
*
e
,
l
=
h
*
e
+
f
*
d
-
g
*
c
;
c
=-
f
*
c
-
g
*
d
-
j
*
e
;
b
.
x
=
i
*
h
+
c
*-
f
+
n
*-
j
-
l
*-
g
;
b
.
y
=
n
*
h
+
c
*-
g
+
l
*-
f
-
i
*-
j
;
b
.
z
=
l
*
h
+
c
*-
j
+
i
*-
g
-
n
*-
f
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
f
=
Math
.
acos
(
e
),
g
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
g
)
<
0.001
){
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
);
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
);
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
);
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
);
return
c
}
e
=
Math
.
sin
((
1
-
d
)
*
f
)
/
g
;
d
=
Math
.
sin
(
d
*
f
)
/
g
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
f
=
Math
.
acos
(
e
),
g
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
g
)
<
0.001
0
){
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
);
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
);
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
);
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
);
return
c
}
e
=
Math
.
sin
((
1
-
d
)
*
f
)
/
g
;
d
=
Math
.
sin
(
d
*
f
)
/
g
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
f
instanceof
THREE
.
Color
?
f
:
new
THREE
.
Color
;
this
.
vertexColors
=
f
instanceof
Array
?
f
:[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
...
...
build/custom/ThreeDOM.js
浏览文件 @
0cb62b71
...
...
@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
THREE
.
Quaternion
.
prototype
=
{
set
:
function
(
a
,
b
,
c
,
e
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
e
;
return
this
},
setFromEuler
:
function
(
a
){
var
b
=
0.5
*
Math
.
PI
/
360
,
c
=
a
.
x
*
b
,
e
=
a
.
y
*
b
,
d
=
a
.
z
*
b
;
a
=
Math
.
cos
(
e
);
e
=
Math
.
sin
(
e
);
b
=
Math
.
cos
(
-
d
);
d
=
Math
.
sin
(
-
d
);
var
g
=
Math
.
cos
(
c
);
c
=
Math
.
sin
(
c
);
var
f
=
a
*
b
,
i
=
e
*
d
;
this
.
w
=
f
*
g
-
i
*
c
;
this
.
x
=
f
*
c
+
i
*
g
;
this
.
y
=
e
*
b
*
g
+
a
*
d
*
c
;
this
.
z
=
a
*
d
*
g
-
e
*
b
*
c
;
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=
-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
if
(
a
==
0
)
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
;
else
{
a
=
1
/
a
;
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
}
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
e
=
this
.
z
,
d
=
this
.
w
,
g
=
a
.
x
,
f
=
a
.
y
,
i
=
a
.
z
;
a
=
a
.
w
;
this
.
x
=
b
*
a
+
d
*
g
+
c
*
i
-
e
*
f
;
this
.
y
=
c
*
a
+
d
*
f
+
e
*
g
-
b
*
i
;
this
.
z
=
e
*
a
+
d
*
i
+
b
*
f
-
c
*
g
;
this
.
w
=
d
*
a
-
b
*
g
-
c
*
f
-
e
*
i
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
e
=
a
.
y
,
d
=
a
.
z
,
g
=
this
.
x
,
f
=
this
.
y
,
i
=
this
.
z
,
h
=
this
.
w
,
j
=
h
*
c
+
f
*
d
-
i
*
e
,
m
=
h
*
e
+
i
*
c
-
g
*
d
,
l
=
h
*
d
+
g
*
e
-
f
*
c
;
c
=-
g
*
c
-
f
*
e
-
i
*
d
;
b
.
x
=
j
*
h
+
c
*-
g
+
m
*-
i
-
l
*-
f
;
b
.
y
=
m
*
h
+
c
*-
f
+
l
*-
g
-
j
*-
i
;
b
.
z
=
l
*
h
+
c
*-
i
+
j
*-
f
-
m
*-
g
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
d
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
d
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
g
=
Math
.
acos
(
d
),
f
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
f
)
<
0.001
){
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
);
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
);
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
);
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
);
return
c
}
d
=
Math
.
sin
((
1
-
e
)
*
g
)
/
f
;
e
=
Math
.
sin
(
e
*
g
)
/
f
;
c
.
w
=
a
.
w
*
d
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
d
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
d
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
d
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
d
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
d
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
g
=
Math
.
acos
(
d
),
f
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
f
)
<
0.001
0
){
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
);
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
);
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
);
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
);
return
c
}
d
=
Math
.
sin
((
1
-
e
)
*
g
)
/
f
;
e
=
Math
.
sin
(
e
*
g
)
/
f
;
c
.
w
=
a
.
w
*
d
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
d
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
d
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
d
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
e
,
d
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
d
instanceof
THREE
.
Color
?
d
:
new
THREE
.
Color
;
this
.
vertexColors
=
d
instanceof
Array
?
d
:[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
e
,
d
,
g
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
e
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
AnimationHandler
=
function
(){
var
a
=
[],
b
=
{},
c
=
{};
c
.
update
=
function
(
d
){
for
(
var
g
=
0
;
g
<
a
.
length
;
g
++
)
a
[
g
].
update
(
d
)};
c
.
addToUpdate
=
function
(
d
){
a
.
indexOf
(
d
)
===-
1
&&
a
.
push
(
d
)};
c
.
removeFromUpdate
=
function
(
d
){
d
=
a
.
indexOf
(
d
);
d
!==-
1
&&
a
.
splice
(
d
,
1
)};
c
.
add
=
function
(
d
){
b
[
d
.
name
]
!==
undefined
&&
console
.
log
(
"
THREE.AnimationHandler.add: Warning!
"
+
d
.
name
+
"
already exists in library. Overwriting.
"
);
b
[
d
.
name
]
=
d
;
if
(
d
.
initialized
!==!
0
){
for
(
var
g
=
0
;
g
<
d
.
hierarchy
.
length
;
g
++
){
for
(
var
f
=
0
;
f
<
d
.
hierarchy
[
g
].
keys
.
length
;
f
++
){
if
(
d
.
hierarchy
[
g
].
keys
[
f
].
time
<
...
...
build/custom/ThreeExtras.js
浏览文件 @
0cb62b71
...
...
@@ -23,7 +23,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
film
:{
uniforms
:{
tDiffuse
:{
type
:
"
t
"
,
value
:
0
,
texture
:
null
},
time
:{
type
:
"
f
"
,
value
:
0
},
nIntensity
:{
type
:
"
f
"
,
value
:
0.5
},
sIntensity
:{
type
:
"
f
"
,
value
:
0.05
},
sCount
:{
type
:
"
f
"
,
value
:
4096
},
grayscale
:{
type
:
"
i
"
,
value
:
1
}},
vertexShader
:
"
varying vec2 vUv;
\n
void main() {
\n
vUv = vec2( uv.x, 1.0 - uv.y );
\n
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
\n
}
"
,
fragmentShader
:
"
varying vec2 vUv;
\n
uniform sampler2D tDiffuse;
\n
uniform float time;
\n
uniform bool grayscale;
\n
uniform float nIntensity;
\n
uniform float sIntensity;
\n
uniform float sCount;
\n
void main() {
\n
vec4 cTextureScreen = texture2D( tDiffuse, vUv );
\n
float x = vUv.x * vUv.y * time * 1000.0;
\n
x = mod( x, 13.0 ) * mod( x, 123.0 );
\n
float dx = mod( x, 0.01 );
\n
vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );
\n
vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );
\n
cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;
\n
cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );
\n
if( grayscale ) {
\n
cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );
\n
}
\n
gl_FragColor = vec4( cResult, cTextureScreen.a );
\n
}
"
},
screen
:{
uniforms
:{
tDiffuse
:{
type
:
"
t
"
,
value
:
0
,
texture
:
null
},
opacity
:{
type
:
"
f
"
,
value
:
1
}},
vertexShader
:
"
varying vec2 vUv;
\n
void main() {
\n
vUv = vec2( uv.x, 1.0 - uv.y );
\n
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
\n
}
"
,
fragmentShader
:
"
varying vec2 vUv;
\n
uniform sampler2D tDiffuse;
\n
uniform float opacity;
\n
void main() {
\n
vec4 texel = texture2D( tDiffuse, vUv );
\n
gl_FragColor = opacity * texel;
\n
}
"
},
basic
:{
uniforms
:{},
vertexShader
:
"
void main() {
\n
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
\n
}
"
,
fragmentShader
:
"
void main() {
\n
gl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );
\n
}
"
}},
buildKernel
:
function
(
a
){
var
e
,
b
,
c
,
g
,
f
=
2
*
Math
.
ceil
(
a
*
3
)
+
1
;
f
>
25
&&
(
f
=
25
);
g
=
(
f
-
1
)
*
0.5
;
b
=
Array
(
f
);
for
(
e
=
c
=
0
;
e
<
f
;
++
e
){
b
[
e
]
=
Math
.
exp
(
-
((
e
-
g
)
*
(
e
-
g
))
/
(
2
*
a
*
a
));
c
+=
b
[
e
]}
for
(
e
=
0
;
e
<
f
;
++
e
)
b
[
e
]
/=
c
;
return
b
}};
THREE
.
QuakeCamera
=
function
(
a
){
function
e
(
b
,
c
){
return
function
(){
c
.
apply
(
b
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
movementSpeed
=
1
;
this
.
lookSpeed
=
0.005
;
this
.
noFly
=!
1
;
this
.
lookVertical
=!
0
;
this
.
autoForward
=!
1
;
this
.
dragToLook
=!
1
;
this
.
heightSpeed
=!
1
;
this
.
heightCoef
=
1
;
this
.
heightMin
=
0
;
this
.
domElement
=
document
;
if
(
a
){
if
(
a
.
movementSpeed
!==
undefined
)
this
.
movementSpeed
=
a
.
movementSpeed
;
if
(
a
.
lookSpeed
!==
undefined
)
this
.
lookSpeed
=
a
.
lookSpeed
;
if
(
a
.
noFly
!==
undefined
)
this
.
noFly
=
THREE
.
QuakeCamera
=
function
(
a
){
function
e
(
b
,
c
){
return
function
(){
c
.
apply
(
b
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
movementSpeed
=
1
;
this
.
lookSpeed
=
0.005
0
;
this
.
noFly
=!
1
;
this
.
lookVertical
=!
0
;
this
.
autoForward
=!
1
;
this
.
dragToLook
=!
1
;
this
.
heightSpeed
=!
1
;
this
.
heightCoef
=
1
;
this
.
heightMin
=
0
;
this
.
domElement
=
document
;
if
(
a
){
if
(
a
.
movementSpeed
!==
undefined
)
this
.
movementSpeed
=
a
.
movementSpeed
;
if
(
a
.
lookSpeed
!==
undefined
)
this
.
lookSpeed
=
a
.
lookSpeed
;
if
(
a
.
noFly
!==
undefined
)
this
.
noFly
=
a
.
noFly
;
if
(
a
.
lookVertical
!==
undefined
)
this
.
lookVertical
=
a
.
lookVertical
;
if
(
a
.
autoForward
!==
undefined
)
this
.
autoForward
=
a
.
autoForward
;
if
(
a
.
dragToLook
!==
undefined
)
this
.
dragToLook
=
a
.
dragToLook
;
if
(
a
.
heightSpeed
!==
undefined
)
this
.
heightSpeed
=
a
.
heightSpeed
;
if
(
a
.
heightCoef
!==
undefined
)
this
.
heightCoef
=
a
.
heightCoef
;
if
(
a
.
heightMin
!==
undefined
)
this
.
heightMin
=
a
.
heightMin
;
if
(
a
.
heightMax
!==
undefined
)
this
.
heightMax
=
a
.
heightMax
;
if
(
a
.
domElement
!==
undefined
)
this
.
domElement
=
a
.
domElement
}
this
.
theta
=
this
.
phi
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
this
.
autoSpeedFactor
=
0
;
this
.
moveForward
=!
1
;
this
.
moveBackward
=!
1
;
this
.
moveLeft
=!
1
;
this
.
moveRight
=!
1
;
this
.
mouseDragOn
=!
1
;
this
.
windowHalfX
=
window
.
innerWidth
/
2
;
this
.
windowHalfY
=
window
.
innerHeight
/
2
;
this
.
onMouseDown
=
function
(
b
){
b
.
preventDefault
();
b
.
stopPropagation
();
if
(
!
this
.
dragToLook
)
switch
(
b
.
button
){
case
0
:
this
.
moveForward
=!
0
;
break
;
case
2
:
this
.
moveBackward
=!
0
}
this
.
mouseDragOn
=!
0
};
this
.
onMouseUp
=
function
(
b
){
b
.
preventDefault
();
b
.
stopPropagation
();
if
(
!
this
.
dragToLook
)
switch
(
b
.
button
){
case
0
:
this
.
moveForward
=
!
1
;
break
;
case
2
:
this
.
moveBackward
=!
1
}
this
.
mouseDragOn
=!
1
};
this
.
onMouseMove
=
function
(
b
){
this
.
mouseX
=
b
.
clientX
-
this
.
windowHalfX
;
this
.
mouseY
=
b
.
clientY
-
this
.
windowHalfY
};
this
.
onKeyDown
=
function
(
b
){
switch
(
b
.
keyCode
){
case
38
:
case
87
:
this
.
moveForward
=!
0
;
break
;
case
37
:
case
65
:
this
.
moveLeft
=!
0
;
break
;
case
40
:
case
83
:
this
.
moveBackward
=!
0
;
break
;
case
39
:
case
68
:
this
.
moveRight
=!
0
}};
this
.
onKeyUp
=
function
(
b
){
switch
(
b
.
keyCode
){
case
38
:
case
87
:
this
.
moveForward
=!
1
;
break
;
case
37
:
case
65
:
this
.
moveLeft
=!
1
;
break
;
case
40
:
case
83
:
this
.
moveBackward
=
...
...
@@ -33,7 +33,7 @@ var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mo
THREE
.
QuakeCamera
.
prototype
.
translate
=
function
(
a
,
e
){
this
.
matrix
.
rotateAxis
(
e
);
if
(
this
.
noFly
)
e
.
y
=
0
;
this
.
position
.
addSelf
(
e
.
multiplyScalar
(
a
));
this
.
target
.
position
.
addSelf
(
e
.
multiplyScalar
(
a
))};
THREE
.
PathCamera
=
function
(
a
){
function
e
(
l
,
k
,
o
,
q
){
var
m
=
{
name
:
o
,
fps
:
0.6
,
length
:
q
,
hierarchy
:[]},
t
,
B
=
k
.
getControlPointsArray
(),
z
=
k
.
getLength
(),
x
=
B
.
length
,
y
=
0
;
t
=
x
-
1
;
k
=
{
parent
:
-
1
,
keys
:[]};
k
.
keys
[
0
]
=
{
time
:
0
,
pos
:
B
[
0
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
k
.
keys
[
t
]
=
{
time
:
q
,
pos
:
B
[
t
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
for
(
t
=
1
;
t
<
x
-
1
;
t
++
){
y
=
q
*
z
.
chunks
[
t
]
/
z
.
total
;
k
.
keys
[
t
]
=
{
time
:
y
,
pos
:
B
[
t
]}}
m
.
hierarchy
[
0
]
=
k
;
THREE
.
AnimationHandler
.
add
(
m
);
return
new
THREE
.
Animation
(
l
,
o
,
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
,
!
1
)}
function
b
(
l
,
k
){
var
o
,
q
,
m
=
new
THREE
.
Geometry
;
for
(
o
=
0
;
o
<
l
.
points
.
length
*
k
;
o
++
){
q
=
o
/
(
l
.
points
.
length
*
k
);
q
=
l
.
getPoint
(
q
);
m
.
vertices
[
o
]
=
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
q
.
x
,
q
.
y
,
q
.
z
))}
return
m
}
function
c
(
l
,
k
){
var
o
=
b
(
k
,
10
),
q
=
b
(
k
,
10
),
m
=
new
THREE
.
LineBasicMaterial
({
color
:
16711680
,
linewidth
:
3
});
lineObj
=
new
THREE
.
Line
(
o
,
m
);
particleObj
=
new
THREE
.
ParticleSystem
(
q
,
new
THREE
.
ParticleBasicMaterial
({
color
:
16755200
,
size
:
3
}));
lineObj
.
scale
.
set
(
1
,
1
,
1
);
l
.
addChild
(
lineObj
);
particleObj
.
scale
.
set
(
1
,
1
,
1
);
l
.
addChild
(
particleObj
);
q
=
new
Sphere
(
1
,
16
,
8
);
m
=
new
THREE
.
MeshBasicMaterial
({
color
:
65280
});
for
(
i
=
0
;
i
<
k
.
points
.
length
;
i
++
){
o
=
new
THREE
.
Mesh
(
q
,
m
);
o
.
position
.
copy
(
k
.
points
[
i
]);
o
.
updateMatrix
();
l
.
addChild
(
o
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
id
=
"
PathCamera
"
+
THREE
.
PathCameraIdCounter
++
;
this
.
duration
=
1
E4
;
this
.
waypoints
=
[];
this
.
useConstantSpeed
=!
0
;
this
.
resamplingCoef
=
50
;
this
.
debugPath
=
new
THREE
.
Object3D
;
this
.
debugDummy
=
new
THREE
.
Object3D
;
this
.
animationParent
=
new
THREE
.
Object3D
;
this
.
lookSpeed
=
0.005
;
this
.
lookVertical
=
16
,
8
);
m
=
new
THREE
.
MeshBasicMaterial
({
color
:
65280
});
for
(
i
=
0
;
i
<
k
.
points
.
length
;
i
++
){
o
=
new
THREE
.
Mesh
(
q
,
m
);
o
.
position
.
copy
(
k
.
points
[
i
]);
o
.
updateMatrix
();
l
.
addChild
(
o
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
id
=
"
PathCamera
"
+
THREE
.
PathCameraIdCounter
++
;
this
.
duration
=
1
E4
;
this
.
waypoints
=
[];
this
.
useConstantSpeed
=!
0
;
this
.
resamplingCoef
=
50
;
this
.
debugPath
=
new
THREE
.
Object3D
;
this
.
debugDummy
=
new
THREE
.
Object3D
;
this
.
animationParent
=
new
THREE
.
Object3D
;
this
.
lookSpeed
=
0.005
0
;
this
.
lookVertical
=
!
0
;
this
.
lookHorizontal
=!
0
;
this
.
verticalAngleMap
=
{
srcRange
:[
0
,
6.28
],
dstRange
:[
0
,
6.28
]};
this
.
horizontalAngleMap
=
{
srcRange
:[
0
,
6.28
],
dstRange
:[
0
,
6.28
]};
this
.
domElement
=
document
;
if
(
a
){
if
(
a
.
duration
!==
undefined
)
this
.
duration
=
a
.
duration
*
1
E3
;
if
(
a
.
waypoints
!==
undefined
)
this
.
waypoints
=
a
.
waypoints
;
if
(
a
.
useConstantSpeed
!==
undefined
)
this
.
useConstantSpeed
=
a
.
useConstantSpeed
;
if
(
a
.
resamplingCoef
!==
undefined
)
this
.
resamplingCoef
=
a
.
resamplingCoef
;
if
(
a
.
createDebugPath
!==
undefined
)
this
.
createDebugPath
=
a
.
createDebugPath
;
if
(
a
.
createDebugDummy
!==
undefined
)
this
.
createDebugDummy
=
a
.
createDebugDummy
;
if
(
a
.
lookSpeed
!==
undefined
)
this
.
lookSpeed
=
a
.
lookSpeed
;
if
(
a
.
lookVertical
!==
undefined
)
this
.
lookVertical
=
a
.
lookVertical
;
if
(
a
.
lookHorizontal
!==
undefined
)
this
.
lookHorizontal
=
a
.
lookHorizontal
;
if
(
a
.
verticalAngleMap
!==
undefined
)
this
.
verticalAngleMap
=
a
.
verticalAngleMap
;
if
(
a
.
horizontalAngleMap
!==
undefined
)
this
.
horizontalAngleMap
=
a
.
horizontalAngleMap
;
if
(
a
.
domElement
!==
undefined
)
this
.
domElement
=
a
.
domElement
}
this
.
theta
=
this
.
phi
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
0
;
this
.
windowHalfX
=
window
.
innerWidth
/
2
;
this
.
windowHalfY
=
window
.
innerHeight
/
2
;
var
g
=
Math
.
PI
*
2
,
f
=
Math
.
PI
/
180
;
this
.
update
=
function
(
l
,
k
,
o
){
var
q
,
m
;
this
.
lookHorizontal
&&
(
this
.
lon
+=
this
.
mouseX
*
this
.
lookSpeed
);
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
this
.
lookSpeed
);
this
.
lon
=
Math
.
max
(
0
,
Math
.
min
(
360
,
this
.
lon
));
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
f
;
this
.
theta
=
this
.
lon
*
f
;
q
=
this
.
phi
%
g
;
this
.
phi
=
q
>=
0
?
q
:
q
+
g
;
q
=
this
.
verticalAngleMap
.
srcRange
;
m
=
this
.
verticalAngleMap
.
dstRange
;
...
...
@@ -49,7 +49,7 @@ for(c=a+a/2;c<2*a;c++)h.faces.push(new THREE.Face4(2*a+1,(2*c-2*a+2)%a+a,(2*c-2*
var
Icosahedron
=
function
(
a
){
function
e
(
o
,
q
,
m
){
var
t
=
Math
.
sqrt
(
o
*
o
+
q
*
q
+
m
*
m
);
return
g
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
o
/
t
,
q
/
t
,
m
/
t
)))
-
1
}
function
b
(
o
,
q
,
m
,
t
){
t
.
faces
.
push
(
new
THREE
.
Face3
(
o
,
q
,
m
))}
function
c
(
o
,
q
){
var
m
=
g
.
vertices
[
o
].
position
,
t
=
g
.
vertices
[
q
].
position
;
return
e
((
m
.
x
+
t
.
x
)
/
2
,(
m
.
y
+
t
.
y
)
/
2
,(
m
.
z
+
t
.
z
)
/
2
)}
var
g
=
this
,
f
=
new
THREE
.
Geometry
,
d
;
this
.
subdivisions
=
a
||
0
;
THREE
.
Geometry
.
call
(
this
);
a
=
(
1
+
Math
.
sqrt
(
5
))
/
2
;
e
(
-
1
,
a
,
0
);
e
(
1
,
a
,
0
);
e
(
-
1
,
-
a
,
0
);
e
(
1
,
-
a
,
0
);
e
(
0
,
-
1
,
a
);
e
(
0
,
1
,
a
);
e
(
0
,
-
1
,
-
a
);
e
(
0
,
1
,
-
a
);
e
(
a
,
0
,
-
1
);
e
(
a
,
0
,
1
);
e
(
-
a
,
0
,
-
1
);
e
(
-
a
,
0
,
1
);
b
(
0
,
11
,
5
,
f
);
b
(
0
,
5
,
1
,
f
);
b
(
0
,
1
,
7
,
f
);
b
(
0
,
7
,
10
,
f
);
b
(
0
,
10
,
11
,
f
);
b
(
1
,
5
,
9
,
f
);
b
(
5
,
11
,
4
,
f
);
b
(
11
,
10
,
2
,
f
);
b
(
10
,
7
,
6
,
f
);
b
(
7
,
1
,
8
,
f
);
b
(
3
,
9
,
4
,
f
);
b
(
3
,
4
,
2
,
f
);
b
(
3
,
2
,
6
,
f
);
b
(
3
,
6
,
8
,
f
);
b
(
3
,
8
,
9
,
f
);
b
(
4
,
9
,
5
,
f
);
b
(
2
,
4
,
11
,
f
);
b
(
6
,
2
,
10
,
f
);
b
(
8
,
6
,
7
,
f
);
b
(
9
,
8
,
1
,
f
);
for
(
a
=
0
;
a
<
this
.
subdivisions
;
a
++
){
d
=
new
THREE
.
Geometry
;
for
(
var
h
in
f
.
faces
){
var
j
=
c
(
f
.
faces
[
h
].
a
,
f
.
faces
[
h
].
b
),
l
=
c
(
f
.
faces
[
h
].
b
,
f
.
faces
[
h
].
c
),
k
=
c
(
f
.
faces
[
h
].
c
,
f
.
faces
[
h
].
a
);
b
(
f
.
faces
[
h
].
a
,
j
,
k
,
d
);
b
(
f
.
faces
[
h
].
b
,
l
,
j
,
d
);
b
(
f
.
faces
[
h
].
c
,
k
,
l
,
d
);
b
(
j
,
l
,
k
,
d
)}
f
.
faces
=
d
.
faces
}
g
.
faces
=
f
.
faces
;
delete
f
;
delete
d
;
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()};
Icosahedron
.
prototype
=
new
THREE
.
Geometry
;
Icosahedron
.
prototype
.
constructor
=
Icosahedron
;
function
Lathe
(
a
,
e
,
b
){
THREE
.
Geometry
.
call
(
this
);
this
.
steps
=
e
||
12
;
this
.
angle
=
b
||
2
*
Math
.
PI
;
e
=
this
.
angle
/
this
.
steps
;
for
(
var
c
=
[],
g
=
[],
f
=
[],
d
=
[],
h
=
0
;
h
<
a
.
length
;
h
++
){
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
a
[
h
]));
c
[
h
]
=
a
[
h
].
clone
();
g
[
h
]
=
this
.
vertices
.
length
-
1
}
for
(
var
j
=
(
new
THREE
.
Matrix4
).
setRotationZ
(
e
),
l
=
0
;
l
<=
this
.
angle
+
0.001
;
l
+=
e
){
for
(
h
=
0
;
h
<
c
.
length
;
h
++
)
if
(
l
<
this
.
angle
){
c
[
h
]
=
j
.
multiplyVector3
(
c
[
h
].
clone
());
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
c
[
h
]));
f
[
h
]
=
this
.
vertices
.
length
-
1
}
else
f
=
d
;
l
==
0
&&
(
d
=
g
);
for
(
h
=
function
Lathe
(
a
,
e
,
b
){
THREE
.
Geometry
.
call
(
this
);
this
.
steps
=
e
||
12
;
this
.
angle
=
b
||
2
*
Math
.
PI
;
e
=
this
.
angle
/
this
.
steps
;
for
(
var
c
=
[],
g
=
[],
f
=
[],
d
=
[],
h
=
0
;
h
<
a
.
length
;
h
++
){
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
a
[
h
]));
c
[
h
]
=
a
[
h
].
clone
();
g
[
h
]
=
this
.
vertices
.
length
-
1
}
for
(
var
j
=
(
new
THREE
.
Matrix4
).
setRotationZ
(
e
),
l
=
0
;
l
<=
this
.
angle
+
0.001
0
;
l
+=
e
){
for
(
h
=
0
;
h
<
c
.
length
;
h
++
)
if
(
l
<
this
.
angle
){
c
[
h
]
=
j
.
multiplyVector3
(
c
[
h
].
clone
());
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
c
[
h
]));
f
[
h
]
=
this
.
vertices
.
length
-
1
}
else
f
=
d
;
l
==
0
&&
(
d
=
g
);
for
(
h
=
0
;
h
<
g
.
length
-
1
;
h
++
){
this
.
faces
.
push
(
new
THREE
.
Face4
(
f
[
h
],
f
[
h
+
1
],
g
[
h
+
1
],
g
[
h
]));
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
l
/
b
,
h
/
a
.
length
),
new
THREE
.
UV
(
l
/
b
,(
h
+
1
)
/
a
.
length
),
new
THREE
.
UV
((
l
-
e
)
/
b
,(
h
+
1
)
/
a
.
length
),
new
THREE
.
UV
((
l
-
e
)
/
b
,
h
/
a
.
length
)])}
g
=
f
;
f
=
[]}
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()}
Lathe
.
prototype
=
new
THREE
.
Geometry
;
Lathe
.
prototype
.
constructor
=
Lathe
;
var
Plane
=
function
(
a
,
e
,
b
,
c
){
THREE
.
Geometry
.
call
(
this
);
var
g
,
f
=
a
/
2
,
d
=
e
/
2
;
b
=
b
||
1
;
c
=
c
||
1
;
var
h
=
b
+
1
,
j
=
c
+
1
;
a
/=
b
;
var
l
=
e
/
c
;
for
(
g
=
0
;
g
<
j
;
g
++
)
for
(
e
=
0
;
e
<
h
;
e
++
)
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
e
*
a
-
f
,
-
(
g
*
l
-
d
),
0
)));
for
(
g
=
0
;
g
<
c
;
g
++
)
for
(
e
=
0
;
e
<
b
;
e
++
){
this
.
faces
.
push
(
new
THREE
.
Face4
(
e
+
h
*
g
,
e
+
h
*
(
g
+
1
),
e
+
1
+
h
*
(
g
+
1
),
e
+
1
+
h
*
g
));
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
e
/
b
,
g
/
c
),
new
THREE
.
UV
(
e
/
b
,(
g
+
1
)
/
c
),
new
THREE
.
UV
((
e
+
1
)
/
b
,(
g
+
1
)
/
c
),
new
THREE
.
UV
((
e
+
1
)
/
b
,
g
/
c
)])}
this
.
computeCentroids
();
this
.
computeFaceNormals
()};
Plane
.
prototype
=
new
THREE
.
Geometry
;
Plane
.
prototype
.
constructor
=
Plane
;
...
...
build/custom/ThreeSVG.js
浏览文件 @
0cb62b71
...
...
@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
THREE
.
Quaternion
.
prototype
=
{
set
:
function
(
a
,
b
,
c
,
e
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
e
;
return
this
},
setFromEuler
:
function
(
a
){
var
b
=
0.5
*
Math
.
PI
/
360
,
c
=
a
.
x
*
b
,
e
=
a
.
y
*
b
,
d
=
a
.
z
*
b
;
a
=
Math
.
cos
(
e
);
e
=
Math
.
sin
(
e
);
b
=
Math
.
cos
(
-
d
);
d
=
Math
.
sin
(
-
d
);
var
f
=
Math
.
cos
(
c
);
c
=
Math
.
sin
(
c
);
var
g
=
a
*
b
,
i
=
e
*
d
;
this
.
w
=
g
*
f
-
i
*
c
;
this
.
x
=
g
*
c
+
i
*
f
;
this
.
y
=
e
*
b
*
f
+
a
*
d
*
c
;
this
.
z
=
a
*
d
*
f
-
e
*
b
*
c
;
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=
-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
if
(
a
==
0
)
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
;
else
{
a
=
1
/
a
;
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
}
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
e
=
this
.
z
,
d
=
this
.
w
,
f
=
a
.
x
,
g
=
a
.
y
,
i
=
a
.
z
;
a
=
a
.
w
;
this
.
x
=
b
*
a
+
d
*
f
+
c
*
i
-
e
*
g
;
this
.
y
=
c
*
a
+
d
*
g
+
e
*
f
-
b
*
i
;
this
.
z
=
e
*
a
+
d
*
i
+
b
*
g
-
c
*
f
;
this
.
w
=
d
*
a
-
b
*
f
-
c
*
g
-
e
*
i
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
e
=
a
.
y
,
d
=
a
.
z
,
f
=
this
.
x
,
g
=
this
.
y
,
i
=
this
.
z
,
h
=
this
.
w
,
j
=
h
*
c
+
g
*
d
-
i
*
e
,
n
=
h
*
e
+
i
*
c
-
f
*
d
,
l
=
h
*
d
+
f
*
e
-
g
*
c
;
c
=-
f
*
c
-
g
*
e
-
i
*
d
;
b
.
x
=
j
*
h
+
c
*-
f
+
n
*-
i
-
l
*-
g
;
b
.
y
=
n
*
h
+
c
*-
g
+
l
*-
f
-
j
*-
i
;
b
.
z
=
l
*
h
+
c
*-
i
+
j
*-
g
-
n
*-
f
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
d
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
d
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
f
=
Math
.
acos
(
d
),
g
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
g
)
<
0.001
){
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
);
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
);
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
);
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
);
return
c
}
d
=
Math
.
sin
((
1
-
e
)
*
f
)
/
g
;
e
=
Math
.
sin
(
e
*
f
)
/
g
;
c
.
w
=
a
.
w
*
d
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
d
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
d
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
d
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
d
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
d
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
f
=
Math
.
acos
(
d
),
g
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
g
)
<
0.001
0
){
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
);
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
);
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
);
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
);
return
c
}
d
=
Math
.
sin
((
1
-
e
)
*
f
)
/
g
;
e
=
Math
.
sin
(
e
*
f
)
/
g
;
c
.
w
=
a
.
w
*
d
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
d
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
d
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
d
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
e
,
d
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
d
instanceof
THREE
.
Color
?
d
:
new
THREE
.
Color
;
this
.
vertexColors
=
d
instanceof
Array
?
d
:[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
e
,
d
,
f
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
e
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
f
instanceof
THREE
.
Color
?
f
:
new
THREE
.
Color
;
this
.
vertexColors
=
f
instanceof
Array
?
f
:[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
...
...
build/custom/ThreeWebGL.js
浏览文件 @
0cb62b71
...
...
@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
THREE
.
Quaternion
.
prototype
=
{
set
:
function
(
a
,
b
,
c
,
e
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
e
;
return
this
},
setFromEuler
:
function
(
a
){
var
b
=
0.5
*
Math
.
PI
/
360
,
c
=
a
.
x
*
b
,
e
=
a
.
y
*
b
,
f
=
a
.
z
*
b
;
a
=
Math
.
cos
(
e
);
e
=
Math
.
sin
(
e
);
b
=
Math
.
cos
(
-
f
);
f
=
Math
.
sin
(
-
f
);
var
i
=
Math
.
cos
(
c
);
c
=
Math
.
sin
(
c
);
var
j
=
a
*
b
,
p
=
e
*
f
;
this
.
w
=
j
*
i
-
p
*
c
;
this
.
x
=
j
*
c
+
p
*
i
;
this
.
y
=
e
*
b
*
i
+
a
*
f
*
c
;
this
.
z
=
a
*
f
*
i
-
e
*
b
*
c
;
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=
-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
if
(
a
==
0
)
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
;
else
{
a
=
1
/
a
;
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
}
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
e
=
this
.
z
,
f
=
this
.
w
,
i
=
a
.
x
,
j
=
a
.
y
,
p
=
a
.
z
;
a
=
a
.
w
;
this
.
x
=
b
*
a
+
f
*
i
+
c
*
p
-
e
*
j
;
this
.
y
=
c
*
a
+
f
*
j
+
e
*
i
-
b
*
p
;
this
.
z
=
e
*
a
+
f
*
p
+
b
*
j
-
c
*
i
;
this
.
w
=
f
*
a
-
b
*
i
-
c
*
j
-
e
*
p
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
e
=
a
.
y
,
f
=
a
.
z
,
i
=
this
.
x
,
j
=
this
.
y
,
p
=
this
.
z
,
n
=
this
.
w
,
s
=
n
*
c
+
j
*
f
-
p
*
e
,
y
=
n
*
e
+
p
*
c
-
i
*
f
,
A
=
n
*
f
+
i
*
e
-
j
*
c
;
c
=-
i
*
c
-
j
*
e
-
p
*
f
;
b
.
x
=
s
*
n
+
c
*-
i
+
y
*-
p
-
A
*-
j
;
b
.
y
=
y
*
n
+
c
*-
j
+
A
*-
i
-
s
*-
p
;
b
.
z
=
A
*
n
+
c
*-
p
+
s
*-
j
-
y
*-
i
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
f
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
f
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
i
=
Math
.
acos
(
f
),
j
=
Math
.
sqrt
(
1
-
f
*
f
);
if
(
Math
.
abs
(
j
)
<
0.001
){
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
);
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
);
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
);
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
);
return
c
}
f
=
Math
.
sin
((
1
-
e
)
*
i
)
/
j
;
e
=
Math
.
sin
(
e
*
i
)
/
j
;
c
.
w
=
a
.
w
*
f
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
f
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
f
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
f
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
f
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
f
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
i
=
Math
.
acos
(
f
),
j
=
Math
.
sqrt
(
1
-
f
*
f
);
if
(
Math
.
abs
(
j
)
<
0.001
0
){
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
);
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
);
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
);
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
);
return
c
}
f
=
Math
.
sin
((
1
-
e
)
*
i
)
/
j
;
e
=
Math
.
sin
(
e
*
i
)
/
j
;
c
.
w
=
a
.
w
*
f
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
f
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
f
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
f
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
e
,
f
,
i
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
f
instanceof
THREE
.
Color
?
f
:
new
THREE
.
Color
;
this
.
vertexColors
=
f
instanceof
Array
?
f
:[];
this
.
materials
=
i
instanceof
Array
?
i
:[
i
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
e
,
f
,
i
,
j
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
e
;
this
.
normal
=
f
instanceof
THREE
.
Vector3
?
f
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
f
instanceof
Array
?
f
:[];
this
.
color
=
i
instanceof
THREE
.
Color
?
i
:
new
THREE
.
Color
;
this
.
vertexColors
=
i
instanceof
Array
?
i
:[];
this
.
materials
=
j
instanceof
Array
?
j
:[
j
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
...
...
examples/textures/2294472375_24a3b8ef46_o.jpg
0 → 100644
浏览文件 @
0cb62b71
1.8 MB
examples/webgl_panorama_equirectangular.html
0 → 100644
浏览文件 @
0cb62b71
<!DOCTYPE HTML>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - equirectangular panorama demo
</title>
<meta
charset=
"utf-8"
>
<style
type=
"text/css"
>
body
{
background-color
:
#000000
;
margin
:
0px
;
overflow
:
hidden
;
}
#info
{
position
:
absolute
;
top
:
0px
;
width
:
100%
;
color
:
#ffffff
;
padding
:
5px
;
font-family
:
Monospace
;
font-size
:
13px
;
font-weight
:
bold
;
text-align
:
center
;
}
a
{
color
:
#ffffff
;
}
</style>
</head>
<body>
<div
id=
"container"
></div>
<div
id=
"info"
><a
href=
"http://github.com/mrdoob/three.js"
target=
"_blank"
>
three.js webgl
</a>
- equirectangular panorama demo. photo by
<a
href=
"http://www.flickr.com/photos/jonragnarsson/2294472375/"
target=
"_blank"
>
Jón Ragnarsson
</a>
.
</div>
<script
type=
"text/javascript"
src=
"../build/Three.js"
></script>
<script
type=
"text/javascript"
src=
"js/RequestAnimationFrame.js"
></script>
<script
type=
"text/javascript"
>
var
camera
,
scene
,
renderer
;
var
fov
=
70
,
texture_placeholder
,
isUserInteracting
=
false
,
onMouseDownMouseX
=
0
,
onMouseDownMouseY
=
0
,
lon
=
0
,
onMouseDownLon
=
0
,
lat
=
0
,
onMouseDownLat
=
0
,
phi
=
0
,
theta
=
0
;
init
();
animate
();
function
init
()
{
var
container
,
mesh
;
container
=
document
.
getElementById
(
'
container
'
);
camera
=
new
THREE
.
Camera
(
fov
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
1100
);
scene
=
new
THREE
.
Scene
();
mesh
=
new
THREE
.
Mesh
(
new
Sphere
(
500
,
60
,
40
),
new
THREE
.
MeshBasicMaterial
(
{
map
:
ImageUtils
.
loadTexture
(
'
textures/2294472375_24a3b8ef46_o.jpg
'
)
}
)
);
mesh
.
scale
.
x
=
-
1
;
scene
.
addObject
(
mesh
);
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
document
.
addEventListener
(
'
mousedown
'
,
onDocumentMouseDown
,
false
);
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
mouseup
'
,
onDocumentMouseUp
,
false
);
document
.
addEventListener
(
'
mousewheel
'
,
onDocumentMouseWheel
,
false
);
}
function
onDocumentMouseDown
(
event
)
{
event
.
preventDefault
();
isUserInteracting
=
true
;
onPointerDownPointerX
=
event
.
clientX
;
onPointerDownPointerY
=
event
.
clientY
;
onPointerDownLon
=
lon
;
onPointerDownLat
=
lat
;
}
function
onDocumentMouseMove
(
event
)
{
if
(
isUserInteracting
)
{
lon
=
(
onPointerDownPointerX
-
event
.
clientX
)
*
0.1
+
onPointerDownLon
;
lat
=
(
event
.
clientY
-
onPointerDownPointerY
)
*
0.1
+
onPointerDownLat
;
}
}
function
onDocumentMouseUp
(
event
)
{
isUserInteracting
=
false
;
}
function
onDocumentMouseWheel
(
event
)
{
fov
-=
event
.
wheelDeltaY
*
0.05
;
camera
.
projectionMatrix
=
THREE
.
Matrix4
.
makePerspective
(
fov
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
1100
);
render
();
}
function
animate
()
{
requestAnimationFrame
(
animate
);
render
();
}
function
render
()
{
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
lat
)
);
phi
=
(
90
-
lat
)
*
Math
.
PI
/
180
;
theta
=
lon
*
Math
.
PI
/
180
;
camera
.
target
.
position
.
x
=
500
*
Math
.
sin
(
phi
)
*
Math
.
cos
(
theta
);
camera
.
target
.
position
.
y
=
500
*
Math
.
cos
(
phi
);
camera
.
target
.
position
.
z
=
500
*
Math
.
sin
(
phi
)
*
Math
.
sin
(
theta
);
/*
// distortion
camera.position.x = - camera.target.position.x;
camera.position.y = - camera.target.position.y;
camera.position.z = - camera.target.position.z;
*/
renderer
.
render
(
scene
,
camera
);
}
</script>
</body>
</html>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录