Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
14304544
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,发现更多精彩内容 >>
提交
14304544
编写于
12月 17, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactored EventDispatcher usage.
上级
e55d50ab
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
53 addition
and
40 deletion
+53
-40
src/animation/AnimationMixer.js
src/animation/AnimationMixer.js
+22
-19
src/core/BufferGeometry.js
src/core/BufferGeometry.js
+5
-2
src/core/EventDispatcher.js
src/core/EventDispatcher.js
+2
-2
src/core/Geometry.js
src/core/Geometry.js
+12
-12
src/core/Object3D.js
src/core/Object3D.js
+6
-2
src/materials/Material.js
src/materials/Material.js
+1
-1
src/renderers/WebGLRenderTarget.js
src/renderers/WebGLRenderTarget.js
+5
-2
未找到文件。
src/animation/AnimationMixer.js
浏览文件 @
14304544
...
...
@@ -27,12 +27,14 @@ function AnimationMixer( root ) {
}
Object
.
assign
(
AnimationMixer
.
prototype
,
EventDispatcher
.
prototype
,
{
AnimationMixer
.
prototype
=
{
constructor
:
AnimationMixer
,
// return an action for a clip optionally using a custom root target
// object (this method allocates a lot of dynamic memory in case a
// previously unknown clip/root combination is specified)
clipAction
:
function
(
clip
,
optionalRoot
)
{
clipAction
:
function
(
clip
,
optionalRoot
)
{
var
root
=
optionalRoot
||
this
.
_root
,
rootUuid
=
root
.
uuid
,
...
...
@@ -273,13 +275,13 @@ Object.assign( AnimationMixer.prototype, EventDispatcher.prototype, {
}
}
)
;
};
// Implementation details:
Object
.
assign
(
AnimationMixer
.
prototype
,
{
_bindAction
:
function
(
action
,
prototypeAction
)
{
_bindAction
:
function
(
action
,
prototypeAction
)
{
var
root
=
action
.
_localRoot
||
this
.
_root
,
tracks
=
action
.
_clip
.
tracks
,
...
...
@@ -346,7 +348,7 @@ Object.assign( AnimationMixer.prototype, {
},
_activateAction
:
function
(
action
)
{
_activateAction
:
function
(
action
)
{
if
(
!
this
.
_isActiveAction
(
action
)
)
{
...
...
@@ -388,7 +390,7 @@ Object.assign( AnimationMixer.prototype, {
},
_deactivateAction
:
function
(
action
)
{
_deactivateAction
:
function
(
action
)
{
if
(
this
.
_isActiveAction
(
action
)
)
{
...
...
@@ -416,7 +418,7 @@ Object.assign( AnimationMixer.prototype, {
// Memory manager
_initMemoryManager
:
function
()
{
_initMemoryManager
:
function
()
{
this
.
_actions
=
[];
// 'nActiveActions' followed by inactive ones
this
.
_nActiveActions
=
0
;
...
...
@@ -461,14 +463,14 @@ Object.assign( AnimationMixer.prototype, {
// Memory management for AnimationAction objects
_isActiveAction
:
function
(
action
)
{
_isActiveAction
:
function
(
action
)
{
var
index
=
action
.
_cacheIndex
;
return
index
!==
null
&&
index
<
this
.
_nActiveActions
;
},
_addInactiveAction
:
function
(
action
,
clipUuid
,
rootUuid
)
{
_addInactiveAction
:
function
(
action
,
clipUuid
,
rootUuid
)
{
var
actions
=
this
.
_actions
,
actionsByClip
=
this
.
_actionsByClip
,
...
...
@@ -503,7 +505,7 @@ Object.assign( AnimationMixer.prototype, {
},
_removeInactiveAction
:
function
(
action
)
{
_removeInactiveAction
:
function
(
action
)
{
var
actions
=
this
.
_actions
,
lastInactiveAction
=
actions
[
actions
.
length
-
1
],
...
...
@@ -548,7 +550,7 @@ Object.assign( AnimationMixer.prototype, {
},
_removeInactiveBindingsForAction
:
function
(
action
)
{
_removeInactiveBindingsForAction
:
function
(
action
)
{
var
bindings
=
action
.
_propertyBindings
;
for
(
var
i
=
0
,
n
=
bindings
.
length
;
i
!==
n
;
++
i
)
{
...
...
@@ -565,7 +567,7 @@ Object.assign( AnimationMixer.prototype, {
},
_lendAction
:
function
(
action
)
{
_lendAction
:
function
(
action
)
{
// [ active actions | inactive actions ]
// [ active actions >| inactive actions ]
...
...
@@ -588,7 +590,7 @@ Object.assign( AnimationMixer.prototype, {
},
_takeBackAction
:
function
(
action
)
{
_takeBackAction
:
function
(
action
)
{
// [ active actions | inactive actions ]
// [ active actions |< inactive actions ]
...
...
@@ -613,7 +615,7 @@ Object.assign( AnimationMixer.prototype, {
// Memory management for PropertyMixer objects
_addInactiveBinding
:
function
(
binding
,
rootUuid
,
trackName
)
{
_addInactiveBinding
:
function
(
binding
,
rootUuid
,
trackName
)
{
var
bindingsByRoot
=
this
.
_bindingsByRootAndName
,
bindingByName
=
bindingsByRoot
[
rootUuid
],
...
...
@@ -634,7 +636,7 @@ Object.assign( AnimationMixer.prototype, {
},
_removeInactiveBinding
:
function
(
binding
)
{
_removeInactiveBinding
:
function
(
binding
)
{
var
bindings
=
this
.
_bindings
,
propBinding
=
binding
.
binding
,
...
...
@@ -662,7 +664,7 @@ Object.assign( AnimationMixer.prototype, {
},
_lendBinding
:
function
(
binding
)
{
_lendBinding
:
function
(
binding
)
{
var
bindings
=
this
.
_bindings
,
prevIndex
=
binding
.
_cacheIndex
,
...
...
@@ -679,7 +681,7 @@ Object.assign( AnimationMixer.prototype, {
},
_takeBackBinding
:
function
(
binding
)
{
_takeBackBinding
:
function
(
binding
)
{
var
bindings
=
this
.
_bindings
,
prevIndex
=
binding
.
_cacheIndex
,
...
...
@@ -699,7 +701,7 @@ Object.assign( AnimationMixer.prototype, {
// Memory management of Interpolants for weight and time scale
_lendControlInterpolant
:
function
()
{
_lendControlInterpolant
:
function
()
{
var
interpolants
=
this
.
_controlInterpolants
,
lastActiveIndex
=
this
.
_nActiveControlInterpolants
++
,
...
...
@@ -720,7 +722,7 @@ Object.assign( AnimationMixer.prototype, {
},
_takeBackControlInterpolant
:
function
(
interpolant
)
{
_takeBackControlInterpolant
:
function
(
interpolant
)
{
var
interpolants
=
this
.
_controlInterpolants
,
prevIndex
=
interpolant
.
__cacheIndex
,
...
...
@@ -741,5 +743,6 @@ Object.assign( AnimationMixer.prototype, {
}
);
Object
.
assign
(
AnimationMixer
.
prototype
,
EventDispatcher
.
prototype
);
export
{
AnimationMixer
};
src/core/BufferGeometry.js
浏览文件 @
14304544
...
...
@@ -38,7 +38,9 @@ function BufferGeometry() {
}
Object
.
assign
(
BufferGeometry
.
prototype
,
EventDispatcher
.
prototype
,
{
BufferGeometry
.
prototype
=
{
constructor
:
BufferGeometry
,
isBufferGeometry
:
true
,
...
...
@@ -1033,9 +1035,10 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
}
}
)
;
};
BufferGeometry
.
MaxIndex
=
65535
;
Object
.
assign
(
BufferGeometry
.
prototype
,
EventDispatcher
.
prototype
);
export
{
BufferGeometry
};
src/core/EventDispatcher.js
浏览文件 @
14304544
...
...
@@ -4,7 +4,7 @@
function
EventDispatcher
()
{}
Object
.
assign
(
EventDispatcher
.
prototype
,
{
EventDispatcher
.
prototype
=
{
addEventListener
:
function
(
type
,
listener
)
{
...
...
@@ -87,7 +87,7 @@ Object.assign( EventDispatcher.prototype, {
}
}
)
;
};
export
{
EventDispatcher
};
src/core/Geometry.js
浏览文件 @
14304544
...
...
@@ -19,6 +19,9 @@ import { _Math } from '../math/Math';
* @author bhouston / http://clara.io
*/
var
count
=
0
;
function
GeometryIdCount
()
{
return
count
++
;
};
function
Geometry
()
{
Object
.
defineProperty
(
this
,
'
id
'
,
{
value
:
GeometryIdCount
()
}
);
...
...
@@ -31,7 +34,7 @@ function Geometry() {
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
faceVertexUvs
=
[
[]
];
this
.
faceVertexUvs
=
[
[]
];
this
.
morphTargets
=
[];
this
.
morphNormals
=
[];
...
...
@@ -56,7 +59,9 @@ function Geometry() {
}
Object
.
assign
(
Geometry
.
prototype
,
EventDispatcher
.
prototype
,
{
Geometry
.
prototype
=
{
constructor
:
Geometry
,
isGeometry
:
true
,
...
...
@@ -308,7 +313,7 @@ Object.assign( Geometry.prototype, EventDispatcher.prototype, {
for
(
var
j
=
start
,
jl
=
start
+
count
;
j
<
jl
;
j
+=
3
)
{
addFace
(
indices
[
j
],
indices
[
j
+
1
],
indices
[
j
+
2
],
group
.
materialIndex
);
addFace
(
indices
[
j
],
indices
[
j
+
1
],
indices
[
j
+
2
],
group
.
materialIndex
);
}
...
...
@@ -701,7 +706,7 @@ Object.assign( Geometry.prototype, EventDispatcher.prototype, {
merge
:
function
(
geometry
,
matrix
,
materialIndexOffset
)
{
if
(
(
geometry
&&
geometry
.
isGeometry
)
===
false
)
{
if
(
(
geometry
&&
geometry
.
isGeometry
)
===
false
)
{
console
.
error
(
'
THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.
'
,
geometry
);
return
;
...
...
@@ -821,7 +826,7 @@ Object.assign( Geometry.prototype, EventDispatcher.prototype, {
mergeMesh
:
function
(
mesh
)
{
if
(
(
mesh
&&
mesh
.
isMesh
)
===
false
)
{
if
(
(
mesh
&&
mesh
.
isMesh
)
===
false
)
{
console
.
error
(
'
THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.
'
,
mesh
);
return
;
...
...
@@ -886,15 +891,12 @@ Object.assign( Geometry.prototype, EventDispatcher.prototype, {
indices
=
[
face
.
a
,
face
.
b
,
face
.
c
];
var
dupIndex
=
-
1
;
// if any duplicate vertices are found in a Face3
// we have to remove the face as nothing can be saved
for
(
var
n
=
0
;
n
<
3
;
n
++
)
{
if
(
indices
[
n
]
===
indices
[
(
n
+
1
)
%
3
]
)
{
dupIndex
=
n
;
faceIndicesToRemove
.
push
(
i
);
break
;
...
...
@@ -1265,10 +1267,8 @@ Object.assign( Geometry.prototype, EventDispatcher.prototype, {
}
}
);
var
count
=
0
;
function
GeometryIdCount
()
{
return
count
++
;
};
};
Object
.
assign
(
Geometry
.
prototype
,
EventDispatcher
.
prototype
);
export
{
GeometryIdCount
,
Geometry
};
src/core/Object3D.js
浏览文件 @
14304544
...
...
@@ -101,7 +101,9 @@ function Object3D() {
Object3D
.
DefaultUp
=
new
Vector3
(
0
,
1
,
0
);
Object3D
.
DefaultMatrixAutoUpdate
=
true
;
Object
.
assign
(
Object3D
.
prototype
,
EventDispatcher
.
prototype
,
{
Object3D
.
prototype
=
{
constructor
:
Object3D
,
isObject3D
:
true
,
...
...
@@ -728,6 +730,8 @@ Object.assign( Object3D.prototype, EventDispatcher.prototype, {
}
}
);
};
Object
.
assign
(
Object3D
.
prototype
,
EventDispatcher
.
prototype
);
export
{
Object3D
};
src/materials/Material.js
浏览文件 @
14304544
...
...
@@ -110,7 +110,7 @@ Material.prototype = {
currentValue
.
set
(
newValue
);
}
else
if
(
(
currentValue
&&
currentValue
.
isVector3
)
&&
(
newValue
&&
newValue
.
isVector3
)
)
{
}
else
if
(
(
currentValue
&&
currentValue
.
isVector3
)
&&
(
newValue
&&
newValue
.
isVector3
)
)
{
currentValue
.
copy
(
newValue
);
...
...
src/renderers/WebGLRenderTarget.js
浏览文件 @
14304544
...
...
@@ -39,7 +39,9 @@ function WebGLRenderTarget( width, height, options ) {
}
Object
.
assign
(
WebGLRenderTarget
.
prototype
,
EventDispatcher
.
prototype
,
{
WebGLRenderTarget
.
prototype
=
{
constructor
:
WebGLRenderTarget
,
isWebGLRenderTarget
:
true
,
...
...
@@ -88,7 +90,8 @@ Object.assign( WebGLRenderTarget.prototype, EventDispatcher.prototype, {
}
}
)
;
};
Object
.
assign
(
WebGLRenderTarget
.
prototype
,
EventDispatcher
.
prototype
);
export
{
WebGLRenderTarget
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录