Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
b686968c
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,发现更多精彩内容 >>
未验证
提交
b686968c
编写于
12月 09, 2019
作者:
M
Mr.doob
提交者:
GitHub
12月 09, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18108 from Mugen87/dev29
WebGLRenderer: Remove gammaInput.
上级
2fb36e6f
ecd7443d
变更
56
隐藏空白更改
内联
并排
Showing
56 changed file
with
84 addition
and
356 deletion
+84
-356
docs/api/en/renderers/WebGLRenderer.html
docs/api/en/renderers/WebGLRenderer.html
+0
-5
docs/api/zh/renderers/WebGLRenderer.html
docs/api/zh/renderers/WebGLRenderer.html
+0
-5
editor/js/libs/tern-threejs/threejs.js
editor/js/libs/tern-threejs/threejs.js
+0
-4
examples/js/misc/MD2Character.js
examples/js/misc/MD2Character.js
+1
-0
examples/js/misc/MD2CharacterComplex.js
examples/js/misc/MD2CharacterComplex.js
+1
-0
examples/jsm/misc/MD2Character.js
examples/jsm/misc/MD2Character.js
+3
-1
examples/jsm/misc/MD2CharacterComplex.js
examples/jsm/misc/MD2CharacterComplex.js
+3
-1
examples/jsm/nodes/core/NodeBuilder.js
examples/jsm/nodes/core/NodeBuilder.js
+2
-2
examples/misc_exporter_collada.html
examples/misc_exporter_collada.html
+2
-1
examples/webgl_animation_cloth.html
examples/webgl_animation_cloth.html
+1
-1
examples/webgl_buffergeometry.html
examples/webgl_buffergeometry.html
+0
-2
examples/webgl_buffergeometry_drawrange.html
examples/webgl_buffergeometry_drawrange.html
+0
-2
examples/webgl_buffergeometry_lines.html
examples/webgl_buffergeometry_lines.html
+0
-2
examples/webgl_buffergeometry_lines_indexed.html
examples/webgl_buffergeometry_lines_indexed.html
+0
-2
examples/webgl_buffergeometry_uint.html
examples/webgl_buffergeometry_uint.html
+0
-2
examples/webgl_geometry_teapot.html
examples/webgl_geometry_teapot.html
+2
-1
examples/webgl_lensflares.html
examples/webgl_lensflares.html
+1
-5
examples/webgl_lightningstrike.html
examples/webgl_lightningstrike.html
+1
-2
examples/webgl_lights_hemisphere.html
examples/webgl_lights_hemisphere.html
+0
-3
examples/webgl_lights_physical.html
examples/webgl_lights_physical.html
+4
-1
examples/webgl_lights_pointlights2.html
examples/webgl_lights_pointlights2.html
+1
-2
examples/webgl_lights_rectarealight.html
examples/webgl_lights_rectarealight.html
+0
-1
examples/webgl_lights_spotlight.html
examples/webgl_lights_spotlight.html
+0
-2
examples/webgl_lights_spotlights.html
examples/webgl_lights_spotlights.html
+0
-2
examples/webgl_loader_ctm.html
examples/webgl_loader_ctm.html
+0
-235
examples/webgl_loader_draco.html
examples/webgl_loader_draco.html
+0
-1
examples/webgl_loader_md2.html
examples/webgl_loader_md2.html
+1
-1
examples/webgl_loader_md2_control.html
examples/webgl_loader_md2_control.html
+1
-2
examples/webgl_loader_ply.html
examples/webgl_loader_ply.html
+0
-2
examples/webgl_loader_stl.html
examples/webgl_loader_stl.html
+0
-2
examples/webgl_materials_bumpmap.html
examples/webgl_materials_bumpmap.html
+0
-4
examples/webgl_materials_displacementmap.html
examples/webgl_materials_displacementmap.html
+1
-2
examples/webgl_materials_envmaps_exr.html
examples/webgl_materials_envmaps_exr.html
+0
-1
examples/webgl_materials_envmaps_hdr_nodes.html
examples/webgl_materials_envmaps_hdr_nodes.html
+1
-2
examples/webgl_materials_envmaps_pmrem_nodes.html
examples/webgl_materials_envmaps_pmrem_nodes.html
+0
-1
examples/webgl_materials_lightmap.html
examples/webgl_materials_lightmap.html
+0
-2
examples/webgl_materials_normalmap.html
examples/webgl_materials_normalmap.html
+11
-7
examples/webgl_materials_parallaxmap.html
examples/webgl_materials_parallaxmap.html
+0
-2
examples/webgl_materials_standard.html
examples/webgl_materials_standard.html
+3
-2
examples/webgl_materials_translucency.html
examples/webgl_materials_translucency.html
+0
-2
examples/webgl_materials_variations_basic.html
examples/webgl_materials_variations_basic.html
+2
-2
examples/webgl_materials_variations_lambert.html
examples/webgl_materials_variations_lambert.html
+2
-2
examples/webgl_materials_variations_phong.html
examples/webgl_materials_variations_phong.html
+2
-2
examples/webgl_materials_variations_toon.html
examples/webgl_materials_variations_toon.html
+2
-2
examples/webgl_performance_doublesided.html
examples/webgl_performance_doublesided.html
+1
-2
examples/webgl_postprocessing_advanced.html
examples/webgl_postprocessing_advanced.html
+8
-6
examples/webgl_shaders_tonemapping.html
examples/webgl_shaders_tonemapping.html
+5
-2
examples/webgl_shading_physical.html
examples/webgl_shading_physical.html
+4
-5
examples/webgl_shadowmap_pcss.html
examples/webgl_shadowmap_pcss.html
+0
-2
examples/webxr_vr_dragging.html
examples/webxr_vr_dragging.html
+0
-1
examples/webxr_vr_paint.html
examples/webxr_vr_paint.html
+0
-1
examples/webxr_vr_sculpt.html
examples/webxr_vr_sculpt.html
+0
-1
src/Three.Legacy.js
src/Three.Legacy.js
+13
-0
src/renderers/WebGLRenderer.d.ts
src/renderers/WebGLRenderer.d.ts
+0
-5
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+0
-1
src/renderers/webgl/WebGLPrograms.js
src/renderers/webgl/WebGLPrograms.js
+5
-5
未找到文件。
docs/api/en/renderers/WebGLRenderer.html
浏览文件 @
b686968c
...
...
@@ -164,11 +164,6 @@
<h3>
[property:Float gammaFactor]
</h3>
<p>
Default is *2*.
</p>
<h3>
[property:Boolean gammaInput]
</h3>
<p>
If set, then it expects that all textures and colors are premultiplied gamma. Default is *false*.
</p>
<h3>
[property:Boolean gammaOutput]
</h3>
<p>
If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is *false*.
</p>
...
...
docs/api/zh/renderers/WebGLRenderer.html
浏览文件 @
b686968c
...
...
@@ -143,11 +143,6 @@
<h3>
[property:Float gammaFactor]
</h3>
<p>
默认是 *2*.
</p>
<h3>
[property:Boolean gammaInput]
</h3>
<p>
如果设置,那么所有的纹理和颜色都会预乘gamma。 默认值是*false*.
</p>
<h3>
[property:Boolean gammaOutput]
</h3>
<p>
如果设置, 那么它期望所有纹理和颜色需要乘以gamma输出。 默认值*false*.
</p>
...
...
editor/js/libs/tern-threejs/threejs.js
浏览文件 @
b686968c
...
...
@@ -4661,10 +4661,6 @@
"
!type
"
:
"
bool
"
,
"
!doc
"
:
"
Defines whether the renderer should auto update objects. Default is true.
"
},
"
gammaInput
"
:
{
"
!type
"
:
"
bool
"
,
"
!doc
"
:
"
Default is false. If set, then it expects that all textures and colors are premultiplied gamma.
"
},
"
gammaOutput
"
:
{
"
!type
"
:
"
bool
"
,
"
!doc
"
:
"
Default is false. If set, then it expects that all textures and colors need to be outputted in premultiplied gamma.
"
...
...
examples/js/misc/MD2Character.js
浏览文件 @
b686968c
...
...
@@ -221,6 +221,7 @@ THREE.MD2Character = function () {
textures
[
i
]
=
textureLoader
.
load
(
baseUrl
+
textureUrls
[
i
],
checkLoadingComplete
);
textures
[
i
].
mapping
=
THREE
.
UVMapping
;
textures
[
i
].
name
=
textureUrls
[
i
];
textures
[
i
].
encoding
=
THREE
.
sRGBEncoding
;
}
...
...
examples/js/misc/MD2CharacterComplex.js
浏览文件 @
b686968c
...
...
@@ -516,6 +516,7 @@ THREE.MD2CharacterComplex = function () {
textures
[
i
]
=
textureLoader
.
load
(
baseUrl
+
textureUrls
[
i
],
checkLoadingComplete
);
textures
[
i
].
mapping
=
THREE
.
UVMapping
;
textures
[
i
].
name
=
textureUrls
[
i
];
textures
[
i
].
encoding
=
THREE
.
sRGBEncoding
;
}
...
...
examples/jsm/misc/MD2Character.js
浏览文件 @
b686968c
...
...
@@ -9,7 +9,8 @@ import {
MeshLambertMaterial
,
Object3D
,
TextureLoader
,
UVMapping
UVMapping
,
sRGBEncoding
}
from
"
../../../build/three.module.js
"
;
import
{
MD2Loader
}
from
"
../loaders/MD2Loader.js
"
;
...
...
@@ -232,6 +233,7 @@ var MD2Character = function () {
textures
[
i
]
=
textureLoader
.
load
(
baseUrl
+
textureUrls
[
i
],
checkLoadingComplete
);
textures
[
i
].
mapping
=
UVMapping
;
textures
[
i
].
name
=
textureUrls
[
i
];
textures
[
i
].
encoding
=
sRGBEncoding
;
}
...
...
examples/jsm/misc/MD2CharacterComplex.js
浏览文件 @
b686968c
...
...
@@ -8,7 +8,8 @@ import {
MeshLambertMaterial
,
Object3D
,
TextureLoader
,
UVMapping
UVMapping
,
sRGBEncoding
}
from
"
../../../build/three.module.js
"
;
import
{
MD2Loader
}
from
"
../loaders/MD2Loader.js
"
;
import
{
MorphBlendMesh
}
from
"
../misc/MorphBlendMesh.js
"
;
...
...
@@ -527,6 +528,7 @@ var MD2CharacterComplex = function () {
textures
[
i
]
=
textureLoader
.
load
(
baseUrl
+
textureUrls
[
i
],
checkLoadingComplete
);
textures
[
i
].
mapping
=
UVMapping
;
textures
[
i
].
name
=
textureUrls
[
i
];
textures
[
i
].
encoding
=
sRGBEncoding
;
}
...
...
examples/jsm/nodes/core/NodeBuilder.js
浏览文件 @
b686968c
...
...
@@ -951,7 +951,7 @@ NodeBuilder.prototype = {
getTextureEncodingFromMap
:
function
(
map
,
gammaOverrideLinear
)
{
gammaOverrideLinear
=
gammaOverrideLinear
!==
undefined
?
gammaOverrideLinear
:
this
.
context
.
gamma
&&
(
this
.
renderer
?
this
.
renderer
.
gammaInput
:
false
)
;
gammaOverrideLinear
=
gammaOverrideLinear
!==
undefined
?
gammaOverrideLinear
:
this
.
context
.
gamma
;
var
encoding
;
...
...
@@ -970,7 +970,7 @@ NodeBuilder.prototype = {
}
// add backwards compatibility for WebGLRenderer.gamma
Input/gamma
Output parameter, should probably be removed at some point.
// add backwards compatibility for WebGLRenderer.gammaOutput parameter, should probably be removed at some point.
if
(
encoding
===
LinearEncoding
&&
gammaOverrideLinear
)
{
encoding
=
GammaEncoding
;
...
...
examples/misc_exporter_collada.html
浏览文件 @
b686968c
...
...
@@ -73,7 +73,6 @@
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
canvasWidth
,
canvasHeight
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
container
.
appendChild
(
renderer
.
domElement
);
...
...
@@ -88,6 +87,7 @@
var
textureMap
=
new
THREE
.
TextureLoader
().
load
(
'
textures/uv_grid_opengl.jpg
'
);
textureMap
.
wrapS
=
textureMap
.
wrapT
=
THREE
.
RepeatWrapping
;
textureMap
.
anisotropy
=
16
;
textureMap
.
encoding
=
THREE
.
sRGBEncoding
;
// REFLECTION MAP
var
path
=
"
textures/cube/pisa/
"
;
...
...
@@ -98,6 +98,7 @@
];
textureCube
=
new
THREE
.
CubeTextureLoader
().
load
(
urls
);
textureCube
.
encoding
=
THREE
.
sRGBEncoding
;
// MATERIALS
var
materialColor
=
new
THREE
.
Color
();
...
...
examples/webgl_animation_cloth.html
浏览文件 @
b686968c
...
...
@@ -503,6 +503,7 @@
groundTexture
.
wrapS
=
groundTexture
.
wrapT
=
THREE
.
RepeatWrapping
;
groundTexture
.
repeat
.
set
(
25
,
25
);
groundTexture
.
anisotropy
=
16
;
groundTexture
.
encoding
=
THREE
.
sRGBEncoding
;
var
groundMaterial
=
new
THREE
.
MeshLambertMaterial
(
{
map
:
groundTexture
}
);
...
...
@@ -561,7 +562,6 @@
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
.
enabled
=
true
;
...
...
examples/webgl_buffergeometry.html
浏览文件 @
b686968c
...
...
@@ -156,8 +156,6 @@
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
container
.
appendChild
(
renderer
.
domElement
);
...
...
examples/webgl_buffergeometry_drawrange.html
浏览文件 @
b686968c
...
...
@@ -168,8 +168,6 @@
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
container
.
appendChild
(
renderer
.
domElement
);
...
...
examples/webgl_buffergeometry_lines.html
浏览文件 @
b686968c
...
...
@@ -82,8 +82,6 @@
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
container
.
appendChild
(
renderer
.
domElement
);
...
...
examples/webgl_buffergeometry_lines_indexed.html
浏览文件 @
b686968c
...
...
@@ -190,8 +190,6 @@
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
container
.
appendChild
(
renderer
.
domElement
);
...
...
examples/webgl_buffergeometry_uint.html
浏览文件 @
b686968c
...
...
@@ -157,8 +157,6 @@
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
container
.
appendChild
(
renderer
.
domElement
);
...
...
examples/webgl_geometry_teapot.html
浏览文件 @
b686968c
...
...
@@ -67,7 +67,6 @@
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
canvasWidth
,
canvasHeight
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
container
.
appendChild
(
renderer
.
domElement
);
...
...
@@ -82,6 +81,7 @@
var
textureMap
=
new
THREE
.
TextureLoader
().
load
(
'
textures/uv_grid_opengl.jpg
'
);
textureMap
.
wrapS
=
textureMap
.
wrapT
=
THREE
.
RepeatWrapping
;
textureMap
.
anisotropy
=
16
;
textureMap
.
encoding
=
THREE
.
sRGBEncoding
;
// REFLECTION MAP
var
path
=
"
textures/cube/pisa/
"
;
...
...
@@ -92,6 +92,7 @@
];
textureCube
=
new
THREE
.
CubeTextureLoader
().
load
(
urls
);
textureCube
.
encoding
=
THREE
.
sRGBEncoding
;
// MATERIALS
var
materialColor
=
new
THREE
.
Color
();
...
...
examples/webgl_lensflares.html
浏览文件 @
b686968c
...
...
@@ -115,12 +115,8 @@
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
,
alpha
:
true
}
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
//
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
container
.
appendChild
(
renderer
.
domElement
);
//
...
...
examples/webgl_lightningstrike.html
浏览文件 @
b686968c
...
...
@@ -54,8 +54,6 @@
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
container
.
appendChild
(
renderer
.
domElement
);
...
...
@@ -419,6 +417,7 @@
var
textureCube
=
new
THREE
.
CubeTextureLoader
().
load
(
urls
);
textureCube
.
format
=
THREE
.
RGBFormat
;
textureCube
.
mapping
=
THREE
.
CubeReflectionMapping
;
textureCube
.
encoding
=
THREE
.
sRGBEncoding
;
var
sphereMaterial
=
new
THREE
.
MeshPhysicalMaterial
(
{
transparent
:
true
,
...
...
examples/webgl_lights_hemisphere.html
浏览文件 @
b686968c
...
...
@@ -190,10 +190,7 @@
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
.
enabled
=
true
;
// STATS
...
...
examples/webgl_lights_physical.html
浏览文件 @
b686968c
...
...
@@ -110,6 +110,7 @@
map
.
wrapT
=
THREE
.
RepeatWrapping
;
map
.
anisotropy
=
4
;
map
.
repeat
.
set
(
10
,
24
);
map
.
encoding
=
THREE
.
sRGBEncoding
;
floorMat
.
map
=
map
;
floorMat
.
needsUpdate
=
true
;
...
...
@@ -147,6 +148,7 @@
map
.
wrapT
=
THREE
.
RepeatWrapping
;
map
.
anisotropy
=
4
;
map
.
repeat
.
set
(
1
,
1
);
map
.
encoding
=
THREE
.
sRGBEncoding
;
cubeMat
.
map
=
map
;
cubeMat
.
needsUpdate
=
true
;
...
...
@@ -170,6 +172,7 @@
textureLoader
.
load
(
"
textures/planets/earth_atmos_2048.jpg
"
,
function
(
map
)
{
map
.
anisotropy
=
4
;
map
.
encoding
=
THREE
.
sRGBEncoding
;
ballMat
.
map
=
map
;
ballMat
.
needsUpdate
=
true
;
...
...
@@ -177,6 +180,7 @@
textureLoader
.
load
(
"
textures/planets/earth_specular_2048.jpg
"
,
function
(
map
)
{
map
.
anisotropy
=
4
;
map
.
encoding
=
THREE
.
sRGBEncoding
;
ballMat
.
metalnessMap
=
map
;
ballMat
.
needsUpdate
=
true
;
...
...
@@ -214,7 +218,6 @@
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
physicallyCorrectLights
=
true
;
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
.
enabled
=
true
;
renderer
.
toneMapping
=
THREE
.
ReinhardToneMapping
;
...
...
examples/webgl_lights_pointlights2.html
浏览文件 @
b686968c
...
...
@@ -55,6 +55,7 @@
texture
.
repeat
.
set
(
20
,
10
);
texture
.
wrapS
=
texture
.
wrapT
=
THREE
.
RepeatWrapping
;
texture
.
format
=
THREE
.
RGBFormat
;
texture
.
encoding
=
THREE
.
sRGBEncoding
;
// MATERIALS
...
...
@@ -133,8 +134,6 @@
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
// CONTROLS
...
...
examples/webgl_lights_rectarealight.html
浏览文件 @
b686968c
...
...
@@ -42,7 +42,6 @@
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
shadowMap
.
enabled
=
true
;
renderer
.
shadowMap
.
type
=
THREE
.
PCFSoftShadowMap
;
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
document
.
body
.
appendChild
(
renderer
.
domElement
);
...
...
examples/webgl_lights_spotlight.html
浏览文件 @
b686968c
...
...
@@ -34,8 +34,6 @@
document
.
body
.
appendChild
(
renderer
.
domElement
);
renderer
.
shadowMap
.
enabled
=
true
;
renderer
.
shadowMap
.
type
=
THREE
.
PCFSoftShadowMap
;
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
scene
=
new
THREE
.
Scene
();
...
...
examples/webgl_lights_spotlights.html
浏览文件 @
b686968c
...
...
@@ -52,8 +52,6 @@
renderer
.
shadowMap
.
enabled
=
true
;
renderer
.
shadowMap
.
type
=
THREE
.
PCFSoftShadowMap
;
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
camera
.
position
.
set
(
46
,
22
,
-
21
);
...
...
examples/webgl_loader_ctm.html
已删除
100644 → 0
浏览文件 @
2fb36e6f
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
three.js webgl - loaders - CTM loader
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
>
<link
type=
"text/css"
rel=
"stylesheet"
href=
"main.css"
>
</head>
<body>
<div
id=
"info"
>
<a
href=
"http://threejs.org"
target=
"_blank"
rel=
"noopener"
>
three.js
</a>
-
<a
href=
"http://openctm.sourceforge.net/"
target=
"_blank"
rel=
"noopener"
>
CTM format
</a>
loader test -
using
<a
href=
"https://github.com/jcmellado/js-openctm"
target=
"_blank"
rel=
"noopener"
>
js-openctm
</a><br/>
models from
<a
href=
"http://www.sci.utah.edu/~wald/animrep/"
target=
"_blank"
rel=
"noopener"
>
The Utah 3D Animation Repository
</a>
,
<a
href=
"http://graphics.cs.williams.edu/data/meshes.xml#14"
target=
"_blank"
rel=
"noopener"
>
Lee Perry-Smith
</a>
,
<a
href=
"http://davidoreilly.com/post/18087489343/disneyhead"
target=
"_blank"
rel=
"noopener"
>
David OReilly
</a>
</div>
<script
type=
"module"
>
import
*
as
THREE
from
'
../build/three.module.js
'
;
import
Stats
from
'
./jsm/libs/stats.module.js
'
;
import
{
CTMLoader
}
from
'
./jsm/loaders/ctm/CTMLoader.js
'
;
var
SCREEN_WIDTH
=
window
.
innerWidth
;
var
SCREEN_HEIGHT
=
window
.
innerHeight
;
var
container
,
stats
;
var
camera
,
scene
,
renderer
;
var
mouseX
=
0
,
mouseY
=
0
;
var
windowHalfX
=
window
.
innerWidth
/
2
;
var
windowHalfY
=
window
.
innerHeight
/
2
;
var
textureLoader
=
new
THREE
.
TextureLoader
();
var
cubeTextureLoader
=
new
THREE
.
CubeTextureLoader
();
var
reflectionCube
;
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
init
();
animate
();
function
init
()
{
container
=
document
.
createElement
(
'
div
'
);
document
.
body
.
appendChild
(
container
);
camera
=
new
THREE
.
PerspectiveCamera
(
20
,
SCREEN_WIDTH
/
SCREEN_HEIGHT
,
1
,
2000
);
camera
.
position
.
z
=
800
;
scene
=
new
THREE
.
Scene
();
scene
.
background
=
new
THREE
.
Color
(
0x050505
);
scene
.
fog
=
new
THREE
.
Fog
(
0x050505
,
800
,
2000
);
var
path
=
"
textures/cube/SwedishRoyalCastle/
"
;
var
format
=
'
.jpg
'
;
var
urls
=
[
path
+
'
px
'
+
format
,
path
+
'
nx
'
+
format
,
path
+
'
py
'
+
format
,
path
+
'
ny
'
+
format
,
path
+
'
pz
'
+
format
,
path
+
'
nz
'
+
format
];
reflectionCube
=
cubeTextureLoader
.
load
(
urls
);
// LIGHTS
var
ambient
=
new
THREE
.
AmbientLight
(
0x040404
);
scene
.
add
(
ambient
);
var
light
=
new
THREE
.
SpotLight
(
0xffeedd
,
1.2
,
650
,
Math
.
PI
/
6
);
light
.
position
.
set
(
0
,
-
100
,
500
);
light
.
castShadow
=
true
;
light
.
shadow
.
mapWidth
=
1024
;
light
.
shadow
.
mapHeight
=
1024
;
// scene.add( new CameraHelper( light.shadow.camera ) );
scene
.
add
(
light
);
// RENDERER
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
SCREEN_WIDTH
,
SCREEN_HEIGHT
);
renderer
.
domElement
.
style
.
position
=
"
relative
"
;
container
.
appendChild
(
renderer
.
domElement
);
//
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
.
enabled
=
true
;
// STATS
stats
=
new
Stats
();
container
.
appendChild
(
stats
.
dom
);
// EVENTS
window
.
addEventListener
(
'
resize
'
,
onWindowResize
,
false
);
// LOADER
var
c
=
0
,
s
=
Date
.
now
();
function
checkTime
()
{
c
++
;
if
(
c
===
3
)
{
var
e
=
Date
.
now
();
console
.
log
(
"
Total parse time:
"
+
(
e
-
s
)
+
"
ms
"
);
}
}
var
loader
=
new
CTMLoader
();
loader
.
setWorkerPath
(
"
js/loaders/ctm/CTMWorker.js
"
);
loader
.
load
(
"
models/ctm/ben.ctm
"
,
function
(
geometry
)
{
var
material
=
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffaa00
,
map
:
textureLoader
.
load
(
"
textures/uv_grid_opengl.jpg
"
),
envMap
:
reflectionCube
,
combine
:
THREE
.
MixOperation
,
reflectivity
:
0.3
}
);
callbackModel
(
geometry
,
450
,
material
,
0
,
-
200
,
0
,
0
,
0
);
checkTime
();
},
{
useWorker
:
true
}
);
loader
.
load
(
"
models/ctm/WaltHead.ctm
"
,
function
(
geometry
)
{
var
material1
=
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffffff
}
);
var
material2
=
new
THREE
.
MeshPhongMaterial
(
{
color
:
0xff4400
,
specular
:
0x333333
,
shininess
:
100
}
);
var
material3
=
new
THREE
.
MeshPhongMaterial
(
{
color
:
0x00ff44
,
specular
:
0x333333
,
shininess
:
100
}
);
callbackModel
(
geometry
,
5
,
material1
,
-
200
,
0
,
-
50
,
0
,
0
);
callbackModel
(
geometry
,
2
,
material2
,
100
,
0
,
125
,
0
,
0
);
callbackModel
(
geometry
,
2
,
material3
,
-
100
,
0
,
125
,
0
,
0
);
checkTime
();
},
{
useWorker
:
true
}
);
loader
.
load
(
"
models/ctm/LeePerry.ctm
"
,
function
(
geometry
)
{
var
material
=
new
THREE
.
MeshPhongMaterial
(
{
specular
:
0x303030
,
shininess
:
50
,
map
:
textureLoader
.
load
(
"
models/gltf/LeePerrySmith/Map-COL.jpg
"
),
specularMap
:
textureLoader
.
load
(
"
models/gltf/LeePerrySmith/Map-SPEC.jpg
"
),
normalMap
:
textureLoader
.
load
(
"
models/gltf/LeePerrySmith/Infinite-Level_02_Tangent_SmoothUV.jpg
"
),
normalScale
:
new
THREE
.
Vector2
(
0.8
,
0.8
)
}
);
callbackModel
(
geometry
,
1300
,
material
,
200
,
50
,
0
,
0
,
0
);
checkTime
();
},
{
useWorker
:
true
}
);
}
function
callbackModel
(
geometry
,
s
,
material
,
x
,
y
,
z
,
rx
,
ry
)
{
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
.
position
.
set
(
x
,
y
,
z
);
mesh
.
scale
.
set
(
s
,
s
,
s
);
mesh
.
rotation
.
x
=
rx
;
mesh
.
rotation
.
z
=
ry
;
mesh
.
castShadow
=
true
;
mesh
.
receiveShadow
=
true
;
scene
.
add
(
mesh
);
}
//
function
onWindowResize
()
{
SCREEN_WIDTH
=
window
.
innerWidth
;
SCREEN_HEIGHT
=
window
.
innerHeight
;
renderer
.
setSize
(
SCREEN_WIDTH
,
SCREEN_HEIGHT
);
camera
.
aspect
=
SCREEN_WIDTH
/
SCREEN_HEIGHT
;
camera
.
updateProjectionMatrix
();
}
function
onDocumentMouseMove
(
event
)
{
mouseX
=
(
event
.
clientX
-
windowHalfX
);
mouseY
=
(
event
.
clientY
-
windowHalfY
);
}
//
function
animate
()
{
requestAnimationFrame
(
animate
);
render
();
stats
.
update
();
}
function
render
()
{
camera
.
position
.
x
+=
(
mouseX
-
camera
.
position
.
x
)
*
.
05
;
camera
.
position
.
y
+=
(
-
mouseY
-
camera
.
position
.
y
)
*
.
05
;
camera
.
lookAt
(
scene
.
position
);
renderer
.
render
(
scene
,
camera
);
}
</script>
</body>
</html>
examples/webgl_loader_draco.html
浏览文件 @
b686968c
...
...
@@ -80,7 +80,6 @@
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
.
enabled
=
true
;
container
.
appendChild
(
renderer
.
domElement
);
...
...
examples/webgl_loader_md2.html
浏览文件 @
b686968c
...
...
@@ -101,6 +101,7 @@
ground
.
rotation
.
x
=
-
Math
.
PI
/
2
;
ground
.
material
.
map
.
repeat
.
set
(
8
,
8
);
ground
.
material
.
map
.
wrapS
=
ground
.
material
.
map
.
wrapT
=
THREE
.
RepeatWrapping
;
ground
.
material
.
map
.
encoding
=
THREE
.
sRGBEncoding
;
ground
.
receiveShadow
=
true
;
scene
.
add
(
ground
);
...
...
@@ -114,7 +115,6 @@
//
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
.
enabled
=
true
;
...
...
examples/webgl_loader_md2_control.html
浏览文件 @
b686968c
...
...
@@ -111,6 +111,7 @@
ground
.
material
.
map
.
repeat
.
set
(
64
,
64
);
ground
.
material
.
map
.
wrapS
=
THREE
.
RepeatWrapping
;
ground
.
material
.
map
.
wrapT
=
THREE
.
RepeatWrapping
;
ground
.
material
.
map
.
encoding
=
THREE
.
sRGBEncoding
;
// note that because the ground does not cast a shadow, .castShadow is left false
ground
.
receiveShadow
=
true
;
...
...
@@ -125,9 +126,7 @@
//
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
.
enabled
=
true
;
renderer
.
shadowMap
.
type
=
THREE
.
PCFSoftShadowMap
;
...
...
examples/webgl_loader_ply.html
浏览文件 @
b686968c
...
...
@@ -109,8 +109,6 @@
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
.
enabled
=
true
;
...
...
examples/webgl_loader_stl.html
浏览文件 @
b686968c
...
...
@@ -145,8 +145,6 @@
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
.
enabled
=
true
;
...
...
examples/webgl_materials_bumpmap.html
浏览文件 @
b686968c
...
...
@@ -102,10 +102,6 @@
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
shadowMap
.
enabled
=
true
;
//
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
//
...
...
examples/webgl_materials_displacementmap.html
浏览文件 @
b686968c
...
...
@@ -112,8 +112,6 @@
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
//
...
...
@@ -157,6 +155,7 @@
];
var
reflectionCube
=
new
THREE
.
CubeTextureLoader
().
load
(
urls
);
reflectionCube
.
encoding
=
THREE
.
sRGBEncoding
;
// textures
...
...
examples/webgl_materials_envmaps_exr.html
浏览文件 @
b686968c
...
...
@@ -107,7 +107,6 @@
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
gammaInput
=
false
;
renderer
.
gammaOutput
=
true
;
stats
=
new
Stats
();
...
...
examples/webgl_materials_envmaps_hdr_nodes.html
浏览文件 @
b686968c
...
...
@@ -106,7 +106,7 @@
THREE
.
DefaultLoadingManager
.
onLoad
=
function
(
)
{
pmremGenerator
.
dispose
();
}
var
hdrUrls
=
[
'
px.hdr
'
,
'
nx.hdr
'
,
'
py.hdr
'
,
'
ny.hdr
'
,
'
pz.hdr
'
,
'
nz.hdr
'
];
...
...
@@ -154,7 +154,6 @@
container
.
appendChild
(
renderer
.
domElement
);
//renderer.toneMapping = THREE.ReinhardToneMapping;
renderer
.
gammaInput
=
true
;
// ???
renderer
.
gammaOutput
=
true
;
stats
=
new
Stats
();
...
...
examples/webgl_materials_envmaps_pmrem_nodes.html
浏览文件 @
b686968c
...
...
@@ -142,7 +142,6 @@
container
.
appendChild
(
renderer
.
domElement
);
//renderer.toneMapping = THREE.ReinhardToneMapping;
renderer
.
gammaInput
=
true
;
// ???
renderer
.
gammaOutput
=
true
;
stats
=
new
Stats
();
...
...
examples/webgl_materials_lightmap.html
浏览文件 @
b686968c
...
...
@@ -110,8 +110,6 @@
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
SCREEN_WIDTH
,
SCREEN_HEIGHT
);
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
// CONTROLS
...
...
examples/webgl_materials_normalmap.html
浏览文件 @
b686968c
...
...
@@ -85,13 +85,21 @@
var
textureLoader
=
new
THREE
.
TextureLoader
();
var
diffuseMap
=
textureLoader
.
load
(
"
models/gltf/LeePerrySmith/Map-COL.jpg
"
);
diffuseMap
.
encoding
=
THREE
.
sRGBEncoding
;
var
specularMap
=
textureLoader
.
load
(
"
models/gltf/LeePerrySmith/Map-SPEC.jpg
"
);
specularMap
.
encoding
=
THREE
.
sRGBEncoding
;
var
normalMap
=
textureLoader
.
load
(
"
models/gltf/LeePerrySmith/Infinite-Level_02_Tangent_SmoothUV.jpg
"
);
var
material
=
new
THREE
.
MeshPhongMaterial
(
{
color
:
0xdddddd
,
specular
:
0x222222
,
shininess
:
35
,
map
:
textureLoader
.
load
(
"
models/gltf/LeePerrySmith/Map-COL.jpg
"
)
,
specularMap
:
textureLoader
.
load
(
"
models/gltf/LeePerrySmith/Map-SPEC.jpg
"
)
,
normalMap
:
textureLoader
.
load
(
"
models/gltf/LeePerrySmith/Infinite-Level_02_Tangent_SmoothUV.jpg
"
)
,
map
:
diffuseMap
,
specularMap
:
specularMap
,
normalMap
:
normalMap
,
normalScale
:
new
THREE
.
Vector2
(
0.8
,
0.8
)
}
);
...
...
@@ -105,10 +113,6 @@
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
//
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
//
...
...
examples/webgl_materials_parallaxmap.html
浏览文件 @
b686968c
...
...
@@ -82,8 +82,6 @@
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
//
...
...
examples/webgl_materials_standard.html
浏览文件 @
b686968c
...
...
@@ -43,7 +43,6 @@
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
toneMapping
=
THREE
.
ReinhardToneMapping
;
renderer
.
toneMappingExposure
=
3
;
...
...
@@ -75,7 +74,9 @@
material
.
roughness
=
1
;
// attenuates roughnessMap
material
.
metalness
=
1
;
// attenuates metalnessMap
material
.
map
=
loader
.
load
(
'
Cerberus_A.jpg
'
);
var
diffuseMap
=
loader
.
load
(
'
Cerberus_A.jpg
'
);
diffuseMap
.
encoding
=
THREE
.
sRGBEncoding
;
material
.
map
=
diffuseMap
;
// roughness is in G channel, metalness is in B channel
material
.
metalnessMap
=
material
.
roughnessMap
=
loader
.
load
(
'
Cerberus_RM.jpg
'
);
material
.
normalMap
=
loader
.
load
(
'
Cerberus_N.jpg
'
);
...
...
examples/webgl_materials_translucency.html
浏览文件 @
b686968c
...
...
@@ -67,8 +67,6 @@
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
//
...
...
examples/webgl_materials_variations_basic.html
浏览文件 @
b686968c
...
...
@@ -46,6 +46,7 @@
.
setPath
(
'
textures/cube/SwedishRoyalCastle/
'
)
.
load
(
[
'
px.jpg
'
,
'
nx.jpg
'
,
'
py.jpg
'
,
'
ny.jpg
'
,
'
pz.jpg
'
,
'
nz.jpg
'
]
);
reflectionCube
.
format
=
THREE
.
RGBFormat
;
reflectionCube
.
encoding
=
THREE
.
sRGBEncoding
;
scene
=
new
THREE
.
Scene
();
scene
.
background
=
reflectionCube
;
...
...
@@ -54,6 +55,7 @@
var
imgTexture
=
new
THREE
.
TextureLoader
().
load
(
"
textures/planets/moon_1024.jpg
"
);
imgTexture
.
wrapS
=
imgTexture
.
wrapT
=
THREE
.
RepeatWrapping
;
imgTexture
.
encoding
=
THREE
.
sRGBEncoding
;
imgTexture
.
anisotropy
=
16
;
imgTexture
=
null
;
...
...
@@ -144,8 +146,6 @@
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
//
...
...
examples/webgl_materials_variations_lambert.html
浏览文件 @
b686968c
...
...
@@ -46,6 +46,7 @@
.
setPath
(
'
textures/cube/SwedishRoyalCastle/
'
)
.
load
(
[
'
px.jpg
'
,
'
nx.jpg
'
,
'
py.jpg
'
,
'
ny.jpg
'
,
'
pz.jpg
'
,
'
nz.jpg
'
]
);
reflectionCube
.
format
=
THREE
.
RGBFormat
;
reflectionCube
.
encoding
=
THREE
.
sRGBEncoding
;
scene
=
new
THREE
.
Scene
();
scene
.
background
=
reflectionCube
;
...
...
@@ -54,6 +55,7 @@
var
imgTexture
=
new
THREE
.
TextureLoader
().
load
(
"
textures/planets/moon_1024.jpg
"
);
imgTexture
.
wrapS
=
imgTexture
.
wrapT
=
THREE
.
RepeatWrapping
;
imgTexture
.
encoding
=
THREE
.
sRGBEncoding
;
imgTexture
.
anisotropy
=
16
;
imgTexture
=
null
;
...
...
@@ -144,8 +146,6 @@
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
//
...
...
examples/webgl_materials_variations_phong.html
浏览文件 @
b686968c
...
...
@@ -46,6 +46,7 @@
.
setPath
(
'
textures/cube/SwedishRoyalCastle/
'
)
.
load
(
[
'
px.jpg
'
,
'
nx.jpg
'
,
'
py.jpg
'
,
'
ny.jpg
'
,
'
pz.jpg
'
,
'
nz.jpg
'
]
);
reflectionCube
.
format
=
THREE
.
RGBFormat
;
reflectionCube
.
encoding
=
THREE
.
sRGBEncoding
;
scene
=
new
THREE
.
Scene
();
scene
.
background
=
reflectionCube
;
...
...
@@ -54,6 +55,7 @@
var
imgTexture
=
new
THREE
.
TextureLoader
().
load
(
"
textures/planets/moon_1024.jpg
"
);
imgTexture
.
wrapS
=
imgTexture
.
wrapT
=
THREE
.
RepeatWrapping
;
imgTexture
.
encoding
=
THREE
.
sRGBEncoding
;
imgTexture
.
anisotropy
=
16
;
imgTexture
=
null
;
...
...
@@ -151,8 +153,6 @@
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
//
...
...
examples/webgl_materials_variations_toon.html
浏览文件 @
b686968c
...
...
@@ -47,6 +47,7 @@
.
setPath
(
'
textures/cube/SwedishRoyalCastle/
'
)
.
load
(
[
'
px.jpg
'
,
'
nx.jpg
'
,
'
py.jpg
'
,
'
ny.jpg
'
,
'
pz.jpg
'
,
'
nz.jpg
'
]
);
reflectionCube
.
format
=
THREE
.
RGBFormat
;
reflectionCube
.
encoding
=
THREE
.
sRGBEncoding
;
scene
=
new
THREE
.
Scene
();
scene
.
background
=
reflectionCube
;
...
...
@@ -55,6 +56,7 @@
var
imgTexture
=
new
THREE
.
TextureLoader
().
load
(
"
textures/planets/moon_1024.jpg
"
);
imgTexture
.
wrapS
=
imgTexture
.
wrapT
=
THREE
.
RepeatWrapping
;
imgTexture
.
encoding
=
THREE
.
sRGBEncoding
;
imgTexture
.
anisotropy
=
16
;
imgTexture
=
null
;
...
...
@@ -150,8 +152,6 @@
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
effect
=
new
OutlineEffect
(
renderer
);
...
...
examples/webgl_performance_doublesided.html
浏览文件 @
b686968c
...
...
@@ -65,6 +65,7 @@
var
reflectionCube
=
new
THREE
.
CubeTextureLoader
().
load
(
urls
);
reflectionCube
.
format
=
THREE
.
RGBFormat
;
reflectionCube
.
encoding
=
THREE
.
sRGBEncoding
;
var
material
=
new
THREE
.
MeshPhongMaterial
(
{
specular
:
0x101010
,
shininess
:
100
,
envMap
:
reflectionCube
,
combine
:
THREE
.
MixOperation
,
reflectivity
:
0.1
,
side
:
THREE
.
DoubleSide
}
);
...
...
@@ -92,8 +93,6 @@
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
SCREEN_WIDTH
,
SCREEN_HEIGHT
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
container
.
appendChild
(
renderer
.
domElement
);
...
...
examples/webgl_postprocessing_advanced.html
浏览文件 @
b686968c
...
...
@@ -90,8 +90,11 @@
//
var
diffuseMap
=
new
THREE
.
TextureLoader
().
load
(
"
textures/cube/SwedishRoyalCastle/pz.jpg
"
);
diffuseMap
.
encoding
=
THREE
.
sRGBEncoding
;
var
materialColor
=
new
THREE
.
MeshBasicMaterial
(
{
map
:
new
THREE
.
TextureLoader
().
load
(
"
textures/cube/SwedishRoyalCastle/pz.jpg
"
)
,
map
:
diffuseMap
,
depthTest
:
false
}
);
...
...
@@ -115,10 +118,6 @@
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
width
,
height
);
renderer
.
autoClear
=
false
;
//
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
//
...
...
@@ -288,12 +287,15 @@
function
createMesh
(
geometry
,
scene
,
scale
)
{
var
diffuseMap
=
new
THREE
.
TextureLoader
().
load
(
"
models/gltf/LeePerrySmith/Map-COL.jpg
"
);
diffuseMap
.
encoding
=
THREE
.
sRGBEncoding
;
var
mat2
=
new
THREE
.
MeshPhongMaterial
(
{
color
:
0x999999
,
specular
:
0x080808
,
shininess
:
20
,
map
:
new
THREE
.
TextureLoader
().
load
(
"
models/gltf/LeePerrySmith/Map-COL.jpg
"
)
,
map
:
diffuseMap
,
normalMap
:
new
THREE
.
TextureLoader
().
load
(
"
models/gltf/LeePerrySmith/Infinite-Level_02_Tangent_SmoothUV.jpg
"
),
normalScale
:
new
THREE
.
Vector2
(
0.75
,
0.75
)
...
...
examples/webgl_shaders_tonemapping.html
浏览文件 @
b686968c
...
...
@@ -193,12 +193,14 @@
textureLoader
.
load
(
'
textures/planets/earth_atmos_4096.jpg
'
,
function
(
tex
)
{
earthMat
.
map
=
tex
;
earthMat
.
map
.
encoding
=
THREE
.
sRGBEncoding
;
earthMat
.
needsUpdate
=
true
;
}
);
textureLoader
.
load
(
'
textures/planets/earth_specular_2048.jpg
'
,
function
(
tex
)
{
earthMat
.
specularMap
=
tex
;
earthMat
.
specularMap
.
encoding
=
THREE
.
sRGBEncoding
;
earthMat
.
needsUpdate
=
true
;
}
);
...
...
@@ -209,6 +211,7 @@
// } );
var
earthLights
=
textureLoader
.
load
(
'
textures/planets/earth_lights_2048.png
'
);
earthLights
.
encoding
=
THREE
.
sRGBEncoding
;
var
earthLightsMat
=
new
THREE
.
MeshBasicMaterial
(
{
color
:
0xffffff
,
...
...
@@ -220,6 +223,7 @@
}
);
var
clouds
=
textureLoader
.
load
(
'
textures/planets/earth_clouds_2048.png
'
);
clouds
.
encoding
=
THREE
.
sRGBEncoding
;
var
earthCloudsMat
=
new
THREE
.
MeshLambertMaterial
(
{
color
:
0xffffff
,
...
...
@@ -312,6 +316,7 @@
var
textureCube
=
new
THREE
.
CubeTextureLoader
().
load
(
urls
);
textureCube
.
format
=
THREE
.
RGBFormat
;
textureCube
.
encoding
=
THREE
.
sRGBEncoding
;
sceneCube
.
background
=
textureCube
;
...
...
@@ -319,8 +324,6 @@
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
autoClear
=
false
;
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
false
;
container
.
appendChild
(
renderer
.
domElement
);
...
...
examples/webgl_shading_physical.html
浏览文件 @
b686968c
...
...
@@ -68,7 +68,7 @@
// CUBE CAMERA
cubeCamera
=
new
THREE
.
CubeCamera
(
1
,
10000
,
128
);
cubeCamera
=
new
THREE
.
CubeCamera
(
1
,
10000
,
128
,
{
encoding
:
THREE
.
sRGBEncoding
}
);
// TEXTURES
var
textureLoader
=
new
THREE
.
TextureLoader
();
...
...
@@ -78,16 +78,19 @@
textureSquares
.
wrapS
=
textureSquares
.
wrapT
=
THREE
.
RepeatWrapping
;
textureSquares
.
magFilter
=
THREE
.
NearestFilter
;
textureSquares
.
format
=
THREE
.
RGBFormat
;
textureSquares
.
encoding
=
THREE
.
sRGBEncoding
;
var
textureNoiseColor
=
textureLoader
.
load
(
"
textures/disturb.jpg
"
);
textureNoiseColor
.
repeat
.
set
(
1
,
1
);
textureNoiseColor
.
wrapS
=
textureNoiseColor
.
wrapT
=
THREE
.
RepeatWrapping
;
textureNoiseColor
.
format
=
THREE
.
RGBFormat
;
textureNoiseColor
.
encoding
=
THREE
.
sRGBEncoding
;
var
textureLava
=
textureLoader
.
load
(
"
textures/lava/lavatile.jpg
"
);
textureLava
.
repeat
.
set
(
6
,
2
);
textureLava
.
wrapS
=
textureLava
.
wrapT
=
THREE
.
RepeatWrapping
;
textureLava
.
format
=
THREE
.
RGBFormat
;
textureLava
.
encoding
=
THREE
.
sRGBEncoding
;
// GROUND
...
...
@@ -233,10 +236,6 @@
renderer
.
shadowMap
.
enabled
=
true
;
renderer
.
shadowMap
.
type
=
THREE
.
PCFSoftShadowMap
;
//
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
//
...
...
examples/webgl_shadowmap_pcss.html
浏览文件 @
b686968c
...
...
@@ -238,9 +238,7 @@
container
.
appendChild
(
renderer
.
domElement
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
.
enabled
=
true
;
// controls
...
...
examples/webxr_vr_dragging.html
浏览文件 @
b686968c
...
...
@@ -114,7 +114,6 @@
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
shadowMap
.
enabled
=
true
;
renderer
.
xr
.
enabled
=
true
;
...
...
examples/webxr_vr_paint.html
浏览文件 @
b686968c
...
...
@@ -91,7 +91,6 @@
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
xr
.
enabled
=
true
;
container
.
appendChild
(
renderer
.
domElement
);
...
...
examples/webxr_vr_sculpt.html
浏览文件 @
b686968c
...
...
@@ -84,7 +84,6 @@
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
renderer
.
gammaInput
=
true
;
renderer
.
gammaOutput
=
true
;
renderer
.
xr
.
enabled
=
true
;
container
.
appendChild
(
renderer
.
domElement
);
...
...
src/Three.Legacy.js
浏览文件 @
b686968c
...
...
@@ -1716,6 +1716,19 @@ Object.defineProperties( WebGLRenderer.prototype, {
console
.
warn
(
'
THREE.WebGLRenderer: .vr has been removed. Use .xr instead.
'
);
return
this
.
xr
;
}
},
gammaInput
:
{
get
:
function
()
{
console
.
warn
(
'
THREE.WebGLRenderer: .gammaInput has been removed. Please define the correct color spaces for textures via Texture.encoding instead.
'
);
return
false
;
},
set
:
function
()
{
console
.
warn
(
'
THREE.WebGLRenderer: .gammaInput has been removed. Please define the correct color spaces for textures via Texture.encoding instead.
'
);
}
}
...
...
src/renderers/WebGLRenderer.d.ts
浏览文件 @
b686968c
...
...
@@ -155,11 +155,6 @@ export class WebGLRenderer implements Renderer {
extensions
:
WebGLExtensions
;
/**
* Default is false.
*/
gammaInput
:
boolean
;
/**
* Default is false.
*/
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
b686968c
...
...
@@ -101,7 +101,6 @@ function WebGLRenderer( parameters ) {
// physically based shading
this
.
gammaFactor
=
2.0
;
// for backwards compatibility
this
.
gammaInput
=
false
;
this
.
gammaOutput
=
false
;
// physical lights
...
...
src/renderers/webgl/WebGLPrograms.js
浏览文件 @
b686968c
...
...
@@ -155,18 +155,18 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
numMultiviewViews
:
numMultiviewViews
,
outputEncoding
:
getTextureEncodingFromMap
(
(
!
currentRenderTarget
)
?
null
:
currentRenderTarget
.
texture
,
renderer
.
gammaOutput
),
map
:
!!
material
.
map
,
mapEncoding
:
getTextureEncodingFromMap
(
material
.
map
,
renderer
.
gammaInput
),
mapEncoding
:
getTextureEncodingFromMap
(
material
.
map
),
matcap
:
!!
material
.
matcap
,
matcapEncoding
:
getTextureEncodingFromMap
(
material
.
matcap
,
renderer
.
gammaInput
),
matcapEncoding
:
getTextureEncodingFromMap
(
material
.
matcap
),
envMap
:
!!
material
.
envMap
,
envMapMode
:
material
.
envMap
&&
material
.
envMap
.
mapping
,
envMapEncoding
:
getTextureEncodingFromMap
(
material
.
envMap
,
renderer
.
gammaInput
),
envMapEncoding
:
getTextureEncodingFromMap
(
material
.
envMap
),
envMapCubeUV
:
(
!!
material
.
envMap
)
&&
(
(
material
.
envMap
.
mapping
===
CubeUVReflectionMapping
)
||
(
material
.
envMap
.
mapping
===
CubeUVRefractionMapping
)
),
lightMap
:
!!
material
.
lightMap
,
lightMapEncoding
:
getTextureEncodingFromMap
(
material
.
lightMap
,
renderer
.
gammaInput
),
lightMapEncoding
:
getTextureEncodingFromMap
(
material
.
lightMap
),
aoMap
:
!!
material
.
aoMap
,
emissiveMap
:
!!
material
.
emissiveMap
,
emissiveMapEncoding
:
getTextureEncodingFromMap
(
material
.
emissiveMap
,
renderer
.
gammaInput
),
emissiveMapEncoding
:
getTextureEncodingFromMap
(
material
.
emissiveMap
),
bumpMap
:
!!
material
.
bumpMap
,
normalMap
:
!!
material
.
normalMap
,
objectSpaceNormalMap
:
material
.
normalMapType
===
ObjectSpaceNormalMap
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录