Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
1373c391
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,发现更多精彩内容 >>
提交
1373c391
编写于
9月 19, 2019
作者:
G
Garrett Johnson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lint jsm js files
上级
0730b431
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
75 addition
and
61 deletion
+75
-61
examples/jsm/loaders/OBJLoader2.js
examples/jsm/loaders/OBJLoader2.js
+15
-12
examples/jsm/loaders/OBJLoader2Parallel.js
examples/jsm/loaders/OBJLoader2Parallel.js
+25
-24
examples/jsm/loaders/obj2/shared/MaterialHandler.js
examples/jsm/loaders/obj2/shared/MaterialHandler.js
+3
-1
examples/jsm/loaders/obj2/worker/parallel/OBJLoader2Parser.js
...ples/jsm/loaders/obj2/worker/parallel/OBJLoader2Parser.js
+12
-4
examples/jsm/nodes/accessors/NormalNode.js
examples/jsm/nodes/accessors/NormalNode.js
+5
-5
examples/jsm/nodes/accessors/ReflectNode.js
examples/jsm/nodes/accessors/ReflectNode.js
+1
-1
examples/jsm/nodes/core/FunctionNode.js
examples/jsm/nodes/core/FunctionNode.js
+1
-1
examples/jsm/nodes/materials/nodes/StandardNode.js
examples/jsm/nodes/materials/nodes/StandardNode.js
+6
-6
examples/jsm/nodes/misc/NormalMapNode.js
examples/jsm/nodes/misc/NormalMapNode.js
+5
-5
examples/jsm/nodes/utils/SpecularMIPLevelNode.js
examples/jsm/nodes/utils/SpecularMIPLevelNode.js
+1
-1
examples/jsm/nodes/utils/SubSlotNode.js
examples/jsm/nodes/utils/SubSlotNode.js
+1
-1
未找到文件。
examples/jsm/loaders/OBJLoader2.js
浏览文件 @
1373c391
...
@@ -21,6 +21,7 @@ import { MaterialHandler } from "./obj2/shared/MaterialHandler.js";
...
@@ -21,6 +21,7 @@ import { MaterialHandler } from "./obj2/shared/MaterialHandler.js";
* @constructor
* @constructor
*/
*/
const
OBJLoader2
=
function
(
manager
)
{
const
OBJLoader2
=
function
(
manager
)
{
Loader
.
call
(
this
,
manager
);
Loader
.
call
(
this
,
manager
);
this
.
parser
=
new
OBJLoader2Parser
();
this
.
parser
=
new
OBJLoader2Parser
();
...
@@ -35,9 +36,12 @@ const OBJLoader2 = function ( manager ) {
...
@@ -35,9 +36,12 @@ const OBJLoader2 = function ( manager ) {
// as OBJLoader2 is no longer derived from OBJLoader2Parser, we need to override the default onAssetAvailable callback
// as OBJLoader2 is no longer derived from OBJLoader2Parser, we need to override the default onAssetAvailable callback
let
scope
=
this
;
let
scope
=
this
;
let
defaultOnAssetAvailable
=
function
(
payload
)
{
let
defaultOnAssetAvailable
=
function
(
payload
)
{
scope
.
_onAssetAvailable
(
payload
)
scope
.
_onAssetAvailable
(
payload
);
};
};
this
.
parser
.
setCallbackOnAssetAvailable
(
defaultOnAssetAvailable
);
this
.
parser
.
setCallbackOnAssetAvailable
(
defaultOnAssetAvailable
);
};
};
OBJLoader2
.
OBJLOADER2_VERSION
=
'
3.1.0
'
;
OBJLoader2
.
OBJLOADER2_VERSION
=
'
3.1.0
'
;
...
@@ -124,7 +128,7 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
...
@@ -124,7 +128,7 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
*/
*/
setBaseObject3d
:
function
(
baseObject3d
)
{
setBaseObject3d
:
function
(
baseObject3d
)
{
this
.
baseObject3d
=
(
baseObject3d
===
undefined
||
baseObject3d
===
null
)
?
this
.
baseObject3d
:
baseObject3d
;
this
.
baseObject3d
=
(
baseObject3d
===
undefined
||
baseObject3d
===
null
)
?
this
.
baseObject3d
:
baseObject3d
;
return
this
;
return
this
;
},
},
...
@@ -224,19 +228,18 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
...
@@ -224,19 +228,18 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
load
:
function
(
url
,
onLoad
,
onFileLoadProgress
,
onError
,
onMeshAlter
)
{
load
:
function
(
url
,
onLoad
,
onFileLoadProgress
,
onError
,
onMeshAlter
)
{
let
scope
=
this
;
let
scope
=
this
;
if
(
onLoad
===
null
||
onLoad
===
undefined
||
!
(
onLoad
instanceof
Function
)
)
{
if
(
onLoad
===
null
||
onLoad
===
undefined
||
!
(
onLoad
instanceof
Function
)
)
{
let
errorMessage
=
'
onLoad is not a function! Aborting...
'
;
let
errorMessage
=
'
onLoad is not a function! Aborting...
'
;
scope
.
parser
.
callbacks
.
onError
(
errorMessage
);
scope
.
parser
.
callbacks
.
onError
(
errorMessage
);
throw
errorMessage
throw
errorMessage
;
}
}
else
{
else
{
this
.
parser
.
setCallbackOnLoad
(
onLoad
);
this
.
parser
.
setCallbackOnLoad
(
onLoad
);
}
}
if
(
onError
===
null
||
onError
===
undefined
||
!
(
onError
instanceof
Function
)
)
{
if
(
onError
===
null
||
onError
===
undefined
||
!
(
onError
instanceof
Function
)
)
{
onError
=
function
(
event
)
{
onError
=
function
(
event
)
{
...
@@ -251,7 +254,7 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
...
@@ -251,7 +254,7 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
};
};
}
}
if
(
!
url
)
{
if
(
!
url
)
{
onError
(
'
An invalid url was provided. Unable to continue!
'
);
onError
(
'
An invalid url was provided. Unable to continue!
'
);
...
@@ -266,19 +269,19 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
...
@@ -266,19 +269,19 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
if
(
urlPartsPath
!==
undefined
&&
urlPartsPath
!==
null
)
this
.
path
=
urlPartsPath
;
if
(
urlPartsPath
!==
undefined
&&
urlPartsPath
!==
null
)
this
.
path
=
urlPartsPath
;
}
}
if
(
onFileLoadProgress
===
null
||
onFileLoadProgress
===
undefined
||
!
(
onFileLoadProgress
instanceof
Function
)
)
{
if
(
onFileLoadProgress
===
null
||
onFileLoadProgress
===
undefined
||
!
(
onFileLoadProgress
instanceof
Function
)
)
{
let
numericalValueRef
=
0
;
let
numericalValueRef
=
0
;
let
numericalValue
=
0
;
let
numericalValue
=
0
;
onFileLoadProgress
=
function
(
event
)
{
onFileLoadProgress
=
function
(
event
)
{
if
(
!
event
.
lengthComputable
)
return
;
if
(
!
event
.
lengthComputable
)
return
;
numericalValue
=
event
.
loaded
/
event
.
total
;
numericalValue
=
event
.
loaded
/
event
.
total
;
if
(
numericalValue
>
numericalValueRef
)
{
if
(
numericalValue
>
numericalValueRef
)
{
numericalValueRef
=
numericalValue
;
numericalValueRef
=
numericalValue
;
let
output
=
'
Download of "
'
+
url
+
'
":
'
+
(
numericalValue
*
100
).
toFixed
(
2
)
+
'
%
'
;
let
output
=
'
Download of "
'
+
url
+
'
":
'
+
(
numericalValue
*
100
).
toFixed
(
2
)
+
'
%
'
;
scope
.
parser
.
callbacks
.
onProgress
(
'
progressLoad
'
,
output
,
numericalValue
);
scope
.
parser
.
callbacks
.
onProgress
(
'
progressLoad
'
,
output
,
numericalValue
);
}
}
...
@@ -331,7 +334,7 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
...
@@ -331,7 +334,7 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
if
(
this
.
parser
.
logging
.
enabled
)
console
.
info
(
'
Parsing arrayBuffer...
'
);
if
(
this
.
parser
.
logging
.
enabled
)
console
.
info
(
'
Parsing arrayBuffer...
'
);
this
.
parser
.
execute
(
content
);
this
.
parser
.
execute
(
content
);
}
else
if
(
typeof
(
content
)
===
'
string
'
||
content
instanceof
String
)
{
}
else
if
(
typeof
(
content
)
===
'
string
'
||
content
instanceof
String
)
{
if
(
this
.
parser
.
logging
.
enabled
)
console
.
info
(
'
Parsing text...
'
);
if
(
this
.
parser
.
logging
.
enabled
)
console
.
info
(
'
Parsing text...
'
);
this
.
parser
.
executeLegacy
(
content
);
this
.
parser
.
executeLegacy
(
content
);
...
...
examples/jsm/loaders/OBJLoader2Parallel.js
浏览文件 @
1373c391
...
@@ -120,7 +120,7 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
...
@@ -120,7 +120,7 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
load
:
function
(
content
,
onLoad
,
onFileLoadProgress
,
onError
,
onMeshAlter
)
{
load
:
function
(
content
,
onLoad
,
onFileLoadProgress
,
onError
,
onMeshAlter
)
{
let
scope
=
this
;
let
scope
=
this
;
function
interceptOnLoad
(
object3d
,
message
)
{
function
interceptOnLoad
(
object3d
,
message
)
{
if
(
object3d
.
name
===
'
OBJLoader2ParallelDummy
'
)
{
if
(
object3d
.
name
===
'
OBJLoader2ParallelDummy
'
)
{
...
@@ -130,8 +130,7 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
...
@@ -130,8 +130,7 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
}
}
}
}
else
{
else
{
onLoad
(
object3d
,
message
);
onLoad
(
object3d
,
message
);
...
@@ -169,7 +168,9 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
...
@@ -169,7 +168,9 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
};
};
function
scopedOnLoad
(
message
)
{
function
scopedOnLoad
(
message
)
{
scope
.
parser
.
callbacks
.
onLoad
(
scope
.
baseObject3d
,
message
);
scope
.
parser
.
callbacks
.
onLoad
(
scope
.
baseObject3d
,
message
);
}
}
this
.
workerExecutionSupport
.
updateCallbacks
(
scopedOnAssetAvailable
,
scopedOnLoad
);
this
.
workerExecutionSupport
.
updateCallbacks
(
scopedOnAssetAvailable
,
scopedOnLoad
);
...
@@ -203,8 +204,8 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
...
@@ -203,8 +204,8 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
let
dummy
=
new
Object3D
();
let
dummy
=
new
Object3D
();
dummy
.
name
=
'
OBJLoader2ParallelDummy
'
;
dummy
.
name
=
'
OBJLoader2ParallelDummy
'
;
return
dummy
;
return
dummy
;
}
else
{
}
else
{
return
OBJLoader2
.
prototype
.
parse
.
call
(
this
,
content
);
return
OBJLoader2
.
prototype
.
parse
.
call
(
this
,
content
);
...
...
examples/jsm/loaders/obj2/shared/MaterialHandler.js
浏览文件 @
1373c391
...
@@ -114,7 +114,7 @@ MaterialHandler.prototype = {
...
@@ -114,7 +114,7 @@ MaterialHandler.prototype = {
}
else
{
}
else
{
if
(
this
.
logging
.
enabled
)
{
if
(
this
.
logging
.
enabled
)
{
console
.
info
(
'
Requested material "
'
+
materialNameOrg
+
'
" is not available!
'
);
console
.
info
(
'
Requested material "
'
+
materialNameOrg
+
'
" is not available!
'
);
...
@@ -255,7 +255,9 @@ MaterialHandler.prototype = {
...
@@ -255,7 +255,9 @@ MaterialHandler.prototype = {
* Removes all materials
* Removes all materials
*/
*/
clearMaterials
:
function
()
{
clearMaterials
:
function
()
{
this
.
materials
=
{};
this
.
materials
=
{};
}
}
};
};
...
...
examples/jsm/loaders/obj2/worker/parallel/OBJLoader2Parser.js
浏览文件 @
1373c391
...
@@ -16,16 +16,24 @@ const OBJLoader2Parser = function () {
...
@@ -16,16 +16,24 @@ const OBJLoader2Parser = function () {
let
scope
=
this
;
let
scope
=
this
;
this
.
callbacks
=
{
this
.
callbacks
=
{
onProgress
:
function
(
text
)
{
onProgress
:
function
(
text
)
{
scope
.
_onProgress
(
text
)
scope
.
_onProgress
(
text
);
},
},
onAssetAvailable
:
function
(
payload
)
{
onAssetAvailable
:
function
(
payload
)
{
scope
.
_onAssetAvailable
(
payload
)
scope
.
_onAssetAvailable
(
payload
);
},
},
onError
:
function
(
errorMessage
)
{
onError
:
function
(
errorMessage
)
{
scope
.
_onError
(
errorMessage
)
scope
.
_onError
(
errorMessage
);
},
},
onLoad
:
function
(
object3d
,
message
)
{
onLoad
:
function
(
object3d
,
message
)
{
scope
.
_onLoad
(
object3d
,
message
)
scope
.
_onLoad
(
object3d
,
message
);
},
},
};
};
this
.
contentRef
=
null
;
this
.
contentRef
=
null
;
...
...
examples/jsm/nodes/accessors/NormalNode.js
浏览文件 @
1373c391
examples/jsm/nodes/accessors/ReflectNode.js
浏览文件 @
1373c391
...
@@ -24,7 +24,7 @@ ReflectNode.prototype.nodeType = "Reflect";
...
@@ -24,7 +24,7 @@ ReflectNode.prototype.nodeType = "Reflect";
ReflectNode
.
prototype
.
getUnique
=
function
(
builder
)
{
ReflectNode
.
prototype
.
getUnique
=
function
(
builder
)
{
return
!
builder
.
context
.
viewNormal
;
return
!
builder
.
context
.
viewNormal
;
};
};
...
...
examples/jsm/nodes/core/FunctionNode.js
浏览文件 @
1373c391
...
@@ -209,7 +209,7 @@ FunctionNode.prototype.parse = function ( src, includes, extensions, keywords )
...
@@ -209,7 +209,7 @@ FunctionNode.prototype.parse = function ( src, includes, extensions, keywords )
}
}
this
.
isInterface
=
this
.
src
.
indexOf
(
'
{
'
)
===
-
1
;
this
.
isInterface
=
this
.
src
.
indexOf
(
'
{
'
)
===
-
1
;
}
else
{
}
else
{
...
...
examples/jsm/nodes/materials/nodes/StandardNode.js
浏览文件 @
1373c391
...
@@ -33,11 +33,11 @@ StandardNode.prototype.build = function ( builder ) {
...
@@ -33,11 +33,11 @@ StandardNode.prototype.build = function ( builder ) {
var
code
;
var
code
;
builder
.
define
(
'
STANDARD
'
);
builder
.
define
(
'
STANDARD
'
);
var
useClearcoat
=
this
.
clearcoat
||
this
.
clearcoatRoughness
||
this
.
clearCoatNormal
;
var
useClearcoat
=
this
.
clearcoat
||
this
.
clearcoatRoughness
||
this
.
clearCoatNormal
;
if
(
useClearcoat
)
{
if
(
useClearcoat
)
{
builder
.
define
(
'
CLEARCOAT
'
);
builder
.
define
(
'
CLEARCOAT
'
);
...
@@ -129,13 +129,13 @@ StandardNode.prototype.build = function ( builder ) {
...
@@ -129,13 +129,13 @@ StandardNode.prototype.build = function ( builder ) {
}
else
{
}
else
{
var
specularRoughness
=
new
ExpressionNode
(
'
material.specularRoughness
'
,
'
f
'
);
var
specularRoughness
=
new
ExpressionNode
(
'
material.specularRoughness
'
,
'
f
'
);
var
clearcoatRoughness
=
new
ExpressionNode
(
'
material.clearcoatRoughness
'
,
'
f
'
);
var
clearcoatRoughness
=
new
ExpressionNode
(
'
material.clearcoatRoughness
'
,
'
f
'
);
var
contextEnvironment
=
{
var
contextEnvironment
=
{
roughness
:
specularRoughness
,
roughness
:
specularRoughness
,
bias
:
new
SpecularMIPLevelNode
(
specularRoughness
),
bias
:
new
SpecularMIPLevelNode
(
specularRoughness
),
viewNormal
:
new
ExpressionNode
(
'
normal
'
,
'
v3
'
),
viewNormal
:
new
ExpressionNode
(
'
normal
'
,
'
v3
'
),
gamma
:
true
gamma
:
true
};
};
...
@@ -146,7 +146,7 @@ StandardNode.prototype.build = function ( builder ) {
...
@@ -146,7 +146,7 @@ StandardNode.prototype.build = function ( builder ) {
var
contextClearcoatEnvironment
=
{
var
contextClearcoatEnvironment
=
{
roughness
:
clearcoatRoughness
,
roughness
:
clearcoatRoughness
,
bias
:
new
SpecularMIPLevelNode
(
clearcoatRoughness
),
bias
:
new
SpecularMIPLevelNode
(
clearcoatRoughness
),
viewNormal
:
new
ExpressionNode
(
'
clearcoatNormal
'
,
'
v3
'
),
viewNormal
:
new
ExpressionNode
(
'
clearcoatNormal
'
,
'
v3
'
),
gamma
:
true
gamma
:
true
};
};
...
...
examples/jsm/nodes/misc/NormalMapNode.js
浏览文件 @
1373c391
...
@@ -22,10 +22,10 @@ NormalMapNode.Nodes = ( function () {
...
@@ -22,10 +22,10 @@ NormalMapNode.Nodes = ( function () {
var
perturbNormal2Arb
=
new
FunctionNode
(
var
perturbNormal2Arb
=
new
FunctionNode
(
// Per-Pixel Tangent Space Normal Mapping
// Per-Pixel Tangent Space Normal Mapping
// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html
// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html
`vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 map, vec2 vUv, vec2 normalScale ) {
`vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 map, vec2 vUv, vec2 normalScale ) {
// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988
// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988
...
...
examples/jsm/nodes/utils/SpecularMIPLevelNode.js
浏览文件 @
1373c391
...
@@ -42,7 +42,7 @@ SpecularMIPLevelNode.prototype = Object.create( TempNode.prototype );
...
@@ -42,7 +42,7 @@ SpecularMIPLevelNode.prototype = Object.create( TempNode.prototype );
SpecularMIPLevelNode
.
prototype
.
constructor
=
SpecularMIPLevelNode
;
SpecularMIPLevelNode
.
prototype
.
constructor
=
SpecularMIPLevelNode
;
SpecularMIPLevelNode
.
prototype
.
nodeType
=
"
SpecularMIPLevel
"
;
SpecularMIPLevelNode
.
prototype
.
nodeType
=
"
SpecularMIPLevel
"
;
SpecularMIPLevelNode
.
prototype
.
setTexture
=
function
(
texture
)
{
SpecularMIPLevelNode
.
prototype
.
setTexture
=
function
(
texture
)
{
this
.
texture
=
texture
;
this
.
texture
=
texture
;
...
...
examples/jsm/nodes/utils/SubSlotNode.js
浏览文件 @
1373c391
...
@@ -26,7 +26,7 @@ SubSlotNode.prototype.generate = function ( builder, output ) {
...
@@ -26,7 +26,7 @@ SubSlotNode.prototype.generate = function ( builder, output ) {
if
(
this
.
slots
[
builder
.
slot
]
)
{
if
(
this
.
slots
[
builder
.
slot
]
)
{
return
this
.
slots
[
builder
.
slot
].
build
(
builder
,
output
)
return
this
.
slots
[
builder
.
slot
].
build
(
builder
,
output
)
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录