Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fktz008
three.js
提交
9902cbbf
T
three.js
项目概览
fktz008
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
9902cbbf
编写于
10月 13, 2011
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Experimenting with Date.now(). Updated builds.
上级
42544a0f
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
19 addition
and
22 deletion
+19
-22
build/Three.js
build/Three.js
+4
-3
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+2
-2
examples/webgl_materials_cars.html
examples/webgl_materials_cars.html
+1
-1
examples/webgl_materials_cubemap_dynamic.html
examples/webgl_materials_cubemap_dynamic.html
+2
-2
examples/webgl_particles_dynamic.html
examples/webgl_particles_dynamic.html
+2
-6
examples/webgl_postprocessing.html
examples/webgl_postprocessing.html
+1
-1
examples/webgl_postprocessing_dof.html
examples/webgl_postprocessing_dof.html
+1
-1
examples/webgl_ribbons.html
examples/webgl_ribbons.html
+1
-1
examples/webgl_shader_lava.html
examples/webgl_shader_lava.html
+1
-1
examples/webgl_shading_physical.html
examples/webgl_shading_physical.html
+2
-2
examples/webgl_shadowmap.html
examples/webgl_shadowmap.html
+2
-2
未找到文件。
build/Three.js
浏览文件 @
9902cbbf
...
...
@@ -21,7 +21,8 @@ w=f instanceof THREE.Face4?w.multiplyVector3(y[f.d].position.clone()):null,u=b.m
THREE
.
Rectangle
=
function
(){
function
b
(){
k
=
f
-
c
;
m
=
h
-
e
}
var
c
,
e
,
f
,
h
,
k
,
m
,
n
=!
0
;
this
.
getX
=
function
(){
return
c
};
this
.
getY
=
function
(){
return
e
};
this
.
getWidth
=
function
(){
return
k
};
this
.
getHeight
=
function
(){
return
m
};
this
.
getLeft
=
function
(){
return
c
};
this
.
getTop
=
function
(){
return
e
};
this
.
getRight
=
function
(){
return
f
};
this
.
getBottom
=
function
(){
return
h
};
this
.
set
=
function
(
k
,
m
,
w
,
u
){
n
=!
1
;
c
=
k
;
e
=
m
;
f
=
w
;
h
=
u
;
b
()};
this
.
addPoint
=
function
(
k
,
m
){
n
?(
n
=!
1
,
c
=
k
,
e
=
m
,
f
=
k
,
h
=
m
):(
c
=
c
<
k
?
c
:
k
,
e
=
e
<
m
?
e
:
m
,
f
=
f
>
k
?
f
:
k
,
h
=
h
>
m
?
h
:
m
);
b
()};
this
.
add3Points
=
function
(
k
,
m
,
w
,
u
,
x
,
v
){
n
?(
n
=!
1
,
c
=
k
<
w
?
k
<
x
?
k
:
x
:
w
<
x
?
w
:
x
,
e
=
m
<
u
?
m
<
v
?
m
:
v
:
u
<
v
?
u
:
v
,
f
=
k
>
w
?
k
>
x
?
k
:
x
:
w
>
x
?
w
:
x
,
h
=
m
>
u
?
m
>
v
?
m
:
v
:
u
>
v
?
u
:
v
):(
c
=
k
<
w
?
k
<
x
?
k
<
c
?
k
:
c
:
x
<
c
?
x
:
c
:
w
<
x
?
w
<
c
?
w
:
c
:
x
<
c
?
x
:
c
,
e
=
m
<
u
?
m
<
v
?
m
<
e
?
m
:
e
:
v
<
e
?
v
:
e
:
u
<
v
?
u
<
e
?
u
:
e
:
v
<
e
?
v
:
e
,
f
=
k
>
w
?
k
>
x
?
k
>
f
?
k
:
f
:
x
>
f
?
x
:
f
:
w
>
x
?
w
>
f
?
w
:
f
:
x
>
f
?
x
:
f
,
h
=
m
>
u
?
m
>
v
?
m
>
h
?
m
:
h
:
v
>
h
?
v
:
h
:
u
>
v
?
u
>
h
?
u
:
h
:
v
>
h
?
v
:
h
);
b
()};
this
.
addRectangle
=
function
(
k
){
n
?(
n
=!
1
,
c
=
k
.
getLeft
(),
e
=
k
.
getTop
(),
f
=
k
.
getRight
(),
h
=
k
.
getBottom
()):(
c
=
c
<
k
.
getLeft
()?
c
:
k
.
getLeft
(),
e
=
e
<
k
.
getTop
()?
e
:
k
.
getTop
(),
f
=
f
>
k
.
getRight
()?
f
:
k
.
getRight
(),
h
=
h
>
k
.
getBottom
()?
h
:
k
.
getBottom
());
b
()};
this
.
inflate
=
function
(
k
){
c
-=
k
;
e
-=
k
;
f
+=
k
;
h
+=
k
;
b
()};
this
.
minSelf
=
function
(
k
){
c
=
c
>
k
.
getLeft
()?
c
:
k
.
getLeft
();
e
=
e
>
k
.
getTop
()?
e
:
k
.
getTop
();
f
=
f
<
k
.
getRight
()?
f
:
k
.
getRight
();
h
=
h
<
k
.
getBottom
()?
h
:
k
.
getBottom
();
b
()};
this
.
intersects
=
function
(
b
){
return
Math
.
min
(
f
,
b
.
getRight
())
-
Math
.
max
(
c
,
b
.
getLeft
())
>=
0
&&
Math
.
min
(
h
,
b
.
getBottom
())
-
Math
.
max
(
e
,
b
.
getTop
())
>=
0
};
this
.
empty
=
function
(){
n
=!
0
;
h
=
f
=
e
=
c
=
0
;
b
()};
this
.
isEmpty
=
function
(){
return
n
}};
THREE
.
Math
=
{
clamp
:
function
(
b
,
c
,
e
){
return
b
<
c
?
c
:
b
>
e
?
e
:
b
},
clampBottom
:
function
(
b
,
c
){
return
b
<
c
?
c
:
b
},
mapLinear
:
function
(
b
,
c
,
e
,
f
,
h
){
return
f
+
(
b
-
c
)
*
(
h
-
f
)
/
(
e
-
c
)}};
THREE
.
Matrix3
=
function
(){
this
.
m
=
[]};
THREE
.
Matrix3
.
prototype
=
{
constructor
:
THREE
.
Matrix3
,
transpose
:
function
(){
var
b
,
c
=
this
.
m
;
b
=
c
[
1
];
c
[
1
]
=
c
[
3
];
c
[
3
]
=
b
;
b
=
c
[
2
];
c
[
2
]
=
c
[
6
];
c
[
6
]
=
b
;
b
=
c
[
5
];
c
[
5
]
=
c
[
7
];
c
[
7
]
=
b
;
return
this
},
transposeIntoArray
:
function
(
b
){
var
c
=
this
.
m
;
b
[
0
]
=
c
[
0
];
b
[
1
]
=
c
[
3
];
b
[
2
]
=
c
[
6
];
b
[
3
]
=
c
[
1
];
b
[
4
]
=
c
[
4
];
b
[
5
]
=
c
[
7
];
b
[
6
]
=
c
[
2
];
b
[
7
]
=
c
[
5
];
b
[
8
]
=
c
[
8
];
return
this
}};
THREE
.
Math
=
{
clamp
:
function
(
b
,
c
,
e
){
return
b
<
c
?
c
:
b
>
e
?
e
:
b
},
clampBottom
:
function
(
b
,
c
){
return
b
<
c
?
c
:
b
},
mapLinear
:
function
(
b
,
c
,
e
,
f
,
h
){
return
f
+
(
b
-
c
)
*
(
h
-
f
)
/
(
e
-
c
)},
random16
:
function
(){
return
(
65280
*
Math
.
random
()
+
255
*
Math
.
random
())
/
65535
}};
THREE
.
Matrix3
=
function
(){
this
.
m
=
[]};
THREE
.
Matrix3
.
prototype
=
{
constructor
:
THREE
.
Matrix3
,
transpose
:
function
(){
var
b
,
c
=
this
.
m
;
b
=
c
[
1
];
c
[
1
]
=
c
[
3
];
c
[
3
]
=
b
;
b
=
c
[
2
];
c
[
2
]
=
c
[
6
];
c
[
6
]
=
b
;
b
=
c
[
5
];
c
[
5
]
=
c
[
7
];
c
[
7
]
=
b
;
return
this
},
transposeIntoArray
:
function
(
b
){
var
c
=
this
.
m
;
b
[
0
]
=
c
[
0
];
b
[
1
]
=
c
[
3
];
b
[
2
]
=
c
[
6
];
b
[
3
]
=
c
[
1
];
b
[
4
]
=
c
[
4
];
b
[
5
]
=
c
[
7
];
b
[
6
]
=
c
[
2
];
b
[
7
]
=
c
[
5
];
b
[
8
]
=
c
[
8
];
return
this
}};
THREE
.
Matrix4
=
function
(
b
,
c
,
e
,
f
,
h
,
k
,
m
,
n
,
p
,
t
,
w
,
u
,
x
,
v
,
A
,
z
){
this
.
set
(
b
!==
void
0
?
b
:
1
,
c
||
0
,
e
||
0
,
f
||
0
,
h
||
0
,
k
!==
void
0
?
k
:
1
,
m
||
0
,
n
||
0
,
p
||
0
,
t
||
0
,
w
!==
void
0
?
w
:
1
,
u
||
0
,
x
||
0
,
v
||
0
,
A
||
0
,
z
!==
void
0
?
z
:
1
);
this
.
flat
=
Array
(
16
);
this
.
m33
=
new
THREE
.
Matrix3
};
THREE
.
Matrix4
.
prototype
=
{
constructor
:
THREE
.
Matrix4
,
set
:
function
(
b
,
c
,
e
,
f
,
h
,
k
,
m
,
n
,
p
,
t
,
w
,
u
,
x
,
v
,
A
,
z
){
this
.
n11
=
b
;
this
.
n12
=
c
;
this
.
n13
=
e
;
this
.
n14
=
f
;
this
.
n21
=
h
;
this
.
n22
=
k
;
this
.
n23
=
m
;
this
.
n24
=
n
;
this
.
n31
=
p
;
this
.
n32
=
t
;
this
.
n33
=
w
;
this
.
n34
=
u
;
this
.
n41
=
x
;
this
.
n42
=
v
;
this
.
n43
=
A
;
this
.
n44
=
z
;
return
this
},
identity
:
function
(){
this
.
set
(
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
);
return
this
},
copy
:
function
(
b
){
this
.
set
(
b
.
n11
,
b
.
n12
,
b
.
n13
,
b
.
n14
,
b
.
n21
,
b
.
n22
,
b
.
n23
,
b
.
n24
,
b
.
n31
,
b
.
n32
,
b
.
n33
,
b
.
n34
,
b
.
n41
,
b
.
n42
,
b
.
n43
,
b
.
n44
);
return
this
},
lookAt
:
function
(
b
,
c
,
e
){
var
f
=
THREE
.
Matrix4
.
__v1
,
h
=
THREE
.
Matrix4
.
__v2
,
k
=
THREE
.
Matrix4
.
__v3
;
k
.
sub
(
b
,
c
).
normalize
();
if
(
k
.
length
()
===
0
)
k
.
z
=
1
;
f
.
cross
(
e
,
k
).
normalize
();
f
.
length
()
===
0
&&
(
k
.
x
+=
1.0
E
-
4
,
f
.
cross
(
e
,
k
).
normalize
());
h
.
cross
(
k
,
f
).
normalize
();
this
.
n11
=
f
.
x
;
this
.
n12
=
h
.
x
;
this
.
n13
=
k
.
x
;
this
.
n21
=
f
.
y
;
this
.
n22
=
h
.
y
;
this
.
n23
=
k
.
y
;
this
.
n31
=
f
.
z
;
this
.
n32
=
h
.
z
;
this
.
n33
=
k
.
z
;
return
this
},
multiplyVector3
:
function
(
b
){
var
c
=
b
.
x
,
e
=
b
.
y
,
f
=
b
.
z
,
h
=
1
/
(
this
.
n41
*
c
+
this
.
n42
*
e
+
this
.
n43
*
f
+
this
.
n44
);
b
.
x
=
(
this
.
n11
*
c
+
this
.
n12
*
e
+
this
.
n13
*
f
+
this
.
n14
)
*
h
;
...
...
@@ -359,8 +360,8 @@ for(m=w.length;f<m;f++)t=w[f],p.vertexNormals.push(t.clone());p.color.copy(n.col
f
+
h
>
1
&&
(
f
=
1
-
f
,
h
=
1
-
h
);
k
=
1
-
f
-
h
;
m
.
copy
(
b
);
m
.
multiplyScalar
(
f
);
n
.
copy
(
c
);
n
.
multiplyScalar
(
h
);
m
.
addSelf
(
n
);
n
.
copy
(
e
);
n
.
multiplyScalar
(
k
);
m
.
addSelf
(
n
);
return
m
},
randomPointInFace
:
function
(
b
,
c
,
e
){
var
f
,
h
,
k
;
if
(
b
instanceof
THREE
.
Face3
)
return
f
=
c
.
vertices
[
b
.
a
].
position
,
h
=
c
.
vertices
[
b
.
b
].
position
,
k
=
c
.
vertices
[
b
.
c
].
position
,
THREE
.
GeometryUtils
.
randomPointInTriangle
(
f
,
h
,
k
);
else
if
(
b
instanceof
THREE
.
Face4
){
f
=
c
.
vertices
[
b
.
a
].
position
;
h
=
c
.
vertices
[
b
.
b
].
position
;
k
=
c
.
vertices
[
b
.
c
].
position
;
var
c
=
c
.
vertices
[
b
.
d
].
position
,
m
;
e
?
b
.
_area1
&&
b
.
_area2
?(
e
=
b
.
_area1
,
m
=
b
.
_area2
):(
e
=
THREE
.
GeometryUtils
.
triangleArea
(
f
,
h
,
c
),
m
=
THREE
.
GeometryUtils
.
triangleArea
(
h
,
k
,
c
),
b
.
_area1
=
e
,
b
.
_area2
=
m
):(
e
=
THREE
.
GeometryUtils
.
triangleArea
(
f
,
h
,
c
),
m
=
THREE
.
GeometryUtils
.
triangleArea
(
h
,
k
,
c
));
return
THREE
.
GeometryUtils
.
random
()
*
(
e
+
m
)
<
e
?
THREE
.
GeometryUtils
.
randomPointInTriangle
(
f
,
h
,
c
):
THREE
.
GeometryUtils
.
randomPointInTriangle
(
h
,
k
,
c
)}},
randomPointsInGeometry
:
function
(
b
,
c
){
function
e
(
b
){
function
c
(
e
,
f
){
if
(
f
<
e
)
return
e
;
var
k
=
e
+
Math
.
floor
((
f
-
e
)
/
2
);
return
t
[
k
]
>
b
?
c
(
e
,
k
-
1
):
t
[
k
]
<
b
?
c
(
k
+
1
,
f
):
k
}
return
c
(
0
,
t
.
length
-
1
)}
var
f
,
h
,
k
=
b
.
faces
,
m
=
b
.
vertices
,
n
=
k
.
length
,
p
=
0
,
t
=
[],
w
,
u
,
x
,
v
;
for
(
h
=
0
;
h
<
n
;
h
++
){
f
=
k
[
h
];
if
(
f
instanceof
THREE
.
Face3
)
w
=
m
[
f
.
a
].
position
,
u
=
m
[
f
.
b
].
position
,
x
=
m
[
f
.
c
].
position
,
f
.
_area
=
THREE
.
GeometryUtils
.
triangleArea
(
w
,
u
,
x
);
else
if
(
f
instanceof
THREE
.
Face4
)
w
=
m
[
f
.
a
].
position
,
u
=
m
[
f
.
b
].
position
,
x
=
m
[
f
.
c
].
position
,
v
=
m
[
f
.
d
].
position
,
f
.
_area1
=
THREE
.
GeometryUtils
.
triangleArea
(
w
,
u
,
v
),
f
.
_area2
=
THREE
.
GeometryUtils
.
triangleArea
(
u
,
x
,
v
),
f
.
_area
=
f
.
_area1
+
f
.
_area2
;
p
+=
f
.
_area
;
t
[
h
]
=
p
}
f
=
[];
m
=
{};
for
(
h
=
0
;
h
<
c
;
h
++
)
n
=
THREE
.
GeometryUtils
.
random
()
*
p
,
n
=
e
(
n
),
f
[
h
]
=
THREE
.
GeometryUtils
.
randomPointInFace
(
k
[
n
],
b
,
!
0
),
m
[
n
]?
m
[
n
]
+=
1
:
m
[
n
]
=
1
;
return
f
},
triangleArea
:
function
(
b
,
c
,
e
){
var
f
,
h
=
THREE
.
GeometryUtils
.
__v1
;
h
.
sub
(
b
,
c
);
f
=
h
.
length
();
h
.
sub
(
b
,
e
);
b
=
h
.
length
();
h
.
sub
(
c
,
e
);
e
=
h
.
length
();
c
=
0.5
*
(
f
+
b
+
e
);
return
Math
.
sqrt
(
c
*
(
c
-
f
)
*
(
c
-
b
)
*
(
c
-
e
))},
random16
:
function
(){
return
(
65280
*
Math
.
random
()
+
255
*
Math
.
random
())
/
65535
},
center
:
function
(
b
){
b
.
computeBoundingBox
();
var
c
=
new
THREE
.
Matrix4
;
c
.
setTranslation
(
-
0.5
*
(
b
.
boundingBox
.
x
[
1
]
+
b
.
boundingBox
.
x
[
0
]),
-
0.5
*
(
b
.
boundingBox
.
y
[
1
]
+
b
.
boundingBox
.
y
[
0
]),
-
0.5
*
(
b
.
boundingBox
.
z
[
1
]
+
b
.
boundingBox
.
z
[
0
]));
b
.
applyMatrix
(
c
);
b
.
computeBoundingBox
()}};
THREE
.
GeometryUtils
.
random
=
THREE
.
GeometryUtils
.
random16
;
THREE
.
GeometryUtils
.
__v1
=
new
THREE
.
Vector3
;
t
[
h
]
=
p
}
f
=
[];
m
=
{};
for
(
h
=
0
;
h
<
c
;
h
++
)
n
=
THREE
.
GeometryUtils
.
random
()
*
p
,
n
=
e
(
n
),
f
[
h
]
=
THREE
.
GeometryUtils
.
randomPointInFace
(
k
[
n
],
b
,
!
0
),
m
[
n
]?
m
[
n
]
+=
1
:
m
[
n
]
=
1
;
return
f
},
triangleArea
:
function
(
b
,
c
,
e
){
var
f
,
h
=
THREE
.
GeometryUtils
.
__v1
;
h
.
sub
(
b
,
c
);
f
=
h
.
length
();
h
.
sub
(
b
,
e
);
b
=
h
.
length
();
h
.
sub
(
c
,
e
);
e
=
h
.
length
();
c
=
0.5
*
(
f
+
b
+
e
);
return
Math
.
sqrt
(
c
*
(
c
-
f
)
*
(
c
-
b
)
*
(
c
-
e
))},
center
:
function
(
b
){
b
.
computeBoundingBox
();
var
c
=
new
THREE
.
Matrix4
;
c
.
setTranslation
(
-
0.5
*
(
b
.
boundingBox
.
x
[
1
]
+
b
.
boundingBox
.
x
[
0
]),
-
0.5
*
(
b
.
boundingBox
.
y
[
1
]
+
b
.
boundingBox
.
y
[
0
]),
-
0.5
*
(
b
.
boundingBox
.
z
[
1
]
+
b
.
boundingBox
.
z
[
0
]));
b
.
applyMatrix
(
c
);
b
.
computeBoundingBox
()}};
THREE
.
GeometryUtils
.
random
=
THREE
.
Math
.
random16
;
THREE
.
GeometryUtils
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
ImageUtils
=
{
loadTexture
:
function
(
b
,
c
,
e
){
var
f
=
new
Image
,
h
=
new
THREE
.
Texture
(
f
,
c
);
f
.
onload
=
function
(){
h
.
needsUpdate
=!
0
;
e
&&
e
(
this
)};
f
.
crossOrigin
=
""
;
f
.
src
=
b
;
return
h
},
loadTextureCube
:
function
(
b
,
c
,
e
){
var
f
,
h
=
[],
k
=
new
THREE
.
Texture
(
h
,
c
),
c
=
h
.
loadCount
=
0
;
for
(
f
=
b
.
length
;
c
<
f
;
++
c
)
h
[
c
]
=
new
Image
,
h
[
c
].
onload
=
function
(){
h
.
loadCount
+=
1
;
if
(
h
.
loadCount
==
6
)
k
.
needsUpdate
=!
0
;
e
&&
e
(
this
)},
h
[
c
].
crossOrigin
=
""
,
h
[
c
].
src
=
b
[
c
];
return
k
},
getNormalMap
:
function
(
b
,
c
){
var
e
=
function
(
b
){
var
c
=
Math
.
sqrt
(
b
[
0
]
*
b
[
0
]
+
b
[
1
]
*
b
[
1
]
+
b
[
2
]
*
b
[
2
]);
return
[
b
[
0
]
/
c
,
b
[
1
]
/
c
,
b
[
2
]
/
c
]};
c
|=
1
;
var
f
=
b
.
width
,
h
=
b
.
height
,
k
=
document
.
createElement
(
"
canvas
"
);
k
.
width
=
f
;
k
.
height
=
h
;
var
m
=
k
.
getContext
(
"
2d
"
);
m
.
drawImage
(
b
,
0
,
0
);
for
(
var
n
=
m
.
getImageData
(
0
,
0
,
f
,
h
).
data
,
p
=
m
.
createImageData
(
f
,
h
),
t
=
p
.
data
,
w
=
0
;
w
<
f
;
w
++
)
for
(
var
u
=
1
;
u
<
h
;
u
++
){
var
x
=
u
-
1
<
0
?
h
-
1
:
u
-
1
,
v
=
(
u
+
1
)
%
h
,
A
=
w
-
1
<
0
?
f
-
1
:
w
-
1
,
z
=
(
w
+
1
)
%
f
,
y
=
[],
E
=
[
0
,
0
,
n
[(
u
*
f
+
w
)
*
4
]
/
255
*
c
];
y
.
push
([
-
1
,
0
,
n
[(
u
*
f
+
A
)
*
4
]
/
255
*
c
]);
y
.
push
([
-
1
,
-
1
,
n
[(
x
*
f
+
A
)
*
4
]
/
255
*
c
]);
y
.
push
([
0
,
-
1
,
n
[(
x
*
f
+
w
)
*
4
]
/
255
*
c
]);
y
.
push
([
1
,
-
1
,
n
[(
x
*
f
+
z
)
*
4
]
/
255
*
c
]);
y
.
push
([
1
,
0
,
n
[(
u
*
f
+
z
)
*
4
]
/
255
*
c
]);
y
.
push
([
1
,
1
,
n
[(
v
*
f
+
z
)
*
4
]
/
255
*
c
]);
y
.
push
([
0
,
1
,
n
[(
v
*
f
+
w
)
*
4
]
/
255
*
c
]);
y
.
push
([
-
1
,
1
,
n
[(
v
*
f
+
A
)
*
4
]
/
255
*
c
]);
x
=
[];
A
=
y
.
length
;
for
(
v
=
0
;
v
<
A
;
v
++
){
var
z
=
y
[
v
],
F
=
y
[(
v
+
1
)
%
A
],
z
=
[
z
[
0
]
-
E
[
0
],
z
[
1
]
-
E
[
1
],
z
[
2
]
-
E
[
2
]],
F
=
[
F
[
0
]
-
E
[
0
],
F
[
1
]
-
E
[
1
],
F
[
2
]
-
E
[
2
]];
x
.
push
(
e
([
z
[
1
]
*
F
[
2
]
-
z
[
2
]
*
F
[
1
],
z
[
2
]
*
F
[
0
]
-
z
[
0
]
*
F
[
2
],
z
[
0
]
*
F
[
1
]
-
z
[
1
]
*
F
[
0
]]))}
y
=
[
0
,
0
,
0
];
for
(
v
=
0
;
v
<
x
.
length
;
v
++
)
y
[
0
]
+=
x
[
v
][
0
],
y
[
1
]
+=
x
[
v
][
1
],
y
[
2
]
+=
x
[
v
][
2
];
y
[
0
]
/=
x
.
length
;
y
[
1
]
/=
x
.
length
;
y
[
2
]
/=
x
.
length
;
E
=
(
u
*
f
+
w
)
*
4
;
t
[
E
]
=
(
y
[
0
]
+
1
)
/
2
*
255
|
0
;
t
[
E
+
1
]
=
(
y
[
1
]
+
0.5
)
*
...
...
build/custom/ThreeExtras.js
浏览文件 @
9902cbbf
...
...
@@ -8,8 +8,8 @@ for(g=n.length;e<g;e++)m=n[e],l.vertexNormals.push(m.clone());l.color.copy(k.col
e
+
f
>
1
&&
(
e
=
1
-
e
,
f
=
1
-
f
);
h
=
1
-
e
-
f
;
g
.
copy
(
a
);
g
.
multiplyScalar
(
e
);
k
.
copy
(
b
);
k
.
multiplyScalar
(
f
);
g
.
addSelf
(
k
);
k
.
copy
(
c
);
k
.
multiplyScalar
(
h
);
g
.
addSelf
(
k
);
return
g
},
randomPointInFace
:
function
(
a
,
b
,
c
){
var
e
,
f
,
h
;
if
(
a
instanceof
THREE
.
Face3
)
return
e
=
b
.
vertices
[
a
.
a
].
position
,
f
=
b
.
vertices
[
a
.
b
].
position
,
h
=
b
.
vertices
[
a
.
c
].
position
,
THREE
.
GeometryUtils
.
randomPointInTriangle
(
e
,
f
,
h
);
else
if
(
a
instanceof
THREE
.
Face4
){
e
=
b
.
vertices
[
a
.
a
].
position
;
f
=
b
.
vertices
[
a
.
b
].
position
;
h
=
b
.
vertices
[
a
.
c
].
position
;
var
b
=
b
.
vertices
[
a
.
d
].
position
,
g
;
c
?
a
.
_area1
&&
a
.
_area2
?(
c
=
a
.
_area1
,
g
=
a
.
_area2
):(
c
=
THREE
.
GeometryUtils
.
triangleArea
(
e
,
f
,
b
),
g
=
THREE
.
GeometryUtils
.
triangleArea
(
f
,
h
,
b
),
a
.
_area1
=
c
,
a
.
_area2
=
g
):(
c
=
THREE
.
GeometryUtils
.
triangleArea
(
e
,
f
,
b
),
g
=
THREE
.
GeometryUtils
.
triangleArea
(
f
,
h
,
b
));
return
THREE
.
GeometryUtils
.
random
()
*
(
c
+
g
)
<
c
?
THREE
.
GeometryUtils
.
randomPointInTriangle
(
e
,
f
,
b
):
THREE
.
GeometryUtils
.
randomPointInTriangle
(
f
,
h
,
b
)}},
randomPointsInGeometry
:
function
(
a
,
b
){
function
c
(
a
){
function
c
(
b
,
e
){
if
(
e
<
b
)
return
b
;
var
g
=
b
+
Math
.
floor
((
e
-
b
)
/
2
);
return
m
[
g
]
>
a
?
c
(
b
,
g
-
1
):
m
[
g
]
<
a
?
c
(
g
+
1
,
e
):
g
}
return
c
(
0
,
m
.
length
-
1
)}
var
e
,
f
,
h
=
a
.
faces
,
g
=
a
.
vertices
,
k
=
h
.
length
,
l
=
0
,
m
=
[],
n
,
o
,
t
,
u
;
for
(
f
=
0
;
f
<
k
;
f
++
){
e
=
h
[
f
];
if
(
e
instanceof
THREE
.
Face3
)
n
=
g
[
e
.
a
].
position
,
o
=
g
[
e
.
b
].
position
,
t
=
g
[
e
.
c
].
position
,
e
.
_area
=
THREE
.
GeometryUtils
.
triangleArea
(
n
,
o
,
t
);
else
if
(
e
instanceof
THREE
.
Face4
)
n
=
g
[
e
.
a
].
position
,
o
=
g
[
e
.
b
].
position
,
t
=
g
[
e
.
c
].
position
,
u
=
g
[
e
.
d
].
position
,
e
.
_area1
=
THREE
.
GeometryUtils
.
triangleArea
(
n
,
o
,
u
),
e
.
_area2
=
THREE
.
GeometryUtils
.
triangleArea
(
o
,
t
,
u
),
e
.
_area
=
e
.
_area1
+
e
.
_area2
;
l
+=
e
.
_area
;
m
[
f
]
=
l
}
e
=
[];
g
=
{};
for
(
f
=
0
;
f
<
b
;
f
++
)
k
=
THREE
.
GeometryUtils
.
random
()
*
l
,
k
=
c
(
k
),
e
[
f
]
=
THREE
.
GeometryUtils
.
randomPointInFace
(
h
[
k
],
a
,
!
0
),
g
[
k
]?
g
[
k
]
+=
1
:
g
[
k
]
=
1
;
return
e
},
triangleArea
:
function
(
a
,
b
,
c
){
var
e
,
f
=
THREE
.
GeometryUtils
.
__v1
;
f
.
sub
(
a
,
b
);
e
=
f
.
length
();
f
.
sub
(
a
,
c
);
a
=
f
.
length
();
f
.
sub
(
b
,
c
);
c
=
f
.
length
();
b
=
0.5
*
(
e
+
a
+
c
);
return
Math
.
sqrt
(
b
*
(
b
-
e
)
*
(
b
-
a
)
*
(
b
-
c
))},
random16
:
function
(){
return
(
65280
*
Math
.
random
()
+
255
*
Math
.
random
())
/
65535
},
center
:
function
(
a
){
a
.
computeBoundingBox
();
var
b
=
new
THREE
.
Matrix4
;
b
.
setTranslation
(
-
0.5
*
(
a
.
boundingBox
.
x
[
1
]
+
a
.
boundingBox
.
x
[
0
]),
-
0.5
*
(
a
.
boundingBox
.
y
[
1
]
+
a
.
boundingBox
.
y
[
0
]),
-
0.5
*
(
a
.
boundingBox
.
z
[
1
]
+
a
.
boundingBox
.
z
[
0
]));
a
.
applyMatrix
(
b
);
a
.
computeBoundingBox
()}};
THREE
.
GeometryUtils
.
random
=
THREE
.
GeometryUtils
.
random16
;
THREE
.
GeometryUtils
.
__v1
=
new
THREE
.
Vector3
;
m
[
f
]
=
l
}
e
=
[];
g
=
{};
for
(
f
=
0
;
f
<
b
;
f
++
)
k
=
THREE
.
GeometryUtils
.
random
()
*
l
,
k
=
c
(
k
),
e
[
f
]
=
THREE
.
GeometryUtils
.
randomPointInFace
(
h
[
k
],
a
,
!
0
),
g
[
k
]?
g
[
k
]
+=
1
:
g
[
k
]
=
1
;
return
e
},
triangleArea
:
function
(
a
,
b
,
c
){
var
e
,
f
=
THREE
.
GeometryUtils
.
__v1
;
f
.
sub
(
a
,
b
);
e
=
f
.
length
();
f
.
sub
(
a
,
c
);
a
=
f
.
length
();
f
.
sub
(
b
,
c
);
c
=
f
.
length
();
b
=
0.5
*
(
e
+
a
+
c
);
return
Math
.
sqrt
(
b
*
(
b
-
e
)
*
(
b
-
a
)
*
(
b
-
c
))},
center
:
function
(
a
){
a
.
computeBoundingBox
();
var
b
=
new
THREE
.
Matrix4
;
b
.
setTranslation
(
-
0.5
*
(
a
.
boundingBox
.
x
[
1
]
+
a
.
boundingBox
.
x
[
0
]),
-
0.5
*
(
a
.
boundingBox
.
y
[
1
]
+
a
.
boundingBox
.
y
[
0
]),
-
0.5
*
(
a
.
boundingBox
.
z
[
1
]
+
a
.
boundingBox
.
z
[
0
]));
a
.
applyMatrix
(
b
);
a
.
computeBoundingBox
()}};
THREE
.
GeometryUtils
.
random
=
THREE
.
Math
.
random16
;
THREE
.
GeometryUtils
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
ImageUtils
=
{
loadTexture
:
function
(
a
,
b
,
c
){
var
e
=
new
Image
,
f
=
new
THREE
.
Texture
(
e
,
b
);
e
.
onload
=
function
(){
f
.
needsUpdate
=!
0
;
c
&&
c
(
this
)};
e
.
crossOrigin
=
""
;
e
.
src
=
a
;
return
f
},
loadTextureCube
:
function
(
a
,
b
,
c
){
var
e
,
f
=
[],
h
=
new
THREE
.
Texture
(
f
,
b
),
b
=
f
.
loadCount
=
0
;
for
(
e
=
a
.
length
;
b
<
e
;
++
b
)
f
[
b
]
=
new
Image
,
f
[
b
].
onload
=
function
(){
f
.
loadCount
+=
1
;
if
(
f
.
loadCount
==
6
)
h
.
needsUpdate
=!
0
;
c
&&
c
(
this
)},
f
[
b
].
crossOrigin
=
""
,
f
[
b
].
src
=
a
[
b
];
return
h
},
getNormalMap
:
function
(
a
,
b
){
var
c
=
function
(
a
){
var
c
=
Math
.
sqrt
(
a
[
0
]
*
a
[
0
]
+
a
[
1
]
*
a
[
1
]
+
a
[
2
]
*
a
[
2
]);
return
[
a
[
0
]
/
c
,
a
[
1
]
/
c
,
a
[
2
]
/
c
]};
b
|=
1
;
var
e
=
a
.
width
,
f
=
a
.
height
,
h
=
document
.
createElement
(
"
canvas
"
);
h
.
width
=
e
;
h
.
height
=
f
;
var
g
=
h
.
getContext
(
"
2d
"
);
g
.
drawImage
(
a
,
0
,
0
);
for
(
var
k
=
g
.
getImageData
(
0
,
0
,
e
,
f
).
data
,
l
=
g
.
createImageData
(
e
,
f
),
m
=
l
.
data
,
n
=
0
;
n
<
e
;
n
++
)
for
(
var
o
=
1
;
o
<
f
;
o
++
){
var
t
=
o
-
1
<
0
?
f
-
1
:
o
-
1
,
u
=
(
o
+
1
)
%
f
,
v
=
n
-
1
<
0
?
e
-
1
:
n
-
1
,
y
=
(
n
+
1
)
%
e
,
p
=
[],
z
=
[
0
,
0
,
k
[(
o
*
e
+
n
)
*
4
]
/
255
*
b
];
p
.
push
([
-
1
,
0
,
k
[(
o
*
e
+
v
)
*
4
]
/
255
*
b
]);
p
.
push
([
-
1
,
-
1
,
k
[(
t
*
e
+
v
)
*
4
]
/
255
*
b
]);
p
.
push
([
0
,
-
1
,
k
[(
t
*
e
+
n
)
*
4
]
/
255
*
b
]);
p
.
push
([
1
,
-
1
,
k
[(
t
*
e
+
y
)
*
4
]
/
255
*
b
]);
p
.
push
([
1
,
0
,
k
[(
o
*
e
+
y
)
*
4
]
/
255
*
b
]);
p
.
push
([
1
,
1
,
k
[(
u
*
e
+
y
)
*
4
]
/
255
*
b
]);
p
.
push
([
0
,
1
,
k
[(
u
*
e
+
n
)
*
4
]
/
255
*
b
]);
p
.
push
([
-
1
,
1
,
k
[(
u
*
e
+
v
)
*
4
]
/
255
*
b
]);
t
=
[];
v
=
p
.
length
;
for
(
u
=
0
;
u
<
v
;
u
++
){
var
y
=
p
[
u
],
x
=
p
[(
u
+
1
)
%
v
],
y
=
[
y
[
0
]
-
z
[
0
],
y
[
1
]
-
z
[
1
],
y
[
2
]
-
z
[
2
]],
x
=
[
x
[
0
]
-
z
[
0
],
x
[
1
]
-
z
[
1
],
x
[
2
]
-
z
[
2
]];
t
.
push
(
c
([
y
[
1
]
*
x
[
2
]
-
y
[
2
]
*
x
[
1
],
y
[
2
]
*
x
[
0
]
-
y
[
0
]
*
x
[
2
],
y
[
0
]
*
x
[
1
]
-
y
[
1
]
*
x
[
0
]]))}
p
=
[
0
,
0
,
0
];
for
(
u
=
0
;
u
<
t
.
length
;
u
++
)
p
[
0
]
+=
t
[
u
][
0
],
p
[
1
]
+=
t
[
u
][
1
],
p
[
2
]
+=
t
[
u
][
2
];
p
[
0
]
/=
t
.
length
;
p
[
1
]
/=
t
.
length
;
p
[
2
]
/=
t
.
length
;
z
=
(
o
*
e
+
n
)
*
4
;
m
[
z
]
=
(
p
[
0
]
+
1
)
/
2
*
255
|
0
;
m
[
z
+
1
]
=
(
p
[
1
]
+
0.5
)
*
...
...
examples/webgl_materials_cars.html
浏览文件 @
9902cbbf
...
...
@@ -601,7 +601,7 @@
function
render
()
{
var
timer
=
-
new
Date
().
getTime
()
*
0.0002
;
var
timer
=
-
Date
.
now
()
*
0.0002
;
camera
.
position
.
y
+=
(
-
mouseY
-
camera
.
position
.
y
)
*
.
05
;
...
...
examples/webgl_materials_cubemap_dynamic.html
浏览文件 @
9902cbbf
...
...
@@ -93,7 +93,7 @@
var
cubeCamera
;
var
oldTime
=
new
Date
().
getTime
();
var
oldTime
=
Date
.
now
();
var
controlsGallardo
=
{
...
...
@@ -875,7 +875,7 @@
function
render
()
{
var
newTime
=
new
Date
().
getTime
();
var
newTime
=
Date
.
now
();
var
delta
=
0.001
*
(
newTime
-
oldTime
);
oldTime
=
newTime
;
...
...
examples/webgl_particles_dynamic.html
浏览文件 @
9902cbbf
...
...
@@ -297,13 +297,9 @@
function
render
()
{
if
(
!
oldTime
)
{
if
(
!
oldTime
)
oldTime
=
Date
.
now
();
oldTime
=
new
Date
().
getTime
();
}
time
=
new
Date
().
getTime
();
time
=
Date
.
now
();
delta
=
0.01
*
(
time
-
oldTime
);
oldTime
=
time
;
...
...
examples/webgl_postprocessing.html
浏览文件 @
9902cbbf
...
...
@@ -380,7 +380,7 @@
function
render
()
{
var
time
=
new
Date
().
getTime
()
*
0.0004
;
var
time
=
Date
.
now
()
*
0.0004
;
if
(
mesh
)
mesh
.
rotation
.
y
=
-
time
;
...
...
examples/webgl_postprocessing_dof.html
浏览文件 @
9902cbbf
...
...
@@ -278,7 +278,7 @@
function
render
()
{
var
time
=
new
Date
().
getTime
()
*
0.00005
;
var
time
=
Date
.
now
()
*
0.00005
;
camera
.
position
.
x
+=
(
mouseX
-
camera
.
position
.
x
)
*
0.036
;
camera
.
position
.
y
+=
(
-
(
mouseY
)
-
camera
.
position
.
y
)
*
0.036
;
...
...
examples/webgl_ribbons.html
浏览文件 @
9902cbbf
...
...
@@ -259,7 +259,7 @@
function
render
()
{
var
time
=
new
Date
().
getTime
()
*
0.00005
;
var
time
=
Date
.
now
()
*
0.00005
;
camera
.
position
.
x
+=
(
mouseX
-
camera
.
position
.
x
)
*
0.036
;
camera
.
position
.
y
+=
(
-
mouseY
-
camera
.
position
.
y
)
*
0.036
;
...
...
examples/webgl_shader_lava.html
浏览文件 @
9902cbbf
...
...
@@ -145,7 +145,7 @@
scene
=
new
THREE
.
Scene
();
start_time
=
new
Date
().
getTime
();
start_time
=
Date
.
now
();
uniforms
=
{
...
...
examples/webgl_shading_physical.html
浏览文件 @
9902cbbf
...
...
@@ -592,9 +592,9 @@
function
render
()
{
if
(
oldTime
===
undefined
)
oldTime
=
new
Date
().
getTime
();
if
(
oldTime
===
undefined
)
oldTime
=
Date
.
now
();
var
newTime
=
new
Date
().
getTime
();
var
newTime
=
Date
.
now
();
var
delta
=
newTime
-
oldTime
;
oldTime
=
newTime
;
...
...
examples/webgl_shadowmap.html
浏览文件 @
9902cbbf
...
...
@@ -364,9 +364,9 @@
function
render
()
{
if
(
oldTime
===
undefined
)
oldTime
=
new
Date
().
getTime
();
if
(
oldTime
===
undefined
)
oldTime
=
Date
.
now
();
newTime
=
new
Date
().
getTime
();
newTime
=
Date
.
now
();
delta
=
newTime
-
oldTime
;
oldTime
=
newTime
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录