Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
8b9a4444
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,发现更多精彩内容 >>
提交
8b9a4444
编写于
7月 23, 2019
作者:
A
arobertson0
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Linting
上级
58f5ef7d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
103 addition
and
99 deletion
+103
-99
src/materials/MeshPhysicalMaterial.d.ts
src/materials/MeshPhysicalMaterial.d.ts
+0
-1
src/materials/MeshPhysicalMaterial.js
src/materials/MeshPhysicalMaterial.js
+2
-2
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+101
-96
未找到文件。
src/materials/MeshPhysicalMaterial.d.ts
浏览文件 @
8b9a4444
import
{
Texture
}
from
'
./../textures/Texture
'
;
import
{
Texture
}
from
'
./../textures/Texture
'
;
import
{
Vector2
}
from
'
./../math/Vector2
'
;
import
{
Vector2
}
from
'
./../math/Vector2
'
;
import
{
NormalMapTypes
}
from
'
../constants
'
;
import
{
import
{
MeshStandardMaterialParameters
,
MeshStandardMaterialParameters
,
MeshStandardMaterial
,
MeshStandardMaterial
,
...
...
src/materials/MeshPhysicalMaterial.js
浏览文件 @
8b9a4444
...
@@ -27,7 +27,7 @@ function MeshPhysicalMaterial( parameters ) {
...
@@ -27,7 +27,7 @@ function MeshPhysicalMaterial( parameters ) {
this
.
clearCoat
=
0.0
;
this
.
clearCoat
=
0.0
;
this
.
clearCoatRoughness
=
0.0
;
this
.
clearCoatRoughness
=
0.0
;
this
.
clearCoatNormalScale
=
new
Vector2
(
1
,
1
);
this
.
clearCoatNormalScale
=
new
Vector2
(
1
,
1
);
this
.
clearCoatNormalMap
=
null
;
this
.
clearCoatNormalMap
=
null
;
this
.
setValues
(
parameters
);
this
.
setValues
(
parameters
);
...
@@ -51,7 +51,7 @@ MeshPhysicalMaterial.prototype.copy = function ( source ) {
...
@@ -51,7 +51,7 @@ MeshPhysicalMaterial.prototype.copy = function ( source ) {
this
.
clearCoatRoughness
=
source
.
clearCoatRoughness
;
this
.
clearCoatRoughness
=
source
.
clearCoatRoughness
;
this
.
clearCoatNormalMap
=
source
.
clearCoatNormalMap
;
this
.
clearCoatNormalMap
=
source
.
clearCoatNormalMap
;
this
.
clearCoatNormalScale
.
copy
(
source
.
clearCoatNormalScale
);
this
.
clearCoatNormalScale
.
copy
(
source
.
clearCoatNormalScale
);
return
this
;
return
this
;
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
8b9a4444
...
@@ -155,7 +155,7 @@ function WebGLRenderer( parameters ) {
...
@@ -155,7 +155,7 @@ function WebGLRenderer( parameters ) {
_currentScissor
=
new
Vector4
(),
_currentScissor
=
new
Vector4
(),
_currentScissorTest
=
null
,
_currentScissorTest
=
null
,
//
//
_width
=
_canvas
.
width
,
_width
=
_canvas
.
width
,
_height
=
_canvas
.
height
,
_height
=
_canvas
.
height
,
...
@@ -256,47 +256,47 @@ function WebGLRenderer( parameters ) {
...
@@ -256,47 +256,47 @@ function WebGLRenderer( parameters ) {
function
initGLContext
()
{
function
initGLContext
()
{
extensions
=
new
WebGLExtensions
(
_gl
);
extensions
=
new
WebGLExtensions
(
_gl
);
capabilities
=
new
WebGLCapabilities
(
_gl
,
extensions
,
parameters
);
capabilities
=
new
WebGLCapabilities
(
_gl
,
extensions
,
parameters
);
if
(
!
capabilities
.
isWebGL2
)
{
if
(
!
capabilities
.
isWebGL2
)
{
extensions
.
get
(
'
WEBGL_depth_texture
'
);
extensions
.
get
(
'
WEBGL_depth_texture
'
);
extensions
.
get
(
'
OES_texture_float
'
);
extensions
.
get
(
'
OES_texture_float
'
);
extensions
.
get
(
'
OES_texture_half_float
'
);
extensions
.
get
(
'
OES_texture_half_float
'
);
extensions
.
get
(
'
OES_texture_half_float_linear
'
);
extensions
.
get
(
'
OES_texture_half_float_linear
'
);
extensions
.
get
(
'
OES_standard_derivatives
'
);
extensions
.
get
(
'
OES_standard_derivatives
'
);
extensions
.
get
(
'
OES_element_index_uint
'
);
extensions
.
get
(
'
OES_element_index_uint
'
);
extensions
.
get
(
'
ANGLE_instanced_arrays
'
);
extensions
.
get
(
'
ANGLE_instanced_arrays
'
);
}
}
extensions
.
get
(
'
OES_texture_float_linear
'
);
extensions
.
get
(
'
OES_texture_float_linear
'
);
utils
=
new
WebGLUtils
(
_gl
,
extensions
,
capabilities
);
utils
=
new
WebGLUtils
(
_gl
,
extensions
,
capabilities
);
state
=
new
WebGLState
(
_gl
,
extensions
,
utils
,
capabilities
);
state
=
new
WebGLState
(
_gl
,
extensions
,
utils
,
capabilities
);
state
.
scissor
(
_currentScissor
.
copy
(
_scissor
).
multiplyScalar
(
_pixelRatio
).
floor
()
);
state
.
scissor
(
_currentScissor
.
copy
(
_scissor
).
multiplyScalar
(
_pixelRatio
).
floor
()
);
state
.
viewport
(
_currentViewport
.
copy
(
_viewport
).
multiplyScalar
(
_pixelRatio
).
floor
()
);
state
.
viewport
(
_currentViewport
.
copy
(
_viewport
).
multiplyScalar
(
_pixelRatio
).
floor
()
);
info
=
new
WebGLInfo
(
_gl
);
info
=
new
WebGLInfo
(
_gl
);
properties
=
new
WebGLProperties
();
properties
=
new
WebGLProperties
();
textures
=
new
WebGLTextures
(
_gl
,
extensions
,
state
,
properties
,
capabilities
,
utils
,
info
);
textures
=
new
WebGLTextures
(
_gl
,
extensions
,
state
,
properties
,
capabilities
,
utils
,
info
);
attributes
=
new
WebGLAttributes
(
_gl
);
attributes
=
new
WebGLAttributes
(
_gl
);
geometries
=
new
WebGLGeometries
(
_gl
,
attributes
,
info
);
geometries
=
new
WebGLGeometries
(
_gl
,
attributes
,
info
);
objects
=
new
WebGLObjects
(
geometries
,
info
);
objects
=
new
WebGLObjects
(
geometries
,
info
);
morphtargets
=
new
WebGLMorphtargets
(
_gl
);
morphtargets
=
new
WebGLMorphtargets
(
_gl
);
programCache
=
new
WebGLPrograms
(
_this
,
extensions
,
capabilities
);
programCache
=
new
WebGLPrograms
(
_this
,
extensions
,
capabilities
);
renderLists
=
new
WebGLRenderLists
();
renderLists
=
new
WebGLRenderLists
();
renderStates
=
new
WebGLRenderStates
();
renderStates
=
new
WebGLRenderStates
();
background
=
new
WebGLBackground
(
_this
,
state
,
objects
,
_premultipliedAlpha
);
background
=
new
WebGLBackground
(
_this
,
state
,
objects
,
_premultipliedAlpha
);
bufferRenderer
=
new
WebGLBufferRenderer
(
_gl
,
extensions
,
info
,
capabilities
);
bufferRenderer
=
new
WebGLBufferRenderer
(
_gl
,
extensions
,
info
,
capabilities
);
indexedBufferRenderer
=
new
WebGLIndexedBufferRenderer
(
_gl
,
extensions
,
info
,
capabilities
);
indexedBufferRenderer
=
new
WebGLIndexedBufferRenderer
(
_gl
,
extensions
,
info
,
capabilities
);
info
.
programs
=
programCache
.
programs
;
info
.
programs
=
programCache
.
programs
;
_this
.
capabilities
=
capabilities
;
_this
.
capabilities
=
capabilities
;
_this
.
extensions
=
extensions
;
_this
.
extensions
=
extensions
;
...
@@ -305,124 +305,124 @@ function WebGLRenderer( parameters ) {
...
@@ -305,124 +305,124 @@ function WebGLRenderer( parameters ) {
_this
.
state
=
state
;
_this
.
state
=
state
;
_this
.
info
=
info
;
_this
.
info
=
info
;
}
}
initGLContext
();
initGLContext
();
// vr
// vr
var
vr
=
(
typeof
navigator
!==
'
undefined
'
&&
'
xr
'
in
navigator
&&
'
supportsSession
'
in
navigator
.
xr
)
?
new
WebXRManager
(
_this
,
_gl
)
:
new
WebVRManager
(
_this
);
var
vr
=
(
typeof
navigator
!==
'
undefined
'
&&
'
xr
'
in
navigator
&&
'
supportsSession
'
in
navigator
.
xr
)
?
new
WebXRManager
(
_this
,
_gl
)
:
new
WebVRManager
(
_this
);
this
.
vr
=
vr
;
this
.
vr
=
vr
;
// shadow map
// shadow map
var
shadowMap
=
new
WebGLShadowMap
(
_this
,
objects
,
capabilities
.
maxTextureSize
);
var
shadowMap
=
new
WebGLShadowMap
(
_this
,
objects
,
capabilities
.
maxTextureSize
);
this
.
shadowMap
=
shadowMap
;
this
.
shadowMap
=
shadowMap
;
// API
// API
this
.
getContext
=
function
()
{
this
.
getContext
=
function
()
{
return
_gl
;
return
_gl
;
};
};
this
.
getContextAttributes
=
function
()
{
this
.
getContextAttributes
=
function
()
{
return
_gl
.
getContextAttributes
();
return
_gl
.
getContextAttributes
();
};
};
this
.
forceContextLoss
=
function
()
{
this
.
forceContextLoss
=
function
()
{
var
extension
=
extensions
.
get
(
'
WEBGL_lose_context
'
);
var
extension
=
extensions
.
get
(
'
WEBGL_lose_context
'
);
if
(
extension
)
extension
.
loseContext
();
if
(
extension
)
extension
.
loseContext
();
};
};
this
.
forceContextRestore
=
function
()
{
this
.
forceContextRestore
=
function
()
{
var
extension
=
extensions
.
get
(
'
WEBGL_lose_context
'
);
var
extension
=
extensions
.
get
(
'
WEBGL_lose_context
'
);
if
(
extension
)
extension
.
restoreContext
();
if
(
extension
)
extension
.
restoreContext
();
};
};
this
.
getPixelRatio
=
function
()
{
this
.
getPixelRatio
=
function
()
{
return
_pixelRatio
;
return
_pixelRatio
;
};
};
this
.
setPixelRatio
=
function
(
value
)
{
this
.
setPixelRatio
=
function
(
value
)
{
if
(
value
===
undefined
)
return
;
if
(
value
===
undefined
)
return
;
_pixelRatio
=
value
;
_pixelRatio
=
value
;
this
.
setSize
(
_width
,
_height
,
false
);
this
.
setSize
(
_width
,
_height
,
false
);
};
};
this
.
getSize
=
function
(
target
)
{
this
.
getSize
=
function
(
target
)
{
if
(
target
===
undefined
)
{
if
(
target
===
undefined
)
{
console
.
warn
(
'
WebGLRenderer: .getsize() now requires a Vector2 as an argument
'
);
console
.
warn
(
'
WebGLRenderer: .getsize() now requires a Vector2 as an argument
'
);
target
=
new
Vector2
();
target
=
new
Vector2
();
}
}
return
target
.
set
(
_width
,
_height
);
return
target
.
set
(
_width
,
_height
);
};
};
this
.
setSize
=
function
(
width
,
height
,
updateStyle
)
{
this
.
setSize
=
function
(
width
,
height
,
updateStyle
)
{
if
(
vr
.
isPresenting
()
)
{
if
(
vr
.
isPresenting
()
)
{
console
.
warn
(
'
THREE.WebGLRenderer: Can
\'
t change size while VR device is presenting.
'
);
console
.
warn
(
'
THREE.WebGLRenderer: Can
\'
t change size while VR device is presenting.
'
);
return
;
return
;
}
}
_width
=
width
;
_width
=
width
;
_height
=
height
;
_height
=
height
;
_canvas
.
width
=
Math
.
floor
(
width
*
_pixelRatio
);
_canvas
.
width
=
Math
.
floor
(
width
*
_pixelRatio
);
_canvas
.
height
=
Math
.
floor
(
height
*
_pixelRatio
);
_canvas
.
height
=
Math
.
floor
(
height
*
_pixelRatio
);
if
(
updateStyle
!==
false
)
{
if
(
updateStyle
!==
false
)
{
_canvas
.
style
.
width
=
width
+
'
px
'
;
_canvas
.
style
.
width
=
width
+
'
px
'
;
_canvas
.
style
.
height
=
height
+
'
px
'
;
_canvas
.
style
.
height
=
height
+
'
px
'
;
}
}
this
.
setViewport
(
0
,
0
,
width
,
height
);
this
.
setViewport
(
0
,
0
,
width
,
height
);
};
};
this
.
getDrawingBufferSize
=
function
(
target
)
{
this
.
getDrawingBufferSize
=
function
(
target
)
{
if
(
target
===
undefined
)
{
if
(
target
===
undefined
)
{
console
.
warn
(
'
WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument
'
);
console
.
warn
(
'
WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument
'
);
target
=
new
Vector2
();
target
=
new
Vector2
();
}
}
return
target
.
set
(
_width
*
_pixelRatio
,
_height
*
_pixelRatio
).
floor
();
return
target
.
set
(
_width
*
_pixelRatio
,
_height
*
_pixelRatio
).
floor
();
};
};
this
.
setDrawingBufferSize
=
function
(
width
,
height
,
pixelRatio
)
{
this
.
setDrawingBufferSize
=
function
(
width
,
height
,
pixelRatio
)
{
_width
=
width
;
_width
=
width
;
_height
=
height
;
_height
=
height
;
_pixelRatio
=
pixelRatio
;
_pixelRatio
=
pixelRatio
;
...
@@ -2275,18 +2275,23 @@ function WebGLRenderer( parameters ) {
...
@@ -2275,18 +2275,23 @@ function WebGLRenderer( parameters ) {
uniforms
.
clearCoat
.
value
=
material
.
clearCoat
;
uniforms
.
clearCoat
.
value
=
material
.
clearCoat
;
uniforms
.
clearCoatRoughness
.
value
=
material
.
clearCoatRoughness
;
uniforms
.
clearCoatRoughness
.
value
=
material
.
clearCoatRoughness
;
if
(
material
.
normalMap
||
material
.
clearCoatNormalMap
)
{
if
(
material
.
normalMap
||
material
.
clearCoatNormalMap
)
{
if
(
material
.
clearCoatNormalMap
)
{
if
(
material
.
clearCoatNormalMap
){
uniforms
.
clearCoatNormalMap
.
value
=
material
.
clearCoatNormalMap
;
uniforms
.
clearCoatNormalMap
.
value
=
material
.
clearCoatNormalMap
;
}
}
uniforms
.
clearCoatNormalScale
.
value
.
copy
(
material
.
clearCoatNormalScale
);
uniforms
.
clearCoatNormalScale
.
value
.
copy
(
material
.
clearCoatNormalScale
);
if
(
material
.
side
===
BackSide
){
if
(
material
.
side
===
BackSide
)
{
uniforms
.
clearCoatNormalScale
.
value
.
negate
();
uniforms
.
clearCoatNormalScale
.
value
.
negate
();
}
}
}
}
}
}
function
refreshUniformsMatcap
(
uniforms
,
material
)
{
function
refreshUniformsMatcap
(
uniforms
,
material
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录