Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
d31398b2
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,发现更多精彩内容 >>
提交
d31398b2
编写于
7月 14, 2011
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added THREE namespace to GeometryUtils.
Somehow this one escaped.
上级
ee98b4ce
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
14 addition
and
10 deletion
+14
-10
build/Three.js
build/Three.js
+2
-2
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+2
-2
examples/webgl_custom_attributes_particles2.html
examples/webgl_custom_attributes_particles2.html
+1
-1
examples/webgl_geometry_minecraft.html
examples/webgl_geometry_minecraft.html
+1
-1
examples/webgl_geometry_minecraft_ao.html
examples/webgl_geometry_minecraft_ao.html
+3
-3
src/extras/GeometryUtils.js
src/extras/GeometryUtils.js
+5
-1
未找到文件。
build/Three.js
浏览文件 @
d31398b2
...
...
@@ -343,8 +343,8 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
THREE
.
RenderableObject
=
function
(){
this
.
z
=
this
.
object
=
null
};
THREE
.
RenderableParticle
=
function
(){
this
.
rotation
=
this
.
z
=
this
.
y
=
this
.
x
=
null
;
this
.
scale
=
new
THREE
.
Vector2
;
this
.
materials
=
null
};
THREE
.
RenderableLine
=
function
(){
this
.
z
=
null
;
this
.
v1
=
new
THREE
.
RenderableVertex
;
this
.
v2
=
new
THREE
.
RenderableVertex
;
this
.
materials
=
null
};
THREE
.
ColorUtils
=
{
adjustHSV
:
function
(
b
,
c
,
e
,
f
){
var
g
=
THREE
.
ColorUtils
.
__hsv
;
THREE
.
ColorUtils
.
rgbToHsv
(
b
,
g
);
g
.
h
=
THREE
.
ColorUtils
.
clamp
(
g
.
h
+
c
,
0
,
1
);
g
.
s
=
THREE
.
ColorUtils
.
clamp
(
g
.
s
+
e
,
0
,
1
);
g
.
v
=
THREE
.
ColorUtils
.
clamp
(
g
.
v
+
f
,
0
,
1
);
b
.
setHSV
(
g
.
h
,
g
.
s
,
g
.
v
)},
rgbToHsv
:
function
(
b
,
c
){
var
e
=
b
.
r
,
f
=
b
.
g
,
g
=
b
.
b
,
k
=
Math
.
max
(
Math
.
max
(
e
,
f
),
g
),
h
=
Math
.
min
(
Math
.
min
(
e
,
f
),
g
);
if
(
h
==
k
)
h
=
e
=
0
;
else
{
var
m
=
k
-
h
,
h
=
m
/
k
,
e
=
e
==
k
?(
f
-
g
)
/
m
:
f
==
k
?
2
+
(
g
-
e
)
/
m
:
4
+
(
e
-
f
)
/
m
;
e
/=
6
;
e
<
0
&&
(
e
+=
1
);
e
>
1
&&
(
e
-=
1
)}
c
===
void
0
&&
(
c
=
{
h
:
0
,
s
:
0
,
v
:
0
});
c
.
h
=
e
;
c
.
s
=
h
;
c
.
v
=
k
;
return
c
},
clamp
:
function
(
b
,
c
,
e
){
return
b
<
c
?
c
:
b
>
e
?
e
:
b
}};
THREE
.
ColorUtils
.
__hsv
=
{
h
:
0
,
s
:
0
,
v
:
0
};
var
GeometryUtils
=
{
merge
:
function
(
b
,
c
){
var
e
=
c
instanceof
THREE
.
Mesh
,
f
=
b
.
vertices
.
length
,
g
=
e
?
c
.
geometry
:
c
,
k
=
b
.
vertices
,
h
=
g
.
vertices
,
m
=
b
.
faces
,
n
=
g
.
faces
,
p
=
b
.
faceVertexUvs
[
0
],
g
=
g
.
faceVertexUvs
[
0
];
e
&&
c
.
matrixAutoUpdate
&&
c
.
updateMatrix
();
for
(
var
o
=
0
,
t
=
h
.
length
;
o
<
t
;
o
++
){
var
u
=
new
THREE
.
Vertex
(
h
[
o
].
position
.
clone
());
e
&&
c
.
matrix
.
multiplyVector3
(
u
.
position
);
k
.
push
(
u
)}
o
=
0
;
for
(
t
=
n
.
length
;
o
<
t
;
o
++
){
var
h
=
n
[
o
],
v
,
x
,
B
=
h
.
vertexNormals
,
u
=
h
.
vertexColors
;
h
instanceof
THREE
.
Face3
?
v
=
new
THREE
.
Face3
(
h
.
a
+
f
,
h
.
b
+
f
,
h
.
c
+
f
):
h
instanceof
THREE
.
Face4
&&
(
v
=
new
THREE
.
Face4
(
h
.
a
+
f
,
h
.
b
+
f
,
h
.
c
+
f
,
h
.
d
+
f
));
v
.
normal
.
copy
(
h
.
normal
);
e
=
0
;
for
(
k
=
B
.
length
;
e
<
k
;
e
++
)
x
=
B
[
e
],
v
.
vertexNormals
.
push
(
x
.
clone
());
v
.
color
.
copy
(
h
.
color
);
e
=
0
;
for
(
k
=
u
.
length
;
e
<
k
;
e
++
)
x
=
u
[
e
],
v
.
vertexColors
.
push
(
x
.
clone
());
v
.
materials
=
h
.
materials
.
slice
();
v
.
centroid
.
copy
(
h
.
centroid
);
m
.
push
(
v
)}
o
=
0
;
for
(
t
=
g
.
length
;
o
<
t
;
o
++
){
f
=
g
[
o
];
m
=
[];
e
=
0
;
for
(
k
=
f
.
length
;
e
<
k
;
e
++
)
m
.
push
(
new
THREE
.
UV
(
f
[
e
].
u
,
f
[
e
].
v
));
p
.
push
(
m
)}}};
THREE
.
GeometryUtils
=
{
merge
:
function
(
b
,
c
){
var
e
=
c
instanceof
THREE
.
Mesh
,
f
=
b
.
vertices
.
length
,
g
=
e
?
c
.
geometry
:
c
,
k
=
b
.
vertices
,
h
=
g
.
vertices
,
m
=
b
.
faces
,
n
=
g
.
faces
,
p
=
b
.
faceVertexUvs
[
0
],
g
=
g
.
faceVertexUvs
[
0
];
e
&&
c
.
matrixAutoUpdate
&&
c
.
updateMatrix
();
for
(
var
o
=
0
,
t
=
h
.
length
;
o
<
t
;
o
++
){
var
u
=
new
THREE
.
Vertex
(
h
[
o
].
position
.
clone
());
e
&&
c
.
matrix
.
multiplyVector3
(
u
.
position
);
k
.
push
(
u
)}
o
=
0
;
for
(
t
=
n
.
length
;
o
<
t
;
o
++
){
var
h
=
n
[
o
],
v
,
x
,
B
=
h
.
vertexNormals
,
u
=
h
.
vertexColors
;
h
instanceof
THREE
.
Face3
?
v
=
new
THREE
.
Face3
(
h
.
a
+
f
,
h
.
b
+
f
,
h
.
c
+
f
):
h
instanceof
THREE
.
Face4
&&
(
v
=
new
THREE
.
Face4
(
h
.
a
+
f
,
h
.
b
+
f
,
h
.
c
+
f
,
h
.
d
+
f
));
v
.
normal
.
copy
(
h
.
normal
);
e
=
0
;
for
(
k
=
B
.
length
;
e
<
k
;
e
++
)
x
=
B
[
e
],
v
.
vertexNormals
.
push
(
x
.
clone
());
v
.
color
.
copy
(
h
.
color
);
e
=
0
;
for
(
k
=
u
.
length
;
e
<
k
;
e
++
)
x
=
u
[
e
],
v
.
vertexColors
.
push
(
x
.
clone
());
v
.
materials
=
h
.
materials
.
slice
();
v
.
centroid
.
copy
(
h
.
centroid
);
m
.
push
(
v
)}
o
=
0
;
for
(
t
=
g
.
length
;
o
<
t
;
o
++
){
f
=
g
[
o
];
m
=
[];
e
=
0
;
for
(
k
=
f
.
length
;
e
<
k
;
e
++
)
m
.
push
(
new
THREE
.
UV
(
f
[
e
].
u
,
f
[
e
].
v
));
p
.
push
(
m
)}}};
THREE
.
ImageUtils
=
{
loadTexture
:
function
(
b
,
c
,
e
){
var
f
=
new
Image
,
g
=
new
THREE
.
Texture
(
f
,
c
);
f
.
onload
=
function
(){
g
.
needsUpdate
=!
0
;
e
&&
e
(
this
)};
f
.
crossOrigin
=
""
;
f
.
src
=
b
;
return
g
},
loadTextureCube
:
function
(
b
,
c
,
e
){
var
f
,
g
=
[],
k
=
new
THREE
.
Texture
(
g
,
c
),
c
=
g
.
loadCount
=
0
;
for
(
f
=
b
.
length
;
c
<
f
;
++
c
)
g
[
c
]
=
new
Image
,
g
[
c
].
onload
=
function
(){
g
.
loadCount
+=
1
;
if
(
g
.
loadCount
==
6
)
k
.
needsUpdate
=!
0
;
e
&&
e
(
this
)},
g
[
c
].
crossOrigin
=
""
,
g
[
c
].
src
=
b
[
c
];
return
k
}};
THREE
.
SceneUtils
=
{
showHierarchy
:
function
(
b
,
c
){
THREE
.
SceneUtils
.
traverseHierarchy
(
b
,
function
(
b
){
b
.
visible
=
c
})},
traverseHierarchy
:
function
(
b
,
c
){
var
e
,
f
,
g
=
b
.
children
.
length
;
for
(
f
=
0
;
f
<
g
;
f
++
)
e
=
b
.
children
[
f
],
c
(
e
),
THREE
.
SceneUtils
.
traverseHierarchy
(
e
,
c
)}};
if
(
THREE
.
WebGLRenderer
)
THREE
.
ShaderUtils
=
{
lib
:{
fresnel
:{
uniforms
:{
mRefractionRatio
:{
type
:
"
f
"
,
value
:
1.02
},
mFresnelBias
:{
type
:
"
f
"
,
value
:
0.1
},
mFresnelPower
:{
type
:
"
f
"
,
value
:
2
},
mFresnelScale
:{
type
:
"
f
"
,
value
:
1
},
tCube
:{
type
:
"
t
"
,
value
:
1
,
texture
:
null
}},
fragmentShader
:
"
uniform samplerCube tCube;
\n
varying vec3 vReflect;
\n
varying vec3 vRefract[3];
\n
varying float vReflectionFactor;
\n
void main() {
\n
vec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );
\n
vec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );
\n
refractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;
\n
refractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;
\n
refractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;
\n
refractedColor.a = 1.0;
\n
gl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );
\n
}
"
,
vertexShader
:
"
uniform float mRefractionRatio;
\n
uniform float mFresnelBias;
\n
uniform float mFresnelScale;
\n
uniform float mFresnelPower;
\n
varying vec3 vReflect;
\n
varying vec3 vRefract[3];
\n
varying float vReflectionFactor;
\n
void main() {
\n
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
\n
vec4 mPosition = objectMatrix * vec4( position, 1.0 );
\n
vec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );
\n
vec3 I = mPosition.xyz - cameraPosition;
\n
vReflect = reflect( I, nWorld );
\n
vRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );
\n
vRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );
\n
vRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );
\n
vReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );
\n
gl_Position = projectionMatrix * mvPosition;
\n
}
"
},
...
...
build/custom/ThreeExtras.js
浏览文件 @
d31398b2
// ThreeExtras.js r42 - http://github.com/mrdoob/three.js
THREE
.
ColorUtils
=
{
adjustHSV
:
function
(
a
,
b
,
c
,
g
){
var
e
=
THREE
.
ColorUtils
.
__hsv
;
THREE
.
ColorUtils
.
rgbToHsv
(
a
,
e
);
e
.
h
=
THREE
.
ColorUtils
.
clamp
(
e
.
h
+
b
,
0
,
1
);
e
.
s
=
THREE
.
ColorUtils
.
clamp
(
e
.
s
+
c
,
0
,
1
);
e
.
v
=
THREE
.
ColorUtils
.
clamp
(
e
.
v
+
g
,
0
,
1
);
a
.
setHSV
(
e
.
h
,
e
.
s
,
e
.
v
)},
rgbToHsv
:
function
(
a
,
b
){
var
c
=
a
.
r
,
g
=
a
.
g
,
e
=
a
.
b
,
h
=
Math
.
max
(
Math
.
max
(
c
,
g
),
e
),
f
=
Math
.
min
(
Math
.
min
(
c
,
g
),
e
);
if
(
f
==
h
)
f
=
c
=
0
;
else
{
var
j
=
h
-
f
,
f
=
j
/
h
,
c
=
c
==
h
?(
g
-
e
)
/
j
:
g
==
h
?
2
+
(
e
-
c
)
/
j
:
4
+
(
c
-
g
)
/
j
;
c
/=
6
;
c
<
0
&&
(
c
+=
1
);
c
>
1
&&
(
c
-=
1
)}
b
===
void
0
&&
(
b
=
{
h
:
0
,
s
:
0
,
v
:
0
});
b
.
h
=
c
;
b
.
s
=
f
;
b
.
v
=
h
;
return
b
},
clamp
:
function
(
a
,
b
,
c
){
return
a
<
b
?
b
:
a
>
c
?
c
:
a
}};
THREE
.
ColorUtils
.
__hsv
=
{
h
:
0
,
s
:
0
,
v
:
0
};
var
GeometryUtils
=
{
merge
:
function
(
a
,
b
){
var
c
=
b
instanceof
THREE
.
Mesh
,
g
=
a
.
vertices
.
length
,
e
=
c
?
b
.
geometry
:
b
,
h
=
a
.
vertices
,
f
=
e
.
vertices
,
j
=
a
.
faces
,
k
=
e
.
faces
,
l
=
a
.
faceVertexUvs
[
0
],
e
=
e
.
faceVertexUvs
[
0
];
c
&&
b
.
matrixAutoUpdate
&&
b
.
updateMatrix
();
for
(
var
m
=
0
,
o
=
f
.
length
;
m
<
o
;
m
++
){
var
n
=
new
THREE
.
Vertex
(
f
[
m
].
position
.
clone
());
c
&&
b
.
matrix
.
multiplyVector3
(
n
.
position
);
h
.
push
(
n
)}
m
=
0
;
for
(
o
=
k
.
length
;
m
<
o
;
m
++
){
var
f
=
k
[
m
],
t
,
v
,
y
=
f
.
vertexNormals
,
n
=
f
.
vertexColors
;
f
instanceof
THREE
.
Face3
?
t
=
new
THREE
.
Face3
(
f
.
a
+
g
,
f
.
b
+
g
,
f
.
c
+
g
):
f
instanceof
THREE
.
Face4
&&
(
t
=
new
THREE
.
Face4
(
f
.
a
+
g
,
f
.
b
+
g
,
f
.
c
+
g
,
f
.
d
+
g
));
t
.
normal
.
copy
(
f
.
normal
);
c
=
0
;
for
(
h
=
y
.
length
;
c
<
h
;
c
++
)
v
=
y
[
c
],
t
.
vertexNormals
.
push
(
v
.
clone
());
t
.
color
.
copy
(
f
.
color
);
c
=
0
;
for
(
h
=
n
.
length
;
c
<
h
;
c
++
)
v
=
n
[
c
],
t
.
vertexColors
.
push
(
v
.
clone
());
t
.
materials
=
f
.
materials
.
slice
();
t
.
centroid
.
copy
(
f
.
centroid
);
j
.
push
(
t
)}
m
=
0
;
for
(
o
=
e
.
length
;
m
<
o
;
m
++
){
g
=
e
[
m
];
j
=
[];
c
=
0
;
for
(
h
=
g
.
length
;
c
<
h
;
c
++
)
j
.
push
(
new
THREE
.
UV
(
g
[
c
].
u
,
g
[
c
].
v
));
l
.
push
(
j
)}}};
THREE
.
GeometryUtils
=
{
merge
:
function
(
a
,
b
){
var
c
=
b
instanceof
THREE
.
Mesh
,
g
=
a
.
vertices
.
length
,
e
=
c
?
b
.
geometry
:
b
,
h
=
a
.
vertices
,
f
=
e
.
vertices
,
j
=
a
.
faces
,
k
=
e
.
faces
,
l
=
a
.
faceVertexUvs
[
0
],
e
=
e
.
faceVertexUvs
[
0
];
c
&&
b
.
matrixAutoUpdate
&&
b
.
updateMatrix
();
for
(
var
m
=
0
,
o
=
f
.
length
;
m
<
o
;
m
++
){
var
n
=
new
THREE
.
Vertex
(
f
[
m
].
position
.
clone
());
c
&&
b
.
matrix
.
multiplyVector3
(
n
.
position
);
h
.
push
(
n
)}
m
=
0
;
for
(
o
=
k
.
length
;
m
<
o
;
m
++
){
var
f
=
k
[
m
],
t
,
v
,
y
=
f
.
vertexNormals
,
n
=
f
.
vertexColors
;
f
instanceof
THREE
.
Face3
?
t
=
new
THREE
.
Face3
(
f
.
a
+
g
,
f
.
b
+
g
,
f
.
c
+
g
):
f
instanceof
THREE
.
Face4
&&
(
t
=
new
THREE
.
Face4
(
f
.
a
+
g
,
f
.
b
+
g
,
f
.
c
+
g
,
f
.
d
+
g
));
t
.
normal
.
copy
(
f
.
normal
);
c
=
0
;
for
(
h
=
y
.
length
;
c
<
h
;
c
++
)
v
=
y
[
c
],
t
.
vertexNormals
.
push
(
v
.
clone
());
t
.
color
.
copy
(
f
.
color
);
c
=
0
;
for
(
h
=
n
.
length
;
c
<
h
;
c
++
)
v
=
n
[
c
],
t
.
vertexColors
.
push
(
v
.
clone
());
t
.
materials
=
f
.
materials
.
slice
();
t
.
centroid
.
copy
(
f
.
centroid
);
j
.
push
(
t
)}
m
=
0
;
for
(
o
=
e
.
length
;
m
<
o
;
m
++
){
g
=
e
[
m
];
j
=
[];
c
=
0
;
for
(
h
=
g
.
length
;
c
<
h
;
c
++
)
j
.
push
(
new
THREE
.
UV
(
g
[
c
].
u
,
g
[
c
].
v
));
l
.
push
(
j
)}}};
THREE
.
ImageUtils
=
{
loadTexture
:
function
(
a
,
b
,
c
){
var
g
=
new
Image
,
e
=
new
THREE
.
Texture
(
g
,
b
);
g
.
onload
=
function
(){
e
.
needsUpdate
=!
0
;
c
&&
c
(
this
)};
g
.
crossOrigin
=
""
;
g
.
src
=
a
;
return
e
},
loadTextureCube
:
function
(
a
,
b
,
c
){
var
g
,
e
=
[],
h
=
new
THREE
.
Texture
(
e
,
b
),
b
=
e
.
loadCount
=
0
;
for
(
g
=
a
.
length
;
b
<
g
;
++
b
)
e
[
b
]
=
new
Image
,
e
[
b
].
onload
=
function
(){
e
.
loadCount
+=
1
;
if
(
e
.
loadCount
==
6
)
h
.
needsUpdate
=!
0
;
c
&&
c
(
this
)},
e
[
b
].
crossOrigin
=
""
,
e
[
b
].
src
=
a
[
b
];
return
h
}};
THREE
.
SceneUtils
=
{
showHierarchy
:
function
(
a
,
b
){
THREE
.
SceneUtils
.
traverseHierarchy
(
a
,
function
(
a
){
a
.
visible
=
b
})},
traverseHierarchy
:
function
(
a
,
b
){
var
c
,
g
,
e
=
a
.
children
.
length
;
for
(
g
=
0
;
g
<
e
;
g
++
)
c
=
a
.
children
[
g
],
b
(
c
),
THREE
.
SceneUtils
.
traverseHierarchy
(
c
,
b
)}};
if
(
THREE
.
WebGLRenderer
)
THREE
.
ShaderUtils
=
{
lib
:{
fresnel
:{
uniforms
:{
mRefractionRatio
:{
type
:
"
f
"
,
value
:
1.02
},
mFresnelBias
:{
type
:
"
f
"
,
value
:
0.1
},
mFresnelPower
:{
type
:
"
f
"
,
value
:
2
},
mFresnelScale
:{
type
:
"
f
"
,
value
:
1
},
tCube
:{
type
:
"
t
"
,
value
:
1
,
texture
:
null
}},
fragmentShader
:
"
uniform samplerCube tCube;
\n
varying vec3 vReflect;
\n
varying vec3 vRefract[3];
\n
varying float vReflectionFactor;
\n
void main() {
\n
vec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );
\n
vec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );
\n
refractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;
\n
refractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;
\n
refractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;
\n
refractedColor.a = 1.0;
\n
gl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );
\n
}
"
,
vertexShader
:
"
uniform float mRefractionRatio;
\n
uniform float mFresnelBias;
\n
uniform float mFresnelScale;
\n
uniform float mFresnelPower;
\n
varying vec3 vReflect;
\n
varying vec3 vRefract[3];
\n
varying float vReflectionFactor;
\n
void main() {
\n
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
\n
vec4 mPosition = objectMatrix * vec4( position, 1.0 );
\n
vec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );
\n
vec3 I = mPosition.xyz - cameraPosition;
\n
vReflect = reflect( I, nWorld );
\n
vRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );
\n
vRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );
\n
vRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );
\n
vReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );
\n
gl_Position = projectionMatrix * mvPosition;
\n
}
"
},
...
...
examples/webgl_custom_attributes_particles2.html
浏览文件 @
d31398b2
...
...
@@ -132,7 +132,7 @@
var
geometry2
=
new
THREE
.
CubeGeometry
(
0.8
*
radius
,
0.8
*
radius
,
0.8
*
radius
,
10
,
10
,
10
);
GeometryUtils
.
merge
(
geometry
,
geometry2
);
THREE
.
GeometryUtils
.
merge
(
geometry
,
geometry2
);
sphere
=
new
THREE
.
ParticleSystem
(
geometry
,
shaderMaterial
);
...
...
examples/webgl_geometry_minecraft.html
浏览文件 @
d31398b2
...
...
@@ -144,7 +144,7 @@
mesh
.
position
.
y
=
h
*
100
;
mesh
.
position
.
z
=
z
*
100
-
worldHalfDepth
*
100
;
GeometryUtils
.
merge
(
geometry
,
mesh
);
THREE
.
GeometryUtils
.
merge
(
geometry
,
mesh
);
}
...
...
examples/webgl_geometry_minecraft_ao.html
浏览文件 @
d31398b2
...
...
@@ -431,7 +431,7 @@
mesh
.
position
.
y
=
h
*
100
;
mesh
.
position
.
z
=
z
*
100
-
worldHalfDepth
*
100
;
GeometryUtils
.
merge
(
geometry
,
mesh
);
THREE
.
GeometryUtils
.
merge
(
geometry
,
mesh
);
}
...
...
@@ -521,7 +521,7 @@
canvas
.
width
=
canvas
.
height
=
size
;
var
texture
=
new
THREE
.
Texture
(
canvas
,
new
THREE
.
UVMapping
(),
THREE
.
ClampToEdgeWrapping
,
THREE
.
ClampToEdgeWrapping
,
THREE
.
NearestFilter
,
THREE
.
LinearMipMapLinearFilter
);
function
generateTexture
()
{
if
(
count
==
3
)
{
...
...
@@ -578,7 +578,7 @@
var
texture
=
new
THREE
.
Texture
(
canvas
,
new
THREE
.
UVMapping
(),
THREE
.
ClampToEdgeWrapping
,
THREE
.
ClampToEdgeWrapping
,
THREE
.
NearestFilter
,
THREE
.
LinearMipMapLinearFilter
);
texture
.
needsUpdate
=
true
;
return
new
THREE
.
MeshLambertMaterial
(
{
map
:
texture
}
);
}
...
...
src/extras/GeometryUtils.js
浏览文件 @
d31398b2
var
GeometryUtils
=
{
/**
* @author mrdoob / http://mrdoob.com/
*/
THREE
.
GeometryUtils
=
{
merge
:
function
(
geometry1
,
object2
/* mesh | geometry */
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录