Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
6acfc12d
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,发现更多精彩内容 >>
提交
6acfc12d
编写于
12月 14, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up.
上级
b8d16dae
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
48 addition
and
39 deletion
+48
-39
src/animation/KeyframeTrackPrototype.js
src/animation/KeyframeTrackPrototype.js
+22
-25
src/core/EventDispatcher.js
src/core/EventDispatcher.js
+1
-1
src/math/Box2.js
src/math/Box2.js
+6
-4
src/math/Box3.js
src/math/Box3.js
+9
-4
src/renderers/webgl/WebGLTextures.js
src/renderers/webgl/WebGLTextures.js
+5
-4
test/unit/math/Frustum.js
test/unit/math/Frustum.js
+5
-1
未找到文件。
src/animation/KeyframeTrackPrototype.js
浏览文件 @
6acfc12d
...
@@ -14,28 +14,28 @@ KeyframeTrackPrototype = {
...
@@ -14,28 +14,28 @@ KeyframeTrackPrototype = {
DefaultInterpolation
:
InterpolateLinear
,
DefaultInterpolation
:
InterpolateLinear
,
InterpolantFactoryMethodDiscrete
:
function
(
result
)
{
InterpolantFactoryMethodDiscrete
:
function
(
result
)
{
return
new
DiscreteInterpolant
(
return
new
DiscreteInterpolant
(
this
.
times
,
this
.
values
,
this
.
getValueSize
(),
result
);
this
.
times
,
this
.
values
,
this
.
getValueSize
(),
result
);
},
},
InterpolantFactoryMethodLinear
:
function
(
result
)
{
InterpolantFactoryMethodLinear
:
function
(
result
)
{
return
new
LinearInterpolant
(
return
new
LinearInterpolant
(
this
.
times
,
this
.
values
,
this
.
getValueSize
(),
result
);
this
.
times
,
this
.
values
,
this
.
getValueSize
(),
result
);
},
},
InterpolantFactoryMethodSmooth
:
function
(
result
)
{
InterpolantFactoryMethodSmooth
:
function
(
result
)
{
return
new
CubicInterpolant
(
return
new
CubicInterpolant
(
this
.
times
,
this
.
values
,
this
.
getValueSize
(),
result
);
this
.
times
,
this
.
values
,
this
.
getValueSize
(),
result
);
},
},
setInterpolation
:
function
(
interpolation
)
{
setInterpolation
:
function
(
interpolation
)
{
var
factoryMethod
;
var
factoryMethod
;
...
@@ -90,7 +90,7 @@ KeyframeTrackPrototype = {
...
@@ -90,7 +90,7 @@ KeyframeTrackPrototype = {
},
},
getInterpolation
:
function
()
{
getInterpolation
:
function
()
{
switch
(
this
.
createInterpolant
)
{
switch
(
this
.
createInterpolant
)
{
...
@@ -110,20 +110,20 @@ KeyframeTrackPrototype = {
...
@@ -110,20 +110,20 @@ KeyframeTrackPrototype = {
},
},
getValueSize
:
function
()
{
getValueSize
:
function
()
{
return
this
.
values
.
length
/
this
.
times
.
length
;
return
this
.
values
.
length
/
this
.
times
.
length
;
},
},
// move all keyframes either forwards or backwards in time
// move all keyframes either forwards or backwards in time
shift
:
function
(
timeOffset
)
{
shift
:
function
(
timeOffset
)
{
if
(
timeOffset
!==
0.0
)
{
if
(
timeOffset
!==
0.0
)
{
var
times
=
this
.
times
;
var
times
=
this
.
times
;
for
(
var
i
=
0
,
n
=
times
.
length
;
i
!==
n
;
++
i
)
{
for
(
var
i
=
0
,
n
=
times
.
length
;
i
!==
n
;
++
i
)
{
times
[
i
]
+=
timeOffset
;
times
[
i
]
+=
timeOffset
;
...
@@ -136,13 +136,13 @@ KeyframeTrackPrototype = {
...
@@ -136,13 +136,13 @@ KeyframeTrackPrototype = {
},
},
// scale all keyframe times by a factor (useful for frame <-> seconds conversions)
// scale all keyframe times by a factor (useful for frame <-> seconds conversions)
scale
:
function
(
timeScale
)
{
scale
:
function
(
timeScale
)
{
if
(
timeScale
!==
1.0
)
{
if
(
timeScale
!==
1.0
)
{
var
times
=
this
.
times
;
var
times
=
this
.
times
;
for
(
var
i
=
0
,
n
=
times
.
length
;
i
!==
n
;
++
i
)
{
for
(
var
i
=
0
,
n
=
times
.
length
;
i
!==
n
;
++
i
)
{
times
[
i
]
*=
timeScale
;
times
[
i
]
*=
timeScale
;
...
@@ -156,7 +156,7 @@ KeyframeTrackPrototype = {
...
@@ -156,7 +156,7 @@ KeyframeTrackPrototype = {
// removes keyframes before and after animation without changing any values within the range [startTime, endTime].
// removes keyframes before and after animation without changing any values within the range [startTime, endTime].
// IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values
// IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values
trim
:
function
(
startTime
,
endTime
)
{
trim
:
function
(
startTime
,
endTime
)
{
var
times
=
this
.
times
,
var
times
=
this
.
times
,
nKeys
=
times
.
length
,
nKeys
=
times
.
length
,
...
@@ -164,17 +164,14 @@ KeyframeTrackPrototype = {
...
@@ -164,17 +164,14 @@ KeyframeTrackPrototype = {
to
=
nKeys
-
1
;
to
=
nKeys
-
1
;
while
(
from
!==
nKeys
&&
times
[
from
]
<
startTime
)
++
from
;
while
(
from
!==
nKeys
&&
times
[
from
]
<
startTime
)
++
from
;
while
(
to
!==
-
1
&&
times
[
to
]
>
endTime
)
--
to
;
while
(
to
!==
-
1
&&
times
[
to
]
>
endTime
)
--
to
;
++
to
;
// inclusive -> exclusive bound
++
to
;
// inclusive -> exclusive bound
if
(
from
!==
0
||
to
!==
nKeys
)
{
if
(
from
!==
0
||
to
!==
nKeys
)
{
// empty tracks are forbidden, so keep at least one keyframe
// empty tracks are forbidden, so keep at least one keyframe
if
(
from
>=
to
){
if
(
from
>=
to
)
to
=
Math
.
max
(
to
,
1
),
from
=
to
-
1
;
to
=
Math
.
max
(
to
,
1
);
from
=
to
-
1
;
}
var
stride
=
this
.
getValueSize
();
var
stride
=
this
.
getValueSize
();
this
.
times
=
AnimationUtils
.
arraySlice
(
times
,
from
,
to
);
this
.
times
=
AnimationUtils
.
arraySlice
(
times
,
from
,
to
);
...
@@ -188,7 +185,7 @@ KeyframeTrackPrototype = {
...
@@ -188,7 +185,7 @@ KeyframeTrackPrototype = {
},
},
// ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable
// ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable
validate
:
function
()
{
validate
:
function
()
{
var
valid
=
true
;
var
valid
=
true
;
...
@@ -205,7 +202,7 @@ KeyframeTrackPrototype = {
...
@@ -205,7 +202,7 @@ KeyframeTrackPrototype = {
nKeys
=
times
.
length
;
nKeys
=
times
.
length
;
if
(
nKeys
===
0
)
{
if
(
nKeys
===
0
)
{
console
.
error
(
"
track is empty
"
,
this
);
console
.
error
(
"
track is empty
"
,
this
);
valid
=
false
;
valid
=
false
;
...
@@ -214,7 +211,7 @@ KeyframeTrackPrototype = {
...
@@ -214,7 +211,7 @@ KeyframeTrackPrototype = {
var
prevTime
=
null
;
var
prevTime
=
null
;
for
(
var
i
=
0
;
i
!==
nKeys
;
i
++
)
{
for
(
var
i
=
0
;
i
!==
nKeys
;
i
++
)
{
var
currTime
=
times
[
i
];
var
currTime
=
times
[
i
];
...
@@ -226,7 +223,7 @@ KeyframeTrackPrototype = {
...
@@ -226,7 +223,7 @@ KeyframeTrackPrototype = {
}
}
if
(
prevTime
!==
null
&&
prevTime
>
currTime
)
{
if
(
prevTime
!==
null
&&
prevTime
>
currTime
)
{
console
.
error
(
"
out of order keys
"
,
this
,
i
,
currTime
,
prevTime
);
console
.
error
(
"
out of order keys
"
,
this
,
i
,
currTime
,
prevTime
);
valid
=
false
;
valid
=
false
;
...
@@ -266,7 +263,7 @@ KeyframeTrackPrototype = {
...
@@ -266,7 +263,7 @@ KeyframeTrackPrototype = {
// removes equivalent sequential keys as common in morph target sequences
// removes equivalent sequential keys as common in morph target sequences
// (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)
// (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)
optimize
:
function
()
{
optimize
:
function
()
{
var
times
=
this
.
times
,
var
times
=
this
.
times
,
values
=
this
.
values
,
values
=
this
.
values
,
...
@@ -277,7 +274,7 @@ KeyframeTrackPrototype = {
...
@@ -277,7 +274,7 @@ KeyframeTrackPrototype = {
writeIndex
=
1
,
writeIndex
=
1
,
lastIndex
=
times
.
length
-
1
;
lastIndex
=
times
.
length
-
1
;
for
(
var
i
=
1
;
i
<
lastIndex
;
++
i
)
{
for
(
var
i
=
1
;
i
<
lastIndex
;
++
i
)
{
var
keep
=
false
;
var
keep
=
false
;
...
...
src/core/EventDispatcher.js
浏览文件 @
6acfc12d
...
@@ -32,7 +32,7 @@ Object.assign( EventDispatcher.prototype, {
...
@@ -32,7 +32,7 @@ Object.assign( EventDispatcher.prototype, {
var
listeners
=
this
.
_listeners
;
var
listeners
=
this
.
_listeners
;
return
(
listeners
[
type
]
!==
undefined
&&
listeners
[
type
].
indexOf
(
listener
)
!==
-
1
)
;
return
listeners
[
type
]
!==
undefined
&&
listeners
[
type
].
indexOf
(
listener
)
!==
-
1
;
},
},
...
...
src/math/Box2.js
浏览文件 @
6acfc12d
...
@@ -129,13 +129,15 @@ Box2.prototype = {
...
@@ -129,13 +129,15 @@ Box2.prototype = {
containsPoint
:
function
(
point
)
{
containsPoint
:
function
(
point
)
{
return
!
(
point
.
x
<
this
.
min
.
x
||
point
.
x
>
this
.
max
.
x
||
point
.
y
<
this
.
min
.
y
||
point
.
y
>
this
.
max
.
y
);
return
point
.
x
<
this
.
min
.
x
||
point
.
x
>
this
.
max
.
x
||
point
.
y
<
this
.
min
.
y
||
point
.
y
>
this
.
max
.
y
?
false
:
true
;
},
},
containsBox
:
function
(
box
)
{
containsBox
:
function
(
box
)
{
return
(
this
.
min
.
x
<=
box
.
min
.
x
)
&&
(
box
.
max
.
x
<=
this
.
max
.
x
)
&&
(
this
.
min
.
y
<=
box
.
min
.
y
)
&&
(
box
.
max
.
y
<=
this
.
max
.
y
);
return
this
.
min
.
x
<=
box
.
min
.
x
&&
box
.
max
.
x
<=
this
.
max
.
x
&&
this
.
min
.
y
<=
box
.
min
.
y
&&
box
.
max
.
y
<=
this
.
max
.
y
;
},
},
...
@@ -156,8 +158,8 @@ Box2.prototype = {
...
@@ -156,8 +158,8 @@ Box2.prototype = {
intersectsBox
:
function
(
box
)
{
intersectsBox
:
function
(
box
)
{
// using 6 splitting planes to rule out intersections.
// using 6 splitting planes to rule out intersections.
return
box
.
max
.
x
<
this
.
min
.
x
||
box
.
min
.
x
>
this
.
max
.
x
||
return
!
(
box
.
max
.
x
<
this
.
min
.
x
||
box
.
min
.
x
>
this
.
max
.
x
||
box
.
max
.
y
<
this
.
min
.
y
||
box
.
min
.
y
>
this
.
max
.
y
)
;
box
.
max
.
y
<
this
.
min
.
y
||
box
.
min
.
y
>
this
.
max
.
y
?
false
:
true
;
},
},
...
...
src/math/Box3.js
浏览文件 @
6acfc12d
...
@@ -275,13 +275,17 @@ Box3.prototype = {
...
@@ -275,13 +275,17 @@ Box3.prototype = {
containsPoint
:
function
(
point
)
{
containsPoint
:
function
(
point
)
{
return
(
point
.
x
<
this
.
min
.
x
||
point
.
x
>
this
.
max
.
x
||
point
.
y
<
this
.
min
.
y
||
point
.
y
>
this
.
max
.
y
||
point
.
z
<
this
.
min
.
z
||
point
.
z
>
this
.
max
.
z
)
===
false
;
return
point
.
x
<
this
.
min
.
x
||
point
.
x
>
this
.
max
.
x
||
point
.
y
<
this
.
min
.
y
||
point
.
y
>
this
.
max
.
y
||
point
.
z
<
this
.
min
.
z
||
point
.
z
>
this
.
max
.
z
?
false
:
true
;
},
},
containsBox
:
function
(
box
)
{
containsBox
:
function
(
box
)
{
return
(
this
.
min
.
x
<=
box
.
min
.
x
)
&&
(
box
.
max
.
x
<=
this
.
max
.
x
)
&&
(
this
.
min
.
y
<=
box
.
min
.
y
)
&&
(
box
.
max
.
y
<=
this
.
max
.
y
)
&&
(
this
.
min
.
z
<=
box
.
min
.
z
)
&&
(
box
.
max
.
z
<=
this
.
max
.
z
);
return
this
.
min
.
x
<=
box
.
min
.
x
&&
box
.
max
.
x
<=
this
.
max
.
x
&&
this
.
min
.
y
<=
box
.
min
.
y
&&
box
.
max
.
y
<=
this
.
max
.
y
&&
this
.
min
.
z
<=
box
.
min
.
z
&&
box
.
max
.
z
<=
this
.
max
.
z
;
},
},
...
@@ -303,8 +307,9 @@ Box3.prototype = {
...
@@ -303,8 +307,9 @@ Box3.prototype = {
intersectsBox
:
function
(
box
)
{
intersectsBox
:
function
(
box
)
{
// using 6 splitting planes to rule out intersections.
// using 6 splitting planes to rule out intersections.
return
box
.
max
.
x
<
this
.
min
.
x
||
box
.
min
.
x
>
this
.
max
.
x
||
return
!
(
box
.
max
.
x
<
this
.
min
.
x
||
box
.
min
.
x
>
this
.
max
.
x
||
box
.
max
.
y
<
this
.
min
.
y
||
box
.
min
.
y
>
this
.
max
.
y
||
box
.
max
.
z
<
this
.
min
.
z
||
box
.
min
.
z
>
this
.
max
.
z
);
box
.
max
.
y
<
this
.
min
.
y
||
box
.
min
.
y
>
this
.
max
.
y
||
box
.
max
.
z
<
this
.
min
.
z
||
box
.
min
.
z
>
this
.
max
.
z
?
false
:
true
;
},
},
...
...
src/renderers/webgl/WebGLTextures.js
浏览文件 @
6acfc12d
...
@@ -67,8 +67,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, paramT
...
@@ -67,8 +67,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, paramT
function
textureNeedsPowerOfTwo
(
texture
)
{
function
textureNeedsPowerOfTwo
(
texture
)
{
return
(
texture
.
wrapS
!==
ClampToEdgeWrapping
||
texture
.
wrapT
!==
ClampToEdgeWrapping
)
||
(
texture
.
minFilter
!==
NearestFilter
&&
texture
.
minFilter
!==
LinearFilter
);
return
(
texture
.
wrapS
!==
ClampToEdgeWrapping
||
texture
.
wrapT
!==
ClampToEdgeWrapping
)
||
(
texture
.
minFilter
!==
NearestFilter
&&
texture
.
minFilter
!==
LinearFilter
);
}
}
// Fallback filters for non-power-of-2 textures
// Fallback filters for non-power-of-2 textures
...
@@ -236,8 +237,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, paramT
...
@@ -236,8 +237,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, paramT
_gl
.
pixelStorei
(
_gl
.
UNPACK_FLIP_Y_WEBGL
,
texture
.
flipY
);
_gl
.
pixelStorei
(
_gl
.
UNPACK_FLIP_Y_WEBGL
,
texture
.
flipY
);
var
isCompressed
=
(
texture
&&
texture
.
isCompressedTexture
);
var
isCompressed
=
(
texture
&&
texture
.
isCompressedTexture
);
var
isDataTexture
=
(
texture
.
image
[
0
]
&&
texture
.
image
[
0
].
isDataTexture
);
var
isDataTexture
=
(
texture
.
image
[
0
]
&&
texture
.
image
[
0
].
isDataTexture
);
var
cubeImage
=
[];
var
cubeImage
=
[];
...
...
test/unit/math/Frustum.js
浏览文件 @
6acfc12d
...
@@ -9,7 +9,11 @@ var unit3 = new THREE.Vector3( 1, 0, 0 );
...
@@ -9,7 +9,11 @@ var unit3 = new THREE.Vector3( 1, 0, 0 );
var
planeEquals
=
function
(
a
,
b
,
tolerance
)
{
var
planeEquals
=
function
(
a
,
b
,
tolerance
)
{
tolerance
=
tolerance
||
0.0001
;
tolerance
=
tolerance
||
0.0001
;
return
!
(
a
.
normal
.
distanceTo
(
b
.
normal
)
>
tolerance
)
&&
!
(
Math
.
abs
(
a
.
constant
-
b
.
constant
)
>
tolerance
);
if
(
a
.
normal
.
distanceTo
(
b
.
normal
)
>
tolerance
)
return
false
;
if
(
Math
.
abs
(
a
.
constant
-
b
.
constant
)
>
tolerance
)
return
false
;
return
true
;
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录