Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fktz008
three.js
提交
3f20fee0
T
three.js
项目概览
fktz008
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
3f20fee0
编写于
4月 04, 2011
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
差异文件
Merge remote branch 'empaempa/master' into experimental
上级
63ab3c2d
0acad374
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
491 addition
and
315 deletion
+491
-315
build/Three.js
build/Three.js
+252
-247
src/extras/cameras/QuakeCamera.js
src/extras/cameras/QuakeCamera.js
+44
-23
src/materials/MeshShaderMaterial.js
src/materials/MeshShaderMaterial.js
+1
-0
src/renderers/WebGLRenderTarget.js
src/renderers/WebGLRenderTarget.js
+3
-0
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+191
-45
未找到文件。
build/Three.js
浏览文件 @
3f20fee0
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
src/extras/cameras/QuakeCamera.js
浏览文件 @
3f20fee0
...
...
@@ -91,6 +91,7 @@ THREE.QuakeCamera = function ( parameters ) {
this
.
moveBackward
=
false
;
this
.
moveLeft
=
false
;
this
.
moveRight
=
false
;
this
.
freeze
=
false
;
this
.
mouseDragOn
=
false
;
...
...
@@ -159,6 +160,8 @@ THREE.QuakeCamera = function ( parameters ) {
case
39
:
/*right*/
case
68
:
/*D*/
this
.
moveRight
=
true
;
break
;
case
81
:
this
.
freeze
=
!
this
.
freeze
;
break
;
}
...
...
@@ -186,30 +189,48 @@ THREE.QuakeCamera = function ( parameters ) {
this
.
update
=
function
()
{
if
(
this
.
heightSpeed
)
{
var
y
=
clamp
(
this
.
position
.
y
,
this
.
heightMin
,
this
.
heightMax
),
delta
=
y
-
this
.
heightMin
;
this
.
autoSpeedFactor
=
delta
*
this
.
heightCoef
;
}
else
{
this
.
autoSpeedFactor
=
0.0
;
}
if
(
this
.
moveForward
||
this
.
autoForward
)
this
.
translateZ
(
-
(
this
.
movementSpeed
+
this
.
autoSpeedFactor
)
);
if
(
this
.
moveBackward
)
this
.
translateZ
(
this
.
movementSpeed
);
if
(
this
.
moveLeft
)
this
.
translateX
(
-
this
.
movementSpeed
);
if
(
this
.
moveRight
)
this
.
translateX
(
this
.
movementSpeed
);
var
actualLookSpeed
=
this
.
lookSpeed
;
if
(
!
this
.
activeLook
)
{
actualLookSpeed
=
0
;
if
(
!
this
.
freeze
)
{
if
(
this
.
heightSpeed
)
{
var
y
=
clamp
(
this
.
position
.
y
,
this
.
heightMin
,
this
.
heightMax
),
delta
=
y
-
this
.
heightMin
;
this
.
autoSpeedFactor
=
delta
*
this
.
heightCoef
;
}
else
{
this
.
autoSpeedFactor
=
0.0
;
}
if
(
this
.
moveForward
||
this
.
autoForward
)
this
.
translateZ
(
-
(
this
.
movementSpeed
+
this
.
autoSpeedFactor
)
);
if
(
this
.
moveBackward
)
this
.
translateZ
(
this
.
movementSpeed
);
if
(
this
.
moveLeft
)
this
.
translateX
(
-
this
.
movementSpeed
);
if
(
this
.
moveRight
)
this
.
translateX
(
this
.
movementSpeed
);
var
actualLookSpeed
=
this
.
lookSpeed
;
if
(
!
this
.
activeLook
)
{
actualLookSpeed
=
0
;
}
this
.
lon
+=
this
.
mouseX
*
actualLookSpeed
;
if
(
this
.
lookVertical
)
this
.
lat
-=
this
.
mouseY
*
actualLookSpeed
;
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
)
);
this
.
phi
=
(
90
-
this
.
lat
)
*
Math
.
PI
/
180
;
this
.
theta
=
this
.
lon
*
Math
.
PI
/
180
;
var
targetPosition
=
this
.
target
.
position
,
position
=
this
.
position
;
targetPosition
.
x
=
position
.
x
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
targetPosition
.
y
=
position
.
y
+
100
*
Math
.
cos
(
this
.
phi
);
targetPosition
.
z
=
position
.
z
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
);
}
this
.
lon
+=
this
.
mouseX
*
actualLookSpeed
;
...
...
src/materials/MeshShaderMaterial.js
浏览文件 @
3f20fee0
...
...
@@ -37,6 +37,7 @@ THREE.MeshShaderMaterial = function ( parameters ) {
this
.
wireframe
=
parameters
.
wireframe
!==
undefined
?
parameters
.
wireframe
:
false
;
this
.
wireframeLinewidth
=
parameters
.
wireframeLinewidth
!==
undefined
?
parameters
.
wireframeLinewidth
:
1
;
this
.
fog
=
parameters
.
fog
!==
undefined
?
parameters
.
fog
:
false
;
// set to use scene fog
this
.
lights
=
parameters
.
lights
!==
undefined
?
parameters
.
lights
:
false
;
// set to use scene lights
this
.
vertexColors
=
parameters
.
vertexColors
!==
undefined
?
parameters
.
vertexColors
:
false
;
// set to use "color" attribute stream
this
.
skinning
=
parameters
.
skinning
!==
undefined
?
parameters
.
skinning
:
false
;
// set to use skinning attribute streams
...
...
src/renderers/WebGLRenderTarget.js
浏览文件 @
3f20fee0
...
...
@@ -17,5 +17,8 @@ THREE.WebGLRenderTarget = function ( width, height, options ) {
this
.
format
=
options
.
format
!==
undefined
?
options
.
format
:
THREE
.
RGBFormat
;
this
.
type
=
options
.
type
!==
undefined
?
options
.
type
:
THREE
.
UnsignedByteType
;
this
.
depthBuffer
=
options
.
depthBuffer
!==
undefined
?
options
.
depthBuffer
:
true
;
this
.
stencilBuffer
=
options
.
stencilBuffer
!==
undefined
?
options
.
stencilBuffer
:
true
;
};
src/renderers/WebGLRenderer.js
浏览文件 @
3f20fee0
...
...
@@ -105,10 +105,10 @@ THREE.WebGLRenderer = function ( parameters ) {
_stencilShadow
.
faces
=
new
Uint16Array
(
6
);
_stencilShadow
.
darkness
=
0.5
;
_stencilShadow
.
vertices
[
0
*
3
+
0
]
=
-
2
;
_stencilShadow
.
vertices
[
0
*
3
+
1
]
=
-
1
;
_stencilShadow
.
vertices
[
0
*
3
+
2
]
=
-
1
;
_stencilShadow
.
vertices
[
1
*
3
+
0
]
=
2
;
_stencilShadow
.
vertices
[
1
*
3
+
1
]
=
-
1
;
_stencilShadow
.
vertices
[
1
*
3
+
2
]
=
-
1
;
_stencilShadow
.
vertices
[
2
*
3
+
0
]
=
2
;
_stencilShadow
.
vertices
[
2
*
3
+
1
]
=
1
;
_stencilShadow
.
vertices
[
2
*
3
+
2
]
=
-
1
;
_stencilShadow
.
vertices
[
3
*
3
+
0
]
=
-
2
;
_stencilShadow
.
vertices
[
3
*
3
+
1
]
=
1
;
_stencilShadow
.
vertices
[
3
*
3
+
2
]
=
-
1
;
_stencilShadow
.
vertices
[
0
*
3
+
0
]
=
-
2
0
;
_stencilShadow
.
vertices
[
0
*
3
+
1
]
=
-
20
;
_stencilShadow
.
vertices
[
0
*
3
+
2
]
=
-
1
;
_stencilShadow
.
vertices
[
1
*
3
+
0
]
=
2
0
;
_stencilShadow
.
vertices
[
1
*
3
+
1
]
=
-
20
;
_stencilShadow
.
vertices
[
1
*
3
+
2
]
=
-
1
;
_stencilShadow
.
vertices
[
2
*
3
+
0
]
=
2
0
;
_stencilShadow
.
vertices
[
2
*
3
+
1
]
=
20
;
_stencilShadow
.
vertices
[
2
*
3
+
2
]
=
-
1
;
_stencilShadow
.
vertices
[
3
*
3
+
0
]
=
-
2
0
;
_stencilShadow
.
vertices
[
3
*
3
+
1
]
=
20
;
_stencilShadow
.
vertices
[
3
*
3
+
2
]
=
-
1
;
_stencilShadow
.
faces
[
0
]
=
0
;
_stencilShadow
.
faces
[
1
]
=
1
;
_stencilShadow
.
faces
[
2
]
=
2
;
_stencilShadow
.
faces
[
3
]
=
0
;
_stencilShadow
.
faces
[
4
]
=
2
;
_stencilShadow
.
faces
[
5
]
=
3
;
...
...
@@ -616,6 +616,7 @@ THREE.WebGLRenderer = function ( parameters ) {
offset_skin
=
0
,
offset_morphTarget
=
0
,
offset_custom
=
0
,
offset_customSrc
=
0
,
vertexArray
=
geometryGroup
.
__vertexArray
,
uvArray
=
geometryGroup
.
__uvArray
,
...
...
@@ -675,6 +676,7 @@ THREE.WebGLRenderer = function ( parameters ) {
for
(
a
in
customAttributes
)
{
customAttributes
[
a
].
offset
=
0
;
customAttributes
[
a
].
offsetSrc
=
0
;
}
...
...
@@ -739,20 +741,61 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
customAttribute
.
needsUpdate
)
{
offset_custom
=
customAttribute
.
offset
;
offset_customSrc
=
customAttribute
.
offsetSrc
;
if
(
customAttribute
.
size
===
1
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
customAttribute
.
value
[
face
.
a
];
customAttribute
.
array
[
offset_custom
+
1
]
=
customAttribute
.
value
[
face
.
b
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
face
.
c
];
if
(
customAttribute
.
boundTo
===
undefined
||
customAttribute
.
boundTo
===
"
vertices
"
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
customAttribute
.
value
[
face
.
a
];
customAttribute
.
array
[
offset_custom
+
1
]
=
customAttribute
.
value
[
face
.
b
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
face
.
c
];
}
else
if
(
customAttribute
.
boundTo
===
"
faces
"
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
customAttribute
.
value
[
offset_customSrc
];
customAttribute
.
array
[
offset_custom
+
1
]
=
customAttribute
.
value
[
offset_customSrc
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
offset_customSrc
];
customAttribute
.
offsetSrc
++
;
}
else
if
(
customAttribute
.
boundTo
===
"
faceVertices
"
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
customAttribute
.
value
[
offset_customSrc
+
0
];
customAttribute
.
array
[
offset_custom
+
1
]
=
customAttribute
.
value
[
offset_customSrc
+
1
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
offset_customSrc
+
2
];
customAttribute
.
offsetSrc
+=
3
;
}
customAttribute
.
offset
+=
3
;
}
else
{
v1
=
customAttribute
.
value
[
face
.
a
];
v2
=
customAttribute
.
value
[
face
.
b
];
v3
=
customAttribute
.
value
[
face
.
c
];
if
(
customAttribute
.
boundTo
===
undefined
||
customAttribute
.
boundTo
===
"
vertices
"
)
{
v1
=
customAttribute
.
value
[
face
.
a
];
v2
=
customAttribute
.
value
[
face
.
b
];
v3
=
customAttribute
.
value
[
face
.
c
];
}
else
if
(
customAttribute
.
boundTo
===
"
faces
"
)
{
v1
=
customAttribute
.
value
[
offset_customSrc
];
v2
=
customAttribute
.
value
[
offset_customSrc
];
v3
=
customAttribute
.
value
[
offset_customSrc
];
customAttribute
.
offsetSrc
++
;
}
else
if
(
customAttribute
.
boundTo
===
"
faceVertices
"
)
{
v1
=
customAttribute
.
value
[
offset_customSrc
+
0
];
v2
=
customAttribute
.
value
[
offset_customSrc
+
1
];
v3
=
customAttribute
.
value
[
offset_customSrc
+
2
];
customAttribute
.
offsetSrc
+=
3
;
}
if
(
customAttribute
.
size
===
2
)
{
...
...
@@ -767,15 +810,31 @@ THREE.WebGLRenderer = function ( parameters ) {
}
else
if
(
customAttribute
.
size
===
3
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
x
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
y
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v1
.
z
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v2
.
x
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v2
.
y
;
customAttribute
.
array
[
offset_custom
+
5
]
=
v2
.
z
;
customAttribute
.
array
[
offset_custom
+
6
]
=
v3
.
x
;
customAttribute
.
array
[
offset_custom
+
7
]
=
v3
.
y
;
customAttribute
.
array
[
offset_custom
+
8
]
=
v3
.
z
;
if
(
customAttribute
.
type
===
"
c
"
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
r
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
g
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v1
.
b
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v2
.
r
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v2
.
g
;
customAttribute
.
array
[
offset_custom
+
5
]
=
v2
.
b
;
customAttribute
.
array
[
offset_custom
+
6
]
=
v3
.
r
;
customAttribute
.
array
[
offset_custom
+
7
]
=
v3
.
g
;
customAttribute
.
array
[
offset_custom
+
8
]
=
v3
.
b
;
}
else
{
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
x
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
y
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v1
.
z
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v2
.
x
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v2
.
y
;
customAttribute
.
array
[
offset_custom
+
5
]
=
v2
.
z
;
customAttribute
.
array
[
offset_custom
+
6
]
=
v3
.
x
;
customAttribute
.
array
[
offset_custom
+
7
]
=
v3
.
y
;
customAttribute
.
array
[
offset_custom
+
8
]
=
v3
.
z
;
}
customAttribute
.
offset
+=
9
;
...
...
@@ -1105,22 +1164,66 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
customAttribute
.
needsUpdate
)
{
offset_custom
=
customAttribute
.
offset
;
offset_customSrc
=
customAttribute
.
offsetSrc
;
if
(
customAttribute
.
size
===
1
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
customAttribute
.
value
[
face
.
a
];
customAttribute
.
array
[
offset_custom
+
1
]
=
customAttribute
.
value
[
face
.
b
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
face
.
c
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
face
.
d
];
if
(
customAttribute
.
boundTo
===
undefined
||
customAttribute
.
boundTo
===
"
vertices
"
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
customAttribute
.
value
[
face
.
a
];
customAttribute
.
array
[
offset_custom
+
1
]
=
customAttribute
.
value
[
face
.
b
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
face
.
c
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
face
.
d
];
}
else
if
(
customAttribute
.
boundTo
===
"
faces
"
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
customAttribute
.
value
[
offset_customSrc
];
customAttribute
.
array
[
offset_custom
+
1
]
=
customAttribute
.
value
[
offset_customSrc
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
offset_customSrc
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
offset_customSrc
];
customAttribute
.
offsetSrc
++
;
}
else
if
(
customAttribute
.
boundTo
===
"
faceVertices
"
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
customAttribute
.
value
[
offset_customSrc
+
0
];
customAttribute
.
array
[
offset_custom
+
1
]
=
customAttribute
.
value
[
offset_customSrc
+
1
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
offset_customSrc
+
2
];
customAttribute
.
array
[
offset_custom
+
2
]
=
customAttribute
.
value
[
offset_customSrc
+
3
];
customAttribute
.
offsetSrc
+=
4
;
}
customAttribute
.
offset
+=
4
;
}
else
{
v1
=
customAttribute
.
value
[
face
.
a
];
v2
=
customAttribute
.
value
[
face
.
b
];
v3
=
customAttribute
.
value
[
face
.
c
];
v4
=
customAttribute
.
value
[
face
.
d
];
if
(
customAttribute
.
boundTo
===
undefined
||
customAttribute
.
boundTo
===
"
vertices
"
)
{
v1
=
customAttribute
.
value
[
face
.
a
];
v2
=
customAttribute
.
value
[
face
.
b
];
v3
=
customAttribute
.
value
[
face
.
c
];
v4
=
customAttribute
.
value
[
face
.
d
];
}
else
if
(
customAttribute
.
boundTo
===
"
faces
"
)
{
v1
=
customAttribute
.
value
[
offset_customSrc
];
v2
=
customAttribute
.
value
[
offset_customSrc
];
v3
=
customAttribute
.
value
[
offset_customSrc
];
v4
=
customAttribute
.
value
[
offset_customSrc
];
customAttribute
.
offsetSrc
++
;
}
else
if
(
customAttribute
.
boundTo
===
"
faceVertices
"
)
{
v1
=
customAttribute
.
value
[
offset_customSrc
+
0
];
v2
=
customAttribute
.
value
[
offset_customSrc
+
1
];
v3
=
customAttribute
.
value
[
offset_customSrc
+
2
];
v4
=
customAttribute
.
value
[
offset_customSrc
+
3
];
customAttribute
.
offsetSrc
+=
4
;
}
if
(
customAttribute
.
size
===
2
)
{
...
...
@@ -1137,18 +1240,37 @@ THREE.WebGLRenderer = function ( parameters ) {
}
else
if
(
customAttribute
.
size
===
3
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
x
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
y
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v1
.
z
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v2
.
x
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v2
.
y
;
customAttribute
.
array
[
offset_custom
+
5
]
=
v2
.
z
;
customAttribute
.
array
[
offset_custom
+
6
]
=
v3
.
x
;
customAttribute
.
array
[
offset_custom
+
7
]
=
v3
.
y
;
customAttribute
.
array
[
offset_custom
+
8
]
=
v3
.
z
;
customAttribute
.
array
[
offset_custom
+
9
]
=
v4
.
x
;
customAttribute
.
array
[
offset_custom
+
10
]
=
v4
.
y
;
customAttribute
.
array
[
offset_custom
+
11
]
=
v4
.
z
;
if
(
customAttribute
.
type
===
"
c
"
)
{
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
r
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
g
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v1
.
b
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v2
.
r
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v2
.
g
;
customAttribute
.
array
[
offset_custom
+
5
]
=
v2
.
b
;
customAttribute
.
array
[
offset_custom
+
6
]
=
v3
.
r
;
customAttribute
.
array
[
offset_custom
+
7
]
=
v3
.
g
;
customAttribute
.
array
[
offset_custom
+
8
]
=
v3
.
b
;
customAttribute
.
array
[
offset_custom
+
9
]
=
v4
.
r
;
customAttribute
.
array
[
offset_custom
+
10
]
=
v4
.
g
;
customAttribute
.
array
[
offset_custom
+
11
]
=
v4
.
b
;
}
else
{
customAttribute
.
array
[
offset_custom
+
0
]
=
v1
.
x
;
customAttribute
.
array
[
offset_custom
+
1
]
=
v1
.
y
;
customAttribute
.
array
[
offset_custom
+
2
]
=
v1
.
z
;
customAttribute
.
array
[
offset_custom
+
3
]
=
v2
.
x
;
customAttribute
.
array
[
offset_custom
+
4
]
=
v2
.
y
;
customAttribute
.
array
[
offset_custom
+
5
]
=
v2
.
z
;
customAttribute
.
array
[
offset_custom
+
6
]
=
v3
.
x
;
customAttribute
.
array
[
offset_custom
+
7
]
=
v3
.
y
;
customAttribute
.
array
[
offset_custom
+
8
]
=
v3
.
z
;
customAttribute
.
array
[
offset_custom
+
9
]
=
v4
.
x
;
customAttribute
.
array
[
offset_custom
+
10
]
=
v4
.
y
;
customAttribute
.
array
[
offset_custom
+
11
]
=
v4
.
z
;
}
customAttribute
.
offset
+=
12
;
...
...
@@ -2913,6 +3035,7 @@ THREE.WebGLRenderer = function ( parameters ) {
_gl
.
enable
(
_gl
.
POLYGON_OFFSET_FILL
);
_gl
.
polygonOffset
(
0.1
,
1.0
);
_gl
.
enable
(
_gl
.
STENCIL_TEST
);
_gl
.
enable
(
_gl
.
DEPTH_TEST
);
_gl
.
depthMask
(
false
);
_gl
.
colorMask
(
false
,
false
,
false
,
false
);
...
...
@@ -4161,14 +4284,13 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
renderTexture
&&
!
renderTexture
.
__webglFramebuffer
)
{
if
(
renderTexture
.
depthBuffer
===
undefined
)
renderTexture
.
depthBuffer
=
true
;
if
(
renderTexture
.
stencilBuffer
===
undefined
)
renderTexture
.
stencilBuffer
=
true
;
renderTexture
.
__webglFramebuffer
=
_gl
.
createFramebuffer
();
renderTexture
.
__webglRenderbuffer
=
_gl
.
createRenderbuffer
();
renderTexture
.
__webglTexture
=
_gl
.
createTexture
();
// Setup renderbuffer
_gl
.
bindRenderbuffer
(
_gl
.
RENDERBUFFER
,
renderTexture
.
__webglRenderbuffer
);
_gl
.
renderbufferStorage
(
_gl
.
RENDERBUFFER
,
_gl
.
DEPTH_COMPONENT16
,
renderTexture
.
width
,
renderTexture
.
height
);
// Setup texture
...
...
@@ -4179,11 +4301,35 @@ THREE.WebGLRenderer = function ( parameters ) {
_gl
.
texParameteri
(
_gl
.
TEXTURE_2D
,
_gl
.
TEXTURE_MIN_FILTER
,
paramThreeToGL
(
renderTexture
.
minFilter
)
);
_gl
.
texImage2D
(
_gl
.
TEXTURE_2D
,
0
,
paramThreeToGL
(
renderTexture
.
format
),
renderTexture
.
width
,
renderTexture
.
height
,
0
,
paramThreeToGL
(
renderTexture
.
format
),
paramThreeToGL
(
renderTexture
.
type
),
null
);
// Setup
frame
buffer
// Setup
render and frame
buffer
_gl
.
bindRenderbuffer
(
_gl
.
RENDERBUFFER
,
renderTexture
.
__webglRenderbuffer
);
_gl
.
bindFramebuffer
(
_gl
.
FRAMEBUFFER
,
renderTexture
.
__webglFramebuffer
);
_gl
.
framebufferTexture2D
(
_gl
.
FRAMEBUFFER
,
_gl
.
COLOR_ATTACHMENT0
,
_gl
.
TEXTURE_2D
,
renderTexture
.
__webglTexture
,
0
);
_gl
.
framebufferRenderbuffer
(
_gl
.
FRAMEBUFFER
,
_gl
.
DEPTH_ATTACHMENT
,
_gl
.
RENDERBUFFER
,
renderTexture
.
__webglRenderbuffer
);
if
(
renderTexture
.
depthBuffer
&&
!
renderTexture
.
stencilBuffer
)
{
_gl
.
renderbufferStorage
(
_gl
.
RENDERBUFFER
,
_gl
.
DEPTH_COMPONENT16
,
renderTexture
.
width
,
renderTexture
.
height
);
_gl
.
framebufferRenderbuffer
(
_gl
.
FRAMEBUFFER
,
_gl
.
DEPTH_ATTACHMENT
,
_gl
.
RENDERBUFFER
,
renderTexture
.
__webglRenderbuffer
);
/* For some reason this is not working. Defaulting to RGBA4.
} else if( !renderTexture.depthBuffer && renderTexture.stencilBuffer ) {
_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.STENCIL_INDEX8, renderTexture.width, renderTexture.height );
_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderTexture.__webglRenderbuffer );
*/
}
else
if
(
renderTexture
.
depthBuffer
&&
renderTexture
.
stencilBuffer
)
{
_gl
.
renderbufferStorage
(
_gl
.
RENDERBUFFER
,
_gl
.
DEPTH_STENCIL
,
renderTexture
.
width
,
renderTexture
.
height
);
_gl
.
framebufferRenderbuffer
(
_gl
.
FRAMEBUFFER
,
_gl
.
DEPTH_STENCIL_ATTACHMENT
,
_gl
.
RENDERBUFFER
,
renderTexture
.
__webglRenderbuffer
);
}
else
{
_gl
.
renderbufferStorage
(
_gl
.
RENDERBUFFER
,
_gl
.
RGBA4
,
renderTexture
.
width
,
renderTexture
.
height
);
}
// Release everything
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录