Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
2a8a3fae
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,发现更多精彩内容 >>
未验证
提交
2a8a3fae
编写于
2月 22, 2019
作者:
M
Michael Herzog
提交者:
GitHub
2月 22, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15818 from Mugen87/dev27
Examples: Clean up
上级
4f09863a
a369b3c2
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
46 addition
and
43 deletion
+46
-43
examples/js/postprocessing/AdaptiveToneMappingPass.js
examples/js/postprocessing/AdaptiveToneMappingPass.js
+23
-23
examples/js/postprocessing/AfterimagePass.js
examples/js/postprocessing/AfterimagePass.js
+2
-2
examples/js/postprocessing/BloomPass.js
examples/js/postprocessing/BloomPass.js
+2
-2
examples/js/postprocessing/BokehPass.js
examples/js/postprocessing/BokehPass.js
+1
-1
examples/js/postprocessing/DotScreenPass.js
examples/js/postprocessing/DotScreenPass.js
+1
-1
examples/js/postprocessing/FilmPass.js
examples/js/postprocessing/FilmPass.js
+1
-1
examples/js/postprocessing/GlitchPass.js
examples/js/postprocessing/GlitchPass.js
+3
-3
examples/js/postprocessing/HalftonePass.js
examples/js/postprocessing/HalftonePass.js
+3
-3
examples/js/postprocessing/MaskPass.js
examples/js/postprocessing/MaskPass.js
+1
-1
examples/js/postprocessing/RenderPass.js
examples/js/postprocessing/RenderPass.js
+1
-0
examples/js/postprocessing/SAOPass.js
examples/js/postprocessing/SAOPass.js
+1
-1
examples/js/postprocessing/SMAAPass.js
examples/js/postprocessing/SMAAPass.js
+3
-1
examples/js/postprocessing/SSAARenderPass.js
examples/js/postprocessing/SSAARenderPass.js
+1
-1
examples/js/postprocessing/ShaderPass.js
examples/js/postprocessing/ShaderPass.js
+1
-1
examples/js/postprocessing/TAARenderPass.js
examples/js/postprocessing/TAARenderPass.js
+1
-1
examples/js/postprocessing/TexturePass.js
examples/js/postprocessing/TexturePass.js
+1
-1
examples/textures/tri_pattern.jpg
examples/textures/tri_pattern.jpg
+0
-0
未找到文件。
examples/js/postprocessing/AdaptiveToneMappingPass.js
浏览文件 @
2a8a3fae
...
...
@@ -49,7 +49,7 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
this
.
adaptLuminanceShader
=
{
defines
:
{
"
MIP_LEVEL_1X1
"
:
(
Math
.
log
(
this
.
resolution
)
/
Math
.
log
(
2.0
)
).
toFixed
(
1
)
"
MIP_LEVEL_1X1
"
:
(
Math
.
log
(
this
.
resolution
)
/
Math
.
log
(
2.0
)
).
toFixed
(
1
)
},
uniforms
:
{
"
lastLum
"
:
{
value
:
null
},
...
...
@@ -63,8 +63,8 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
"
void main() {
"
,
"
vUv = uv;
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
"
vUv = uv;
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
"
}
"
].
join
(
'
\n
'
),
...
...
@@ -79,20 +79,20 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
"
void main() {
"
,
"
vec4 lastLum = texture2D( lastLum, vUv, MIP_LEVEL_1X1 );
"
,
"
vec4 currentLum = texture2D( currentLum, vUv, MIP_LEVEL_1X1 );
"
,
"
vec4 lastLum = texture2D( lastLum, vUv, MIP_LEVEL_1X1 );
"
,
"
vec4 currentLum = texture2D( currentLum, vUv, MIP_LEVEL_1X1 );
"
,
"
float fLastLum = max( minLuminance, lastLum.r );
"
,
"
float fCurrentLum = max( minLuminance, currentLum.r );
"
,
"
float fLastLum = max( minLuminance, lastLum.r );
"
,
"
float fCurrentLum = max( minLuminance, currentLum.r );
"
,
//The adaption seems to work better in extreme lighting differences
//if the input luminance is squared.
"
fCurrentLum *= fCurrentLum;
"
,
//The adaption seems to work better in extreme lighting differences
//if the input luminance is squared.
"
fCurrentLum *= fCurrentLum;
"
,
// Adapt the luminance using Pattanaik's technique
"
float fAdaptedLum = fLastLum + (fCurrentLum - fLastLum) * (1.0 - exp(-delta * tau));
"
,
// "fAdaptedLum = sqrt(fAdaptedLum);",
"
gl_FragColor.r = fAdaptedLum;
"
,
// Adapt the luminance using Pattanaik's technique
"
float fAdaptedLum = fLastLum + (fCurrentLum - fLastLum) * (1.0 - exp(-delta * tau));
"
,
// "fAdaptedLum = sqrt(fAdaptedLum);",
"
gl_FragColor.r = fAdaptedLum;
"
,
"
}
"
].
join
(
'
\n
'
)
};
...
...
@@ -118,7 +118,7 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
}
);
this
.
camera
=
new
THREE
.
OrthographicCamera
(
-
1
,
1
,
1
,
-
1
,
0
,
1
);
this
.
scene
=
new
THREE
.
Scene
();
this
.
scene
=
new
THREE
.
Scene
();
this
.
quad
=
new
THREE
.
Mesh
(
new
THREE
.
PlaneBufferGeometry
(
2
,
2
),
null
);
this
.
quad
.
frustumCulled
=
false
;
// Avoid getting clipped
...
...
@@ -188,7 +188,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
},
reset
:
function
(
renderer
)
{
reset
:
function
(
renderer
)
{
// render targets
if
(
this
.
luminanceRT
)
{
...
...
@@ -240,7 +240,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
},
setAdaptive
:
function
(
adaptive
)
{
setAdaptive
:
function
(
adaptive
)
{
if
(
adaptive
)
{
...
...
@@ -259,7 +259,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
},
setAdaptionRate
:
function
(
rate
)
{
setAdaptionRate
:
function
(
rate
)
{
if
(
rate
)
{
...
...
@@ -269,7 +269,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
},
setMinLuminance
:
function
(
minLum
)
{
setMinLuminance
:
function
(
minLum
)
{
if
(
minLum
)
{
...
...
@@ -280,7 +280,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
},
setMaxLuminance
:
function
(
maxLum
)
{
setMaxLuminance
:
function
(
maxLum
)
{
if
(
maxLum
)
{
...
...
@@ -290,7 +290,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
},
setAverageLuminance
:
function
(
avgLum
)
{
setAverageLuminance
:
function
(
avgLum
)
{
if
(
avgLum
)
{
...
...
@@ -300,7 +300,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
},
setMiddleGrey
:
function
(
middleGrey
)
{
setMiddleGrey
:
function
(
middleGrey
)
{
if
(
middleGrey
)
{
...
...
@@ -310,7 +310,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
},
dispose
:
function
()
{
dispose
:
function
()
{
if
(
this
.
luminanceRT
)
{
...
...
examples/js/postprocessing/AfterimagePass.js
浏览文件 @
2a8a3fae
...
...
@@ -42,7 +42,7 @@ THREE.AfterimagePass = function ( damp ) {
this
.
sceneComp
=
new
THREE
.
Scene
();
this
.
scene
=
new
THREE
.
Scene
();
this
.
camera
=
new
THREE
.
OrthographicCamera
(
-
1
,
1
,
1
,
-
1
,
0
,
1
);
this
.
camera
=
new
THREE
.
OrthographicCamera
(
-
1
,
1
,
1
,
-
1
,
0
,
1
);
this
.
camera
.
position
.
z
=
1
;
var
geometry
=
new
THREE
.
PlaneBufferGeometry
(
2
,
2
);
...
...
@@ -50,7 +50,7 @@ THREE.AfterimagePass = function ( damp ) {
this
.
quadComp
=
new
THREE
.
Mesh
(
geometry
,
this
.
shaderMaterial
);
this
.
sceneComp
.
add
(
this
.
quadComp
);
var
material
=
new
THREE
.
MeshBasicMaterial
(
{
var
material
=
new
THREE
.
MeshBasicMaterial
(
{
map
:
this
.
textureComp
.
texture
}
);
...
...
examples/js/postprocessing/BloomPass.js
浏览文件 @
2a8a3fae
...
...
@@ -56,7 +56,7 @@ THREE.BloomPass = function ( strength, kernelSize, sigma, resolution ) {
this
.
materialConvolution
=
new
THREE
.
ShaderMaterial
(
{
uniforms
:
this
.
convolutionUniforms
,
vertexShader
:
convolutionShader
.
vertexShader
,
vertexShader
:
convolutionShader
.
vertexShader
,
fragmentShader
:
convolutionShader
.
fragmentShader
,
defines
:
{
"
KERNEL_SIZE_FLOAT
"
:
kernelSize
.
toFixed
(
1
),
...
...
@@ -68,7 +68,7 @@ THREE.BloomPass = function ( strength, kernelSize, sigma, resolution ) {
this
.
needsSwap
=
false
;
this
.
camera
=
new
THREE
.
OrthographicCamera
(
-
1
,
1
,
1
,
-
1
,
0
,
1
);
this
.
scene
=
new
THREE
.
Scene
();
this
.
scene
=
new
THREE
.
Scene
();
this
.
quad
=
new
THREE
.
Mesh
(
new
THREE
.
PlaneBufferGeometry
(
2
,
2
),
null
);
this
.
quad
.
frustumCulled
=
false
;
// Avoid getting clipped
...
...
examples/js/postprocessing/BokehPass.js
浏览文件 @
2a8a3fae
...
...
@@ -67,7 +67,7 @@ THREE.BokehPass = function ( scene, camera, params ) {
this
.
needsSwap
=
false
;
this
.
camera2
=
new
THREE
.
OrthographicCamera
(
-
1
,
1
,
1
,
-
1
,
0
,
1
);
this
.
scene2
=
new
THREE
.
Scene
();
this
.
scene2
=
new
THREE
.
Scene
();
this
.
quad2
=
new
THREE
.
Mesh
(
new
THREE
.
PlaneBufferGeometry
(
2
,
2
),
null
);
this
.
quad2
.
frustumCulled
=
false
;
// Avoid getting clipped
...
...
examples/js/postprocessing/DotScreenPass.js
浏览文件 @
2a8a3fae
...
...
@@ -26,7 +26,7 @@ THREE.DotScreenPass = function ( center, angle, scale ) {
}
);
this
.
camera
=
new
THREE
.
OrthographicCamera
(
-
1
,
1
,
1
,
-
1
,
0
,
1
);
this
.
scene
=
new
THREE
.
Scene
();
this
.
scene
=
new
THREE
.
Scene
();
this
.
quad
=
new
THREE
.
Mesh
(
new
THREE
.
PlaneBufferGeometry
(
2
,
2
),
null
);
this
.
quad
.
frustumCulled
=
false
;
// Avoid getting clipped
...
...
examples/js/postprocessing/FilmPass.js
浏览文件 @
2a8a3fae
...
...
@@ -27,7 +27,7 @@ THREE.FilmPass = function ( noiseIntensity, scanlinesIntensity, scanlinesCount,
if
(
scanlinesCount
!==
undefined
)
this
.
uniforms
.
sCount
.
value
=
scanlinesCount
;
this
.
camera
=
new
THREE
.
OrthographicCamera
(
-
1
,
1
,
1
,
-
1
,
0
,
1
);
this
.
scene
=
new
THREE
.
Scene
();
this
.
scene
=
new
THREE
.
Scene
();
this
.
quad
=
new
THREE
.
Mesh
(
new
THREE
.
PlaneBufferGeometry
(
2
,
2
),
null
);
this
.
quad
.
frustumCulled
=
false
;
// Avoid getting clipped
...
...
examples/js/postprocessing/GlitchPass.js
浏览文件 @
2a8a3fae
...
...
@@ -24,7 +24,7 @@ THREE.GlitchPass = function ( dt_size ) {
}
);
this
.
camera
=
new
THREE
.
OrthographicCamera
(
-
1
,
1
,
1
,
-
1
,
0
,
1
);
this
.
scene
=
new
THREE
.
Scene
();
this
.
scene
=
new
THREE
.
Scene
();
this
.
quad
=
new
THREE
.
Mesh
(
new
THREE
.
PlaneBufferGeometry
(
2
,
2
),
null
);
this
.
quad
.
frustumCulled
=
false
;
// Avoid getting clipped
...
...
@@ -90,13 +90,13 @@ THREE.GlitchPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
},
generateTrigger
:
function
()
{
generateTrigger
:
function
()
{
this
.
randX
=
THREE
.
Math
.
randInt
(
120
,
240
);
},
generateHeightmap
:
function
(
dt_size
)
{
generateHeightmap
:
function
(
dt_size
)
{
var
data_arr
=
new
Float32Array
(
dt_size
*
dt_size
*
3
);
var
length
=
dt_size
*
dt_size
;
...
...
examples/js/postprocessing/HalftonePass.js
浏览文件 @
2a8a3fae
...
...
@@ -30,7 +30,7 @@ THREE.HalftonePass = function ( width, height, params ) {
if
(
params
.
hasOwnProperty
(
key
)
&&
this
.
uniforms
.
hasOwnProperty
(
key
)
)
{
this
.
uniforms
[
key
].
value
=
params
[
key
];
this
.
uniforms
[
key
].
value
=
params
[
key
];
}
...
...
@@ -42,9 +42,9 @@ THREE.HalftonePass = function ( width, height, params ) {
this
.
quad
.
frustumCulled
=
false
;
this
.
scene
.
add
(
this
.
quad
);
};
};
THREE
.
HalftonePass
.
prototype
=
Object
.
assign
(
Object
.
create
(
THREE
.
Pass
.
prototype
),
{
THREE
.
HalftonePass
.
prototype
=
Object
.
assign
(
Object
.
create
(
THREE
.
Pass
.
prototype
),
{
constructor
:
THREE
.
HalftonePass
,
...
...
examples/js/postprocessing/MaskPass.js
浏览文件 @
2a8a3fae
...
...
@@ -73,7 +73,7 @@ THREE.MaskPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ),
// only render where stencil is set to 1
state
.
buffers
.
stencil
.
setFunc
(
context
.
EQUAL
,
1
,
0xffffffff
);
// draw if == 1
state
.
buffers
.
stencil
.
setFunc
(
context
.
EQUAL
,
1
,
0xffffffff
);
// draw if == 1
state
.
buffers
.
stencil
.
setOp
(
context
.
KEEP
,
context
.
KEEP
,
context
.
KEEP
);
}
...
...
examples/js/postprocessing/RenderPass.js
浏览文件 @
2a8a3fae
...
...
@@ -60,6 +60,7 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
this
.
scene
.
overrideMaterial
=
null
;
renderer
.
autoClear
=
oldAutoClear
;
}
}
);
examples/js/postprocessing/SAOPass.js
浏览文件 @
2a8a3fae
...
...
@@ -319,7 +319,7 @@ THREE.SAOPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ),
var
originalClearAlpha
=
renderer
.
getClearAlpha
();
var
originalAutoClear
=
renderer
.
autoClear
;
renderer
.
setRenderTarget
(
renderTarget
);
renderer
.
setRenderTarget
(
renderTarget
);
// setup pass state
renderer
.
autoClear
=
false
;
...
...
examples/js/postprocessing/SMAAPass.js
浏览文件 @
2a8a3fae
...
...
@@ -31,9 +31,11 @@ THREE.SMAAPass = function ( width, height ) {
var
areaTextureImage
=
new
Image
();
areaTextureImage
.
src
=
this
.
getAreaTexture
();
areaTextureImage
.
onload
=
function
()
{
areaTextureImage
.
onload
=
function
()
{
// assigning data to HTMLImageElement.src is asynchronous (see #15162)
scope
.
areaTexture
.
needsUpdate
=
true
;
};
this
.
areaTexture
=
new
THREE
.
Texture
();
...
...
examples/js/postprocessing/SSAARenderPass.js
浏览文件 @
2a8a3fae
...
...
@@ -100,7 +100,7 @@ THREE.SSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.protot
if
(
this
.
camera
.
setViewOffset
)
{
this
.
camera
.
setViewOffset
(
width
,
height
,
jitterOffset
[
0
]
*
0.0625
,
jitterOffset
[
1
]
*
0.0625
,
// 0.0625 = 1 / 16
jitterOffset
[
0
]
*
0.0625
,
jitterOffset
[
1
]
*
0.0625
,
// 0.0625 = 1 / 16
width
,
height
);
}
...
...
examples/js/postprocessing/ShaderPass.js
浏览文件 @
2a8a3fae
...
...
@@ -42,7 +42,7 @@ THREE.ShaderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
constructor
:
THREE
.
ShaderPass
,
render
:
function
(
renderer
,
writeBuffer
,
readBuffer
,
deltaTime
,
maskActive
)
{
render
:
function
(
renderer
,
writeBuffer
,
readBuffer
,
deltaTime
,
maskActive
)
{
if
(
this
.
uniforms
[
this
.
textureID
]
)
{
...
...
examples/js/postprocessing/TAARenderPass.js
浏览文件 @
2a8a3fae
...
...
@@ -88,7 +88,7 @@ THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.SSAARenderPa
if
(
this
.
camera
.
setViewOffset
)
{
this
.
camera
.
setViewOffset
(
readBuffer
.
width
,
readBuffer
.
height
,
jitterOffset
[
0
]
*
0.0625
,
jitterOffset
[
1
]
*
0.0625
,
// 0.0625 = 1 / 16
jitterOffset
[
0
]
*
0.0625
,
jitterOffset
[
1
]
*
0.0625
,
// 0.0625 = 1 / 16
readBuffer
.
width
,
readBuffer
.
height
);
}
...
...
examples/js/postprocessing/TexturePass.js
浏览文件 @
2a8a3fae
...
...
@@ -29,7 +29,7 @@ THREE.TexturePass = function ( map, opacity ) {
this
.
needsSwap
=
false
;
this
.
camera
=
new
THREE
.
OrthographicCamera
(
-
1
,
1
,
1
,
-
1
,
0
,
1
);
this
.
scene
=
new
THREE
.
Scene
();
this
.
scene
=
new
THREE
.
Scene
();
this
.
quad
=
new
THREE
.
Mesh
(
new
THREE
.
PlaneBufferGeometry
(
2
,
2
),
null
);
this
.
quad
.
frustumCulled
=
false
;
// Avoid getting clipped
...
...
examples/textures/tri_pattern.jpg
查看替换文件 @
4f09863a
浏览文件 @
2a8a3fae
19.8 KB
|
W:
|
H:
64.4 KB
|
W:
|
H:
2-up
Swipe
Onion skin
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录