Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
9dc27fe9
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,发现更多精彩内容 >>
提交
9dc27fe9
编写于
4月 13, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CubeCamera.renderTarget instead of CubeCamera.getRenderTarget().
上级
193e1990
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
170 addition
and
175 deletion
+170
-175
build/Three.js
build/Three.js
+3
-3
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+160
-160
examples/webgl_materials_cubemap_dynamic.html
examples/webgl_materials_cubemap_dynamic.html
+1
-1
examples/webgl_materials_cubemap_dynamic2.html
examples/webgl_materials_cubemap_dynamic2.html
+2
-2
examples/webgl_shading_physical.html
examples/webgl_shading_physical.html
+2
-2
src/extras/cameras/CubeCamera.js
src/extras/cameras/CubeCamera.js
+2
-7
未找到文件。
build/Three.js
浏览文件 @
9dc27fe9
...
...
@@ -194,7 +194,7 @@ Gb(R)}else{x(J,N,F,i,U,E,H,W);Q.wireframe?Mb(Q.color,Q.wireframeLinewidth,Q.wire
aa
.
r
=
aa
.
g
=
aa
.
b
=
1
-
ac
(
g
.
positionScreen
.
z
,
sa
,
Oa
);
ea
.
r
=
ea
.
g
=
ea
.
b
=
1
-
ac
(
e
.
positionScreen
.
z
,
sa
,
Oa
);
Ha
=
Dc
(
$
,
ba
,
aa
,
ea
);
y
(
J
,
N
,
F
,
i
,
H
,
W
);
gc
(
J
,
N
,
F
,
i
,
H
,
W
,
0
,
0
,
1
,
0
,
0
,
1
,
Ha
);
y
(
G
,
ha
,
U
,
E
,
fa
,
la
);
gc
(
G
,
ha
,
U
,
E
,
fa
,
la
,
1
,
0
,
1
,
1
,
0
,
1
,
Ha
)}}}
function
y
(
a
,
b
,
c
,
d
,
e
,
f
){
n
.
beginPath
();
n
.
moveTo
(
a
,
b
);
n
.
lineTo
(
c
,
d
);
n
.
lineTo
(
e
,
f
);
n
.
lineTo
(
a
,
b
);
n
.
closePath
()}
function
x
(
a
,
b
,
c
,
d
,
e
,
f
,
g
,
ca
){
n
.
beginPath
();
n
.
moveTo
(
a
,
b
);
n
.
lineTo
(
c
,
d
);
n
.
lineTo
(
e
,
f
);
n
.
lineTo
(
g
,
ca
);
n
.
lineTo
(
a
,
b
);
n
.
closePath
()}
function
Mb
(
a
,
b
,
c
,
e
){
if
(
D
!=
b
)
n
.
lineWidth
=
D
=
b
;
if
(
B
!=
c
)
n
.
lineCap
=
B
=
c
;
if
(
w
!=
e
)
n
.
lineJoin
=
w
=
e
;
d
(
a
.
getContextStyle
());
n
.
stroke
();
ua
.
inflate
(
b
*
2
)}
function
Gb
(
a
){
e
(
a
.
getContextStyle
());
n
.
fill
()}
function
Tc
(
a
,
b
,
c
,
d
,
f
,
g
,
ca
,
h
,
Q
,
i
,
S
,
k
,
j
){
if
(
j
.
image
.
width
!=
0
){
if
(
j
.
needsUpdate
==
true
||
Na
[
j
.
id
]
==
void
0
){
var
l
=
j
.
wrapS
==
THREE
.
RepeatWrapping
,
m
=
j
.
wrapT
==
THREE
.
RepeatWrapping
;
Na
[
j
.
id
]
=
n
.
createPattern
(
j
.
image
,
l
&&
m
?
"
repeat
"
:
l
&&!
m
?
"
repeat-x
"
:
!
l
&&
m
?
"
repeat-y
"
:
"
no-repeat
"
);
j
.
needsUpdate
=
false
}
e
(
Na
[
j
.
id
]);
var
l
=
j
.
offset
.
x
/
j
.
repeat
.
x
,
m
=
j
.
offset
.
y
/
j
.
repeat
.
y
,
p
=
j
.
image
.
width
*
j
.
repeat
.
x
,
o
=
j
.
image
.
height
*
j
.
repeat
.
y
,
ca
=
(
ca
+
l
)
*
p
,
h
=
(
h
+
m
)
*
o
,
c
=
c
-
a
,
d
=
d
-
b
,
f
=
f
-
a
,
g
=
g
-
b
,
Q
=
(
Q
+
l
)
*
p
-
ca
,
i
=
(
i
+
m
)
*
o
-
h
,
S
=
(
S
+
l
)
*
p
-
ca
,
k
=
(
k
+
m
)
*
o
-
h
,
l
=
Q
*
k
-
S
*
i
;
if
(
l
==
0
){
if
(
wa
[
j
.
id
]
===
void
0
){
b
=
document
.
createElement
(
"
canvas
"
);
b
.
width
=
j
.
image
.
width
;
b
.
height
=
j
.
image
.
height
;
b
=
b
.
getContext
(
"
2d
"
);
b
.
drawImage
(
j
.
image
,
0
,
0
);
wa
[
j
.
id
]
=
b
.
getImageData
(
0
,
0
,
j
.
image
.
width
,
j
.
image
.
height
).
data
}
b
=
wa
[
j
.
id
];
ca
=
(
Math
.
floor
(
ca
)
+
Math
.
floor
(
h
)
*
j
.
image
.
width
)
*
4
;
R
.
setRGB
(
b
[
ca
]
/
255
,
b
[
ca
+
1
]
/
255
,
b
[
ca
+
2
]
/
255
);
Gb
(
R
)}
else
{
l
=
1
/
l
;
j
=
(
k
*
c
-
i
*
f
)
*
l
;
i
=
(
k
*
d
-
i
*
g
)
*
l
;
c
=
(
Q
*
f
-
S
*
c
)
*
l
;
d
=
(
Q
*
g
-
S
*
d
)
*
l
;
a
=
a
-
j
*
ca
-
c
*
h
;
ca
=
b
-
i
*
ca
-
d
*
h
;
n
.
save
();
n
.
transform
(
j
,
i
,
c
,
d
,
a
,
ca
);
n
.
fill
();
n
.
restore
()}}}
function
gc
(
a
,
b
,
c
,
d
,
e
,
f
,
g
,
ca
,
h
,
Q
,
i
,
S
,
k
){
var
j
,
l
;
j
=
k
.
width
-
1
;
l
=
k
.
height
-
1
;
g
=
g
*
j
;
ca
=
ca
*
l
;
c
=
c
-
a
;
d
=
d
-
b
;
e
=
e
-
a
;
f
=
f
-
b
;
h
=
h
*
j
-
g
;
Q
=
Q
*
l
-
ca
;
i
=
i
*
j
-
g
;
S
=
S
*
l
-
ca
;
l
=
1
/
(
h
*
S
-
i
*
Q
);
j
=
(
S
*
c
-
Q
*
e
)
*
l
;
Q
=
(
S
*
d
-
Q
*
f
)
*
l
;
c
=
(
h
*
e
-
i
*
c
)
*
l
;
d
=
(
h
*
f
-
i
*
d
)
*
l
;
a
=
a
-
j
*
g
-
c
*
ca
;
b
=
b
-
Q
*
g
-
d
*
ca
;
n
.
save
();
n
.
transform
(
j
,
Q
,
c
,
d
,
a
,
b
);
n
.
clip
();
n
.
drawImage
(
k
,
0
,
0
);
n
.
restore
()}
function
Dc
(
a
,
b
,
c
,
d
){
var
e
=~~
(
a
.
r
*
255
),
f
=~~
(
a
.
g
*
255
),
a
=~~
(
a
.
b
*
255
),
g
=~~
(
b
.
r
*
l
;
c
=
(
Q
*
f
-
S
*
c
)
*
l
;
d
=
(
Q
*
g
-
S
*
d
)
*
l
;
a
=
a
-
j
*
ca
-
c
*
h
;
ca
=
b
-
i
*
ca
-
d
*
h
;
n
.
save
();
n
.
transform
(
j
,
i
,
c
,
d
,
a
,
ca
);
n
.
fill
();
n
.
restore
()}}}
function
gc
(
a
,
b
,
c
,
d
,
e
,
f
,
g
,
ca
,
h
,
Q
,
i
,
S
,
j
){
var
k
,
l
;
k
=
j
.
width
-
1
;
l
=
j
.
height
-
1
;
g
=
g
*
k
;
ca
=
ca
*
l
;
c
=
c
-
a
;
d
=
d
-
b
;
e
=
e
-
a
;
f
=
f
-
b
;
h
=
h
*
k
-
g
;
Q
=
Q
*
l
-
ca
;
i
=
i
*
k
-
g
;
S
=
S
*
l
-
ca
;
l
=
1
/
(
h
*
S
-
i
*
Q
);
k
=
(
S
*
c
-
Q
*
e
)
*
l
;
Q
=
(
S
*
d
-
Q
*
f
)
*
l
;
c
=
(
h
*
e
-
i
*
c
)
*
l
;
d
=
(
h
*
f
-
i
*
d
)
*
l
;
a
=
a
-
k
*
g
-
c
*
ca
;
b
=
b
-
Q
*
g
-
d
*
ca
;
n
.
save
();
n
.
transform
(
k
,
Q
,
c
,
d
,
a
,
b
);
n
.
clip
();
n
.
drawImage
(
j
,
0
,
0
);
n
.
restore
()}
function
Dc
(
a
,
b
,
c
,
d
){
var
e
=~~
(
a
.
r
*
255
),
f
=~~
(
a
.
g
*
255
),
a
=~~
(
a
.
b
*
255
),
g
=~~
(
b
.
r
*
255
),
h
=~~
(
b
.
g
*
255
),
b
=~~
(
b
.
b
*
255
),
i
=~~
(
c
.
r
*
255
),
k
=~~
(
c
.
g
*
255
),
c
=~~
(
c
.
b
*
255
),
j
=~~
(
d
.
r
*
255
),
l
=~~
(
d
.
g
*
255
),
d
=~~
(
d
.
b
*
255
);
Q
[
0
]
=
e
<
0
?
0
:
e
>
255
?
255
:
e
;
Q
[
1
]
=
f
<
0
?
0
:
f
>
255
?
255
:
f
;
Q
[
2
]
=
a
<
0
?
0
:
a
>
255
?
255
:
a
;
Q
[
4
]
=
g
<
0
?
0
:
g
>
255
?
255
:
g
;
Q
[
5
]
=
h
<
0
?
0
:
h
>
255
?
255
:
h
;
Q
[
6
]
=
b
<
0
?
0
:
b
>
255
?
255
:
b
;
Q
[
8
]
=
i
<
0
?
0
:
i
>
255
?
255
:
i
;
Q
[
9
]
=
k
<
0
?
0
:
k
>
255
?
255
:
k
;
Q
[
10
]
=
c
<
0
?
0
:
c
>
255
?
255
:
c
;
Q
[
12
]
=
j
<
0
?
0
:
j
>
255
?
255
:
j
;
Q
[
13
]
=
l
<
0
?
0
:
l
>
255
?
255
:
l
;
Q
[
14
]
=
d
<
0
?
0
:
d
>
255
?
255
:
d
;
ca
.
putImageData
(
S
,
0
,
0
);
Cc
.
drawImage
(
Fb
,
0
,
0
);
return
pc
}
function
ac
(
a
,
b
,
c
){
a
=
(
a
-
b
)
/
(
c
-
b
);
return
a
*
a
*
(
3
-
2
*
a
)}
function
hc
(
a
){
a
=
(
a
+
1
)
*
0.5
;
return
a
<
0
?
0
:
a
>
1
?
1
:
a
}
function
Nb
(
a
,
b
){
var
c
=
b
.
x
-
a
.
x
,
d
=
b
.
y
-
a
.
y
,
e
=
c
*
c
+
d
*
d
;
if
(
e
!=
0
){
e
=
1
/
Math
.
sqrt
(
e
);
c
=
c
*
e
;
d
=
d
*
e
;
b
.
x
=
b
.
x
+
c
;
b
.
y
=
b
.
y
+
d
;
a
.
x
=
a
.
x
-
c
;
a
.
y
=
a
.
y
-
d
}}
var
Ec
,
cd
,
Ta
,
kb
;
this
.
autoClear
?
this
.
clear
():
n
.
setTransform
(
1
,
0
,
0
,
-
1
,
o
,
r
);
f
.
info
.
render
.
vertices
=
0
;
f
.
info
.
render
.
faces
=
0
;
g
=
k
.
projectScene
(
a
,
l
,
this
.
sortElements
);
h
=
g
.
elements
;
j
=
g
.
lights
;(
ab
=
j
.
length
>
0
)
&&
m
(
j
);
Ec
=
0
;
for
(
cd
=
h
.
length
;
Ec
<
cd
;
Ec
++
){
Ta
=
h
[
Ec
];
kb
=
Ta
.
material
;
kb
=
kb
instanceof
THREE
.
MeshFaceMaterial
?
Ta
.
faceMaterial
:
kb
;
if
(
!
(
kb
==
null
||
kb
.
opacity
==
0
)){
ua
.
empty
();
if
(
Ta
instanceof
THREE
.
RenderableParticle
){
v
=
Ta
;
v
.
x
=
v
.
x
*
o
;
v
.
y
=
v
.
y
*
r
;
q
(
v
,
Ta
,
kb
,
a
)}
else
if
(
Ta
instanceof
THREE
.
RenderableLine
){
v
=
Ta
.
v1
;
C
=
Ta
.
v2
;
v
.
positionScreen
.
x
=
v
.
positionScreen
.
x
*
o
;
v
.
positionScreen
.
y
=
v
.
positionScreen
.
y
*
r
;
C
.
positionScreen
.
x
=
C
.
positionScreen
.
x
*
o
;
C
.
positionScreen
.
y
=
C
.
positionScreen
.
y
*
r
;
ua
.
addPoint
(
v
.
positionScreen
.
x
,
v
.
positionScreen
.
y
);
ua
.
addPoint
(
C
.
positionScreen
.
x
,
C
.
positionScreen
.
y
);
Pa
.
intersects
(
ua
)
&&
s
(
v
,
C
,
Ta
,
kb
,
a
)}
else
if
(
Ta
instanceof
THREE
.
RenderableFace3
){
v
=
...
...
@@ -503,8 +503,8 @@ true}else if(l.length){if(this.JITCompile&&p)d instanceof THREE.Bone?d.skinMatri
for
(
a
=
0
;
a
<
this
.
hierarchy
.
length
;
a
++
)
f
[
a
][
e
]
=
this
.
hierarchy
[
a
]
instanceof
THREE
.
Bone
?
this
.
hierarchy
[
a
].
skinMatrix
.
clone
():
this
.
hierarchy
[
a
].
matrix
.
clone
()}}}};
THREE
.
KeyFrameAnimation
.
prototype
.
getNextKeyWith
=
function
(
a
,
b
,
c
){
b
=
this
.
data
.
hierarchy
[
b
].
keys
;
for
(
c
=
c
%
b
.
length
;
c
<
b
.
length
;
c
++
)
if
(
b
[
c
].
hasTarget
(
a
))
return
b
[
c
];
return
b
[
0
]};
THREE
.
KeyFrameAnimation
.
prototype
.
getPrevKeyWith
=
function
(
a
,
b
,
c
){
b
=
this
.
data
.
hierarchy
[
b
].
keys
;
for
(
c
=
c
>=
0
?
c
:
c
+
b
.
length
;
c
>=
0
;
c
--
)
if
(
b
[
c
].
hasTarget
(
a
))
return
b
[
c
];
return
b
[
b
.
length
-
1
]};
THREE
.
CubeCamera
=
function
(
a
,
b
,
c
){
THREE
.
Object3D
.
call
(
this
);
var
d
=
new
THREE
.
PerspectiveCamera
(
90
,
1
,
a
,
b
);
d
.
up
.
set
(
0
,
-
1
,
0
);
d
.
lookAt
(
new
THREE
.
Vector3
(
1
,
0
,
0
));
this
.
add
(
d
);
var
e
=
new
THREE
.
PerspectiveCamera
(
90
,
1
,
a
,
b
);
e
.
up
.
set
(
0
,
-
1
,
0
);
e
.
lookAt
(
new
THREE
.
Vector3
(
-
1
,
0
,
0
));
this
.
add
(
e
);
var
f
=
new
THREE
.
PerspectiveCamera
(
90
,
1
,
a
,
b
);
f
.
up
.
set
(
0
,
0
,
1
);
f
.
lookAt
(
new
THREE
.
Vector3
(
0
,
1
,
0
));
this
.
add
(
f
);
var
g
=
new
THREE
.
PerspectiveCamera
(
90
,
1
,
a
,
b
);
g
.
up
.
set
(
0
,
0
,
-
1
);
g
.
lookAt
(
new
THREE
.
Vector3
(
0
,
-
1
,
0
));
this
.
add
(
g
);
var
h
=
new
THREE
.
PerspectiveCamera
(
90
,
1
,
a
,
b
);
h
.
up
.
set
(
0
,
-
1
,
0
);
h
.
lookAt
(
new
THREE
.
Vector3
(
0
,
0
,
1
));
this
.
add
(
h
);
var
j
=
new
THREE
.
PerspectiveCamera
(
90
,
1
,
a
,
b
);
j
.
up
.
set
(
0
,
-
1
,
0
);
j
.
lookAt
(
new
THREE
.
Vector3
(
0
,
0
,
-
1
));
this
.
add
(
j
);
var
k
=
new
THREE
.
WebGLRenderTargetCube
(
c
,
c
,{
format
:
THREE
.
RGBFormat
,
magFilter
:
THREE
.
LinearFilter
,
minFilter
:
THREE
.
LinearFilter
});
this
.
getRenderTarget
=
function
(){
return
k
};
this
.
updateCubeMap
=
function
(
a
,
b
){
var
c
=
k
.
generateMipmaps
;
k
.
generateMipmaps
=
false
;
k
.
activeCubeFace
=
0
;
a
.
render
(
b
,
d
,
k
);
k
.
activeCubeFace
=
1
;
a
.
render
(
b
,
e
,
k
);
k
.
activeCubeFace
=
2
;
a
.
render
(
b
,
f
,
k
);
k
.
activeCubeFace
=
3
;
a
.
render
(
b
,
g
,
k
);
k
.
activeCubeFace
=
4
;
a
.
render
(
b
,
h
,
k
);
k
.
generateMipmaps
=
c
;
k
.
activeCubeFace
=
5
;
a
.
render
(
b
,
j
,
k
)}};
THREE
.
CubeCamera
.
prototype
=
new
THREE
.
Object3D
;
THREE
.
CubeCamera
.
prototype
.
constructor
=
THREE
.
CubeCamera
;
1
,
a
,
b
);
h
.
up
.
set
(
0
,
-
1
,
0
);
h
.
lookAt
(
new
THREE
.
Vector3
(
0
,
0
,
1
));
this
.
add
(
h
);
var
j
=
new
THREE
.
PerspectiveCamera
(
90
,
1
,
a
,
b
);
j
.
up
.
set
(
0
,
-
1
,
0
);
j
.
lookAt
(
new
THREE
.
Vector3
(
0
,
0
,
-
1
));
this
.
add
(
j
);
this
.
renderTarget
=
new
THREE
.
WebGLRenderTargetCube
(
c
,
c
,{
format
:
THREE
.
RGBFormat
,
magFilter
:
THREE
.
LinearFilter
,
minFilter
:
THREE
.
LinearFilter
});
this
.
updateCubeMap
=
function
(
a
,
b
){
var
c
=
this
.
renderTarget
,
m
=
c
.
generateMipmaps
;
c
.
generateMipmaps
=
false
;
c
.
activeCubeFace
=
0
;
a
.
render
(
b
,
d
,
c
);
c
.
activeCubeFace
=
1
;
a
.
render
(
b
,
e
,
c
);
c
.
activeCubeFace
=
2
;
a
.
render
(
b
,
f
,
c
);
c
.
activeCubeFace
=
3
;
a
.
render
(
b
,
g
,
c
);
c
.
activeCubeFace
=
4
;
a
.
render
(
b
,
h
,
c
);
c
.
generateMipmaps
=
m
;
c
.
activeCubeFace
=
5
;
a
.
render
(
b
,
j
,
c
)}};
THREE
.
CubeCamera
.
prototype
=
new
THREE
.
Object3D
;
THREE
.
CubeCamera
.
prototype
.
constructor
=
THREE
.
CubeCamera
;
THREE
.
CombinedCamera
=
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
THREE
.
Camera
.
call
(
this
);
this
.
fov
=
c
;
this
.
left
=-
a
/
2
;
this
.
right
=
a
/
2
;
this
.
top
=
b
/
2
;
this
.
bottom
=-
b
/
2
;
this
.
cameraO
=
new
THREE
.
OrthographicCamera
(
a
/-
2
,
a
/
2
,
b
/
2
,
b
/-
2
,
f
,
g
);
this
.
cameraP
=
new
THREE
.
PerspectiveCamera
(
c
,
a
/
b
,
d
,
e
);
this
.
zoom
=
1
;
this
.
toPerspective
()};
THREE
.
CombinedCamera
.
prototype
=
new
THREE
.
Camera
;
THREE
.
CombinedCamera
.
prototype
.
constructor
=
THREE
.
CombinedCamera
;
THREE
.
CombinedCamera
.
prototype
.
toPerspective
=
function
(){
this
.
near
=
this
.
cameraP
.
near
;
this
.
far
=
this
.
cameraP
.
far
;
this
.
cameraP
.
fov
=
this
.
fov
/
this
.
zoom
;
this
.
cameraP
.
updateProjectionMatrix
();
this
.
projectionMatrix
=
this
.
cameraP
.
projectionMatrix
;
this
.
inPersepectiveMode
=
true
;
this
.
inOrthographicMode
=
false
};
THREE
.
CombinedCamera
.
prototype
.
toOrthographic
=
function
(){
var
a
=
this
.
cameraP
.
aspect
,
b
=
(
this
.
cameraP
.
near
+
this
.
cameraP
.
far
)
/
2
,
b
=
Math
.
tan
(
this
.
fov
/
2
)
*
b
,
a
=
2
*
b
*
a
/
2
,
b
=
b
/
this
.
zoom
,
a
=
a
/
this
.
zoom
;
this
.
cameraO
.
left
=-
a
;
this
.
cameraO
.
right
=
a
;
this
.
cameraO
.
top
=
b
;
this
.
cameraO
.
bottom
=-
b
;
this
.
cameraO
.
updateProjectionMatrix
();
this
.
near
=
this
.
cameraO
.
near
;
this
.
far
=
this
.
cameraO
.
far
;
this
.
projectionMatrix
=
this
.
cameraO
.
projectionMatrix
;
this
.
inPersepectiveMode
=
false
;
this
.
inOrthographicMode
=
true
};
...
...
build/custom/ThreeExtras.js
浏览文件 @
9dc27fe9
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
examples/webgl_materials_cubemap_dynamic.html
浏览文件 @
9dc27fe9
...
...
@@ -220,7 +220,7 @@
// MATERIALS
var
cubeTarget
=
cubeCamera
.
getRenderTarget
()
;
var
cubeTarget
=
cubeCamera
.
renderTarget
;
mlib
=
{
...
...
examples/webgl_materials_cubemap_dynamic2.html
浏览文件 @
9dc27fe9
...
...
@@ -68,14 +68,14 @@
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
cubeCamera
=
new
THREE
.
CubeCamera
(
1
,
1000
,
256
);
cubeCamera
.
getRenderTarget
()
.
minFilter
=
THREE
.
LinearMipMapLinearFilter
;
cubeCamera
.
renderTarget
.
minFilter
=
THREE
.
LinearMipMapLinearFilter
;
scene
.
add
(
cubeCamera
);
document
.
body
.
appendChild
(
renderer
.
domElement
);
//
var
material
=
new
THREE
.
MeshBasicMaterial
(
{
envMap
:
cubeCamera
.
getRenderTarget
()
}
);
var
material
=
new
THREE
.
MeshBasicMaterial
(
{
envMap
:
cubeCamera
.
renderTarget
}
);
sphere
=
new
THREE
.
Mesh
(
new
THREE
.
SphereGeometry
(
20
,
60
,
40
),
material
);
scene
.
add
(
sphere
);
...
...
examples/webgl_shading_physical.html
浏览文件 @
9dc27fe9
...
...
@@ -207,7 +207,7 @@
// MATERIALS
var
shader
=
THREE
.
ShaderUtils
.
lib
[
"
cube
"
];
shader
.
uniforms
[
"
tCube
"
].
texture
=
cubeCamera
.
getRenderTarget
()
;
shader
.
uniforms
[
"
tCube
"
].
texture
=
cubeCamera
.
renderTarget
;
shader
.
uniforms
[
"
tFlip
"
].
value
=
1
;
var
materialCube
=
new
THREE
.
ShaderMaterial
(
{
...
...
@@ -220,7 +220,7 @@
var
materialLambert
=
new
THREE
.
MeshPhongMaterial
(
{
shininess
:
50
,
ambient
:
0x444444
,
color
:
0xffffff
,
map
:
textureNoiseColor
}
);
var
materialPhong
=
new
THREE
.
MeshPhongMaterial
(
{
shininess
:
50
,
ambient
:
0x444444
,
color
:
0xffffff
,
specular
:
0x999999
,
map
:
textureLava
}
);
var
materialPhongCube
=
new
THREE
.
MeshPhongMaterial
(
{
shininess
:
50
,
ambient
:
0x444444
,
color
:
0xffffff
,
specular
:
0x999999
,
envMap
:
cubeCamera
.
getRenderTarget
()
}
);
var
materialPhongCube
=
new
THREE
.
MeshPhongMaterial
(
{
shininess
:
50
,
ambient
:
0x444444
,
color
:
0xffffff
,
specular
:
0x999999
,
envMap
:
cubeCamera
.
renderTarget
}
);
// OBJECTS
...
...
src/extras/cameras/CubeCamera.js
浏览文件 @
9dc27fe9
...
...
@@ -41,16 +41,11 @@ THREE.CubeCamera = function ( near, far, cubeResolution ) {
cameraNZ
.
lookAt
(
new
THREE
.
Vector3
(
0
,
0
,
-
1
)
);
this
.
add
(
cameraNZ
);
var
renderTarget
=
new
THREE
.
WebGLRenderTargetCube
(
cubeResolution
,
cubeResolution
,
{
format
:
THREE
.
RGBFormat
,
magFilter
:
THREE
.
LinearFilter
,
minFilter
:
THREE
.
LinearFilter
}
);
this
.
getRenderTarget
=
function
()
{
return
renderTarget
;
};
this
.
renderTarget
=
new
THREE
.
WebGLRenderTargetCube
(
cubeResolution
,
cubeResolution
,
{
format
:
THREE
.
RGBFormat
,
magFilter
:
THREE
.
LinearFilter
,
minFilter
:
THREE
.
LinearFilter
}
);
this
.
updateCubeMap
=
function
(
renderer
,
scene
)
{
var
renderTarget
=
this
.
renderTarget
;
var
generateMipmaps
=
renderTarget
.
generateMipmaps
;
renderTarget
.
generateMipmaps
=
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录