Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
b74342a4
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,发现更多精彩内容 >>
提交
b74342a4
编写于
1月 12, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated RequestAnimationFrame polyfill.
上级
541bf84b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
209 addition
and
190 deletion
+209
-190
build/Three.js
build/Three.js
+4
-3
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+3
-1
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+3
-1
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+3
-1
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+167
-165
src/Three.js
src/Three.js
+29
-19
未找到文件。
build/Three.js
浏览文件 @
b74342a4
// Three.js r47dev - http://github.com/mrdoob/three.js
'
use strict
'
;
var
THREE
=
THREE
||
{};
if
(
!
self
.
Int32Array
)
self
.
Int32Array
=
Array
,
self
.
Float32Array
=
Array
;
if
(
!
self
.
requestAnimationFrame
)
self
.
requestAnimationFrame
=
function
(){
return
self
.
webkitRequestAnimationFrame
||
self
.
mozRequestAnimationFrame
||
self
.
oRequestAnimationFrame
||
self
.
msRequestAnimationFrame
||
function
(
a
){
self
.
setTimeout
(
a
,
1
E3
/
60
)}}();
THREE
.
Clock
=
function
(
a
){
this
.
autoStart
=
void
0
!==
a
?
a
:
!
0
;
this
.
elapsedTime
=
this
.
oldTime
=
this
.
startTime
=
0
;
this
.
running
=!
1
};
THREE
.
Clock
.
prototype
.
start
=
function
(){
this
.
oldTime
=
this
.
startTime
=
Date
.
now
();
this
.
running
=!
0
};
THREE
.
Clock
.
prototype
.
stop
=
function
(){
this
.
getElapsedTime
();
this
.
running
=!
1
};
THREE
.
Clock
.
prototype
.
getElapsedTime
=
function
(){
return
this
.
elapsedTime
+=
this
.
getDelta
()};
THREE
.
Clock
.
prototype
.
getDelta
=
function
(){
var
a
=
0
;
this
.
autoStart
&&!
this
.
running
&&
this
.
start
();
if
(
this
.
running
){
var
b
=
Date
.
now
(),
a
=
0.001
*
(
b
-
this
.
oldTime
);
this
.
oldTime
=
b
;
this
.
elapsedTime
+=
a
}
return
a
};
THREE
.
Color
=
function
(
a
){
void
0
!==
a
&&
this
.
setHex
(
a
);
return
this
};
'
use strict
'
;
var
THREE
=
THREE
||
{};
if
(
!
self
.
Int32Array
)
self
.
Int32Array
=
Array
,
self
.
Float32Array
=
Array
;
(
function
(){
for
(
var
a
=
0
,
b
=
[
"
ms
"
,
"
moz
"
,
"
webkit
"
,
"
o
"
],
c
=
0
;
c
<
b
.
length
&&!
window
.
requestAnimationFrame
;
++
c
)
window
.
requestAnimationFrame
=
window
[
b
[
c
]
+
"
RequestAnimationFrame
"
],
window
.
cancelAnimationFrame
=
window
[
b
[
c
]
+
"
CancelAnimationFrame
"
]
||
window
[
b
[
c
]
+
"
RequestCancelAnimationFrame
"
];
if
(
!
window
.
requestAnimationFrame
)
window
.
requestAnimationFrame
=
function
(
b
){
var
c
=
(
new
Date
).
getTime
(),
f
=
Math
.
max
(
0
,
16
-
(
c
-
a
)),
g
=
window
.
setTimeout
(
function
(){
b
(
c
+
f
)},
f
);
a
=
c
+
f
;
return
g
};
if
(
!
window
.
cancelAnimationFrame
)
window
.
cancelAnimationFrame
=
function
(
a
){
clearTimeout
(
a
)}})();
THREE
.
Clock
=
function
(
a
){
this
.
autoStart
=
void
0
!==
a
?
a
:
!
0
;
this
.
elapsedTime
=
this
.
oldTime
=
this
.
startTime
=
0
;
this
.
running
=!
1
};
THREE
.
Clock
.
prototype
.
start
=
function
(){
this
.
oldTime
=
this
.
startTime
=
Date
.
now
();
this
.
running
=!
0
};
THREE
.
Clock
.
prototype
.
stop
=
function
(){
this
.
getElapsedTime
();
this
.
running
=!
1
};
THREE
.
Clock
.
prototype
.
getElapsedTime
=
function
(){
return
this
.
elapsedTime
+=
this
.
getDelta
()};
THREE
.
Clock
.
prototype
.
getDelta
=
function
(){
var
a
=
0
;
this
.
autoStart
&&!
this
.
running
&&
this
.
start
();
if
(
this
.
running
){
var
b
=
Date
.
now
(),
a
=
0.001
*
(
b
-
this
.
oldTime
);
this
.
oldTime
=
b
;
this
.
elapsedTime
+=
a
}
return
a
};
THREE
.
Color
=
function
(
a
){
void
0
!==
a
&&
this
.
setHex
(
a
);
return
this
};
THREE
.
Color
.
prototype
=
{
constructor
:
THREE
.
Color
,
r
:
1
,
g
:
1
,
b
:
1
,
copy
:
function
(
a
){
this
.
r
=
a
.
r
;
this
.
g
=
a
.
g
;
this
.
b
=
a
.
b
;
return
this
},
copyGammaToLinear
:
function
(
a
){
this
.
r
=
a
.
r
*
a
.
r
;
this
.
g
=
a
.
g
*
a
.
g
;
this
.
b
=
a
.
b
*
a
.
b
;
return
this
},
copyLinearToGamma
:
function
(
a
){
this
.
r
=
Math
.
sqrt
(
a
.
r
);
this
.
g
=
Math
.
sqrt
(
a
.
g
);
this
.
b
=
Math
.
sqrt
(
a
.
b
);
return
this
},
convertGammaToLinear
:
function
(){
var
a
=
this
.
r
,
b
=
this
.
g
,
c
=
this
.
b
;
this
.
r
=
a
*
a
;
this
.
g
=
b
*
b
;
this
.
b
=
c
*
c
;
return
this
},
convertLinearToGamma
:
function
(){
this
.
r
=
Math
.
sqrt
(
this
.
r
);
this
.
g
=
Math
.
sqrt
(
this
.
g
);
this
.
b
=
Math
.
sqrt
(
this
.
b
);
return
this
},
setRGB
:
function
(
a
,
b
,
c
){
this
.
r
=
a
;
this
.
g
=
b
;
this
.
b
=
c
;
return
this
},
setHSV
:
function
(
a
,
b
,
c
){
var
d
,
e
,
f
;
if
(
0
===
c
)
this
.
r
=
this
.
g
=
this
.
b
=
0
;
else
switch
(
d
=
Math
.
floor
(
6
*
a
),
e
=
6
*
a
-
d
,
a
=
c
*
(
1
-
b
),
f
=
c
*
(
1
-
b
*
e
),
b
=
c
*
(
1
-
b
*
(
1
-
e
)),
d
){
case
1
:
this
.
r
=
f
;
this
.
g
=
c
;
this
.
b
=
a
;
break
;
case
2
:
this
.
r
=
a
;
this
.
g
=
c
;
this
.
b
=
b
;
break
;
case
3
:
this
.
r
=
a
;
this
.
g
=
f
;
this
.
b
=
c
;
break
;
case
4
:
this
.
r
=
b
;
this
.
g
=
a
;
this
.
b
=
c
;
break
;
case
5
:
this
.
r
=
c
;
this
.
g
=
a
;
this
.
b
=
f
;
break
;
case
6
:
case
0
:
this
.
r
=
c
,
this
.
g
=
b
,
this
.
b
=
a
}
return
this
},
setHex
:
function
(
a
){
a
=
Math
.
floor
(
a
);
this
.
r
=
(
a
>>
16
&
255
)
/
255
;
this
.
g
=
(
a
>>
8
&
255
)
/
255
;
this
.
b
=
(
a
&
255
)
/
255
;
return
this
},
getHex
:
function
(){
return
Math
.
floor
(
255
*
this
.
r
)
<<
16
^
Math
.
floor
(
255
*
this
.
g
)
<<
8
^
Math
.
floor
(
255
*
this
.
b
)},
getContextStyle
:
function
(){
return
"
rgb(
"
+
Math
.
floor
(
255
*
this
.
r
)
+
"
,
"
+
Math
.
floor
(
255
*
this
.
g
)
+
"
,
"
+
Math
.
floor
(
255
*
this
.
b
)
+
"
)
"
},
clone
:
function
(){
return
(
new
THREE
.
Color
).
setRGB
(
this
.
r
,
this
.
g
,
this
.
b
)}};
THREE
.
Vector2
=
function
(
a
,
b
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
};
...
...
build/custom/ThreeCanvas.js
浏览文件 @
b74342a4
// ThreeCanvas.js r47dev - http://github.com/mrdoob/three.js
'
use strict
'
;
var
THREE
=
THREE
||
{};
if
(
!
self
.
Int32Array
)
self
.
Int32Array
=
Array
,
self
.
Float32Array
=
Array
;
if
(
!
self
.
requestAnimationFrame
)
self
.
requestAnimationFrame
=
function
(){
return
self
.
webkitRequestAnimationFrame
||
self
.
mozRequestAnimationFrame
||
self
.
oRequestAnimationFrame
||
self
.
msRequestAnimationFrame
||
function
(
a
){
self
.
setTimeout
(
a
,
1
E3
/
60
)}}();
THREE
.
Color
=
function
(
a
){
void
0
!==
a
&&
this
.
setHex
(
a
);
return
this
};
'
use strict
'
;
var
THREE
=
THREE
||
{};
if
(
!
self
.
Int32Array
)
self
.
Int32Array
=
Array
,
self
.
Float32Array
=
Array
;
(
function
(){
for
(
var
a
=
0
,
b
=
[
"
ms
"
,
"
moz
"
,
"
webkit
"
,
"
o
"
],
c
=
0
;
c
<
b
.
length
&&!
window
.
requestAnimationFrame
;
++
c
)
window
.
requestAnimationFrame
=
window
[
b
[
c
]
+
"
RequestAnimationFrame
"
],
window
.
cancelAnimationFrame
=
window
[
b
[
c
]
+
"
CancelAnimationFrame
"
]
||
window
[
b
[
c
]
+
"
RequestCancelAnimationFrame
"
];
if
(
!
window
.
requestAnimationFrame
)
window
.
requestAnimationFrame
=
function
(
b
){
var
c
=
(
new
Date
).
getTime
(),
f
=
Math
.
max
(
0
,
16
-
(
c
-
a
)),
g
=
window
.
setTimeout
(
function
(){
b
(
c
+
f
)},
f
);
a
=
c
+
f
;
return
g
};
if
(
!
window
.
cancelAnimationFrame
)
window
.
cancelAnimationFrame
=
function
(
a
){
clearTimeout
(
a
)}})();
THREE
.
Color
=
function
(
a
){
void
0
!==
a
&&
this
.
setHex
(
a
);
return
this
};
THREE
.
Color
.
prototype
=
{
constructor
:
THREE
.
Color
,
r
:
1
,
g
:
1
,
b
:
1
,
copy
:
function
(
a
){
this
.
r
=
a
.
r
;
this
.
g
=
a
.
g
;
this
.
b
=
a
.
b
;
return
this
},
copyGammaToLinear
:
function
(
a
){
this
.
r
=
a
.
r
*
a
.
r
;
this
.
g
=
a
.
g
*
a
.
g
;
this
.
b
=
a
.
b
*
a
.
b
;
return
this
},
copyLinearToGamma
:
function
(
a
){
this
.
r
=
Math
.
sqrt
(
a
.
r
);
this
.
g
=
Math
.
sqrt
(
a
.
g
);
this
.
b
=
Math
.
sqrt
(
a
.
b
);
return
this
},
convertGammaToLinear
:
function
(){
var
a
=
this
.
r
,
b
=
this
.
g
,
c
=
this
.
b
;
this
.
r
=
a
*
a
;
this
.
g
=
b
*
b
;
this
.
b
=
c
*
c
;
return
this
},
convertLinearToGamma
:
function
(){
this
.
r
=
Math
.
sqrt
(
this
.
r
);
this
.
g
=
Math
.
sqrt
(
this
.
g
);
this
.
b
=
Math
.
sqrt
(
this
.
b
);
return
this
},
setRGB
:
function
(
a
,
b
,
c
){
this
.
r
=
a
;
this
.
g
=
b
;
this
.
b
=
c
;
return
this
},
setHSV
:
function
(
a
,
b
,
c
){
var
d
,
e
,
f
;
if
(
0
===
c
)
this
.
r
=
this
.
g
=
this
.
b
=
0
;
else
switch
(
d
=
Math
.
floor
(
6
*
a
),
e
=
6
*
a
-
d
,
a
=
c
*
(
1
-
b
),
f
=
c
*
(
1
-
b
*
e
),
b
=
c
*
(
1
-
b
*
(
1
-
e
)),
d
){
case
1
:
this
.
r
=
f
;
this
.
g
=
c
;
this
.
b
=
a
;
break
;
case
2
:
this
.
r
=
a
;
this
.
g
=
c
;
this
.
b
=
b
;
break
;
case
3
:
this
.
r
=
a
;
this
.
g
=
f
;
this
.
b
=
c
;
break
;
case
4
:
this
.
r
=
b
;
this
.
g
=
a
;
this
.
b
=
c
;
break
;
case
5
:
this
.
r
=
c
;
this
.
g
=
a
;
this
.
b
=
f
;
break
;
case
6
:
case
0
:
this
.
r
=
c
,
this
.
g
=
b
,
this
.
b
=
a
}
return
this
},
setHex
:
function
(
a
){
a
=
Math
.
floor
(
a
);
this
.
r
=
(
a
>>
16
&
255
)
/
255
;
this
.
g
=
(
a
>>
8
&
255
)
/
255
;
this
.
b
=
(
a
&
255
)
/
255
;
return
this
},
getHex
:
function
(){
return
Math
.
floor
(
255
*
this
.
r
)
<<
16
^
Math
.
floor
(
255
*
this
.
g
)
<<
8
^
Math
.
floor
(
255
*
this
.
b
)},
getContextStyle
:
function
(){
return
"
rgb(
"
+
Math
.
floor
(
255
*
this
.
r
)
+
"
,
"
+
Math
.
floor
(
255
*
this
.
g
)
+
"
,
"
+
Math
.
floor
(
255
*
this
.
b
)
+
"
)
"
},
clone
:
function
(){
return
(
new
THREE
.
Color
).
setRGB
(
this
.
r
,
this
.
g
,
this
.
b
)}};
THREE
.
Vector2
=
function
(
a
,
b
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
};
...
...
build/custom/ThreeDOM.js
浏览文件 @
b74342a4
// ThreeDOM.js r47dev - http://github.com/mrdoob/three.js
'
use strict
'
;
var
THREE
=
THREE
||
{};
if
(
!
self
.
Int32Array
)
self
.
Int32Array
=
Array
,
self
.
Float32Array
=
Array
;
if
(
!
self
.
requestAnimationFrame
)
self
.
requestAnimationFrame
=
function
(){
return
self
.
webkitRequestAnimationFrame
||
self
.
mozRequestAnimationFrame
||
self
.
oRequestAnimationFrame
||
self
.
msRequestAnimationFrame
||
function
(
a
){
self
.
setTimeout
(
a
,
1
E3
/
60
)}}();
THREE
.
Color
=
function
(
a
){
void
0
!==
a
&&
this
.
setHex
(
a
);
return
this
};
'
use strict
'
;
var
THREE
=
THREE
||
{};
if
(
!
self
.
Int32Array
)
self
.
Int32Array
=
Array
,
self
.
Float32Array
=
Array
;
(
function
(){
for
(
var
a
=
0
,
b
=
[
"
ms
"
,
"
moz
"
,
"
webkit
"
,
"
o
"
],
c
=
0
;
c
<
b
.
length
&&!
window
.
requestAnimationFrame
;
++
c
)
window
.
requestAnimationFrame
=
window
[
b
[
c
]
+
"
RequestAnimationFrame
"
],
window
.
cancelAnimationFrame
=
window
[
b
[
c
]
+
"
CancelAnimationFrame
"
]
||
window
[
b
[
c
]
+
"
RequestCancelAnimationFrame
"
];
if
(
!
window
.
requestAnimationFrame
)
window
.
requestAnimationFrame
=
function
(
b
){
var
c
=
(
new
Date
).
getTime
(),
f
=
Math
.
max
(
0
,
16
-
(
c
-
a
)),
g
=
window
.
setTimeout
(
function
(){
b
(
c
+
f
)},
f
);
a
=
c
+
f
;
return
g
};
if
(
!
window
.
cancelAnimationFrame
)
window
.
cancelAnimationFrame
=
function
(
a
){
clearTimeout
(
a
)}})();
THREE
.
Color
=
function
(
a
){
void
0
!==
a
&&
this
.
setHex
(
a
);
return
this
};
THREE
.
Color
.
prototype
=
{
constructor
:
THREE
.
Color
,
r
:
1
,
g
:
1
,
b
:
1
,
copy
:
function
(
a
){
this
.
r
=
a
.
r
;
this
.
g
=
a
.
g
;
this
.
b
=
a
.
b
;
return
this
},
copyGammaToLinear
:
function
(
a
){
this
.
r
=
a
.
r
*
a
.
r
;
this
.
g
=
a
.
g
*
a
.
g
;
this
.
b
=
a
.
b
*
a
.
b
;
return
this
},
copyLinearToGamma
:
function
(
a
){
this
.
r
=
Math
.
sqrt
(
a
.
r
);
this
.
g
=
Math
.
sqrt
(
a
.
g
);
this
.
b
=
Math
.
sqrt
(
a
.
b
);
return
this
},
convertGammaToLinear
:
function
(){
var
a
=
this
.
r
,
b
=
this
.
g
,
c
=
this
.
b
;
this
.
r
=
a
*
a
;
this
.
g
=
b
*
b
;
this
.
b
=
c
*
c
;
return
this
},
convertLinearToGamma
:
function
(){
this
.
r
=
Math
.
sqrt
(
this
.
r
);
this
.
g
=
Math
.
sqrt
(
this
.
g
);
this
.
b
=
Math
.
sqrt
(
this
.
b
);
return
this
},
setRGB
:
function
(
a
,
b
,
c
){
this
.
r
=
a
;
this
.
g
=
b
;
this
.
b
=
c
;
return
this
},
setHSV
:
function
(
a
,
b
,
c
){
var
d
,
e
,
f
;
if
(
0
===
c
)
this
.
r
=
this
.
g
=
this
.
b
=
0
;
else
switch
(
d
=
Math
.
floor
(
6
*
a
),
e
=
6
*
a
-
d
,
a
=
c
*
(
1
-
b
),
f
=
c
*
(
1
-
b
*
e
),
b
=
c
*
(
1
-
b
*
(
1
-
e
)),
d
){
case
1
:
this
.
r
=
f
;
this
.
g
=
c
;
this
.
b
=
a
;
break
;
case
2
:
this
.
r
=
a
;
this
.
g
=
c
;
this
.
b
=
b
;
break
;
case
3
:
this
.
r
=
a
;
this
.
g
=
f
;
this
.
b
=
c
;
break
;
case
4
:
this
.
r
=
b
;
this
.
g
=
a
;
this
.
b
=
c
;
break
;
case
5
:
this
.
r
=
c
;
this
.
g
=
a
;
this
.
b
=
f
;
break
;
case
6
:
case
0
:
this
.
r
=
c
,
this
.
g
=
b
,
this
.
b
=
a
}
return
this
},
setHex
:
function
(
a
){
a
=
Math
.
floor
(
a
);
this
.
r
=
(
a
>>
16
&
255
)
/
255
;
this
.
g
=
(
a
>>
8
&
255
)
/
255
;
this
.
b
=
(
a
&
255
)
/
255
;
return
this
},
getHex
:
function
(){
return
Math
.
floor
(
255
*
this
.
r
)
<<
16
^
Math
.
floor
(
255
*
this
.
g
)
<<
8
^
Math
.
floor
(
255
*
this
.
b
)},
getContextStyle
:
function
(){
return
"
rgb(
"
+
Math
.
floor
(
255
*
this
.
r
)
+
"
,
"
+
Math
.
floor
(
255
*
this
.
g
)
+
"
,
"
+
Math
.
floor
(
255
*
this
.
b
)
+
"
)
"
},
clone
:
function
(){
return
(
new
THREE
.
Color
).
setRGB
(
this
.
r
,
this
.
g
,
this
.
b
)}};
THREE
.
Vector2
=
function
(
a
,
b
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
};
...
...
build/custom/ThreeSVG.js
浏览文件 @
b74342a4
// ThreeSVG.js r47dev - http://github.com/mrdoob/three.js
'
use strict
'
;
var
THREE
=
THREE
||
{};
if
(
!
self
.
Int32Array
)
self
.
Int32Array
=
Array
,
self
.
Float32Array
=
Array
;
if
(
!
self
.
requestAnimationFrame
)
self
.
requestAnimationFrame
=
function
(){
return
self
.
webkitRequestAnimationFrame
||
self
.
mozRequestAnimationFrame
||
self
.
oRequestAnimationFrame
||
self
.
msRequestAnimationFrame
||
function
(
a
){
self
.
setTimeout
(
a
,
1
E3
/
60
)}}();
THREE
.
Color
=
function
(
a
){
void
0
!==
a
&&
this
.
setHex
(
a
);
return
this
};
'
use strict
'
;
var
THREE
=
THREE
||
{};
if
(
!
self
.
Int32Array
)
self
.
Int32Array
=
Array
,
self
.
Float32Array
=
Array
;
(
function
(){
for
(
var
a
=
0
,
b
=
[
"
ms
"
,
"
moz
"
,
"
webkit
"
,
"
o
"
],
c
=
0
;
c
<
b
.
length
&&!
window
.
requestAnimationFrame
;
++
c
)
window
.
requestAnimationFrame
=
window
[
b
[
c
]
+
"
RequestAnimationFrame
"
],
window
.
cancelAnimationFrame
=
window
[
b
[
c
]
+
"
CancelAnimationFrame
"
]
||
window
[
b
[
c
]
+
"
RequestCancelAnimationFrame
"
];
if
(
!
window
.
requestAnimationFrame
)
window
.
requestAnimationFrame
=
function
(
b
){
var
c
=
(
new
Date
).
getTime
(),
f
=
Math
.
max
(
0
,
16
-
(
c
-
a
)),
g
=
window
.
setTimeout
(
function
(){
b
(
c
+
f
)},
f
);
a
=
c
+
f
;
return
g
};
if
(
!
window
.
cancelAnimationFrame
)
window
.
cancelAnimationFrame
=
function
(
a
){
clearTimeout
(
a
)}})();
THREE
.
Color
=
function
(
a
){
void
0
!==
a
&&
this
.
setHex
(
a
);
return
this
};
THREE
.
Color
.
prototype
=
{
constructor
:
THREE
.
Color
,
r
:
1
,
g
:
1
,
b
:
1
,
copy
:
function
(
a
){
this
.
r
=
a
.
r
;
this
.
g
=
a
.
g
;
this
.
b
=
a
.
b
;
return
this
},
copyGammaToLinear
:
function
(
a
){
this
.
r
=
a
.
r
*
a
.
r
;
this
.
g
=
a
.
g
*
a
.
g
;
this
.
b
=
a
.
b
*
a
.
b
;
return
this
},
copyLinearToGamma
:
function
(
a
){
this
.
r
=
Math
.
sqrt
(
a
.
r
);
this
.
g
=
Math
.
sqrt
(
a
.
g
);
this
.
b
=
Math
.
sqrt
(
a
.
b
);
return
this
},
convertGammaToLinear
:
function
(){
var
a
=
this
.
r
,
b
=
this
.
g
,
c
=
this
.
b
;
this
.
r
=
a
*
a
;
this
.
g
=
b
*
b
;
this
.
b
=
c
*
c
;
return
this
},
convertLinearToGamma
:
function
(){
this
.
r
=
Math
.
sqrt
(
this
.
r
);
this
.
g
=
Math
.
sqrt
(
this
.
g
);
this
.
b
=
Math
.
sqrt
(
this
.
b
);
return
this
},
setRGB
:
function
(
a
,
b
,
c
){
this
.
r
=
a
;
this
.
g
=
b
;
this
.
b
=
c
;
return
this
},
setHSV
:
function
(
a
,
b
,
c
){
var
d
,
e
,
f
;
if
(
0
===
c
)
this
.
r
=
this
.
g
=
this
.
b
=
0
;
else
switch
(
d
=
Math
.
floor
(
6
*
a
),
e
=
6
*
a
-
d
,
a
=
c
*
(
1
-
b
),
f
=
c
*
(
1
-
b
*
e
),
b
=
c
*
(
1
-
b
*
(
1
-
e
)),
d
){
case
1
:
this
.
r
=
f
;
this
.
g
=
c
;
this
.
b
=
a
;
break
;
case
2
:
this
.
r
=
a
;
this
.
g
=
c
;
this
.
b
=
b
;
break
;
case
3
:
this
.
r
=
a
;
this
.
g
=
f
;
this
.
b
=
c
;
break
;
case
4
:
this
.
r
=
b
;
this
.
g
=
a
;
this
.
b
=
c
;
break
;
case
5
:
this
.
r
=
c
;
this
.
g
=
a
;
this
.
b
=
f
;
break
;
case
6
:
case
0
:
this
.
r
=
c
,
this
.
g
=
b
,
this
.
b
=
a
}
return
this
},
setHex
:
function
(
a
){
a
=
Math
.
floor
(
a
);
this
.
r
=
(
a
>>
16
&
255
)
/
255
;
this
.
g
=
(
a
>>
8
&
255
)
/
255
;
this
.
b
=
(
a
&
255
)
/
255
;
return
this
},
getHex
:
function
(){
return
Math
.
floor
(
255
*
this
.
r
)
<<
16
^
Math
.
floor
(
255
*
this
.
g
)
<<
8
^
Math
.
floor
(
255
*
this
.
b
)},
getContextStyle
:
function
(){
return
"
rgb(
"
+
Math
.
floor
(
255
*
this
.
r
)
+
"
,
"
+
Math
.
floor
(
255
*
this
.
g
)
+
"
,
"
+
Math
.
floor
(
255
*
this
.
b
)
+
"
)
"
},
clone
:
function
(){
return
(
new
THREE
.
Color
).
setRGB
(
this
.
r
,
this
.
g
,
this
.
b
)}};
THREE
.
Vector2
=
function
(
a
,
b
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
};
...
...
build/custom/ThreeWebGL.js
浏览文件 @
b74342a4
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
src/Three.js
浏览文件 @
b74342a4
...
...
@@ -11,23 +11,33 @@ if ( ! self.Int32Array ) {
}
// Provides requestAnimationFrame in a cross browser way.
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
if
(
!
self
.
requestAnimationFrame
)
{
self
.
requestAnimationFrame
=
(
function
()
{
return
self
.
webkitRequestAnimationFrame
||
self
.
mozRequestAnimationFrame
||
self
.
oRequestAnimationFrame
||
self
.
msRequestAnimationFrame
||
function
(
callback
,
element
)
{
self
.
setTimeout
(
callback
,
1000
/
60
);
};
}
)();
}
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller
// fixes from Paul Irish and Tino Zijdel
(
function
()
{
var
lastTime
=
0
;
var
vendors
=
[
'
ms
'
,
'
moz
'
,
'
webkit
'
,
'
o
'
];
for
(
var
x
=
0
;
x
<
vendors
.
length
&&
!
window
.
requestAnimationFrame
;
++
x
)
{
window
.
requestAnimationFrame
=
window
[
vendors
[
x
]
+
'
RequestAnimationFrame
'
];
window
.
cancelAnimationFrame
=
window
[
vendors
[
x
]
+
'
CancelAnimationFrame
'
]
||
window
[
vendors
[
x
]
+
'
RequestCancelAnimationFrame
'
];
}
if
(
!
window
.
requestAnimationFrame
)
window
.
requestAnimationFrame
=
function
(
callback
,
element
)
{
var
currTime
=
new
Date
().
getTime
();
var
timeToCall
=
Math
.
max
(
0
,
16
-
(
currTime
-
lastTime
));
var
id
=
window
.
setTimeout
(
function
()
{
callback
(
currTime
+
timeToCall
);
},
timeToCall
);
lastTime
=
currTime
+
timeToCall
;
return
id
;
};
if
(
!
window
.
cancelAnimationFrame
)
window
.
cancelAnimationFrame
=
function
(
id
)
{
clearTimeout
(
id
);
};
}());
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录