Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
b5db8b34
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,发现更多精彩内容 >>
提交
b5db8b34
编写于
6月 17, 2018
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removed webgl_loader_msgpack example.
上级
3ff59ea7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
0 addition
and
1415 deletion
+0
-1415
examples/files.js
examples/files.js
+0
-1
examples/js/libs/msgpack-js.js
examples/js/libs/msgpack-js.js
+0
-646
examples/models/msgpack/robo_pigeon.js
examples/models/msgpack/robo_pigeon.js
+0
-615
examples/models/msgpack/robo_pigeon.pack
examples/models/msgpack/robo_pigeon.pack
+0
-0
examples/webgl_loader_msgpack.html
examples/webgl_loader_msgpack.html
+0
-153
未找到文件。
examples/files.js
浏览文件 @
b5db8b34
...
...
@@ -103,7 +103,6 @@ var files = {
"
webgl_loader_mmd
"
,
"
webgl_loader_mmd_pose
"
,
"
webgl_loader_mmd_audio
"
,
"
webgl_loader_msgpack
"
,
"
webgl_loader_nodes
"
,
"
webgl_loader_obj
"
,
"
webgl_loader_obj_mtl
"
,
...
...
examples/js/libs/msgpack-js.js
已删除
100644 → 0
浏览文件 @
3ff59ea7
/* jshint browser: true */
/* global define, module */
(
// Module boilerplate to support browser globals and browserify and AMD.
typeof
define
===
"
function
"
?
function
(
m
)
{
define
(
"
msgpack-js
"
,
m
);
}
:
typeof
exports
===
"
object
"
?
function
(
m
)
{
module
.
exports
=
m
();
}
:
function
(
m
){
this
.
msgpack
=
m
();
}
)(
function
()
{
"
use strict
"
;
var
exports
=
{};
exports
.
inspect
=
inspect
;
function
inspect
(
buffer
)
{
if
(
buffer
===
undefined
)
return
"
undefined
"
;
var
view
;
var
type
;
if
(
buffer
instanceof
ArrayBuffer
)
{
type
=
"
ArrayBuffer
"
;
view
=
new
DataView
(
buffer
);
}
else
if
(
buffer
instanceof
DataView
)
{
type
=
"
DataView
"
;
view
=
buffer
;
}
if
(
!
view
)
return
JSON
.
stringify
(
buffer
);
var
bytes
=
[];
for
(
var
i
=
0
;
i
<
buffer
.
byteLength
;
i
++
)
{
if
(
i
>
20
)
{
bytes
.
push
(
"
...
"
);
break
;
}
var
byte
=
view
.
getUint8
(
i
).
toString
(
16
);
if
(
byte
.
length
===
1
)
byte
=
"
0
"
+
byte
;
bytes
.
push
(
byte
);
}
return
"
<
"
+
type
+
"
"
+
bytes
.
join
(
"
"
)
+
"
>
"
;
}
// Encode string as utf8 into dataview at offset
exports
.
utf8Write
=
utf8Write
;
function
utf8Write
(
view
,
offset
,
string
)
{
var
byteLength
=
view
.
byteLength
;
for
(
var
i
=
0
,
l
=
string
.
length
;
i
<
l
;
i
++
)
{
var
codePoint
=
string
.
charCodeAt
(
i
);
// One byte of UTF-8
if
(
codePoint
<
0x80
)
{
view
.
setUint8
(
offset
++
,
codePoint
>>>
0
&
0x7f
|
0x00
);
continue
;
}
// Two bytes of UTF-8
if
(
codePoint
<
0x800
)
{
view
.
setUint8
(
offset
++
,
codePoint
>>>
6
&
0x1f
|
0xc0
);
view
.
setUint8
(
offset
++
,
codePoint
>>>
0
&
0x3f
|
0x80
);
continue
;
}
// Three bytes of UTF-8.
if
(
codePoint
<
0x10000
)
{
view
.
setUint8
(
offset
++
,
codePoint
>>>
12
&
0x0f
|
0xe0
);
view
.
setUint8
(
offset
++
,
codePoint
>>>
6
&
0x3f
|
0x80
);
view
.
setUint8
(
offset
++
,
codePoint
>>>
0
&
0x3f
|
0x80
);
continue
;
}
// Four bytes of UTF-8
if
(
codePoint
<
0x110000
)
{
view
.
setUint8
(
offset
++
,
codePoint
>>>
18
&
0x07
|
0xf0
);
view
.
setUint8
(
offset
++
,
codePoint
>>>
12
&
0x3f
|
0x80
);
view
.
setUint8
(
offset
++
,
codePoint
>>>
6
&
0x3f
|
0x80
);
view
.
setUint8
(
offset
++
,
codePoint
>>>
0
&
0x3f
|
0x80
);
continue
;
}
throw
new
Error
(
"
bad codepoint
"
+
codePoint
);
}
}
exports
.
utf8Read
=
utf8Read
;
function
utf8Read
(
view
,
offset
,
length
)
{
var
string
=
""
;
for
(
var
i
=
offset
,
end
=
offset
+
length
;
i
<
end
;
i
++
)
{
var
byte
=
view
.
getUint8
(
i
);
// One byte character
if
((
byte
&
0x80
)
===
0x00
)
{
string
+=
String
.
fromCharCode
(
byte
);
continue
;
}
// Two byte character
if
((
byte
&
0xe0
)
===
0xc0
)
{
string
+=
String
.
fromCharCode
(
((
byte
&
0x1f
)
<<
6
)
|
(
view
.
getUint8
(
++
i
)
&
0x3f
)
);
continue
;
}
// Three byte character
if
((
byte
&
0xf0
)
===
0xe0
)
{
string
+=
String
.
fromCharCode
(
((
byte
&
0x0f
)
<<
12
)
|
((
view
.
getUint8
(
++
i
)
&
0x3f
)
<<
6
)
|
((
view
.
getUint8
(
++
i
)
&
0x3f
)
<<
0
)
);
continue
;
}
// Four byte character
if
((
byte
&
0xf8
)
===
0xf0
)
{
string
+=
String
.
fromCharCode
(
((
byte
&
0x07
)
<<
18
)
|
((
view
.
getUint8
(
++
i
)
&
0x3f
)
<<
12
)
|
((
view
.
getUint8
(
++
i
)
&
0x3f
)
<<
6
)
|
((
view
.
getUint8
(
++
i
)
&
0x3f
)
<<
0
)
);
continue
;
}
throw
new
Error
(
"
Invalid byte
"
+
byte
.
toString
(
16
));
}
return
string
;
}
exports
.
utf8ByteCount
=
utf8ByteCount
;
function
utf8ByteCount
(
string
)
{
var
count
=
0
;
for
(
var
i
=
0
,
l
=
string
.
length
;
i
<
l
;
i
++
)
{
var
codePoint
=
string
.
charCodeAt
(
i
);
if
(
codePoint
<
0x80
)
{
count
+=
1
;
continue
;
}
if
(
codePoint
<
0x800
)
{
count
+=
2
;
continue
;
}
if
(
codePoint
<
0x10000
)
{
count
+=
3
;
continue
;
}
if
(
codePoint
<
0x110000
)
{
count
+=
4
;
continue
;
}
throw
new
Error
(
"
bad codepoint
"
+
codePoint
);
}
return
count
;
}
exports
.
encode
=
function
(
value
)
{
var
buffer
=
new
ArrayBuffer
(
encodedSize
(
value
));
var
view
=
new
DataView
(
buffer
);
encode
(
value
,
view
,
0
);
return
buffer
;
};
exports
.
decode
=
decode
;
// https://github.com/msgpack/msgpack/blob/master/spec.md
// we reserve extension type 0x00 to encode javascript 'undefined'
function
Decoder
(
view
,
offset
)
{
this
.
offset
=
offset
||
0
;
this
.
view
=
view
;
}
Decoder
.
prototype
.
map
=
function
(
length
)
{
var
value
=
{};
for
(
var
i
=
0
;
i
<
length
;
i
++
)
{
var
key
=
this
.
parse
();
value
[
key
]
=
this
.
parse
();
}
return
value
;
};
Decoder
.
prototype
.
bin
=
function
(
length
)
{
var
value
=
new
ArrayBuffer
(
length
);
(
new
Uint8Array
(
value
)).
set
(
new
Uint8Array
(
this
.
view
.
buffer
,
this
.
offset
,
length
),
0
);
this
.
offset
+=
length
;
return
value
;
};
Decoder
.
prototype
.
str
=
function
(
length
)
{
var
value
=
utf8Read
(
this
.
view
,
this
.
offset
,
length
);
this
.
offset
+=
length
;
return
value
;
};
Decoder
.
prototype
.
array
=
function
(
length
)
{
var
value
=
new
Array
(
length
);
for
(
var
i
=
0
;
i
<
length
;
i
++
)
{
value
[
i
]
=
this
.
parse
();
}
return
value
;
};
Decoder
.
prototype
.
parse
=
function
()
{
var
type
=
this
.
view
.
getUint8
(
this
.
offset
);
var
value
,
length
;
// FixStr
if
((
type
&
0xe0
)
===
0xa0
)
{
length
=
type
&
0x1f
;
this
.
offset
++
;
return
this
.
str
(
length
);
}
// FixMap
if
((
type
&
0xf0
)
===
0x80
)
{
length
=
type
&
0x0f
;
this
.
offset
++
;
return
this
.
map
(
length
);
}
// FixArray
if
((
type
&
0xf0
)
===
0x90
)
{
length
=
type
&
0x0f
;
this
.
offset
++
;
return
this
.
array
(
length
);
}
// Positive FixNum
if
((
type
&
0x80
)
===
0x00
)
{
this
.
offset
++
;
return
type
;
}
// Negative Fixnum
if
((
type
&
0xe0
)
===
0xe0
)
{
value
=
this
.
view
.
getInt8
(
this
.
offset
);
this
.
offset
++
;
return
value
;
}
// Undefined as FixExt1
if
(
type
===
0xd4
&&
this
.
view
.
getUint8
(
this
.
offset
+
1
)
===
0x00
)
{
this
.
offset
+=
3
;
return
undefined
;
}
switch
(
type
)
{
// str 8
case
0xd9
:
length
=
this
.
view
.
getUint8
(
this
.
offset
+
1
);
this
.
offset
+=
2
;
return
this
.
str
(
length
);
// str 16
case
0xda
:
length
=
this
.
view
.
getUint16
(
this
.
offset
+
1
);
this
.
offset
+=
3
;
return
this
.
str
(
length
);
// str 32
case
0xdb
:
length
=
this
.
view
.
getUint32
(
this
.
offset
+
1
);
this
.
offset
+=
5
;
return
this
.
str
(
length
);
// bin 8
case
0xc4
:
length
=
this
.
view
.
getUint8
(
this
.
offset
+
1
);
this
.
offset
+=
2
;
return
this
.
bin
(
length
);
// bin 16
case
0xc5
:
length
=
this
.
view
.
getUint16
(
this
.
offset
+
1
);
this
.
offset
+=
3
;
return
this
.
bin
(
length
);
// bin 32
case
0xc6
:
length
=
this
.
view
.
getUint32
(
this
.
offset
+
1
);
this
.
offset
+=
5
;
return
this
.
bin
(
length
);
// nil
case
0xc0
:
this
.
offset
++
;
return
null
;
// false
case
0xc2
:
this
.
offset
++
;
return
false
;
// true
case
0xc3
:
this
.
offset
++
;
return
true
;
// uint8
case
0xcc
:
value
=
this
.
view
.
getUint8
(
this
.
offset
+
1
);
this
.
offset
+=
2
;
return
value
;
// uint 16
case
0xcd
:
value
=
this
.
view
.
getUint16
(
this
.
offset
+
1
);
this
.
offset
+=
3
;
return
value
;
// uint 32
case
0xce
:
value
=
this
.
view
.
getUint32
(
this
.
offset
+
1
);
this
.
offset
+=
5
;
return
value
;
// uint 64
case
0xcf
:
var
high
=
this
.
view
.
getUint32
(
this
.
offset
+
1
);
var
low
=
this
.
view
.
getUint32
(
this
.
offset
+
5
);
value
=
high
*
0x100000000
+
low
;
this
.
offset
+=
9
;
return
value
;
// int 8
case
0xd0
:
value
=
this
.
view
.
getInt8
(
this
.
offset
+
1
);
this
.
offset
+=
2
;
return
value
;
// int 16
case
0xd1
:
value
=
this
.
view
.
getInt16
(
this
.
offset
+
1
);
this
.
offset
+=
3
;
return
value
;
// int 32
case
0xd2
:
value
=
this
.
view
.
getInt32
(
this
.
offset
+
1
);
this
.
offset
+=
5
;
return
value
;
// int 64
case
0xd3
:
var
high
=
this
.
view
.
getInt32
(
this
.
offset
+
1
);
var
low
=
this
.
view
.
getUint32
(
this
.
offset
+
5
);
value
=
high
*
0x100000000
+
low
;
this
.
offset
+=
9
;
return
value
;
// map 16
case
0xde
:
length
=
this
.
view
.
getUint16
(
this
.
offset
+
1
);
this
.
offset
+=
3
;
return
this
.
map
(
length
);
// map 32
case
0xdf
:
length
=
this
.
view
.
getUint32
(
this
.
offset
+
1
);
this
.
offset
+=
5
;
return
this
.
map
(
length
);
// array 16
case
0xdc
:
length
=
this
.
view
.
getUint16
(
this
.
offset
+
1
);
this
.
offset
+=
3
;
return
this
.
array
(
length
);
// array 32
case
0xdd
:
length
=
this
.
view
.
getUint32
(
this
.
offset
+
1
);
this
.
offset
+=
5
;
return
this
.
array
(
length
);
// float
case
0xca
:
value
=
this
.
view
.
getFloat32
(
this
.
offset
+
1
);
this
.
offset
+=
5
;
return
value
;
// double
case
0xcb
:
value
=
this
.
view
.
getFloat64
(
this
.
offset
+
1
);
this
.
offset
+=
9
;
return
value
;
}
throw
new
Error
(
"
Unknown type 0x
"
+
type
.
toString
(
16
));
};
function
decode
(
buffer
)
{
var
view
=
new
DataView
(
buffer
);
var
decoder
=
new
Decoder
(
view
);
var
value
=
decoder
.
parse
();
if
(
decoder
.
offset
!==
buffer
.
byteLength
)
throw
new
Error
((
buffer
.
byteLength
-
decoder
.
offset
)
+
"
trailing bytes
"
);
return
value
;
}
function
encode
(
value
,
view
,
offset
)
{
var
type
=
typeof
value
;
// Strings Bytes
if
(
type
===
"
string
"
)
{
var
length
=
utf8ByteCount
(
value
);
// fix str
if
(
length
<
0x20
)
{
view
.
setUint8
(
offset
,
length
|
0xa0
);
utf8Write
(
view
,
offset
+
1
,
value
);
return
1
+
length
;
}
// str 8
if
(
length
<
0x100
)
{
view
.
setUint8
(
offset
,
0xd9
);
view
.
setUint8
(
offset
+
1
,
length
);
utf8Write
(
view
,
offset
+
2
,
value
);
return
2
+
length
;
}
// str 16
if
(
length
<
0x10000
)
{
view
.
setUint8
(
offset
,
0xda
);
view
.
setUint16
(
offset
+
1
,
length
);
utf8Write
(
view
,
offset
+
3
,
value
);
return
3
+
length
;
}
// str 32
if
(
length
<
0x100000000
)
{
view
.
setUint8
(
offset
,
0xdb
);
view
.
setUint32
(
offset
+
1
,
length
);
utf8Write
(
view
,
offset
+
5
,
value
);
return
5
+
length
;
}
}
if
(
value
instanceof
ArrayBuffer
)
{
var
length
=
value
.
byteLength
;
// bin 8
if
(
length
<
0x100
)
{
view
.
setUint8
(
offset
,
0xc4
);
view
.
setUint8
(
offset
+
1
,
length
);
(
new
Uint8Array
(
view
.
buffer
)).
set
(
new
Uint8Array
(
value
),
offset
+
2
);
return
2
+
length
;
}
// bin 16
if
(
length
<
0x10000
)
{
view
.
setUint8
(
offset
,
0xc5
);
view
.
setUint16
(
offset
+
1
,
length
);
(
new
Uint8Array
(
view
.
buffer
)).
set
(
new
Uint8Array
(
value
),
offset
+
3
);
return
3
+
length
;
}
// bin 32
if
(
length
<
0x100000000
)
{
view
.
setUint8
(
offset
,
0xc6
);
view
.
setUint32
(
offset
+
1
,
length
);
(
new
Uint8Array
(
view
.
buffer
)).
set
(
new
Uint8Array
(
value
),
offset
+
5
);
return
5
+
length
;
}
}
if
(
type
===
"
number
"
)
{
// Floating Point
if
((
value
<<
0
)
!==
value
)
{
view
.
setUint8
(
offset
,
0xcb
);
view
.
setFloat64
(
offset
+
1
,
value
);
return
9
;
}
// Integers
if
(
value
>=
0
)
{
// positive fixnum
if
(
value
<
0x80
)
{
view
.
setUint8
(
offset
,
value
);
return
1
;
}
// uint 8
if
(
value
<
0x100
)
{
view
.
setUint8
(
offset
,
0xcc
);
view
.
setUint8
(
offset
+
1
,
value
);
return
2
;
}
// uint 16
if
(
value
<
0x10000
)
{
view
.
setUint8
(
offset
,
0xcd
);
view
.
setUint16
(
offset
+
1
,
value
);
return
3
;
}
// uint 32
if
(
value
<
0x100000000
)
{
view
.
setUint8
(
offset
,
0xce
);
view
.
setUint32
(
offset
+
1
,
value
);
return
5
;
}
throw
new
Error
(
"
Number too big 0x
"
+
value
.
toString
(
16
));
}
// negative fixnum
if
(
value
>=
-
0x20
)
{
view
.
setInt8
(
offset
,
value
);
return
1
;
}
// int 8
if
(
value
>=
-
0x80
)
{
view
.
setUint8
(
offset
,
0xd0
);
view
.
setInt8
(
offset
+
1
,
value
);
return
2
;
}
// int 16
if
(
value
>=
-
0x8000
)
{
view
.
setUint8
(
offset
,
0xd1
);
view
.
setInt16
(
offset
+
1
,
value
);
return
3
;
}
// int 32
if
(
value
>=
-
0x80000000
)
{
view
.
setUint8
(
offset
,
0xd2
);
view
.
setInt32
(
offset
+
1
,
value
);
return
5
;
}
throw
new
Error
(
"
Number too small -0x
"
+
(
-
value
).
toString
(
16
).
substr
(
1
));
}
// undefined
if
(
type
===
"
undefined
"
)
{
view
.
setUint8
(
offset
,
0xd4
);
// fixext 1
view
.
setUint8
(
offset
+
1
,
0
);
// type (undefined)
view
.
setUint8
(
offset
+
2
,
0
);
// data (ignored)
return
3
;
}
// null
if
(
value
===
null
)
{
view
.
setUint8
(
offset
,
0xc0
);
return
1
;
}
// Boolean
if
(
type
===
"
boolean
"
)
{
view
.
setUint8
(
offset
,
value
?
0xc3
:
0xc2
);
return
1
;
}
// Container Types
if
(
type
===
"
object
"
)
{
var
length
,
size
=
0
;
var
isArray
=
Array
.
isArray
(
value
);
if
(
isArray
)
{
length
=
value
.
length
;
}
else
{
var
keys
=
Object
.
keys
(
value
);
length
=
keys
.
length
;
}
var
size
;
if
(
length
<
0x10
)
{
view
.
setUint8
(
offset
,
length
|
(
isArray
?
0x90
:
0x80
));
size
=
1
;
}
else
if
(
length
<
0x10000
)
{
view
.
setUint8
(
offset
,
isArray
?
0xdc
:
0xde
);
view
.
setUint16
(
offset
+
1
,
length
);
size
=
3
;
}
else
if
(
length
<
0x100000000
)
{
view
.
setUint8
(
offset
,
isArray
?
0xdd
:
0xdf
);
view
.
setUint32
(
offset
+
1
,
length
);
size
=
5
;
}
if
(
isArray
)
{
for
(
var
i
=
0
;
i
<
length
;
i
++
)
{
size
+=
encode
(
value
[
i
],
view
,
offset
+
size
);
}
}
else
{
for
(
var
i
=
0
;
i
<
length
;
i
++
)
{
var
key
=
keys
[
i
];
size
+=
encode
(
key
,
view
,
offset
+
size
);
size
+=
encode
(
value
[
key
],
view
,
offset
+
size
);
}
}
return
size
;
}
throw
new
Error
(
"
Unknown type
"
+
type
);
}
function
encodedSize
(
value
)
{
var
type
=
typeof
value
;
// Raw Bytes
if
(
type
===
"
string
"
)
{
var
length
=
utf8ByteCount
(
value
);
if
(
length
<
0x20
)
{
return
1
+
length
;
}
if
(
length
<
0x100
)
{
return
2
+
length
;
}
if
(
length
<
0x10000
)
{
return
3
+
length
;
}
if
(
length
<
0x100000000
)
{
return
5
+
length
;
}
}
if
(
value
instanceof
ArrayBuffer
)
{
var
length
=
value
.
byteLength
;
if
(
length
<
0x100
)
{
return
2
+
length
;
}
if
(
length
<
0x10000
)
{
return
3
+
length
;
}
if
(
length
<
0x100000000
)
{
return
5
+
length
;
}
}
if
(
type
===
"
number
"
)
{
// Floating Point
// double
if
(
value
<<
0
!==
value
)
return
9
;
// Integers
if
(
value
>=
0
)
{
// positive fixnum
if
(
value
<
0x80
)
return
1
;
// uint 8
if
(
value
<
0x100
)
return
2
;
// uint 16
if
(
value
<
0x10000
)
return
3
;
// uint 32
if
(
value
<
0x100000000
)
return
5
;
// uint 64
if
(
value
<
0x10000000000000000
)
return
9
;
throw
new
Error
(
"
Number too big 0x
"
+
value
.
toString
(
16
));
}
// negative fixnum
if
(
value
>=
-
0x20
)
return
1
;
// int 8
if
(
value
>=
-
0x80
)
return
2
;
// int 16
if
(
value
>=
-
0x8000
)
return
3
;
// int 32
if
(
value
>=
-
0x80000000
)
return
5
;
// int 64
if
(
value
>=
-
0x8000000000000000
)
return
9
;
throw
new
Error
(
"
Number too small -0x
"
+
value
.
toString
(
16
).
substr
(
1
));
}
// undefined
if
(
type
===
"
undefined
"
)
return
3
;
// Boolean, null
if
(
type
===
"
boolean
"
||
value
===
null
)
return
1
;
// Container Types
if
(
type
===
"
object
"
)
{
var
length
,
size
=
0
;
if
(
Array
.
isArray
(
value
))
{
length
=
value
.
length
;
for
(
var
i
=
0
;
i
<
length
;
i
++
)
{
size
+=
encodedSize
(
value
[
i
]);
}
}
else
{
var
keys
=
Object
.
keys
(
value
);
length
=
keys
.
length
;
for
(
var
i
=
0
;
i
<
length
;
i
++
)
{
var
key
=
keys
[
i
];
size
+=
encodedSize
(
key
)
+
encodedSize
(
value
[
key
]);
}
}
if
(
length
<
0x10
)
{
return
1
+
size
;
}
if
(
length
<
0x10000
)
{
return
3
+
size
;
}
if
(
length
<
0x100000000
)
{
return
5
+
size
;
}
throw
new
Error
(
"
Array or object too long 0x
"
+
length
.
toString
(
16
));
}
throw
new
Error
(
"
Unknown type
"
+
type
);
}
return
exports
;
});
examples/models/msgpack/robo_pigeon.js
已删除
100644 → 0
浏览文件 @
3ff59ea7
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
examples/models/msgpack/robo_pigeon.pack
已删除
100644 → 0
浏览文件 @
3ff59ea7
文件已删除
examples/webgl_loader_msgpack.html
已删除
100644 → 0
浏览文件 @
3ff59ea7
<!DOCTYPE html>
<!--
Requires msgpack-js.js
https://github.com/creationix/msgpack-js-browser
(ported from https://github.com/creationix/msgpack-js)
-->
<html
lang=
'en'
>
<head>
<title>
three.js webgl - msgpack loader
</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
{
margin
:
0px
;
overflow
:
hidden
;
}
#viewport
{
position
:
absolute
;
width
:
100%
;
height
:
100%
;
background
:
#1b1c1e
;
background-image
:
linear-gradient
(
#7d8fa3
,
#1b1c1e
);
}
#info
{
color
:
#fff
;
position
:
absolute
;
top
:
10px
;
width
:
100%
;
text-align
:
center
;
z-index
:
100
;
display
:
block
;
}
a
{
color
:
orange
}
</style>
<script
src=
'../build/three.js'
></script>
<script
src=
'js/controls/OrbitControls.js'
></script>
<script
src=
'js/Detector.js'
></script>
<script
src=
'js/libs/msgpack-js.js'
></script>
</head>
<body>
<div
id=
'info'
>
<p>
Robo Pigeon, from
<a
href=
'http://www.tearsofsteel.org'
target=
'_blank'
>
Tears of Steel
</a>
, is licensed under
<a
href=
'http://creativecommons.org/licenses/by/3.0/'
target=
'_blank'
>
Creative Commons Attribution 3.0
</a>
.
</p>
</div>
<div
id=
'viewport'
></div>
<script>
if
(
!
Detector
.
webgl
)
Detector
.
addGetWebGLMessage
();
var
container
,
scene
,
camera
,
renderer
;
function
render
()
{
if
(
scene
!==
undefined
)
{
renderer
.
render
(
scene
,
camera
);
}
}
function
threePointLight
()
{
var
directionalLight
=
new
THREE
.
DirectionalLight
(
0xb8b8b8
);
directionalLight
.
position
.
set
(
1
,
1
,
1
).
normalize
();
directionalLight
.
intensity
=
1.0
;
scene
.
add
(
directionalLight
);
directionalLight
=
new
THREE
.
DirectionalLight
(
0xb8b8b8
);
directionalLight
.
position
.
set
(
-
1
,
0.6
,
0.5
).
normalize
();
directionalLight
.
intensity
=
0.5
;
scene
.
add
(
directionalLight
);
directionalLight
=
new
THREE
.
DirectionalLight
();
directionalLight
.
position
.
set
(
-
0.3
,
0.6
,
-
0.8
).
normalize
(
0xb8b8b8
);
directionalLight
.
intensity
=
0.45
;
scene
.
add
(
directionalLight
);
}
function
setupScene
(
result
)
{
scene
=
result
;
scene
.
add
(
new
THREE
.
GridHelper
(
20
,
8
)
);
threePointLight
();
render
();
}
function
loadMSGPack
()
{
new
THREE
.
FileLoader
()
.
setResponseType
(
'
arraybuffer
'
)
.
load
(
'
models/msgpack/robo_pigeon.pack
'
,
function
(
data
)
{
var
decoded
=
msgpack
.
decode
(
data
);
var
loader
=
new
THREE
.
ObjectLoader
();
setupScene
(
loader
.
parse
(
decoded
)
);
}
);
}
function
onWindowResize
()
{
camera
.
aspect
=
window
.
innerWidth
/
window
.
innerHeight
;
camera
.
updateProjectionMatrix
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
render
();
}
function
init
()
{
container
=
document
.
getElementById
(
'
viewport
'
);
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
,
alpha
:
true
}
);
renderer
.
setClearColor
(
0x000000
,
0
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
camera
=
new
THREE
.
PerspectiveCamera
(
60
,
window
.
innerWidth
/
window
.
innerHeight
,
0.01
,
50
);
camera
.
position
.
set
(
5
,
5
,
5
);
camera
.
updateProjectionMatrix
();
var
orbit
=
new
THREE
.
OrbitControls
(
camera
,
container
);
orbit
.
addEventListener
(
'
change
'
,
render
);
var
target
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
camera
.
lookAt
(
target
);
orbit
.
target
=
target
;
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
loadMSGPack
();
}
init
();
</script>
</body>
</html>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录