Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
522da658
T
three.js
项目概览
Ablesons
/
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,发现更多精彩内容 >>
提交
522da658
编写于
7月 01, 2011
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed Sprite removal bug.
上级
d6345d71
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
64 addition
and
48 deletion
+64
-48
build/Three.js
build/Three.js
+3
-3
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+3
-3
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+58
-42
未找到文件。
build/Three.js
浏览文件 @
522da658
...
...
@@ -332,9 +332,9 @@ if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(v=k.numMorphTargets;u<v;
B
.
createUniqueBuffers
)
B
.
__webglInitialized
=!
0
,
w
=
1
,
B
.
type
===
"
v2
"
?
w
=
2
:
B
.
type
===
"
v3
"
?
w
=
3
:
B
.
type
===
"
v4
"
?
w
=
4
:
B
.
type
===
"
c
"
&&
(
w
=
3
),
B
.
size
=
w
,
B
.
array
=
new
Float32Array
(
n
*
w
),
B
.
buffer
=
j
.
createBuffer
(),
B
.
buffer
.
belongsToAttribute
=
a
,
p
.
needsUpdate
=!
0
,
B
.
__original
=
p
;
k
.
__webglCustomAttributes
[
a
]
=
B
}
k
.
__inittedArrays
=!
0
;
g
.
__dirtyVertices
=!
0
;
g
.
__dirtyMorphTargets
=!
0
;
g
.
__dirtyElements
=!
0
;
g
.
__dirtyUvs
=!
0
;
g
.
__dirtyNormals
=!
0
;
g
.
__dirtyTangents
=!
0
;
g
.
__dirtyColors
=!
0
}
e
instanceof
THREE
.
ShadowVolume
?
E
(
c
.
__webglShadowVolumes
,
h
,
e
):
E
(
c
.
__webglObjects
,
h
,
e
)}
else
if
(
e
instanceof
THREE
.
LensFlare
)
E
(
c
.
__webglLensFlares
,
void
0
,
e
);
else
if
(
e
instanceof
THREE
.
Ribbon
){
g
=
e
.
geometry
;
if
(
!
g
.
__webglVertexBuffer
)
f
=
g
,
f
.
__webglVertexBuffer
=
j
.
createBuffer
(),
f
.
__webglColorBuffer
=
j
.
createBuffer
(),
f
=
g
,
h
=
f
.
vertices
.
length
,
f
.
__vertexArray
=
new
Float32Array
(
h
*
3
),
f
.
__colorArray
=
new
Float32Array
(
h
*
3
),
f
.
__webglVertexCount
=
h
,
g
.
__dirtyVertices
=!
0
,
g
.
__dirtyColors
=!
0
;
E
(
c
.
__webglObjects
,
g
,
e
)}
else
if
(
e
instanceof
THREE
.
Line
){
g
=
e
.
geometry
;
if
(
!
g
.
__webglVertexBuffer
)
f
=
g
,
f
.
__webglVertexBuffer
=
j
.
createBuffer
(),
f
.
__webglColorBuffer
=
j
.
createBuffer
(),
f
=
g
,
h
=
f
.
vertices
.
length
,
f
.
__vertexArray
=
new
Float32Array
(
h
*
3
),
f
.
__colorArray
=
new
Float32Array
(
h
*
3
),
f
.
__webglLineCount
=
h
,
g
.
__dirtyVertices
=!
0
,
g
.
__dirtyColors
=!
0
;
E
(
c
.
__webglObjects
,
g
,
e
)}
else
if
(
e
instanceof
THREE
.
ParticleSystem
){
g
=
e
.
geometry
;
if
(
!
g
.
__webglVertexBuffer
)
f
=
g
,
f
.
__webglVertexBuffer
=
j
.
createBuffer
(),
f
.
__webglColorBuffer
=
j
.
createBuffer
(),
f
=
g
,
h
=
f
.
vertices
.
length
,
f
.
__vertexArray
=
new
Float32Array
(
h
*
3
),
f
.
__colorArray
=
new
Float32Array
(
h
*
3
),
f
.
__sortArray
=
[],
f
.
__webglParticleCount
=
h
,
g
.
__dirtyVertices
=!
0
,
g
.
__dirtyColors
=!
0
;
E
(
c
.
__webglObjects
,
g
,
e
)}
else
THREE
.
MarchingCubes
!==
void
0
&&
e
instanceof
THREE
.
MarchingCubes
?
c
.
__webglObjectsImmediate
.
push
({
object
:
e
,
opaque
:{
list
:[],
count
:
0
},
transparent
:{
list
:[],
count
:
0
}}):
e
instanceof
THREE
.
Sprite
&&
c
.
__webglSprites
.
push
(
e
);
b
.
__objectsAdded
.
splice
(
0
,
1
)}
for
(;
b
.
__objectsRemoved
.
length
;)
e
=
b
.
__objectsRemoved
[
0
],
c
=
b
,
e
instanceof
THREE
.
ShadowVolume
?
G
(
c
.
__webglShadowVolumes
,
e
):
e
instanceof
THREE
.
Mesh
||
e
instanceof
THREE
.
ParticleSystem
||
e
instanceof
THREE
.
Ribbon
||
e
instanceof
THREE
.
Line
?
G
(
c
.
__webglObjects
,
e
):
e
instanceof
THREE
.
Sprite
?
G
(
c
.
__webglSprites
,
e
):
e
instanceof
THREE
.
LensFlare
?
G
(
c
.
__webglLensFlares
,
e
):
e
instanceof
THREE
.
MarchingCubes
&&
G
(
c
.
__webglObjectsImmediate
,
e
),
b
.
__objectsRemoved
.
splice
(
0
,
1
);
e
=
0
;
for
(
c
=
b
.
__webglObjects
.
length
;
e
<
c
;
e
++
)
x
(
b
.
__webglObjects
[
e
].
object
,
b
);
e
=
0
;
for
(
c
=
b
.
__webglShadowVolumes
.
length
;
e
<
c
;
e
++
)
x
(
b
.
__webglShadowVolumes
[
e
].
object
,
b
);
e
=
0
;
for
(
c
=
b
.
__webglLensFlar
es
.
length
;
e
<
c
;
e
++
)
x
(
b
.
__webglLensFlares
[
e
].
object
,
b
)};
this
.
setFaceCulling
=
function
(
b
,
e
){
b
?(
!
e
||
e
==
"
ccw
"
?
j
.
frontFace
(
j
.
CCW
):
j
.
frontFace
(
j
.
CW
),
b
==
"
back
"
?
j
.
cullFace
(
j
.
BACK
):
b
==
"
front
"
?
j
.
cullFace
(
j
.
FRONT
):
j
.
cullFace
(
j
.
FRONT_AND_BACK
),
j
.
enable
(
j
.
CULL_FACE
)):
j
.
disable
(
j
.
CULL_FACE
)};
this
.
supportsVertexTextures
=
function
(){
return
Ba
}};
new
Float32Array
(
h
*
3
),
f
.
__sortArray
=
[],
f
.
__webglParticleCount
=
h
,
g
.
__dirtyVertices
=!
0
,
g
.
__dirtyColors
=!
0
;
E
(
c
.
__webglObjects
,
g
,
e
)}
else
THREE
.
MarchingCubes
!==
void
0
&&
e
instanceof
THREE
.
MarchingCubes
?
c
.
__webglObjectsImmediate
.
push
({
object
:
e
,
opaque
:{
list
:[],
count
:
0
},
transparent
:{
list
:[],
count
:
0
}}):
e
instanceof
THREE
.
Sprite
&&
c
.
__webglSprites
.
push
(
e
);
b
.
__objectsAdded
.
splice
(
0
,
1
)}
for
(;
b
.
__objectsRemoved
.
length
;)
{
c
=
b
.
__objectsRemoved
[
0
];
e
=
b
;
if
(
c
instanceof
THREE
.
ShadowVolume
)
G
(
e
.
__webglShadowVolumes
,
c
);
else
if
(
c
instanceof
THREE
.
Mesh
||
c
instanceof
THREE
.
ParticleSystem
||
c
instanceof
THREE
.
Ribbon
||
c
instanceof
THREE
.
Line
)
G
(
e
.
__webglObjects
,
c
);
else
if
(
c
instanceof
THREE
.
Sprite
){
e
=
e
.
__webglSprites
;
g
=
void
0
;
for
(
g
=
e
.
length
-
1
;
g
>=
0
;
g
--
)
e
[
g
]
==
c
&&
e
.
splice
(
g
,
1
)}
else
c
instanceof
THREE
.
LensFlare
?
G
(
e
.
__webglLensFlares
,
c
):
c
instanceof
THREE
.
MarchingCubes
&&
G
(
e
.
__webglObjectsImmediate
,
c
);
b
.
__objectsRemoved
.
splice
(
0
,
1
)}
e
=
0
;
for
(
c
=
b
.
__webglObjects
.
length
;
e
<
c
;
e
++
)
x
(
b
.
__webglObjects
[
e
].
object
,
b
);
e
=
0
;
for
(
c
=
b
.
__webglShadowVolum
es
.
length
;
e
<
c
;
e
++
)
x
(
b
.
__webgl
ShadowVolumes
[
e
].
object
,
b
);
e
=
0
;
for
(
c
=
b
.
__webglLensFlares
.
length
;
e
<
c
;
e
++
)
x
(
b
.
__webgl
LensFlares
[
e
].
object
,
b
)};
this
.
setFaceCulling
=
function
(
b
,
e
){
b
?(
!
e
||
e
==
"
ccw
"
?
j
.
frontFace
(
j
.
CCW
):
j
.
frontFace
(
j
.
CW
),
b
==
"
back
"
?
j
.
cullFace
(
j
.
BACK
):
b
==
"
front
"
?
j
.
cullFace
(
j
.
FRONT
):
j
.
cullFace
(
j
.
FRONT_AND_BACK
),
j
.
enable
(
j
.
CULL_FACE
)):
j
.
disable
(
j
.
CULL_FACE
)};
this
.
supportsVertexTextures
=
function
(){
return
Ba
}};
THREE
.
WebGLRenderTarget
=
function
(
b
,
c
,
e
){
this
.
width
=
b
;
this
.
height
=
c
;
e
=
e
||
{};
this
.
wrapS
=
e
.
wrapS
!==
void
0
?
e
.
wrapS
:
THREE
.
ClampToEdgeWrapping
;
this
.
wrapT
=
e
.
wrapT
!==
void
0
?
e
.
wrapT
:
THREE
.
ClampToEdgeWrapping
;
this
.
magFilter
=
e
.
magFilter
!==
void
0
?
e
.
magFilter
:
THREE
.
LinearFilter
;
this
.
minFilter
=
e
.
minFilter
!==
void
0
?
e
.
minFilter
:
THREE
.
LinearMipMapLinearFilter
;
this
.
offset
=
new
THREE
.
Vector2
(
0
,
0
);
this
.
repeat
=
new
THREE
.
Vector2
(
1
,
1
);
this
.
format
=
e
.
format
!==
void
0
?
e
.
format
:
THREE
.
RGBAFormat
;
this
.
type
=
e
.
type
!==
void
0
?
e
.
type
:
THREE
.
UnsignedByteType
;
this
.
depthBuffer
=
e
.
depthBuffer
!==
void
0
?
e
.
depthBuffer
:
!
0
;
this
.
stencilBuffer
=
e
.
stencilBuffer
!==
void
0
?
e
.
stencilBuffer
:
!
0
};
THREE
.
SoundRenderer
=
function
(){
this
.
volume
=
1
;
this
.
domElement
=
document
.
createElement
(
"
div
"
);
this
.
domElement
.
id
=
"
THREESound
"
;
this
.
cameraPosition
=
new
THREE
.
Vector3
;
this
.
soundPosition
=
new
THREE
.
Vector3
;
this
.
render
=
function
(
b
,
c
,
e
){
e
&&
b
.
update
(
void
0
,
!
1
,
c
);
var
e
=
b
.
sounds
,
f
,
g
=
e
.
length
;
for
(
f
=
0
;
f
<
g
;
f
++
)
b
=
e
[
f
],
this
.
soundPosition
.
set
(
b
.
matrixWorld
.
n14
,
b
.
matrixWorld
.
n24
,
b
.
matrixWorld
.
n34
),
this
.
soundPosition
.
subSelf
(
c
.
position
),
b
.
isPlaying
&&
b
.
isLoaded
&&
(
b
.
isAddedToDOM
||
b
.
addToDOM
(
this
.
domElement
),
b
.
calculateVolumeAndPan
(
this
.
soundPosition
))}};
...
...
build/custom/ThreeWebGL.js
浏览文件 @
522da658
...
...
@@ -293,8 +293,8 @@ i.__faceArray=new Uint16Array(u*3+(j.geometry.edgeFaces?j.geometry.edgeFaces.len
{},
p
.
attributes
){
o
=
p
.
attributes
[
a
];
t
=
{};
for
(
y
in
o
)
t
[
y
]
=
o
[
y
];
if
(
!
t
.
__webglInitialized
||
t
.
createUniqueBuffers
)
t
.
__webglInitialized
=!
0
,
u
=
1
,
t
.
type
===
"
v2
"
?
u
=
2
:
t
.
type
===
"
v3
"
?
u
=
3
:
t
.
type
===
"
v4
"
?
u
=
4
:
t
.
type
===
"
c
"
&&
(
u
=
3
),
t
.
size
=
u
,
t
.
array
=
new
Float32Array
(
k
*
u
),
t
.
buffer
=
c
.
createBuffer
(),
t
.
buffer
.
belongsToAttribute
=
a
,
o
.
needsUpdate
=!
0
,
t
.
__original
=
o
;
i
.
__webglCustomAttributes
[
a
]
=
t
}
i
.
__inittedArrays
=!
0
;
g
.
__dirtyVertices
=!
0
;
g
.
__dirtyMorphTargets
=!
0
;
g
.
__dirtyElements
=!
0
;
g
.
__dirtyUvs
=!
0
;
g
.
__dirtyNormals
=!
0
;
g
.
__dirtyTangents
=
!
0
;
g
.
__dirtyColors
=!
0
}
d
instanceof
THREE
.
ShadowVolume
?
T
(
e
.
__webglShadowVolumes
,
h
,
d
):
T
(
e
.
__webglObjects
,
h
,
d
)}
else
if
(
d
instanceof
THREE
.
LensFlare
)
T
(
e
.
__webglLensFlares
,
void
0
,
d
);
else
if
(
d
instanceof
THREE
.
Ribbon
){
g
=
d
.
geometry
;
if
(
!
g
.
__webglVertexBuffer
)
f
=
g
,
f
.
__webglVertexBuffer
=
c
.
createBuffer
(),
f
.
__webglColorBuffer
=
c
.
createBuffer
(),
f
=
g
,
h
=
f
.
vertices
.
length
,
f
.
__vertexArray
=
new
Float32Array
(
h
*
3
),
f
.
__colorArray
=
new
Float32Array
(
h
*
3
),
f
.
__webglVertexCount
=
h
,
g
.
__dirtyVertices
=!
0
,
g
.
__dirtyColors
=!
0
;
T
(
e
.
__webglObjects
,
g
,
d
)}
else
if
(
d
instanceof
THREE
.
Line
){
g
=
d
.
geometry
;
if
(
!
g
.
__webglVertexBuffer
)
f
=
g
,
f
.
__webglVertexBuffer
=
c
.
createBuffer
(),
f
.
__webglColorBuffer
=
c
.
createBuffer
(),
f
=
g
,
h
=
f
.
vertices
.
length
,
f
.
__vertexArray
=
new
Float32Array
(
h
*
3
),
f
.
__colorArray
=
new
Float32Array
(
h
*
3
),
f
.
__webglLineCount
=
h
,
g
.
__dirtyVertices
=!
0
,
g
.
__dirtyColors
=!
0
;
T
(
e
.
__webglObjects
,
g
,
d
)}
else
if
(
d
instanceof
THREE
.
ParticleSystem
){
g
=
d
.
geometry
;
if
(
!
g
.
__webglVertexBuffer
)
f
=
g
,
f
.
__webglVertexBuffer
=
c
.
createBuffer
(),
f
.
__webglColorBuffer
=
c
.
createBuffer
(),
f
=
g
,
h
=
f
.
vertices
.
length
,
f
.
__vertexArray
=
new
Float32Array
(
h
*
3
),
f
.
__colorArray
=
new
Float32Array
(
h
*
3
),
f
.
__sortArray
=
[],
f
.
__webglParticleCount
=
h
,
g
.
__dirtyVertices
=!
0
,
g
.
__dirtyColors
=!
0
;
T
(
e
.
__webglObjects
,
g
,
d
)}
else
THREE
.
MarchingCubes
!==
void
0
&&
d
instanceof
THREE
.
MarchingCubes
?
e
.
__webglObjectsImmediate
.
push
({
object
:
d
,
opaque
:{
list
:[],
count
:
0
},
transparent
:{
list
:[],
count
:
0
}}):
d
instanceof
THREE
.
Sprite
&&
e
.
__webglSprites
.
push
(
d
);
b
.
__objectsAdded
.
splice
(
0
,
1
)}
for
(;
b
.
__objectsRemoved
.
length
;)
d
=
b
.
__objectsRemoved
[
0
],
e
=
b
,
d
instanceof
THREE
.
ShadowVolume
?
O
(
e
.
__webglShadowVolumes
,
d
):
d
instanceof
THREE
.
Mesh
||
d
instanceof
THREE
.
ParticleSystem
||
d
instanceof
THREE
.
Ribbon
||
d
instanceof
THREE
.
Line
?
O
(
e
.
__webglObjects
,
d
):
d
instanceof
THREE
.
Sprite
?
O
(
e
.
__webglSprites
,
d
):
d
instanceof
THREE
.
LensFlare
?
O
(
e
.
__webglLensFlares
,
d
):
d
instanceof
THREE
.
MarchingCubes
&&
O
(
e
.
__webglObjectsImmediate
,
d
),
b
.
__objectsRemoved
.
splice
(
0
,
1
);
d
=
0
;
for
(
e
=
b
.
__webglObjects
.
length
;
d
<
e
;
d
++
)
A
(
b
.
__webglObjects
[
d
].
object
,
b
);
d
=
0
;
for
(
e
=
b
.
__webglShadowVolume
s
.
length
;
d
<
e
;
d
++
)
A
(
b
.
__webglShadowVolumes
[
d
].
object
,
b
);
d
=
0
;
for
(
e
=
b
.
__webglLensFlares
.
length
;
d
<
e
;
d
++
)
A
(
b
.
__webglLensFlares
[
d
].
object
,
b
)};
this
.
setFaceCulling
=
function
(
b
,
d
){
b
?(
!
d
||
d
==
"
ccw
"
?
c
.
frontFace
(
c
.
CCW
):
c
.
frontFace
(
c
.
CW
),
b
==
"
back
"
?
c
.
cullFace
(
c
.
BACK
):
b
==
"
front
"
?
c
.
cullFace
(
c
.
FRONT
):
c
.
cullFace
(
c
.
FRONT_AND_BACK
),
c
.
enable
(
c
.
CULL_FACE
)):
c
.
disable
(
c
.
CULL_FACE
)};
this
.
supportsVertexTextures
=
function
(){
return
Ga
}};
f
=
g
,
h
=
f
.
vertices
.
length
,
f
.
__vertexArray
=
new
Float32Array
(
h
*
3
),
f
.
__colorArray
=
new
Float32Array
(
h
*
3
),
f
.
__sortArray
=
[],
f
.
__webglParticleCount
=
h
,
g
.
__dirtyVertices
=!
0
,
g
.
__dirtyColors
=!
0
;
T
(
e
.
__webglObjects
,
g
,
d
)}
else
THREE
.
MarchingCubes
!==
void
0
&&
d
instanceof
THREE
.
MarchingCubes
?
e
.
__webglObjectsImmediate
.
push
({
object
:
d
,
opaque
:{
list
:[],
count
:
0
},
transparent
:{
list
:[],
count
:
0
}}):
d
instanceof
THREE
.
Sprite
&&
e
.
__webglSprites
.
push
(
d
);
b
.
__objectsAdded
.
splice
(
0
,
1
)}
for
(;
b
.
__objectsRemoved
.
length
;)
{
e
=
b
.
__objectsRemoved
[
0
];
d
=
b
;
if
(
e
instanceof
THREE
.
ShadowVolume
)
O
(
d
.
__webglShadowVolumes
,
e
);
else
if
(
e
instanceof
THREE
.
Mesh
||
e
instanceof
THREE
.
ParticleSystem
||
e
instanceof
THREE
.
Ribbon
||
e
instanceof
THREE
.
Line
)
O
(
d
.
__webglObjects
,
e
);
else
if
(
e
instanceof
THREE
.
Sprite
){
d
=
d
.
__webglSprites
;
g
=
void
0
;
for
(
g
=
d
.
length
-
1
;
g
>=
0
;
g
--
)
d
[
g
]
==
e
&&
d
.
splice
(
g
,
1
)}
else
e
instanceof
THREE
.
LensFlare
?
O
(
d
.
__webglLensFlares
,
e
):
e
instanceof
THREE
.
MarchingCubes
&&
O
(
d
.
__webglObjectsImmediate
,
e
);
b
.
__objectsRemoved
.
splice
(
0
,
1
)}
d
=
0
;
for
(
e
=
b
.
__webglObject
s
.
length
;
d
<
e
;
d
++
)
A
(
b
.
__webgl
Objects
[
d
].
object
,
b
);
d
=
0
;
for
(
e
=
b
.
__webglShadowVolumes
.
length
;
d
<
e
;
d
++
)
A
(
b
.
__webgl
ShadowVolumes
[
d
].
object
,
b
);
d
=
0
;
for
(
e
=
b
.
__webglLensFlares
.
length
;
d
<
e
;
d
++
)
A
(
b
.
__webglLensFlares
[
d
].
object
,
b
)};
this
.
setFaceCulling
=
function
(
b
,
d
){
b
?(
!
d
||
d
==
"
ccw
"
?
c
.
frontFace
(
c
.
CCW
):
c
.
frontFace
(
c
.
CW
),
b
==
"
back
"
?
c
.
cullFace
(
c
.
BACK
):
b
==
"
front
"
?
c
.
cullFace
(
c
.
FRONT
):
c
.
cullFace
(
c
.
FRONT_AND_BACK
),
c
.
enable
(
c
.
CULL_FACE
)):
c
.
disable
(
c
.
CULL_FACE
)};
this
.
supportsVertexTextures
=
function
(){
return
Ga
}};
THREE
.
WebGLRenderTarget
=
function
(
b
,
d
,
e
){
this
.
width
=
b
;
this
.
height
=
d
;
e
=
e
||
{};
this
.
wrapS
=
e
.
wrapS
!==
void
0
?
e
.
wrapS
:
THREE
.
ClampToEdgeWrapping
;
this
.
wrapT
=
e
.
wrapT
!==
void
0
?
e
.
wrapT
:
THREE
.
ClampToEdgeWrapping
;
this
.
magFilter
=
e
.
magFilter
!==
void
0
?
e
.
magFilter
:
THREE
.
LinearFilter
;
this
.
minFilter
=
e
.
minFilter
!==
void
0
?
e
.
minFilter
:
THREE
.
LinearMipMapLinearFilter
;
this
.
offset
=
new
THREE
.
Vector2
(
0
,
0
);
this
.
repeat
=
new
THREE
.
Vector2
(
1
,
1
);
this
.
format
=
e
.
format
!==
void
0
?
e
.
format
:
THREE
.
RGBAFormat
;
this
.
type
=
e
.
type
!==
void
0
?
e
.
type
:
THREE
.
UnsignedByteType
;
this
.
depthBuffer
=
e
.
depthBuffer
!==
void
0
?
e
.
depthBuffer
:
!
0
;
this
.
stencilBuffer
=
e
.
stencilBuffer
!==
void
0
?
e
.
stencilBuffer
:
!
0
};
src/renderers/WebGLRenderer.js
浏览文件 @
522da658
...
...
@@ -269,7 +269,7 @@ THREE.WebGLRenderer = function ( parameters ) {
var
_lensFlareAttributesEnabled
=
false
;
// prepare sprites
var
_sprite
=
{};
_sprite
.
vertices
=
new
Float32Array
(
8
+
8
);
...
...
@@ -534,7 +534,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
geometryGroup
.
numMorphTargets
)
{
var
m
,
ml
;
geometryGroup
.
__webglMorphTargetsBuffers
=
[];
geometryGroup
.
__webglMorphTargetsBuffers
=
[];
for
(
m
=
0
,
ml
=
geometryGroup
.
numMorphTargets
;
m
<
ml
;
m
++
)
{
...
...
@@ -619,7 +619,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
materials
=
unrollGroupMaterials
(
geometryGroup
,
object
);
// this will not work if materials would change in run-time
// it should be refreshed every frame
// but need to do unrollGroupMaterials
...
...
@@ -684,7 +684,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
geometryGroup
.
numMorphTargets
)
{
geometryGroup
.
__morphTargetsArrays
=
[];
geometryGroup
.
__morphTargetsArrays
=
[];
for
(
m
=
0
,
ml
=
geometryGroup
.
numMorphTargets
;
m
<
ml
;
m
++
)
{
...
...
@@ -744,7 +744,7 @@ THREE.WebGLRenderer = function ( parameters ) {
attribute
.
array
=
new
Float32Array
(
nvertices
*
size
);
attribute
.
buffer
=
_gl
.
createBuffer
();
attribute
.
buffer
.
belongsToAttribute
=
a
;
originalAttribute
.
needsUpdate
=
true
;
attribute
.
__original
=
originalAttribute
;
...
...
@@ -922,7 +922,7 @@ THREE.WebGLRenderer = function ( parameters ) {
for
(
a
in
customAttributes
)
{
customAttribute
=
customAttributes
[
a
];
if
(
customAttribute
.
__original
.
needsUpdate
)
{
offset_custom
=
customAttribute
.
offset
;
...
...
@@ -2186,10 +2186,10 @@ THREE.WebGLRenderer = function ( parameters ) {
uniforms
.
diffuse
.
value
=
material
.
color
;
uniforms
.
opacity
.
value
=
material
.
opacity
;
uniforms
.
map
.
texture
=
material
.
map
;
if
(
material
.
map
)
{
uniforms
.
offsetRepeat
.
value
.
set
(
material
.
map
.
offset
.
x
,
material
.
map
.
offset
.
y
,
material
.
map
.
repeat
.
x
,
material
.
map
.
repeat
.
y
);
}
...
...
@@ -2314,7 +2314,7 @@ THREE.WebGLRenderer = function ( parameters ) {
maxBones
=
allocateBones
(
object
);
parameters
=
{
map
:
!!
material
.
map
,
envMap
:
!!
material
.
envMap
,
lightMap
:
!!
material
.
lightMap
,
map
:
!!
material
.
map
,
envMap
:
!!
material
.
envMap
,
lightMap
:
!!
material
.
lightMap
,
vertexColors
:
material
.
vertexColors
,
fog
:
fog
,
sizeAttenuation
:
material
.
sizeAttenuation
,
skinning
:
material
.
skinning
,
...
...
@@ -2345,13 +2345,13 @@ THREE.WebGLRenderer = function ( parameters ) {
}
if
(
material
.
attributes
)
{
for
(
a
in
material
.
attributes
)
{
if
(
attributes
[
a
]
!==
undefined
&&
attributes
[
a
]
>=
0
)
_gl
.
enableVertexAttribArray
(
attributes
[
a
]
);
}
}
...
...
@@ -2520,9 +2520,9 @@ THREE.WebGLRenderer = function ( parameters ) {
material
.
envMap
)
{
if
(
p_uniforms
.
cameraPosition
!==
null
)
{
_gl
.
uniform3f
(
p_uniforms
.
cameraPosition
,
camera
.
position
.
x
,
camera
.
position
.
y
,
camera
.
position
.
z
);
}
}
...
...
@@ -2532,9 +2532,9 @@ THREE.WebGLRenderer = function ( parameters ) {
material
.
skinning
)
{
if
(
p_uniforms
.
objectMatrix
!==
null
)
{
_gl
.
uniformMatrix4fv
(
p_uniforms
.
objectMatrix
,
false
,
object
.
_objectMatrixArray
);
}
}
...
...
@@ -2545,10 +2545,10 @@ THREE.WebGLRenderer = function ( parameters ) {
material
.
skinning
)
{
if
(
p_uniforms
.
viewMatrix
!==
null
)
{
_gl
.
uniformMatrix4fv
(
p_uniforms
.
viewMatrix
,
false
,
_viewMatrixArray
);
}
}
}
...
...
@@ -2631,7 +2631,7 @@ THREE.WebGLRenderer = function ( parameters ) {
attribute = material.attributes[ a ];
if( attribute.buffer ) {
_gl.bindBuffer( _gl.ARRAY_BUFFER, attribute.buffer );
_gl.vertexAttribPointer( attributes[ a ], attribute.size, _gl.FLOAT, false, 0, 0 );
...
...
@@ -2862,9 +2862,9 @@ THREE.WebGLRenderer = function ( parameters ) {
// load updated influences uniform
if
(
material
.
program
.
uniforms
.
morphTargetInfluences
!==
null
)
{
_gl
.
uniform1fv
(
material
.
program
.
uniforms
.
morphTargetInfluences
,
object
.
__webglMorphTargetInfluences
);
}
}
...
...
@@ -2915,15 +2915,15 @@ THREE.WebGLRenderer = function ( parameters ) {
ny
=
(
nay
+
nby
+
ncy
)
/
3
;
nz
=
(
naz
+
nbz
+
ncz
)
/
3
;
normalArray
[
i
]
=
nx
;
normalArray
[
i
]
=
nx
;
normalArray
[
i
+
1
]
=
ny
;
normalArray
[
i
+
2
]
=
nz
;
normalArray
[
i
+
3
]
=
nx
;
normalArray
[
i
+
3
]
=
nx
;
normalArray
[
i
+
4
]
=
ny
;
normalArray
[
i
+
5
]
=
nz
;
normalArray
[
i
+
6
]
=
nx
;
normalArray
[
i
+
6
]
=
nx
;
normalArray
[
i
+
7
]
=
ny
;
normalArray
[
i
+
8
]
=
nz
;
...
...
@@ -3407,10 +3407,10 @@ THREE.WebGLRenderer = function ( parameters ) {
/*
* Stencil Shadows
* method: we're rendering the world in light, then the shadow
* volumes into the stencil and last a big darkening
* volumes into the stencil and last a big darkening
* quad over the whole thing. This is not how "you're
* supposed to" do stencil shadows but is much faster
*
*
*/
function
renderStencilShadows
(
scene
)
{
...
...
@@ -3543,7 +3543,7 @@ THREE.WebGLRenderer = function ( parameters ) {
/*
* Render sprites
*
*
*/
function
renderSprites
(
scene
,
camera
)
{
...
...
@@ -3623,7 +3623,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
object
.
useScreenCoordinates
)
{
_gl
.
uniform1i
(
uniforms
.
useScreenCoordinates
,
1
);
_gl
.
uniform3f
(
uniforms
.
screenPosition
,
(
object
.
position
.
x
-
halfViewportWidth
)
/
halfViewportWidth
,
_gl
.
uniform3f
(
uniforms
.
screenPosition
,
(
object
.
position
.
x
-
halfViewportWidth
)
/
halfViewportWidth
,
(
halfViewportHeight
-
object
.
position
.
y
)
/
halfViewportHeight
,
Math
.
max
(
0
,
Math
.
min
(
1
,
object
.
position
.
z
)));
...
...
@@ -3695,11 +3695,11 @@ THREE.WebGLRenderer = function ( parameters ) {
/*
* Render lens flares
* Method: renders 16x16 0xff00ff-colored points scattered over the light source area,
* reads these back and calculates occlusion.
* Then LensFlare.updateLensFlares() is called to re-position and
* Method: renders 16x16 0xff00ff-colored points scattered over the light source area,
* reads these back and calculates occlusion.
* Then LensFlare.updateLensFlares() is called to re-position and
* update transparency of flares. Then they are rendered.
*
*
*/
function
renderLensFlares
(
scene
,
camera
)
{
...
...
@@ -3731,10 +3731,10 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
!
_lensFlareAttributesEnabled
)
{
_gl
.
enableVertexAttribArray
(
_lensFlare
.
attributes
.
vertex
);
_gl
.
enableVertexAttribArray
(
_lensFlare
.
attributes
.
uv
);
_lensFlareAttributesEnabled
=
true
;
}
...
...
@@ -3783,7 +3783,7 @@ THREE.WebGLRenderer = function ( parameters ) {
screenPositionPixels
[
1
]
=
screenPosition
[
1
]
*
halfViewportHeight
+
halfViewportHeight
;
// screen cull
// screen cull
if
(
_lensFlare
.
hasVertexTexture
||
(
screenPositionPixels
[
0
]
>
0
&&
screenPositionPixels
[
0
]
<
_viewportWidth
&&
...
...
@@ -4238,6 +4238,22 @@ THREE.WebGLRenderer = function ( parameters ) {
};
function
removeInstancesDirect
(
objlist
,
object
)
{
var
o
,
ol
;
for
(
o
=
objlist
.
length
-
1
;
o
>=
0
;
o
--
)
{
if
(
objlist
[
o
]
==
object
)
{
objlist
.
splice
(
o
,
1
);
}
}
};
function
removeObject
(
object
,
scene
)
{
// must check as shadow volume before mesh (as they are also meshes)
...
...
@@ -4255,7 +4271,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
else
if
(
object
instanceof
THREE
.
Sprite
)
{
removeInstances
(
scene
.
__webglSprites
,
object
);
removeInstances
Direct
(
scene
.
__webglSprites
,
object
);
}
else
if
(
object
instanceof
THREE
.
LensFlare
)
{
...
...
@@ -4487,7 +4503,7 @@ THREE.WebGLRenderer = function ( parameters ) {
].
join
(
"
\n
"
);
var
prefix_vertex
=
[
_supportsVertexTextures
?
"
#define VERTEX_TEXTURES
"
:
""
,
"
#define MAX_DIR_LIGHTS
"
+
parameters
.
maxDirLights
,
...
...
@@ -4820,7 +4836,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
*/
_gl
.
activeTexture
(
_gl
.
TEXTURE0
+
slot
);
_gl
.
bindTexture
(
_gl
.
TEXTURE_2D
,
texture
.
__webglTexture
);
...
...
@@ -4907,7 +4923,7 @@ THREE.WebGLRenderer = function ( parameters ) {
_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.
/* 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 );
...
...
@@ -5035,7 +5051,7 @@ THREE.WebGLRenderer = function ( parameters ) {
case
THREE
.
LinearFilter
:
case
THREE
.
LinearMipMapNearestFilter
:
case
THREE
.
LinearMipMapLinearFilter
:
case
THREE
.
LinearMipMapLinearFilter
:
default
:
return
_gl
.
LINEAR
;
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录