Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
d649e79f
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,发现更多精彩内容 >>
未验证
提交
d649e79f
编写于
10月 15, 2018
作者:
M
Mr.doob
提交者:
GitHub
10月 15, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15060 from kaisalmen/OBJLoader2_V250
OBJLoader2 V2.5.0
上级
fb6efa9f
c1016a6c
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
2040 addition
and
2085 deletion
+2040
-2085
examples/js/loaders/LoaderSupport.js
examples/js/loaders/LoaderSupport.js
+747
-584
examples/js/loaders/OBJLoader2.js
examples/js/loaders/OBJLoader2.js
+878
-885
examples/webgl_loader_obj2.html
examples/webgl_loader_obj2.html
+40
-68
examples/webgl_loader_obj2_meshspray.html
examples/webgl_loader_obj2_meshspray.html
+210
-268
examples/webgl_loader_obj2_options.html
examples/webgl_loader_obj2_options.html
+80
-149
examples/webgl_loader_obj2_run_director.html
examples/webgl_loader_obj2_run_director.html
+85
-131
未找到文件。
examples/js/loaders/LoaderSupport.js
浏览文件 @
d649e79f
此差异已折叠。
点击以展开。
examples/js/loaders/OBJLoader2.js
浏览文件 @
d649e79f
此差异已折叠。
点击以展开。
examples/webgl_loader_obj2.html
浏览文件 @
d649e79f
...
...
@@ -83,34 +83,31 @@
'
use strict
'
;
var
OBJLoader2Example
=
(
function
()
{
var
Validator
=
THREE
.
LoaderSupport
.
Validator
;
function
OBJLoader2Example
(
elementToBindTo
)
{
this
.
renderer
=
null
;
this
.
canvas
=
elementToBindTo
;
this
.
aspectRatio
=
1
;
this
.
recalcAspectRatio
();
this
.
scene
=
null
;
this
.
cameraDefaults
=
{
posCamera
:
new
THREE
.
Vector3
(
0.0
,
175.0
,
500.0
),
posCameraTarget
:
new
THREE
.
Vector3
(
0
,
0
,
0
),
near
:
0.1
,
far
:
10000
,
fov
:
45
};
this
.
camera
=
null
;
this
.
cameraTarget
=
this
.
cameraDefaults
.
posCameraTarget
;
var
OBJLoader2Example
=
function
(
elementToBindTo
)
{
this
.
renderer
=
null
;
this
.
canvas
=
elementToBindTo
;
this
.
aspectRatio
=
1
;
this
.
recalcAspectRatio
();
this
.
scene
=
null
;
this
.
cameraDefaults
=
{
posCamera
:
new
THREE
.
Vector3
(
0.0
,
175.0
,
500.0
),
posCameraTarget
:
new
THREE
.
Vector3
(
0
,
0
,
0
),
near
:
0.1
,
far
:
10000
,
fov
:
45
};
this
.
camera
=
null
;
this
.
cameraTarget
=
this
.
cameraDefaults
.
posCameraTarget
;
this
.
controls
=
null
;
this
.
controls
=
null
;
};
}
OBJLoader2Example
.
prototype
=
{
OBJLoader2Example
.
prototype
.
initGL
=
function
()
{
constructor
:
OBJLoader2Example
,
initGL
:
function
()
{
this
.
renderer
=
new
THREE
.
WebGLRenderer
(
{
canvas
:
this
.
canvas
,
antialias
:
true
,
...
...
@@ -128,8 +125,8 @@
var
directionalLight1
=
new
THREE
.
DirectionalLight
(
0xC0C090
);
var
directionalLight2
=
new
THREE
.
DirectionalLight
(
0xC0C090
);
directionalLight1
.
position
.
set
(
-
100
,
-
50
,
100
);
directionalLight2
.
position
.
set
(
100
,
50
,
-
100
);
directionalLight1
.
position
.
set
(
-
100
,
-
50
,
100
);
directionalLight2
.
position
.
set
(
100
,
50
,
-
100
);
this
.
scene
.
add
(
directionalLight1
);
this
.
scene
.
add
(
directionalLight2
);
...
...
@@ -137,103 +134,78 @@
var
helper
=
new
THREE
.
GridHelper
(
1200
,
60
,
0xFF4444
,
0x404040
);
this
.
scene
.
add
(
helper
);
},
};
OBJLoader2Example
.
prototype
.
initContent
=
function
()
{
initContent
:
function
()
{
var
modelName
=
'
female02
'
;
this
.
_reportProgress
(
{
detail
:
{
text
:
'
Loading:
'
+
modelName
}
}
);
var
scope
=
this
;
var
objLoader
=
new
THREE
.
OBJLoader2
();
var
callbackOnLoad
=
function
(
event
)
{
scope
.
scene
.
add
(
event
.
detail
.
loaderRootNode
);
console
.
log
(
'
Loading complete:
'
+
event
.
detail
.
modelName
);
scope
.
_reportProgress
(
{
detail
:
{
text
:
''
}
}
);
};
var
onLoadMtl
=
function
(
materials
)
{
objLoader
.
setModelName
(
modelName
);
objLoader
.
setMaterials
(
materials
);
objLoader
.
setLogging
(
true
,
true
);
objLoader
.
load
(
'
models/obj/female02/female02.obj
'
,
callbackOnLoad
,
null
,
null
,
null
,
false
);
};
objLoader
.
loadMtl
(
'
models/obj/female02/female02.mtl
'
,
null
,
onLoadMtl
);
},
};
OBJLoader2Example
.
prototype
.
_reportProgress
=
function
(
event
)
{
var
output
=
Validator
.
verifyInput
(
event
.
detail
.
text
,
''
);
_reportProgress
:
function
(
event
)
{
var
output
=
THREE
.
LoaderSupport
.
Validator
.
verifyInput
(
event
.
detail
.
text
,
''
);
console
.
log
(
'
Progress:
'
+
output
);
document
.
getElementById
(
'
feedback
'
).
innerHTML
=
output
;
},
};
OBJLoader2Example
.
prototype
.
resizeDisplayGL
=
function
()
{
resizeDisplayGL
:
function
()
{
this
.
controls
.
handleResize
();
this
.
recalcAspectRatio
();
this
.
renderer
.
setSize
(
this
.
canvas
.
offsetWidth
,
this
.
canvas
.
offsetHeight
,
false
);
this
.
updateCamera
();
},
};
OBJLoader2Example
.
prototype
.
recalcAspectRatio
=
function
()
{
recalcAspectRatio
:
function
()
{
this
.
aspectRatio
=
(
this
.
canvas
.
offsetHeight
===
0
)
?
1
:
this
.
canvas
.
offsetWidth
/
this
.
canvas
.
offsetHeight
;
},
};
OBJLoader2Example
.
prototype
.
resetCamera
=
function
()
{
resetCamera
:
function
()
{
this
.
camera
.
position
.
copy
(
this
.
cameraDefaults
.
posCamera
);
this
.
cameraTarget
.
copy
(
this
.
cameraDefaults
.
posCameraTarget
);
this
.
updateCamera
();
},
};
OBJLoader2Example
.
prototype
.
updateCamera
=
function
()
{
updateCamera
:
function
()
{
this
.
camera
.
aspect
=
this
.
aspectRatio
;
this
.
camera
.
lookAt
(
this
.
cameraTarget
);
this
.
camera
.
updateProjectionMatrix
();
},
};
OBJLoader2Example
.
prototype
.
render
=
function
()
{
render
:
function
()
{
if
(
!
this
.
renderer
.
autoClear
)
this
.
renderer
.
clear
();
this
.
controls
.
update
();
this
.
renderer
.
render
(
this
.
scene
,
this
.
camera
);
}
};
return
OBJLoader2Example
;
}
)();
};
var
app
=
new
OBJLoader2Example
(
document
.
getElementById
(
'
example
'
)
);
var
resizeWindow
=
function
()
{
app
.
resizeDisplayGL
();
};
var
render
=
function
()
{
requestAnimationFrame
(
render
);
app
.
render
();
};
window
.
addEventListener
(
'
resize
'
,
resizeWindow
,
false
);
...
...
examples/webgl_loader_obj2_meshspray.html
浏览文件 @
d649e79f
此差异已折叠。
点击以展开。
examples/webgl_loader_obj2_options.html
浏览文件 @
d649e79f
此差异已折叠。
点击以展开。
examples/webgl_loader_obj2_run_director.html
浏览文件 @
d649e79f
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录