Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
5b8f3700
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,发现更多精彩内容 >>
提交
5b8f3700
编写于
2月 20, 2011
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
差异文件
Merge remote branch 'alteredq/skinning' into skinning
上级
251a7d53
3ecde220
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
87 deletion
+28
-87
build/ThreeExtras.js
build/ThreeExtras.js
+1
-3
examples/ribbons_gl.html
examples/ribbons_gl.html
+15
-12
src/extras/MiscUtils.js
src/extras/MiscUtils.js
+12
-72
未找到文件。
build/ThreeExtras.js
浏览文件 @
5b8f3700
...
...
@@ -280,9 +280,7 @@ THREE.Detector={canvas:!!document.createElement("canvas").getContext,webgl:windo
c
;
c
=
d
.
style
;
c
.
fontFamily
=
"
monospace
"
;
c
.
fontSize
=
"
13px
"
;
c
.
textAlign
=
"
center
"
;
c
.
background
=
"
#eee
"
;
c
.
color
=
"
#000
"
;
c
.
padding
=
"
1em
"
;
c
.
width
=
"
475px
"
;
c
.
margin
=
"
5em auto 0
"
;
a
.
appendChild
(
d
);
b
.
appendChild
(
a
);
return
d
}};
var
GeometryUtils
=
{
merge
:
function
(
a
,
b
){
var
c
=
b
instanceof
THREE
.
Mesh
,
d
=
a
.
vertices
.
length
,
f
=
c
?
b
.
geometry
:
b
,
g
=
a
.
vertices
,
h
=
f
.
vertices
,
k
=
a
.
faces
,
j
=
f
.
faces
,
m
=
a
.
uvs
;
f
=
f
.
uvs
;
c
&&
b
.
autoUpdateMatrix
&&
b
.
updateMatrix
();
for
(
var
o
=
0
,
w
=
h
.
length
;
o
<
w
;
o
++
){
var
u
=
new
THREE
.
Vertex
(
h
[
o
].
position
.
clone
());
c
&&
b
.
localMatrix
.
multiplyVector3
(
u
.
position
);
g
.
push
(
u
)}
o
=
0
;
for
(
w
=
j
.
length
;
o
<
w
;
o
++
){
h
=
j
[
o
];
var
t
,
x
=
h
.
vertexNormals
;
if
(
h
instanceof
THREE
.
Face3
)
t
=
new
THREE
.
Face3
(
h
.
a
+
d
,
h
.
b
+
d
,
h
.
c
+
d
);
else
h
instanceof
THREE
.
Face4
&&
(
t
=
new
THREE
.
Face4
(
h
.
a
+
d
,
h
.
b
+
d
,
h
.
c
+
d
,
h
.
d
+
d
));
t
.
centroid
.
copy
(
h
.
centroid
);
t
.
normal
.
copy
(
h
.
normal
);
c
=
0
;
for
(
g
=
x
.
length
;
c
<
g
;
c
++
){
u
=
x
[
c
];
t
.
vertexNormals
.
push
(
u
.
clone
())}
t
.
materials
=
h
.
materials
.
slice
();
k
.
push
(
t
)}
o
=
0
;
for
(
w
=
f
.
length
;
o
<
w
;
o
++
){
d
=
f
[
o
];
k
=
[];
c
=
0
;
for
(
g
=
d
.
length
;
c
<
g
;
c
++
)
k
.
push
(
new
THREE
.
UV
(
d
[
c
].
u
,
d
[
c
].
v
));
m
.
push
(
k
)}}},
ImageUtils
=
{
loadTexture
:
function
(
a
,
b
,
c
){
var
d
=
new
Image
;
d
.
onload
=
function
(){
this
.
loaded
=!
0
;
c
&&
c
(
this
)};
d
.
src
=
a
;
return
new
THREE
.
Texture
(
d
,
b
)},
loadArray
:
function
(
a
,
b
){
var
c
,
d
,
f
=
[];
c
=
f
.
loadCount
=
0
;
for
(
d
=
a
.
length
;
c
<
d
;
++
c
){
f
[
c
]
=
new
Image
;
f
[
c
].
loaded
=
0
;
f
[
c
].
onload
=
function
(){
f
.
loadCount
+=
1
;
this
.
loaded
=!
0
;
b
&&
b
(
this
)};
f
[
c
].
src
=
a
[
c
]}
return
f
}};
THREE
.
requestAnimationFrame
=
function
(
a
,
b
){
if
(
!
THREE
.
requestAnimationFrameImpl_
)
THREE
.
requestAnimationFrameImpl_
=
function
(){
for
(
var
c
=
[
a
,
window
],
d
=
[
"
requestAnimationFrame
"
,
"
webkitRequestAnimationFrame
"
,
"
mozRequestAnimationFrame
"
,
"
operaRequestAnimationFrame
"
,
"
requestAnimationFrame
"
],
f
=
[
function
(
m
){
return
function
(
o
,
w
){
o
[
m
].
call
(
o
,
w
)}},
function
(
m
){
return
function
(
o
,
w
){
window
[
m
].
call
(
window
,
w
)}}],
g
=
0
;
g
<
c
.
length
;
++
g
)
for
(
var
h
=
c
[
g
],
k
=
0
;
k
<
d
.
length
;
++
k
){
var
j
=
d
[
k
];
if
(
h
[
j
]){
console
.
log
(
"
using
"
,
j
);
return
f
[
g
](
j
)}}
console
.
log
(
"
using window.setTimeout
"
);
return
function
(
m
,
o
){
window
.
setTimeout
(
o
,
1
E3
/
70
)}}();
THREE
.
requestAnimationFrameImpl_
(
a
,
b
)};
d
;
++
c
){
f
[
c
]
=
new
Image
;
f
[
c
].
loaded
=
0
;
f
[
c
].
onload
=
function
(){
f
.
loadCount
+=
1
;
this
.
loaded
=!
0
;
b
&&
b
(
this
)};
f
[
c
].
src
=
a
[
c
]}
return
f
}};
if
(
!
window
.
requestAnimationFrame
)
window
.
requestAnimationFrame
=
function
(){
return
window
.
requestAnimationFrame
||
window
.
webkitRequestAnimationFrame
||
window
.
mozRequestAnimationFrame
||
window
.
oRequestAnimationFrame
||
window
.
msRequestAnimationFrame
||
function
(
a
){
window
.
setTimeout
(
a
,
1
E3
/
60
)}}();
var
SceneUtils
=
{
loadScene
:
function
(
a
,
b
,
c
,
d
){
a
=
new
Worker
(
a
);
a
.
postMessage
(
0
);
a
.
onmessage
=
function
(
f
){
function
g
(){
for
(
o
in
L
.
objects
)
if
(
!
G
.
objects
[
o
]){
A
=
L
.
objects
[
o
];
if
(
q
=
G
.
geometries
[
A
.
geometry
]){
ba
=
[];
for
(
i
=
0
;
i
<
A
.
materials
.
length
;
i
++
)
ba
[
i
]
=
G
.
materials
[
A
.
materials
[
i
]];
F
=
A
.
position
;
r
=
A
.
rotation
;
s
=
A
.
scale
;
object
=
new
THREE
.
Mesh
(
q
,
ba
);
object
.
position
.
set
(
F
[
0
],
F
[
1
],
F
[
2
]);
object
.
rotation
.
set
(
r
[
0
],
r
[
1
],
r
[
2
]);
object
.
scale
.
set
(
s
[
0
],
s
[
1
],
s
[
2
]);
object
.
visible
=
A
.
visible
;
G
.
scene
.
addObject
(
object
);
G
.
objects
[
o
]
=
object
}}}
function
h
(
U
){
return
function
(
na
){
G
.
geometries
[
U
]
=
na
;
g
();
V
-=
1
;
k
()}}
function
k
(){
d
({
total_models
:
Y
,
total_textures
:
Z
,
loaded_models
:
Y
-
V
,
loaded_textures
:
Z
-
S
},
G
);
V
==
0
&&
S
==
0
&&
c
(
G
)}
var
j
,
m
,
o
,
w
,
u
,
t
,
x
,
A
,
F
,
v
,
I
,
q
,
J
,
e
,
ba
,
L
,
M
,
V
,
S
,
Y
,
Z
,
G
;
L
=
f
.
data
;
M
=
new
THREE
.
Loader
;
S
=
V
=
0
;
G
=
{
scene
:
new
THREE
.
Scene
,
geometries
:{},
materials
:{},
textures
:{},
objects
:{},
cameras
:{},
lights
:{},
fogs
:{}};
f
=
function
(){
S
-=
1
;
k
()};
for
(
u
in
L
.
cameras
){
v
=
L
.
cameras
[
u
];
if
(
v
.
type
==
"
perspective
"
)
J
=
new
THREE
.
Camera
(
v
.
fov
,
v
.
aspect
,
v
.
near
,
v
.
far
);
else
if
(
v
.
type
==
"
ortho
"
){
J
=
new
THREE
.
Camera
;
J
.
projectionMatrix
=
THREE
.
Matrix4
.
makeOrtho
(
v
.
left
,
v
.
right
,
v
.
top
,
v
.
bottom
,
v
.
near
,
v
.
far
)}
F
=
v
.
position
;
v
=
v
.
target
;
J
.
position
.
set
(
F
[
0
],
F
[
1
],
F
[
2
]);
J
.
target
.
position
.
set
(
v
[
0
],
v
[
1
],
v
[
2
]);
G
.
cameras
[
u
]
=
J
}
for
(
w
in
L
.
lights
){
u
=
L
.
lights
[
w
];
if
(
u
.
type
==
"
directional
"
){
F
=
u
.
direction
;
light
=
new
THREE
.
DirectionalLight
;
light
.
position
.
set
(
F
[
0
],
F
[
1
],
F
[
2
]);
light
.
position
.
normalize
()}
else
if
(
u
.
type
==
"
point
"
){
F
=
u
.
position
;
light
=
new
THREE
.
PointLight
;
light
.
position
.
set
(
F
[
0
],
F
[
1
],
...
...
examples/ribbons_gl.html
浏览文件 @
5b8f3700
...
...
@@ -27,22 +27,24 @@
z-index
:
100
;
}
</style>
</style>
</head>
<body>
<body>
<script
type=
"text/javascript"
src=
"../build/ThreeExtras.js"
></script>
<script
type=
"text/javascript"
src=
"js/Stats.js"
></script>
<div
id=
"info"
>
<a
href=
"http://github.com/mrdoob/three.js"
target=
"_blank"
>
three.js
</a>
- webgl ribbons example
</div>
<script
type=
"text/javascript"
src=
"../build/ThreeExtras.js"
></script>
<script
type=
"text/javascript"
src=
"js/Stats.js"
></script>
<script
type=
"text/javascript"
>
if
(
!
THREE
.
Detector
.
webgl
)
THREE
.
Detector
.
addGetWebGLMessage
();
window
.
onload
=
init
;
var
container
,
stats
;
var
camera
,
scene
,
renderer
,
ribbon
,
geometry
,
geometry2
,
materials
=
[],
ribbons
=
[],
...
...
@@ -58,9 +60,6 @@
enabled
:
true
};
init
();
loop
();
function
init
()
{
...
...
@@ -168,6 +167,8 @@
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
document
.
addEventListener
(
'
touchmove
'
,
onDocumentTouchMove
,
false
);
loop
();
}
function
onDocumentMouseMove
(
event
)
{
...
...
@@ -257,9 +258,9 @@
}
function
loop
()
{
THREE
.
requestAnimationFrame
(
renderer
.
domElement
,
loop
);
requestAnimationFrame
(
loop
,
renderer
.
domElement
);
var
time
=
new
Date
().
getTime
()
*
0.00005
;
camera
.
position
.
x
+=
(
mouseX
-
camera
.
position
.
x
)
*
0.036
;
...
...
@@ -335,6 +336,8 @@
stats
.
update
();
}
...
...
src/extras/MiscUtils.js
浏览文件 @
5b8f3700
...
...
@@ -2,75 +2,15 @@
* @author greggman / http://greggman.com/
*/
THREE
.
requestAnimationFrame
=
function
(
element
,
callback
)
{
if
(
!
THREE
.
requestAnimationFrameImpl_
)
{
THREE
.
requestAnimationFrameImpl_
=
function
()
{
var
objects
=
[
element
,
window
];
var
functionNames
=
[
"
requestAnimationFrame
"
,
"
webkitRequestAnimationFrame
"
,
"
mozRequestAnimationFrame
"
,
"
operaRequestAnimationFrame
"
,
"
requestAnimationFrame
"
];
var
functions
=
[
function
(
name
)
{
return
function
(
element
,
callback
)
{
element
[
name
].
call
(
element
,
callback
);
};
},
function
(
name
)
{
return
function
(
element
,
callback
)
{
window
[
name
].
call
(
window
,
callback
);
};
}
];
for
(
var
ii
=
0
;
ii
<
objects
.
length
;
++
ii
)
{
var
obj
=
objects
[
ii
];
for
(
var
jj
=
0
;
jj
<
functionNames
.
length
;
++
jj
)
{
var
functionName
=
functionNames
[
jj
];
if
(
obj
[
functionName
]
)
{
console
.
log
(
"
using
"
,
functionName
);
return
functions
[
ii
](
functionName
);
}
}
}
console
.
log
(
"
using window.setTimeout
"
);
return
function
(
element
,
callback
)
{
window
.
setTimeout
(
callback
,
1000
/
70
);
};
}();
}
THREE
.
requestAnimationFrameImpl_
(
element
,
callback
);
};
if
(
!
window
.
requestAnimationFrame
)
{
window
.
requestAnimationFrame
=
(
function
()
{
return
window
.
requestAnimationFrame
||
window
.
webkitRequestAnimationFrame
||
window
.
mozRequestAnimationFrame
||
window
.
oRequestAnimationFrame
||
window
.
msRequestAnimationFrame
||
function
(
/* function FrameRequestCallback */
callback
,
/* DOMElement Element */
element
)
{
window
.
setTimeout
(
callback
,
1000
/
60
);
};
})();
};
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录