Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
ffe7fb2e
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,发现更多精彩内容 >>
提交
ffe7fb2e
编写于
3月 17, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
08e5e21a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
4 addition
and
4 deletion
+4
-4
build/three.js
build/three.js
+2
-2
build/three.min.js
build/three.min.js
+2
-2
未找到文件。
build/three.js
浏览文件 @
ffe7fb2e
...
...
@@ -31092,14 +31092,14 @@ THREE.LensFlarePlugin = function ( renderer, flares ) {
occlusionTexture = gl.createTexture();
state.bindTexture( gl.TEXTURE_2D, tempTexture );
gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, n
ull
);
gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, n
ew Uint8Array( 16 * 16 * 3 )
);
gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE );
gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE );
gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST );
gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST );
state.bindTexture( gl.TEXTURE_2D, occlusionTexture );
gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, n
ull
);
gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, n
ew Uint8Array( 16 * 16 * 4 )
);
gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE );
gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE );
gl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST );
...
...
build/three.min.js
浏览文件 @
ffe7fb2e
...
...
@@ -734,8 +734,8 @@ function(b){B!==b&&(a.stencilMask(b),B=b)};this.setFlipSided=function(b){K!==b&&
function
(
b
){
void
0
===
b
&&
(
b
=
a
.
TEXTURE0
+
O
-
1
);
Q
!==
b
&&
(
a
.
activeTexture
(
b
),
Q
=
b
)};
this
.
bindTexture
=
function
(
b
,
c
){
void
0
===
Q
&&
d
.
activeTexture
();
var
e
=
P
[
Q
];
void
0
===
e
&&
(
e
=
{
type
:
void
0
,
texture
:
void
0
},
P
[
Q
]
=
e
);
if
(
e
.
type
!==
b
||
e
.
texture
!==
c
)
a
.
bindTexture
(
b
,
c
||
Z
),
e
.
type
=
b
,
e
.
texture
=
c
};
this
.
compressedTexImage2D
=
function
(){
try
{
a
.
compressedTexImage2D
.
apply
(
a
,
arguments
)}
catch
(
b
){
console
.
error
(
b
)}};
this
.
texImage2D
=
function
(){
try
{
a
.
texImage2D
.
apply
(
a
,
arguments
)}
catch
(
b
){
console
.
error
(
b
)}};
this
.
clearColor
=
function
(
b
,
c
,
d
,
f
){
e
.
set
(
b
,
c
,
d
,
f
);
!
1
===
T
.
equals
(
e
)
&&
(
a
.
clearColor
(
b
,
c
,
d
,
f
),
T
.
copy
(
e
))};
this
.
clearDepth
=
function
(
b
){
M
!==
b
&&
(
a
.
clearDepth
(
b
),
M
=
b
)};
this
.
clearStencil
=
function
(
b
){
D
!==
b
&&
(
a
.
clearStencil
(
b
),
D
=
b
)};
this
.
scissor
=
function
(
b
){
!
1
===
W
.
equals
(
b
)
&&
(
a
.
scissor
(
b
.
x
,
b
.
y
,
b
.
z
,
b
.
w
),
W
.
copy
(
b
))};
this
.
viewport
=
function
(
b
){
!
1
===
S
.
equals
(
b
)
&&
(
a
.
viewport
(
b
.
x
,
b
.
y
,
b
.
z
,
b
.
w
),
S
.
copy
(
b
))};
this
.
reset
=
function
(){
for
(
var
b
=
0
;
b
<
g
.
length
;
b
++
)
1
===
g
[
b
]
&&
(
a
.
disableVertexAttribArray
(
b
),
g
[
b
]
=
0
);
k
=
{};
l
=
null
;
Q
=
void
0
;
P
=
{};
K
=
B
=
C
=
x
=
n
=
null
}};
THREE
.
LensFlarePlugin
=
function
(
a
,
b
){
var
c
,
d
,
e
,
f
,
g
,
h
,
k
,
l
,
n
,
p
,
m
=
a
.
context
,
q
=
a
.
state
,
u
,
v
,
t
,
s
,
w
,
C
;
this
.
render
=
function
(
x
,
B
,
A
){
if
(
0
!==
b
.
length
){
x
=
new
THREE
.
Vector3
;
var
z
=
A
.
w
/
A
.
z
,
y
=
.
5
*
A
.
z
,
F
=
.
5
*
A
.
w
,
E
=
16
/
A
.
w
,
H
=
new
THREE
.
Vector2
(
E
*
z
,
E
),
K
=
new
THREE
.
Vector3
(
1
,
1
,
0
),
G
=
new
THREE
.
Vector2
(
1
,
1
);
if
(
void
0
===
t
){
var
E
=
new
Float32Array
([
-
1
,
-
1
,
0
,
0
,
1
,
-
1
,
1
,
0
,
1
,
1
,
1
,
1
,
-
1
,
1
,
0
,
1
]),
N
=
new
Uint16Array
([
0
,
1
,
2
,
0
,
2
,
3
]);
u
=
m
.
createBuffer
();
v
=
m
.
createBuffer
();
m
.
bindBuffer
(
m
.
ARRAY_BUFFER
,
u
);
m
.
bufferData
(
m
.
ARRAY_BUFFER
,
E
,
m
.
STATIC_DRAW
);
m
.
bindBuffer
(
m
.
ELEMENT_ARRAY_BUFFER
,
v
);
m
.
bufferData
(
m
.
ELEMENT_ARRAY_BUFFER
,
N
,
m
.
STATIC_DRAW
);
w
=
m
.
createTexture
();
C
=
m
.
createTexture
();
q
.
bindTexture
(
m
.
TEXTURE_2D
,
w
);
m
.
texImage2D
(
m
.
TEXTURE_2D
,
0
,
m
.
RGB
,
16
,
16
,
0
,
m
.
RGB
,
m
.
UNSIGNED_BYTE
,
n
ull
);
m
.
texParameteri
(
m
.
TEXTURE_2D
,
m
.
TEXTURE_WRAP_S
,
m
.
CLAMP_TO_EDGE
);
m
.
texParameteri
(
m
.
TEXTURE_2D
,
m
.
TEXTURE_WRAP_T
,
m
.
CLAMP_TO_EDGE
);
m
.
texParameteri
(
m
.
TEXTURE_2D
,
m
.
TEXTURE_MAG_FILTER
,
m
.
NEAREST
);
m
.
texParameteri
(
m
.
TEXTURE_2D
,
m
.
TEXTURE_MIN_FILTER
,
m
.
NEAREST
);
q
.
bindTexture
(
m
.
TEXTURE_2D
,
C
);
m
.
texImage2D
(
m
.
TEXTURE_2D
,
0
,
m
.
RGBA
,
16
,
16
,
0
,
m
.
RGBA
,
m
.
UNSIGNED_BYTE
,
n
ull
);
m
.
texParameteri
(
m
.
TEXTURE_2D
,
m
.
TEXTURE_WRAP_S
,
m
.
CLAMP_TO_EDGE
);
m
.
texParameteri
(
m
.
TEXTURE_2D
,
m
.
TEXTURE_WRAP_T
,
m
.
CLAMP_TO_EDGE
);
m
.
texParameteri
(
m
.
TEXTURE_2D
,
m
.
TEXTURE_MAG_FILTER
,
m
.
NEAREST
);
m
.
texParameteri
(
m
.
TEXTURE_2D
,
m
.
TEXTURE_MIN_FILTER
,
m
.
NEAREST
);
var
E
=
(
s
=
0
<
m
.
getParameter
(
m
.
MAX_VERTEX_TEXTURE_IMAGE_UNITS
))?{
vertexShader
:
"
uniform lowp int renderType;
\n
uniform vec3 screenPosition;
\n
uniform vec2 scale;
\n
uniform float rotation;
\n
uniform sampler2D occlusionMap;
\n
attribute vec2 position;
\n
attribute vec2 uv;
\n
varying vec2 vUV;
\n
varying float vVisibility;
\n
void main() {
\n
vUV = uv;
\n
vec2 pos = position;
\n
if ( renderType == 2 ) {
\n
vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );
\n
visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );
\n
visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );
\n
visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );
\n
visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );
\n
visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );
\n
visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );
\n
visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );
\n
visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );
\n
vVisibility = visibility.r / 9.0;
\n
vVisibility *= 1.0 - visibility.g / 9.0;
\n
vVisibility *= visibility.b / 9.0;
\n
vVisibility *= 1.0 - visibility.a / 9.0;
\n
pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;
\n
pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;
\n
}
\n
gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );
\n
}
"
,
m
.
bindBuffer
(
m
.
ELEMENT_ARRAY_BUFFER
,
v
);
m
.
bufferData
(
m
.
ELEMENT_ARRAY_BUFFER
,
N
,
m
.
STATIC_DRAW
);
w
=
m
.
createTexture
();
C
=
m
.
createTexture
();
q
.
bindTexture
(
m
.
TEXTURE_2D
,
w
);
m
.
texImage2D
(
m
.
TEXTURE_2D
,
0
,
m
.
RGB
,
16
,
16
,
0
,
m
.
RGB
,
m
.
UNSIGNED_BYTE
,
n
ew
Uint8Array
(
768
)
);
m
.
texParameteri
(
m
.
TEXTURE_2D
,
m
.
TEXTURE_WRAP_S
,
m
.
CLAMP_TO_EDGE
);
m
.
texParameteri
(
m
.
TEXTURE_2D
,
m
.
TEXTURE_WRAP_T
,
m
.
CLAMP_TO_EDGE
);
m
.
texParameteri
(
m
.
TEXTURE_2D
,
m
.
TEXTURE_MAG_FILTER
,
m
.
NEAREST
);
m
.
texParameteri
(
m
.
TEXTURE_2D
,
m
.
TEXTURE_MIN_FILTER
,
m
.
NEAREST
);
q
.
bindTexture
(
m
.
TEXTURE_2D
,
C
);
m
.
texImage2D
(
m
.
TEXTURE_2D
,
0
,
m
.
RGBA
,
16
,
16
,
0
,
m
.
RGBA
,
m
.
UNSIGNED_BYTE
,
n
ew
Uint8Array
(
1024
)
);
m
.
texParameteri
(
m
.
TEXTURE_2D
,
m
.
TEXTURE_WRAP_S
,
m
.
CLAMP_TO_EDGE
);
m
.
texParameteri
(
m
.
TEXTURE_2D
,
m
.
TEXTURE_WRAP_T
,
m
.
CLAMP_TO_EDGE
);
m
.
texParameteri
(
m
.
TEXTURE_2D
,
m
.
TEXTURE_MAG_FILTER
,
m
.
NEAREST
);
m
.
texParameteri
(
m
.
TEXTURE_2D
,
m
.
TEXTURE_MIN_FILTER
,
m
.
NEAREST
);
var
E
=
(
s
=
0
<
m
.
getParameter
(
m
.
MAX_VERTEX_TEXTURE_IMAGE_UNITS
))?{
vertexShader
:
"
uniform lowp int renderType;
\n
uniform vec3 screenPosition;
\n
uniform vec2 scale;
\n
uniform float rotation;
\n
uniform sampler2D occlusionMap;
\n
attribute vec2 position;
\n
attribute vec2 uv;
\n
varying vec2 vUV;
\n
varying float vVisibility;
\n
void main() {
\n
vUV = uv;
\n
vec2 pos = position;
\n
if ( renderType == 2 ) {
\n
vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );
\n
visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );
\n
visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );
\n
visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );
\n
visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );
\n
visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );
\n
visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );
\n
visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );
\n
visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );
\n
vVisibility = visibility.r / 9.0;
\n
vVisibility *= 1.0 - visibility.g / 9.0;
\n
vVisibility *= visibility.b / 9.0;
\n
vVisibility *= 1.0 - visibility.a / 9.0;
\n
pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;
\n
pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;
\n
}
\n
gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );
\n
}
"
,
fragmentShader
:
"
uniform lowp int renderType;
\n
uniform sampler2D map;
\n
uniform float opacity;
\n
uniform vec3 color;
\n
varying vec2 vUV;
\n
varying float vVisibility;
\n
void main() {
\n
if ( renderType == 0 ) {
\n
gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );
\n
} else if ( renderType == 1 ) {
\n
gl_FragColor = texture2D( map, vUV );
\n
} else {
\n
vec4 texture = texture2D( map, vUV );
\n
texture.a *= opacity * vVisibility;
\n
gl_FragColor = texture;
\n
gl_FragColor.rgb *= color;
\n
}
\n
}
"
}:{
vertexShader
:
"
uniform lowp int renderType;
\n
uniform vec3 screenPosition;
\n
uniform vec2 scale;
\n
uniform float rotation;
\n
attribute vec2 position;
\n
attribute vec2 uv;
\n
varying vec2 vUV;
\n
void main() {
\n
vUV = uv;
\n
vec2 pos = position;
\n
if ( renderType == 2 ) {
\n
pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;
\n
pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;
\n
}
\n
gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );
\n
}
"
,
fragmentShader
:
"
precision mediump float;
\n
uniform lowp int renderType;
\n
uniform sampler2D map;
\n
uniform sampler2D occlusionMap;
\n
uniform float opacity;
\n
uniform vec3 color;
\n
varying vec2 vUV;
\n
void main() {
\n
if ( renderType == 0 ) {
\n
gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );
\n
} else if ( renderType == 1 ) {
\n
gl_FragColor = texture2D( map, vUV );
\n
} else {
\n
float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;
\n
visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;
\n
visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;
\n
visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;
\n
visibility = ( 1.0 - visibility / 4.0 );
\n
vec4 texture = texture2D( map, vUV );
\n
texture.a *= opacity * visibility;
\n
gl_FragColor = texture;
\n
gl_FragColor.rgb *= color;
\n
}
\n
}
"
},
N
=
m
.
createProgram
(),
L
=
m
.
createShader
(
m
.
FRAGMENT_SHADER
),
I
=
m
.
createShader
(
m
.
VERTEX_SHADER
),
O
=
"
precision
"
+
a
.
getPrecision
()
+
"
float;
\n
"
;
m
.
shaderSource
(
L
,
O
+
E
.
fragmentShader
);
m
.
shaderSource
(
I
,
O
+
E
.
vertexShader
);
m
.
compileShader
(
L
);
m
.
compileShader
(
I
);
m
.
attachShader
(
N
,
L
);
m
.
attachShader
(
N
,
I
);
m
.
linkProgram
(
N
);
t
=
N
;
n
=
m
.
getAttribLocation
(
t
,
"
position
"
);
p
=
m
.
getAttribLocation
(
t
,
"
uv
"
);
c
=
m
.
getUniformLocation
(
t
,
"
renderType
"
);
d
=
m
.
getUniformLocation
(
t
,
"
map
"
);
e
=
m
.
getUniformLocation
(
t
,
"
occlusionMap
"
);
f
=
m
.
getUniformLocation
(
t
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录