Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
c41288c7
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,发现更多精彩内容 >>
提交
c41288c7
编写于
9月 06, 2012
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactored CTMLoader parameters passing to make it easier to handle in SceneLoader.
上级
d0593850
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
17 deletion
+15
-17
examples/js/loaders/ctm/CTMLoader.js
examples/js/loaders/ctm/CTMLoader.js
+9
-8
examples/webgl_loader_ctm.html
examples/webgl_loader_ctm.html
+4
-6
examples/webgl_loader_ctm_materials.html
examples/webgl_loader_ctm_materials.html
+2
-3
未找到文件。
examples/js/loaders/ctm/CTMLoader.js
浏览文件 @
c41288c7
...
@@ -18,13 +18,13 @@ THREE.CTMLoader.prototype = Object.create( THREE.Loader.prototype );
...
@@ -18,13 +18,13 @@ THREE.CTMLoader.prototype = Object.create( THREE.Loader.prototype );
// Load multiple CTM parts defined in JSON
// Load multiple CTM parts defined in JSON
THREE
.
CTMLoader
.
prototype
.
loadParts
=
function
(
url
,
callback
,
useWorker
,
useBuffers
,
basePath
)
{
THREE
.
CTMLoader
.
prototype
.
loadParts
=
function
(
url
,
callback
,
parameters
)
{
var
scope
=
this
;
var
scope
=
this
;
var
xhr
=
new
XMLHttpRequest
();
var
xhr
=
new
XMLHttpRequest
();
basePath
=
basePath
?
basePath
:
this
.
extractUrlBase
(
url
);
var
basePath
=
parameters
.
basePath
?
parameters
.
basePath
:
this
.
extractUrlBase
(
url
);
xhr
.
onreadystatechange
=
function
()
{
xhr
.
onreadystatechange
=
function
()
{
...
@@ -62,7 +62,8 @@ THREE.CTMLoader.prototype.loadParts = function( url, callback, useWorker, useBuf
...
@@ -62,7 +62,8 @@ THREE.CTMLoader.prototype.loadParts = function( url, callback, useWorker, useBuf
// load joined CTM file
// load joined CTM file
var
partUrl
=
basePath
+
jsonObject
.
data
;
var
partUrl
=
basePath
+
jsonObject
.
data
;
scope
.
load
(
partUrl
,
callbackFinal
,
useWorker
,
useBuffers
,
jsonObject
.
offsets
);
var
parametersPart
=
{
useWorker
:
parameters
.
useWorker
,
useBuffers
:
parameters
.
useBuffers
,
offsets
:
jsonObject
.
offsets
};
scope
.
load
(
partUrl
,
callbackFinal
,
parametersPart
);
}
}
...
@@ -82,11 +83,11 @@ THREE.CTMLoader.prototype.loadParts = function( url, callback, useWorker, useBuf
...
@@ -82,11 +83,11 @@ THREE.CTMLoader.prototype.loadParts = function( url, callback, useWorker, useBuf
// - url (required)
// - url (required)
// - callback (required)
// - callback (required)
THREE
.
CTMLoader
.
prototype
.
load
=
function
(
url
,
callback
,
useWorker
,
useBuffers
,
offset
s
)
{
THREE
.
CTMLoader
.
prototype
.
load
=
function
(
url
,
callback
,
parameter
s
)
{
var
scope
=
this
;
var
scope
=
this
;
offsets
=
offsets
!==
undefined
?
offsets
:
[
0
];
var
offsets
=
parameters
.
offsets
!==
undefined
?
parameters
.
offsets
:
[
0
];
var
xhr
=
new
XMLHttpRequest
(),
var
xhr
=
new
XMLHttpRequest
(),
callbackProgress
=
null
;
callbackProgress
=
null
;
...
@@ -103,7 +104,7 @@ THREE.CTMLoader.prototype.load = function( url, callback, useWorker, useBuffers,
...
@@ -103,7 +104,7 @@ THREE.CTMLoader.prototype.load = function( url, callback, useWorker, useBuffers,
//var s = Date.now();
//var s = Date.now();
if
(
useWorker
)
{
if
(
parameters
.
useWorker
)
{
var
worker
=
new
Worker
(
"
js/loaders/ctm/CTMWorker.js
"
);
var
worker
=
new
Worker
(
"
js/loaders/ctm/CTMWorker.js
"
);
...
@@ -115,7 +116,7 @@ THREE.CTMLoader.prototype.load = function( url, callback, useWorker, useBuffers,
...
@@ -115,7 +116,7 @@ THREE.CTMLoader.prototype.load = function( url, callback, useWorker, useBuffers,
var
ctmFile
=
files
[
i
];
var
ctmFile
=
files
[
i
];
if
(
useBuffers
)
{
if
(
parameters
.
useBuffers
)
{
scope
.
createModelBuffers
(
ctmFile
,
callback
);
scope
.
createModelBuffers
(
ctmFile
,
callback
);
...
@@ -144,7 +145,7 @@ THREE.CTMLoader.prototype.load = function( url, callback, useWorker, useBuffers,
...
@@ -144,7 +145,7 @@ THREE.CTMLoader.prototype.load = function( url, callback, useWorker, useBuffers,
var
ctmFile
=
new
CTM
.
File
(
stream
);
var
ctmFile
=
new
CTM
.
File
(
stream
);
if
(
useBuffers
)
{
if
(
parameters
.
useBuffers
)
{
scope
.
createModelBuffers
(
ctmFile
,
callback
);
scope
.
createModelBuffers
(
ctmFile
,
callback
);
...
...
examples/webgl_loader_ctm.html
浏览文件 @
c41288c7
...
@@ -155,9 +155,7 @@
...
@@ -155,9 +155,7 @@
}
}
var
useWorker
=
true
;
var
parameters
=
{
useWorker
:
true
,
useBuffers
:
true
};
var
useBuffers
=
true
;
var
loader
=
new
THREE
.
CTMLoader
();
var
loader
=
new
THREE
.
CTMLoader
();
loader
.
load
(
"
models/ctm/ben.ctm
"
,
function
(
geometry
)
{
loader
.
load
(
"
models/ctm/ben.ctm
"
,
function
(
geometry
)
{
...
@@ -166,7 +164,7 @@
...
@@ -166,7 +164,7 @@
callbackModel
(
geometry
,
450
,
material
,
0
,
-
200
,
0
,
0
,
0
);
callbackModel
(
geometry
,
450
,
material
,
0
,
-
200
,
0
,
0
,
0
);
checkTime
();
checkTime
();
},
useWorker
,
useBuff
ers
);
},
paramet
ers
);
loader
.
load
(
"
models/ctm/WaltHead.ctm
"
,
function
(
geometry
)
{
loader
.
load
(
"
models/ctm/WaltHead.ctm
"
,
function
(
geometry
)
{
...
@@ -180,7 +178,7 @@
...
@@ -180,7 +178,7 @@
checkTime
();
checkTime
();
},
useWorker
,
useBuff
ers
);
},
paramet
ers
);
loader
.
load
(
"
models/ctm/LeePerry.ctm
"
,
function
(
geometry
)
{
loader
.
load
(
"
models/ctm/LeePerry.ctm
"
,
function
(
geometry
)
{
...
@@ -222,7 +220,7 @@
...
@@ -222,7 +220,7 @@
callbackModel
(
geometry
,
1300
,
material
,
200
,
50
,
0
,
0
,
0
);
callbackModel
(
geometry
,
1300
,
material
,
200
,
50
,
0
,
0
,
0
);
checkTime
();
checkTime
();
},
useWorker
,
useBuff
ers
);
},
paramet
ers
);
}
}
...
...
examples/webgl_loader_ctm_materials.html
浏览文件 @
c41288c7
...
@@ -196,8 +196,7 @@
...
@@ -196,8 +196,7 @@
*/
*/
// new way via CTMLoader and separate parts
// new way via CTMLoader and separate parts
var
useWorker
=
true
,
var
parameters
=
{
useWorker
:
true
,
useBuffers
:
true
};
useBuffers
=
true
;
loaderCTM
=
new
THREE
.
CTMLoader
(
true
);
loaderCTM
=
new
THREE
.
CTMLoader
(
true
);
document
.
body
.
appendChild
(
loaderCTM
.
statusDomElement
);
document
.
body
.
appendChild
(
loaderCTM
.
statusDomElement
);
...
@@ -224,7 +223,7 @@
...
@@ -224,7 +223,7 @@
console
.
log
(
"
load time:
"
,
end
-
start
,
"
ms
"
);
console
.
log
(
"
load time:
"
,
end
-
start
,
"
ms
"
);
},
useWorker
,
useBuff
ers
);
},
paramet
ers
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录