Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
7eb62a13
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,体验更适合开发者的 AI 搜索 >>
提交
7eb62a13
编写于
9月 03, 2012
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added handling of bumpScale to Loader base class.
上级
b9eae42d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
3 deletion
+12
-3
build/three.min.js
build/three.min.js
+4
-3
src/loaders/Loader.js
src/loaders/Loader.js
+8
-0
未找到文件。
build/three.min.js
浏览文件 @
7eb62a13
...
...
@@ -145,9 +145,10 @@ Math.log(a)/Math.LN2;return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN
h
[
j
[
1
]]}
var
r
=
a
[
f
],
a
=
b
+
"
/
"
+
e
,
f
=
new
Image
;
f
.
onload
=
function
(){
if
(
!
c
(
this
.
width
)
||!
c
(
this
.
height
)){
var
a
=
d
(
this
.
width
),
b
=
d
(
this
.
height
);
r
.
image
.
width
=
a
;
r
.
image
.
height
=
b
;
r
.
image
.
getContext
(
"
2d
"
).
drawImage
(
this
,
0
,
0
,
a
,
b
)}
else
r
.
image
=
this
;
r
.
needsUpdate
=
true
};
f
.
crossOrigin
=
g
.
crossOrigin
;
f
.
src
=
a
}
function
e
(
a
){
return
(
a
[
0
]
*
255
<<
16
)
+
(
a
[
1
]
*
255
<<
8
)
+
a
[
2
]
*
255
}
var
g
=
this
,
h
=
"
MeshLambertMaterial
"
,
i
=
{
color
:
15658734
,
opacity
:
1
,
map
:
null
,
lightMap
:
null
,
normalMap
:
null
,
bumpMap
:
null
,
wireframe
:
false
};
if
(
a
.
shading
){
var
j
=
a
.
shading
.
toLowerCase
();
j
===
"
phong
"
?
h
=
"
MeshPhongMaterial
"
:
j
===
"
basic
"
&&
(
h
=
"
MeshBasicMaterial
"
)}
if
(
a
.
blending
!==
void
0
&&
THREE
[
a
.
blending
]
!==
void
0
)
i
.
blending
=
THREE
[
a
.
blending
];
if
(
a
.
transparent
!==
void
0
||
a
.
opacity
<
1
)
i
.
transparent
=
a
.
transparent
;
if
(
a
.
depthTest
!==
void
0
)
i
.
depthTest
=
a
.
depthTest
;
if
(
a
.
depthWrite
!==
void
0
)
i
.
depthWrite
=
a
.
depthWrite
;
if
(
a
.
visible
!==
void
0
)
i
.
visible
=
a
.
visible
;
if
(
a
.
flipSided
!==
void
0
)
i
.
side
=
THREE
.
BackSide
;
if
(
a
.
doubleSided
!==
void
0
)
i
.
side
=
THREE
.
DoubleSide
;
if
(
a
.
wireframe
!==
void
0
)
i
.
wireframe
=
a
.
wireframe
;
if
(
a
.
vertexColors
!==
void
0
)
if
(
a
.
vertexColors
==
"
face
"
)
i
.
vertexColors
=
THREE
.
FaceColors
;
else
if
(
a
.
vertexColors
)
i
.
vertexColors
=
THREE
.
VertexColors
;
if
(
a
.
colorDiffuse
)
i
.
color
=
e
(
a
.
colorDiffuse
);
else
if
(
a
.
DbgColor
)
i
.
color
=
a
.
DbgColor
;
if
(
a
.
colorSpecular
)
i
.
specular
=
e
(
a
.
colorSpecular
);
if
(
a
.
colorAmbient
)
i
.
ambient
=
e
(
a
.
colorAmbient
);
if
(
a
.
transparency
)
i
.
opacity
=
a
.
transparency
;
if
(
a
.
specularCoef
)
i
.
shininess
=
a
.
specularCoef
;
a
.
mapDiffuse
&&
b
&&
f
(
i
,
"
map
"
,
a
.
mapDiffuse
,
a
.
mapDiffuseRepeat
,
a
.
mapDiffuseOffset
,
a
.
mapDiffuseWrap
);
a
.
mapLight
&&
b
&&
f
(
i
,
"
lightMap
"
,
a
.
mapLight
,
a
.
mapLightRepeat
,
a
.
mapLightOffset
,
a
.
mapLightWrap
);
a
.
mapBump
&&
b
&&
f
(
i
,
"
bumpMap
"
,
a
.
mapBump
,
a
.
mapBumpRepeat
,
a
.
mapBumpOffset
,
a
.
mapBumpWrap
);
a
.
mapNormal
&&
b
&&
f
(
i
,
"
normalMap
"
,
a
.
mapNormal
,
a
.
mapNormalRepeat
,
a
.
mapNormalOffset
,
a
.
mapNormalWrap
);
a
.
mapSpecular
&&
b
&&
f
(
i
,
"
specularMap
"
,
a
.
mapSpecular
,
a
.
mapSpecularRepeat
,
a
.
mapSpecularOffset
,
a
.
mapSpecularWrap
);
if
(
a
.
mapNormal
){
h
=
THREE
.
ShaderUtils
.
lib
.
normal
;
j
=
THREE
.
UniformsUtils
.
clone
(
h
.
uniforms
);
j
.
tNormal
.
value
=
i
.
normalMap
;
a
.
mapNormalFactor
&&
j
.
uNormalScale
.
value
.
set
(
a
.
mapNormalFactor
,
a
.
mapNormalFactor
);
if
(
i
.
map
){
j
.
tDiffuse
.
value
=
i
.
map
;
j
.
enableDiffuse
.
value
=
true
}
if
(
i
.
specularMap
){
j
.
tSpecular
.
value
=
i
.
specularMap
;
j
.
enableSpecular
.
value
=
true
}
if
(
i
.
lightMap
){
j
.
tAO
.
value
=
i
.
lightMap
;
j
.
enableAO
.
value
=
true
}
j
.
uDiffuseColor
.
value
.
setHex
(
i
.
color
);
j
.
uSpecularColor
.
value
.
setHex
(
i
.
specular
);
j
.
uAmbientColor
.
value
.
setHex
(
i
.
ambient
);
j
.
uShininess
.
value
=
i
.
shininess
;
if
(
i
.
opacity
!==
void
0
)
j
.
uOpacity
.
value
=
i
.
opacity
;
i
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
h
.
fragmentShader
,
vertexShader
:
h
.
vertexShader
,
uniforms
:
j
,
lights
:
true
,
fog
:
true
})}
else
i
=
new
THREE
[
h
](
i
);
if
(
a
.
DbgName
!==
void
0
)
i
.
name
=
a
.
DbgName
;
return
i
}};
THREE
.
BinaryLoader
=
function
(
a
){
THREE
.
Loader
.
call
(
this
,
a
)};
THREE
.
BinaryLoader
.
prototype
=
Object
.
create
(
THREE
.
Loader
.
prototype
);
THREE
.
BinaryLoader
.
prototype
.
load
=
function
(
a
,
b
,
c
,
d
){
var
c
=
c
?
c
:
this
.
extractUrlBase
(
a
),
d
=
d
?
d
:
this
.
extractUrlBase
(
a
),
f
=
this
.
showProgress
?
THREE
.
Loader
.
prototype
.
updateProgress
:
null
;
this
.
onLoadStart
();
this
.
loadAjaxJSON
(
this
,
a
,
b
,
c
,
d
,
f
)};
a
.
mapLight
&&
b
&&
f
(
i
,
"
lightMap
"
,
a
.
mapLight
,
a
.
mapLightRepeat
,
a
.
mapLightOffset
,
a
.
mapLightWrap
);
a
.
mapBump
&&
b
&&
f
(
i
,
"
bumpMap
"
,
a
.
mapBump
,
a
.
mapBumpRepeat
,
a
.
mapBumpOffset
,
a
.
mapBumpWrap
);
a
.
mapNormal
&&
b
&&
f
(
i
,
"
normalMap
"
,
a
.
mapNormal
,
a
.
mapNormalRepeat
,
a
.
mapNormalOffset
,
a
.
mapNormalWrap
);
a
.
mapSpecular
&&
b
&&
f
(
i
,
"
specularMap
"
,
a
.
mapSpecular
,
a
.
mapSpecularRepeat
,
a
.
mapSpecularOffset
,
a
.
mapSpecularWrap
);
if
(
a
.
mapBumpScale
)
i
.
bumpScale
=
a
.
mapBumpScale
;
if
(
a
.
mapNormal
){
h
=
THREE
.
ShaderUtils
.
lib
.
normal
;
j
=
THREE
.
UniformsUtils
.
clone
(
h
.
uniforms
);
j
.
tNormal
.
value
=
i
.
normalMap
;
a
.
mapNormalFactor
&&
j
.
uNormalScale
.
value
.
set
(
a
.
mapNormalFactor
,
a
.
mapNormalFactor
);
if
(
i
.
map
){
j
.
tDiffuse
.
value
=
i
.
map
;
j
.
enableDiffuse
.
value
=
true
}
if
(
i
.
specularMap
){
j
.
tSpecular
.
value
=
i
.
specularMap
;
j
.
enableSpecular
.
value
=
true
}
if
(
i
.
lightMap
){
j
.
tAO
.
value
=
i
.
lightMap
;
j
.
enableAO
.
value
=
true
}
j
.
uDiffuseColor
.
value
.
setHex
(
i
.
color
);
j
.
uSpecularColor
.
value
.
setHex
(
i
.
specular
);
j
.
uAmbientColor
.
value
.
setHex
(
i
.
ambient
);
j
.
uShininess
.
value
=
i
.
shininess
;
if
(
i
.
opacity
!==
void
0
)
j
.
uOpacity
.
value
=
i
.
opacity
;
i
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
h
.
fragmentShader
,
vertexShader
:
h
.
vertexShader
,
uniforms
:
j
,
lights
:
true
,
fog
:
true
})}
else
i
=
new
THREE
[
h
](
i
);
if
(
a
.
DbgName
!==
void
0
)
i
.
name
=
a
.
DbgName
;
return
i
}};
THREE
.
BinaryLoader
=
function
(
a
){
THREE
.
Loader
.
call
(
this
,
a
)};
THREE
.
BinaryLoader
.
prototype
=
Object
.
create
(
THREE
.
Loader
.
prototype
);
THREE
.
BinaryLoader
.
prototype
.
load
=
function
(
a
,
b
,
c
,
d
){
var
c
=
c
?
c
:
this
.
extractUrlBase
(
a
),
d
=
d
?
d
:
this
.
extractUrlBase
(
a
),
f
=
this
.
showProgress
?
THREE
.
Loader
.
prototype
.
updateProgress
:
null
;
this
.
onLoadStart
();
this
.
loadAjaxJSON
(
this
,
a
,
b
,
c
,
d
,
f
)};
THREE
.
BinaryLoader
.
prototype
.
loadAjaxJSON
=
function
(
a
,
b
,
c
,
d
,
f
,
e
){
var
g
=
new
XMLHttpRequest
;
g
.
onreadystatechange
=
function
(){
if
(
g
.
readyState
==
4
)
if
(
g
.
status
==
200
||
g
.
status
==
0
){
var
h
=
JSON
.
parse
(
g
.
responseText
);
a
.
loadAjaxBuffers
(
h
,
c
,
f
,
d
,
e
)}
else
console
.
error
(
"
THREE.BinaryLoader: Couldn't load [
"
+
b
+
"
] [
"
+
g
.
status
+
"
]
"
)};
g
.
open
(
"
GET
"
,
b
,
true
);
g
.
overrideMimeType
&&
g
.
overrideMimeType
(
"
text/plain; charset=x-user-defined
"
);
g
.
setRequestHeader
(
"
Content-Type
"
,
"
text/plain
"
);
g
.
send
(
null
)};
THREE
.
BinaryLoader
.
prototype
.
loadAjaxBuffers
=
function
(
a
,
b
,
c
,
d
,
f
){
var
e
=
new
XMLHttpRequest
,
g
=
c
+
"
/
"
+
a
.
buffers
,
h
=
0
;
e
.
onreadystatechange
=
function
(){
if
(
e
.
readyState
==
4
)
if
(
e
.
status
==
200
||
e
.
status
==
0
){
var
c
=
e
.
response
;
if
(
c
===
void
0
)
c
=
(
new
Uint8Array
(
e
.
responseBody
)).
buffer
;
THREE
.
BinaryLoader
.
prototype
.
createBinModel
(
c
,
b
,
d
,
a
.
materials
)}
else
console
.
error
(
"
THREE.BinaryLoader: Couldn't load [
"
+
g
+
"
] [
"
+
e
.
status
+
"
]
"
);
else
if
(
e
.
readyState
==
3
){
if
(
f
){
h
==
0
&&
(
h
=
e
.
getResponseHeader
(
"
Content-Length
"
));
f
({
total
:
h
,
loaded
:
e
.
responseText
.
length
})}}
else
e
.
readyState
==
2
&&
(
h
=
e
.
getResponseHeader
(
"
Content-Length
"
))};
e
.
open
(
"
GET
"
,
g
,
true
);
e
.
responseType
=
"
arraybuffer
"
;
e
.
send
(
null
)};
...
...
src/loaders/Loader.js
浏览文件 @
7eb62a13
...
...
@@ -335,6 +335,14 @@ THREE.Loader.prototype = {
}
//
if
(
m
.
mapBumpScale
)
{
mpars
.
bumpScale
=
m
.
mapBumpScale
;
}
// special case for normal mapped material
if
(
m
.
mapNormal
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录