Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
16ee7941
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,发现更多精彩内容 >>
提交
16ee7941
编写于
7月 31, 2015
作者:
B
Ben Houston
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
get UCSCharacter working again.
上级
055dc347
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
15 addition
and
395 deletion
+15
-395
examples/js/UCSCharacter.js
examples/js/UCSCharacter.js
+3
-2
examples/webgl_morphtargets_horse.html
examples/webgl_morphtargets_horse.html
+8
-6
examples/webgl_morphtargets_horse_mixer.html
examples/webgl_morphtargets_horse_mixer.html
+0
-148
examples/webgl_morphtargets_human.html
examples/webgl_morphtargets_human.html
+1
-1
examples/webgl_morphtargets_human_mixer.html
examples/webgl_morphtargets_human_mixer.html
+0
-236
src/animation/PropertyBinding.js
src/animation/PropertyBinding.js
+3
-2
未找到文件。
examples/js/UCSCharacter.js
浏览文件 @
16ee7941
THREE
.
UCSCharacter
Mixer
=
function
()
{
THREE
.
UCSCharacter
=
function
()
{
var
scope
=
this
;
var
scope
=
this
;
...
@@ -55,7 +55,8 @@ THREE.UCSCharacterMixer = function() {
...
@@ -55,7 +55,8 @@ THREE.UCSCharacterMixer = function() {
mesh
.
castShadow
=
true
;
mesh
.
castShadow
=
true
;
mesh
.
receiveShadow
=
true
;
mesh
.
receiveShadow
=
true
;
var
clipBones
=
THREE
.
AnimationClip
.
FromJSONLoaderAnimation
(
geometry
,
mesh
.
uuid
);
console
.
log
(
geometry
);
var
clipBones
=
THREE
.
AnimationClip
.
FromJSONLoaderAnimation
(
geometry
.
animation
,
geometry
.
bones
,
mesh
.
uuid
);
scope
.
mixer
.
addAction
(
new
THREE
.
AnimationAction
(
clipBones
,
0
,
1
,
1
,
true
)
);
scope
.
mixer
.
addAction
(
new
THREE
.
AnimationAction
(
clipBones
,
0
,
1
,
1
,
true
)
);
...
...
examples/webgl_morphtargets_horse.html
浏览文件 @
16ee7941
...
@@ -16,14 +16,14 @@
...
@@ -16,14 +16,14 @@
<body>
<body>
<script
src=
"../build/three.min.js"
></script>
<script
src=
"../build/three.min.js"
></script>
<script
src=
"js/libs/stats.min.js"
></script>
<script
src=
"js/libs/stats.min.js"
></script>
<script
src=
"js/AnimationClipCreator.js"
></script>
<script>
<script>
var
container
,
stats
;
var
container
,
stats
;
var
camera
,
scene
,
projector
,
renderer
;
var
camera
,
scene
,
projector
,
renderer
;
var
mesh
,
animation
;
var
mesh
,
mixer
;
init
();
init
();
animate
();
animate
();
...
@@ -66,8 +66,10 @@
...
@@ -66,8 +66,10 @@
mesh
.
scale
.
set
(
1.5
,
1.5
,
1.5
);
mesh
.
scale
.
set
(
1.5
,
1.5
,
1.5
);
scene
.
add
(
mesh
);
scene
.
add
(
mesh
);
animation
=
new
THREE
.
MorphAnimation
(
mesh
);
mixer
=
new
THREE
.
AnimationMixer
(
mesh
);
animation
.
play
();
var
clipMorphTargets
=
THREE
.
AnimationClipCreator
.
CreateMorphAnimation
(
geometry
.
morphTargets
,
1.0
);
mixer
.
addAction
(
new
THREE
.
AnimationAction
(
clipMorphTargets
,
0
,
1
,
1
,
true
)
);
}
);
}
);
...
@@ -126,11 +128,11 @@
...
@@ -126,11 +128,11 @@
camera
.
lookAt
(
camera
.
target
);
camera
.
lookAt
(
camera
.
target
);
if
(
animation
)
{
if
(
mixer
)
{
var
time
=
Date
.
now
();
var
time
=
Date
.
now
();
animation
.
update
(
time
-
prevTime
);
mixer
.
update
(
(
time
-
prevTime
)
*
0.001
);
prevTime
=
time
;
prevTime
=
time
;
...
...
examples/webgl_morphtargets_horse_mixer.html
已删除
100644 → 0
浏览文件 @
055dc347
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - morph targets - horse
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
>
<style>
body
{
font-family
:
Monospace
;
background-color
:
#f0f0f0
;
margin
:
0px
;
overflow
:
hidden
;
}
</style>
</head>
<body>
<script
src=
"../build/three.min.js"
></script>
<script
src=
"js/libs/stats.min.js"
></script>
<script
src=
"js/AnimationClipCreator.js"
></script>
<script>
var
container
,
stats
;
var
camera
,
scene
,
projector
,
renderer
;
var
mesh
,
mixer
;
init
();
animate
();
function
init
()
{
container
=
document
.
createElement
(
'
div
'
);
document
.
body
.
appendChild
(
container
);
var
info
=
document
.
createElement
(
'
div
'
);
info
.
style
.
position
=
'
absolute
'
;
info
.
style
.
top
=
'
10px
'
;
info
.
style
.
width
=
'
100%
'
;
info
.
style
.
textAlign
=
'
center
'
;
info
.
innerHTML
=
'
<a href="http://threejs.org" target="_blank">three.js</a> webgl - morph targets - horse. model by <a href="http://mirada.com/">mirada</a> from <a href="http://ro.me">rome</a>
'
;
container
.
appendChild
(
info
);
//
camera
=
new
THREE
.
PerspectiveCamera
(
50
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
10000
);
camera
.
position
.
y
=
300
;
camera
.
target
=
new
THREE
.
Vector3
(
0
,
150
,
0
);
scene
=
new
THREE
.
Scene
();
//
var
light
=
new
THREE
.
DirectionalLight
(
0xefefff
,
2
);
light
.
position
.
set
(
1
,
1
,
1
).
normalize
();
scene
.
add
(
light
);
var
light
=
new
THREE
.
DirectionalLight
(
0xffefef
,
2
);
light
.
position
.
set
(
-
1
,
-
1
,
-
1
).
normalize
();
scene
.
add
(
light
);
var
loader
=
new
THREE
.
JSONLoader
();
loader
.
load
(
"
models/animated/horse.js
"
,
function
(
geometry
)
{
mesh
=
new
THREE
.
Mesh
(
geometry
,
new
THREE
.
MeshLambertMaterial
(
{
color
:
0x606060
,
morphTargets
:
true
}
)
);
mesh
.
scale
.
set
(
1.5
,
1.5
,
1.5
);
scene
.
add
(
mesh
);
mixer
=
new
THREE
.
AnimationMixer
(
mesh
);
var
clipMorphTargets
=
THREE
.
AnimationClipCreator
.
CreateMorphAnimation
(
geometry
.
morphTargets
,
1.0
);
mixer
.
addAction
(
new
THREE
.
AnimationAction
(
clipMorphTargets
,
0
,
1
,
1
,
true
)
);
}
);
//
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setClearColor
(
0xf0f0f0
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
//
stats
=
new
Stats
();
stats
.
domElement
.
style
.
position
=
'
absolute
'
;
stats
.
domElement
.
style
.
top
=
'
0px
'
;
container
.
appendChild
(
stats
.
domElement
);
//
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
//
function
animate
()
{
requestAnimationFrame
(
animate
);
render
();
stats
.
update
();
}
var
radius
=
600
;
var
theta
=
0
;
var
prevTime
=
Date
.
now
();
function
render
()
{
theta
+=
0.1
;
camera
.
position
.
x
=
radius
*
Math
.
sin
(
THREE
.
Math
.
degToRad
(
theta
)
);
camera
.
position
.
z
=
radius
*
Math
.
cos
(
THREE
.
Math
.
degToRad
(
theta
)
);
camera
.
lookAt
(
camera
.
target
);
if
(
mixer
)
{
var
time
=
Date
.
now
();
mixer
.
update
(
(
time
-
prevTime
)
*
0.001
);
prevTime
=
time
;
}
renderer
.
render
(
scene
,
camera
);
}
</script>
</body>
</html>
examples/webgl_morphtargets_human.html
浏览文件 @
16ee7941
...
@@ -224,7 +224,7 @@
...
@@ -224,7 +224,7 @@
// update skinning
// update skinning
THREE
.
AnimationHandl
er
.
update
(
delta
);
character
.
mix
er
.
update
(
delta
);
renderer
.
render
(
scene
,
camera
);
renderer
.
render
(
scene
,
camera
);
...
...
examples/webgl_morphtargets_human_mixer.html
已删除
100644 → 0
浏览文件 @
055dc347
<!doctype html>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - morph target - human
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
>
<style>
body
{
color
:
#000
;
font-family
:
Monospace
;
font-size
:
13px
;
text-align
:
center
;
background-color
:
#fff
;
margin
:
0px
;
overflow
:
hidden
;
}
#info
{
position
:
absolute
;
top
:
0px
;
width
:
100%
;
padding
:
5px
;
}
a
{
color
:
#0af
;
}
</style>
</head>
<body>
<div
id=
"container"
></div>
<div
id=
"info"
>
<a
href=
"http://github.com/mrdoob/three.js"
target=
"_blank"
>
three.js
</a>
webgl - morph targets - human
</a>
</div>
<script
src=
"../build/three.min.js"
></script>
<script
src=
"js/UCSCharacterMixer.js"
></script>
<script
src=
"js/Detector.js"
></script>
<script
src=
'js/libs/dat.gui.min.js'
></script>
<script
src=
"js/controls/OrbitControls.js"
></script>
<script>
var
SCREEN_WIDTH
=
window
.
innerWidth
;
var
SCREEN_HEIGHT
=
window
.
innerHeight
;
var
container
;
var
camera
,
scene
;
var
renderer
;
var
mesh
;
var
mouseX
=
0
,
mouseY
=
0
;
var
windowHalfX
=
window
.
innerWidth
/
2
;
var
windowHalfY
=
window
.
innerHeight
/
2
;
var
clock
=
new
THREE
.
Clock
();
var
gui
,
skinConfig
,
morphConfig
;
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
init
();
animate
();
function
init
()
{
container
=
document
.
getElementById
(
'
container
'
);
camera
=
new
THREE
.
PerspectiveCamera
(
60
,
window
.
innerWidth
/
window
.
innerHeight
,
1
,
100000
);
camera
.
position
.
set
(
2000
,
5000
,
5000
);
scene
=
new
THREE
.
Scene
();
// LIGHTS
var
light
=
new
THREE
.
DirectionalLight
(
0xffffff
,
1
);
light
.
position
.
set
(
0
,
140
,
500
);
light
.
position
.
multiplyScalar
(
1.1
);
light
.
color
.
setHSL
(
0.6
,
0.075
,
1
);
scene
.
add
(
light
);
//
var
light
=
new
THREE
.
DirectionalLight
(
0xffffff
,
1
);
light
.
position
.
set
(
0
,
-
1
,
0
);
scene
.
add
(
light
);
// RENDERER
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setClearColor
(
0xffffff
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
SCREEN_WIDTH
,
SCREEN_HEIGHT
);
container
.
appendChild
(
renderer
.
domElement
);
// CHARACTER
character
=
new
THREE
.
UCSCharacterMixer
();
character
.
onLoadComplete
=
function
()
{
console
.
log
(
"
Load Complete
"
);
console
.
log
(
character
.
numSkins
+
"
skins and
"
+
character
.
numMorphs
+
"
morphtargets loaded.
"
);
gui
=
new
dat
.
GUI
();
setupSkinsGUI
();
setupMorphsGUI
();
gui
.
width
=
300
;
gui
.
open
();
};
var
loader
=
new
THREE
.
XHRLoader
();
loader
.
load
(
"
models/skinned/UCS_config.json
"
,
function
(
text
)
{
var
config
=
JSON
.
parse
(
text
);
character
.
loadParts
(
config
);
scene
.
add
(
character
.
root
);
}
);
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
controls
=
new
THREE
.
OrbitControls
(
camera
,
renderer
.
domElement
);
controls
.
center
.
set
(
0
,
3000
,
0
);
controls
.
addEventListener
(
'
change
'
,
render
);
}
function
setupSkinsGUI
()
{
var
skinGui
=
gui
.
addFolder
(
"
Skins
"
);
skinConfig
=
{
wireframe
:
false
};
var
skinCallback
=
function
(
index
)
{
return
function
()
{
character
.
setSkin
(
index
);
};
};
for
(
var
i
=
0
;
i
<
character
.
numSkins
;
i
++
)
{
var
name
=
character
.
skins
[
i
].
name
;
skinConfig
[
name
]
=
skinCallback
(
i
);
}
for
(
var
i
=
0
;
i
<
character
.
numSkins
;
i
++
)
{
skinGui
.
add
(
skinConfig
,
character
.
skins
[
i
].
name
);
}
skinGui
.
open
();
}
function
setupMorphsGUI
()
{
var
morphGui
=
gui
.
addFolder
(
"
Morphs
"
);
morphConfig
=
{
};
var
morphCallback
=
function
(
index
)
{
return
function
()
{
character
.
updateMorphs
(
morphConfig
);
}
};
for
(
var
i
=
0
;
i
<
character
.
numMorphs
;
i
++
)
{
var
morphName
=
character
.
morphs
[
i
];
morphConfig
[
morphName
]
=
0
;
}
for
(
var
i
=
0
;
i
<
character
.
numMorphs
;
i
++
)
{
morphGui
.
add
(
morphConfig
,
character
.
morphs
[
i
]
).
min
(
0
).
max
(
100
).
onChange
(
morphCallback
(
i
)
);
}
morphGui
.
open
();
}
function
onWindowResize
()
{
windowHalfX
=
window
.
innerWidth
/
2
;
windowHalfY
=
window
.
innerHeight
/
2
;
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
}
function
onDocumentMouseMove
(
event
)
{
mouseX
=
(
event
.
clientX
-
windowHalfX
)
*
10
;
mouseY
=
(
event
.
clientY
-
windowHalfY
)
*
10
;
}
//
function
animate
()
{
requestAnimationFrame
(
animate
);
controls
.
update
();
render
();
}
function
render
()
{
var
delta
=
0.75
*
clock
.
getDelta
();
// update skinning
character
.
mixer
.
update
(
delta
);
renderer
.
render
(
scene
,
camera
);
}
</script>
</body>
</html>
src/animation/PropertyBinding.js
浏览文件 @
16ee7941
...
@@ -47,7 +47,7 @@ THREE.PropertyBinding.prototype = {
...
@@ -47,7 +47,7 @@ THREE.PropertyBinding.prototype = {
if
(
this
.
cumulativeWeight
===
0
)
{
if
(
this
.
cumulativeWeight
===
0
)
{
if
(
weight
>
0
)
{
if
(
weight
>
0
)
{
if
(
this
.
cumulativeValue
===
null
)
{
if
(
this
.
cumulativeValue
===
null
)
{
this
.
cumulativeValue
=
THREE
.
AnimationUtils
.
clone
(
value
);
this
.
cumulativeValue
=
THREE
.
AnimationUtils
.
clone
(
value
);
}
}
...
@@ -94,7 +94,7 @@ THREE.PropertyBinding.prototype = {
...
@@ -94,7 +94,7 @@ THREE.PropertyBinding.prototype = {
//console.log( "PropertyBinding", this );
//console.log( "PropertyBinding", this );
var
targetObject
=
this
.
rootN
ode
;
var
targetObject
=
this
.
n
ode
;
// ensure there is a value node
// ensure there is a value node
if
(
!
targetObject
)
{
if
(
!
targetObject
)
{
...
@@ -118,6 +118,7 @@ THREE.PropertyBinding.prototype = {
...
@@ -118,6 +118,7 @@ THREE.PropertyBinding.prototype = {
else
if
(
this
.
objectName
===
"
bones
"
)
{
else
if
(
this
.
objectName
===
"
bones
"
)
{
if
(
!
targetObject
.
skeleton
)
{
if
(
!
targetObject
.
skeleton
)
{
console
.
error
(
'
can not bind to bones as node does not have a skeleton
'
,
this
);
console
.
error
(
'
can not bind to bones as node does not have a skeleton
'
,
this
);
return
;
}
}
// TODO/OPTIMIZE, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.
// TODO/OPTIMIZE, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录