Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
75952217
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,发现更多精彩内容 >>
提交
75952217
编写于
9月 02, 2011
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added frustumCulled flag to Object3D.
上级
22e84234
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
68 addition
and
64 deletion
+68
-64
build/Three.js
build/Three.js
+10
-10
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+1
-1
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+1
-1
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+1
-1
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+49
-49
examples/webgl_performance.html
examples/webgl_performance.html
+2
-0
src/core/Object3D.js
src/core/Object3D.js
+2
-0
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+2
-2
未找到文件。
build/Three.js
浏览文件 @
75952217
...
...
@@ -47,7 +47,7 @@ THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.
THREE
.
Matrix4
.
makeFrustum
=
function
(
b
,
c
,
e
,
f
,
h
,
k
){
var
j
;
j
=
new
THREE
.
Matrix4
;
j
.
n11
=
2
*
h
/
(
c
-
b
);
j
.
n12
=
0
;
j
.
n13
=
(
c
+
b
)
/
(
c
-
b
);
j
.
n14
=
0
;
j
.
n21
=
0
;
j
.
n22
=
2
*
h
/
(
f
-
e
);
j
.
n23
=
(
f
+
e
)
/
(
f
-
e
);
j
.
n24
=
0
;
j
.
n31
=
0
;
j
.
n32
=
0
;
j
.
n33
=-
(
k
+
h
)
/
(
k
-
h
);
j
.
n34
=-
2
*
k
*
h
/
(
k
-
h
);
j
.
n41
=
0
;
j
.
n42
=
0
;
j
.
n43
=-
1
;
j
.
n44
=
0
;
return
j
};
THREE
.
Matrix4
.
makePerspective
=
function
(
b
,
c
,
e
,
f
){
var
h
,
b
=
e
*
Math
.
tan
(
b
*
Math
.
PI
/
360
);
h
=-
b
;
return
THREE
.
Matrix4
.
makeFrustum
(
h
*
c
,
b
*
c
,
h
,
b
,
e
,
f
)};
THREE
.
Matrix4
.
makeOrtho
=
function
(
b
,
c
,
e
,
f
,
h
,
k
){
var
j
,
m
,
p
,
o
;
j
=
new
THREE
.
Matrix4
;
m
=
c
-
b
;
p
=
e
-
f
;
o
=
k
-
h
;
j
.
n11
=
2
/
m
;
j
.
n12
=
0
;
j
.
n13
=
0
;
j
.
n14
=-
((
c
+
b
)
/
m
);
j
.
n21
=
0
;
j
.
n22
=
2
/
p
;
j
.
n23
=
0
;
j
.
n24
=-
((
e
+
f
)
/
p
);
j
.
n31
=
0
;
j
.
n32
=
0
;
j
.
n33
=-
2
/
o
;
j
.
n34
=-
((
k
+
h
)
/
o
);
j
.
n41
=
0
;
j
.
n42
=
0
;
j
.
n43
=
0
;
j
.
n44
=
1
;
return
j
};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__m1
=
new
THREE
.
Matrix4
;
THREE
.
Matrix4
.
__m2
=
new
THREE
.
Matrix4
;
THREE
.
Object3D
=
function
(){
this
.
id
=
THREE
.
Object3DCount
++
;
this
.
parent
=
void
0
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
eulerOrder
=
"
XYZ
"
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
flipSided
=
this
.
doubleSided
=
this
.
dynamic
=!
1
;
this
.
renderDepth
=
null
;
this
.
rotationAutoUpdate
=!
0
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixWorldNeedsUpdate
=
this
.
matrixAutoUpdate
=
!
0
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=!
1
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=!
0
;
this
.
receiveShadow
=
this
.
castShadow
=!
1
;
this
.
_vector
=
new
THREE
.
Vector3
;
this
.
name
=
""
};
!
0
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=!
1
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=!
0
;
this
.
receiveShadow
=
this
.
castShadow
=!
1
;
this
.
frustumCulled
=!
0
;
this
.
_vector
=
new
THREE
.
Vector3
;
this
.
name
=
""
};
THREE
.
Object3D
.
prototype
=
{
constructor
:
THREE
.
Object3D
,
translate
:
function
(
b
,
c
){
this
.
matrix
.
rotateAxis
(
c
);
this
.
position
.
addSelf
(
c
.
multiplyScalar
(
b
))},
translateX
:
function
(
b
){
this
.
translate
(
b
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
b
){
this
.
translate
(
b
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
b
){
this
.
translate
(
b
,
this
.
_vector
.
set
(
0
,
0
,
1
))},
lookAt
:
function
(
b
){
this
.
matrix
.
lookAt
(
b
,
this
.
position
,
this
.
up
);
this
.
rotationAutoUpdate
&&
this
.
rotation
.
setRotationFromMatrix
(
this
.
matrix
)},
addChild
:
function
(
b
){
if
(
this
.
children
.
indexOf
(
b
)
===
-
1
){
b
.
parent
!==
void
0
&&
b
.
parent
.
removeChild
(
b
);
b
.
parent
=
this
;
this
.
children
.
push
(
b
);
for
(
var
c
=
this
;
c
.
parent
!==
void
0
;)
c
=
c
.
parent
;
c
!==
void
0
&&
c
instanceof
THREE
.
Scene
&&
c
.
addChildRecurse
(
b
)}},
removeChild
:
function
(
b
){
var
c
=
this
.
children
.
indexOf
(
b
);
if
(
c
!==-
1
)
b
.
parent
=
void
0
,
this
.
children
.
splice
(
c
,
1
)},
getChildByName
:
function
(
b
,
c
){
var
e
,
f
,
h
;
e
=
0
;
for
(
f
=
this
.
children
.
length
;
e
<
f
;
e
++
){
h
=
this
.
children
[
e
];
if
(
h
.
name
===
b
)
return
h
;
if
(
c
&&
(
h
=
h
.
getChildByName
(
b
,
c
),
h
!==
void
0
))
return
h
}},
updateMatrix
:
function
(){
this
.
matrix
.
setPosition
(
this
.
position
);
this
.
useQuaternion
?
this
.
matrix
.
setRotationFromQuaternion
(
this
.
quaternion
):
this
.
matrix
.
setRotationFromEuler
(
this
.
rotation
,
this
.
eulerOrder
);
if
(
this
.
scale
.
x
!==
1
||
this
.
scale
.
y
!==
1
||
this
.
scale
.
z
!==
1
)
this
.
matrix
.
scale
(
this
.
scale
),
this
.
boundRadiusScale
=
Math
.
max
(
this
.
scale
.
x
,
Math
.
max
(
this
.
scale
.
y
,
this
.
scale
.
z
));
this
.
matrixWorldNeedsUpdate
=!
0
},
update
:
function
(
b
,
c
,
e
){
this
.
matrixAutoUpdate
&&
this
.
updateMatrix
();
if
(
this
.
matrixWorldNeedsUpdate
||
c
)
b
?
this
.
matrixWorld
.
multiply
(
b
,
this
.
matrix
):
this
.
matrixWorld
.
copy
(
this
.
matrix
),
...
...
@@ -247,14 +247,14 @@ function m(b,e,c){ja!=b&&(b?n.enable(n.POLYGON_OFFSET_FILL):n.disable(n.POLYGON_
b
.
n34
);
for
(
var
e
,
b
=
0
;
b
<
6
;
b
++
)
e
=
Z
[
b
],
e
.
divideScalar
(
Math
.
sqrt
(
e
.
x
*
e
.
x
+
e
.
y
*
e
.
y
+
e
.
z
*
e
.
z
))}
function
o
(
b
){
for
(
var
e
=
b
.
matrixWorld
,
c
=-
b
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
b
.
scale
.
x
,
Math
.
max
(
b
.
scale
.
y
,
b
.
scale
.
z
)),
f
=
0
;
f
<
6
;
f
++
)
if
(
b
=
Z
[
f
].
x
*
e
.
n14
+
Z
[
f
].
y
*
e
.
n24
+
Z
[
f
].
z
*
e
.
n34
+
Z
[
f
].
w
,
b
<=
c
)
return
!
1
;
return
!
0
}
function
t
(
b
,
e
){
b
.
list
[
b
.
count
]
=
e
;
b
.
count
+=
1
}
function
v
(
b
){
var
e
,
c
,
f
=
b
.
object
,
j
=
b
.
opaque
,
h
=
b
.
transparent
;
h
.
count
=
0
;
b
=
j
.
count
=
0
;
for
(
e
=
f
.
materials
.
length
;
b
<
e
;
b
++
)
c
=
f
.
materials
[
b
],
c
.
transparent
?
t
(
h
,
c
):
t
(
j
,
c
)}
function
w
(
b
){
var
e
,
c
,
f
,
j
,
h
=
b
.
object
,
k
=
b
.
buffer
,
m
=
b
.
opaque
,
n
=
b
.
transparent
;
n
.
count
=
0
;
b
=
m
.
count
=
0
;
for
(
f
=
h
.
materials
.
length
;
b
<
f
;
b
++
)
if
(
e
=
h
.
materials
[
b
],
e
instanceof
THREE
.
MeshFaceMaterial
){
e
=
0
;
for
(
c
=
k
.
materials
.
length
;
e
<
c
;
e
++
)(
j
=
k
.
materials
[
e
])
&&
(
j
.
transparent
?
t
(
n
,
j
):
t
(
m
,
j
))}
else
(
j
=
e
)
&&
(
j
.
transparent
?
t
(
n
,
j
):
t
(
m
,
j
))}
function
u
(
b
,
e
){
return
e
.
z
-
b
.
z
}
function
y
(
b
,
c
){
var
m
,
v
,
t
,
u
=
0
,
w
,
y
,
z
,
x
,
D
=
b
.
lights
;
ea
||
(
ea
=
new
THREE
.
Camera
(
S
.
shadowCameraFov
,
c
.
aspect
,
S
.
shadowCameraNear
,
S
.
shadowCameraFar
));
m
=
0
;
for
(
v
=
D
.
length
;
m
<
v
;
m
++
)
if
(
t
=
D
[
m
],
t
instanceof
THREE
.
SpotLight
&&
t
.
castShadow
){
S
.
shadowMap
[
u
]
||
(
S
.
shadowMap
[
u
]
=
new
THREE
.
WebGLRenderTarget
(
S
.
shadowMapWidth
,
S
.
shadowMapHeight
,{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
,
format
:
THREE
.
RGBAFormat
}));
ya
[
u
]
||
(
ya
[
u
]
=
new
THREE
.
Matrix4
);
w
=
S
.
shadowMap
[
u
];
y
=
ya
[
u
];
ea
.
position
.
copy
(
t
.
position
);
ea
.
target
.
position
.
copy
(
t
.
target
.
position
);
ea
.
update
(
void
0
,
!
0
);
b
.
update
(
void
0
,
!
1
,
ea
);
y
.
set
(
0.5
,
0
,
0
,
0.5
,
0
,
0.5
,
0
,
0.5
,
0
,
0
,
0.5
,
0.5
,
0
,
0
,
0
,
1
);
y
.
multiplySelf
(
ea
.
projectionMatrix
);
y
.
multiplySelf
(
ea
.
matrixWorldInverse
);
ea
.
matrixWorldInverse
.
flattenToArray
(
la
);
ea
.
projectionMatrix
.
flattenToArray
(
ra
);
N
.
multiply
(
ea
.
projectionMatrix
,
ea
.
matrixWorldInverse
);
p
(
N
);
S
.
initWebGLObjects
(
b
);
F
(
w
);
n
.
clearColor
(
1
,
1
,
1
,
1
);
S
.
clear
();
n
.
clearColor
(
pa
.
r
,
pa
.
g
,
pa
.
b
,
ta
);
y
=
b
.
__webglObjects
.
length
;
t
=
b
.
__webglObjectsImmediate
.
length
;
for
(
w
=
0
;
w
<
y
;
w
++
)
z
=
b
.
__webglObjects
[
w
],
x
=
z
.
object
,
x
.
visible
&&
x
.
castShadow
?
!
(
x
instanceof
THREE
.
Mesh
)
||
o
(
x
)?(
x
.
matrixWorld
.
flattenToArray
(
x
.
_objectMatrixArray
),
B
(
x
,
ea
,
!
1
),
z
.
render
=
!
0
):
z
.
render
=!
1
:
z
.
render
=!
1
;
j
(
!
0
);
O
(
THREE
.
NormalBlending
);
for
(
w
=
0
;
w
<
y
;
w
++
)
if
(
z
=
b
.
__webglObjects
[
w
],
z
.
render
)
x
=
z
.
object
,
buffer
=
z
.
buffer
,
k
(
x
),
z
=
x
.
customDepthMaterial
?
x
.
customDepthMaterial
:
x
.
geometry
.
morphTargets
.
length
?
Ea
:
wa
,
f
(
ea
,
D
,
null
,
z
,
buffer
,
x
);
for
(
w
=
0
;
w
<
t
;
w
++
)
z
=
b
.
__webglObjectsImmediate
[
w
],
x
=
z
.
object
,
x
.
visible
&&
x
.
castShadow
&&
(
x
.
matrixAutoUpdate
&&
x
.
matrixWorld
.
flattenToArray
(
x
.
_objectMatrixArray
),
B
(
x
,
ea
,
!
1
),
k
(
x
),
program
=
e
(
ea
,
D
,
null
,
wa
,
x
),
x
.
render
(
function
(
b
){
h
(
b
,
program
,
wa
.
shading
)}));
u
++
}}
function
x
(
b
,
e
){
var
c
,
f
,
j
;
c
=
T
.
attributes
;
var
h
=
T
.
uniforms
,
k
=
ma
/
ia
,
m
,
o
=
[],
p
=
ia
*
0.5
,
v
=
ma
*
0.5
,
t
=!
0
;
n
.
useProgram
(
T
.
program
);
fa
=
T
.
program
;
aa
=
U
=-
1
;
Aa
||
(
n
.
enableVertexAttribArray
(
T
.
attributes
.
position
),
n
.
enableVertexAttribArray
(
T
.
attributes
.
uv
),
Aa
=!
0
);
n
.
disable
(
n
.
CULL_FACE
);
n
.
enable
(
n
.
BLEND
);
n
.
depthMask
(
!
0
);
n
.
bindBuffer
(
n
.
ARRAY_BUFFER
,
T
.
vertexBuffer
);
n
.
vertexAttribPointer
(
c
.
position
,
2
,
n
.
FLOAT
,
!
1
,
16
,
0
);
n
.
vertexAttribPointer
(
c
.
uv
,
2
,
n
.
FLOAT
,
!
1
,
16
,
8
);
n
.
bindBuffer
(
n
.
ELEMENT_ARRAY_BUFFER
,
T
.
elementBuffer
);
n
.
uniformMatrix4fv
(
h
.
projectionMatrix
,
!
1
,
ra
);
n
.
activeTexture
(
n
.
TEXTURE0
);
n
.
uniform1i
(
h
.
map
,
0
);
c
=
0
;
for
(
f
=
b
.
__webglSprites
.
length
;
c
<
f
;
c
++
)
j
=
b
.
__webglSprites
[
c
],
j
.
useScreenCoordinates
?
j
.
z
=-
j
.
position
.
z
:(
j
.
_modelViewMatrix
.
multiplyToArray
(
e
.
matrixWorldInverse
,
j
.
matrixWorld
,
j
.
_modelViewMatrixArray
),
j
.
z
=-
j
.
_modelViewMatrix
.
n34
);
b
.
__webglSprites
.
sort
(
u
);
c
=
0
;
for
(
f
=
b
.
__webglSprites
.
length
;
c
<
f
;
c
++
)
j
=
b
.
__webglSprites
[
c
],
j
.
material
===
void
0
&&
j
.
map
&&
j
.
map
.
image
&&
j
.
map
.
image
.
width
&&
(
j
.
useScreenCoordinates
?(
n
.
uniform1i
(
h
.
useScreenCoordinates
,
1
),
n
.
uniform3f
(
h
.
screenPosition
,
(
j
.
position
.
x
-
p
)
/
p
,(
v
-
j
.
position
.
y
)
/
v
,
Math
.
max
(
0
,
Math
.
min
(
1
,
j
.
position
.
z
)))):(
n
.
uniform1i
(
h
.
useScreenCoordinates
,
0
),
n
.
uniform1i
(
h
.
affectedByDistance
,
j
.
affectedByDistance
?
1
:
0
),
n
.
uniformMatrix4fv
(
h
.
modelViewMatrix
,
!
1
,
j
.
_modelViewMatrixArray
)),
m
=
j
.
map
.
image
.
width
/
(
j
.
scaleByViewport
?
ma
:
1
),
o
[
0
]
=
m
*
k
*
j
.
scale
.
x
,
o
[
1
]
=
m
*
j
.
scale
.
y
,
n
.
uniform2f
(
h
.
uvScale
,
j
.
uvScale
.
x
,
j
.
uvScale
.
y
),
n
.
uniform2f
(
h
.
uvOffset
,
j
.
uvOffset
.
x
,
j
.
uvOffset
.
y
),
n
.
uniform2f
(
h
.
alignment
,
j
.
alignment
.
x
,
j
.
alignment
.
y
),
n
.
uniform1f
(
h
.
opacity
,
j
.
opacit
y
),
n
.
uniform1f
(
h
.
rotation
,
j
.
rotation
),
n
.
uniform2fv
(
h
.
scale
,
o
),
j
.
mergeWith3D
&&!
t
?(
n
.
enable
(
n
.
DEPTH_TEST
),
t
=!
0
):
!
j
.
mergeWith3D
&&
t
&&
(
n
.
disable
(
n
.
DEPTH_TEST
),
t
=!
1
),
O
(
j
.
blending
),
I
(
j
.
map
,
0
),
n
.
drawElements
(
n
.
TRIANGLES
,
6
,
n
.
UNSIGNED_SHORT
,
0
));
n
.
enable
(
n
.
CULL_FACE
);
n
.
enable
(
n
.
DEPTH_TEST
);
n
.
depthMask
(
da
)}
function
B
(
b
,
e
,
c
){
b
.
_modelViewMatrix
.
multiplyToArray
(
e
.
matrixWorldInverse
,
b
.
matrixWorld
,
b
.
_modelViewMatrixArray
);
c
&&
THREE
.
Matrix4
.
makeInvert3x3
(
b
.
_modelViewMatrix
).
transposeIntoArray
(
b
.
_normalMatrixArray
)}
function
z
(
b
){
var
e
,
c
,
f
,
j
;
j
=
b
.
__materials
;
b
=
0
;
for
(
c
=
j
.
length
;
b
<
c
;
b
++
)
if
(
f
=
j
[
b
],
f
.
attributes
)
for
(
e
in
f
.
attributes
)
if
(
f
.
attributes
[
e
].
needsUpdate
)
return
!
0
;
return
!
1
}
function
D
(
b
){
var
e
,
c
,
f
,
j
;
j
=
b
.
__materials
;
b
=
0
;
for
(
c
=
j
.
length
;
b
<
c
;
b
++
)
if
(
f
=
j
[
b
],
f
.
attributes
)
for
(
e
in
f
.
attributes
)
f
.
attributes
[
e
].
needsUpdate
=!
1
}
function
C
(
b
,
e
){
var
c
;
for
(
c
=
b
.
length
-
1
;
c
>=
0
;
c
--
)
b
[
c
].
object
==
e
&&
b
.
splice
(
c
,
1
)}
function
E
(
b
){
function
e
(
b
){
var
j
=
[];
c
=
0
;
for
(
f
=
b
.
length
;
c
<
f
;
c
++
)
b
[
c
]
==
void
0
?
j
.
push
(
"
undefined
"
):
j
.
push
(
b
[
c
].
id
);
return
j
.
join
(
"
_
"
)}
var
c
,
f
,
j
,
h
,
k
,
m
,
n
,
o
,
p
=
{},
v
=
b
.
morphTargets
!==
void
0
?
b
.
morphTargets
.
length
:
0
;
b
.
geometryGroups
=
{};
j
=
0
;
for
(
h
=
b
.
faces
.
length
;
j
<
h
;
j
++
)
k
=
b
.
faces
[
j
],
m
=
k
.
materials
,
n
=
e
(
m
),
p
[
n
]
==
void
0
&&
(
p
[
n
]
=
{
hash
:
n
,
counter
:
0
}),
o
=
p
[
n
].
hash
+
"
_
"
+
p
[
n
].
counter
,
b
.
geometryGroups
[
o
]
==
void
0
&&
(
b
.
geometryGroups
[
o
]
=
{
faces
:[],
materials
:
m
,
vertices
:
0
,
numMorphTargets
:
v
}),
k
=
k
instanceof
THREE
.
Face3
?
3
:
4
,
b
.
geometryGroups
[
o
].
vertices
+
k
>
65535
&&
(
p
[
n
].
counter
+=
1
,
o
=
p
[
n
].
hash
+
"
_
"
+
p
[
n
].
counter
,
b
.
geometryGroups
[
o
]
==
void
0
&&
(
b
.
geometryGroups
[
o
]
=
{
faces
:[],
y
.
multiplySelf
(
ea
.
matrixWorldInverse
);
ea
.
matrixWorldInverse
.
flattenToArray
(
la
);
ea
.
projectionMatrix
.
flattenToArray
(
ra
);
N
.
multiply
(
ea
.
projectionMatrix
,
ea
.
matrixWorldInverse
);
p
(
N
);
S
.
initWebGLObjects
(
b
);
F
(
w
);
n
.
clearColor
(
1
,
1
,
1
,
1
);
S
.
clear
();
n
.
clearColor
(
pa
.
r
,
pa
.
g
,
pa
.
b
,
ta
);
y
=
b
.
__webglObjects
.
length
;
t
=
b
.
__webglObjectsImmediate
.
length
;
for
(
w
=
0
;
w
<
y
;
w
++
)
z
=
b
.
__webglObjects
[
w
],
x
=
z
.
object
,
x
.
visible
&&
x
.
castShadow
?
!
(
x
instanceof
THREE
.
Mesh
)
||
!
x
.
frustumCulled
||
o
(
x
)?(
x
.
matrixWorld
.
flattenToArray
(
x
.
_objectMatrixArray
),
B
(
x
,
ea
,
!
1
),
z
.
render
=!
0
):
z
.
render
=!
1
:
z
.
render
=!
1
;
j
(
!
0
);
O
(
THREE
.
NormalBlending
);
for
(
w
=
0
;
w
<
y
;
w
++
)
if
(
z
=
b
.
__webglObjects
[
w
],
z
.
render
)
x
=
z
.
object
,
buffer
=
z
.
buffer
,
k
(
x
),
z
=
x
.
customDepthMaterial
?
x
.
customDepthMaterial
:
x
.
geometry
.
morphTargets
.
length
?
Ea
:
wa
,
f
(
ea
,
D
,
null
,
z
,
buffer
,
x
);
for
(
w
=
0
;
w
<
t
;
w
++
)
z
=
b
.
__webglObjectsImmediate
[
w
],
x
=
z
.
object
,
x
.
visible
&&
x
.
castShadow
&&
(
x
.
matrixAutoUpdate
&&
x
.
matrixWorld
.
flattenToArray
(
x
.
_objectMatrixArray
),
B
(
x
,
ea
,
!
1
),
k
(
x
),
program
=
e
(
ea
,
D
,
null
,
wa
,
x
),
x
.
render
(
function
(
b
){
h
(
b
,
program
,
wa
.
shading
)}));
u
++
}}
function
x
(
b
,
e
){
var
c
,
f
,
j
;
c
=
T
.
attributes
;
var
h
=
T
.
uniforms
,
k
=
ma
/
ia
,
m
,
o
=
[],
p
=
ia
*
0.5
,
v
=
ma
*
0.5
,
t
=!
0
;
n
.
useProgram
(
T
.
program
);
fa
=
T
.
program
;
aa
=
U
=-
1
;
Aa
||
(
n
.
enableVertexAttribArray
(
T
.
attributes
.
position
),
n
.
enableVertexAttribArray
(
T
.
attributes
.
uv
),
Aa
=!
0
);
n
.
disable
(
n
.
CULL_FACE
);
n
.
enable
(
n
.
BLEND
);
n
.
depthMask
(
!
0
);
n
.
bindBuffer
(
n
.
ARRAY_BUFFER
,
T
.
vertexBuffer
);
n
.
vertexAttribPointer
(
c
.
position
,
2
,
n
.
FLOAT
,
!
1
,
16
,
0
);
n
.
vertexAttribPointer
(
c
.
uv
,
2
,
n
.
FLOAT
,
!
1
,
16
,
8
);
n
.
bindBuffer
(
n
.
ELEMENT_ARRAY_BUFFER
,
T
.
elementBuffer
);
n
.
uniformMatrix4fv
(
h
.
projectionMatrix
,
!
1
,
ra
);
n
.
activeTexture
(
n
.
TEXTURE0
);
n
.
uniform1i
(
h
.
map
,
0
);
c
=
0
;
for
(
f
=
b
.
__webglSprites
.
length
;
c
<
f
;
c
++
)
j
=
b
.
__webglSprites
[
c
],
j
.
useScreenCoordinates
?
j
.
z
=-
j
.
position
.
z
:(
j
.
_modelViewMatrix
.
multiplyToArray
(
e
.
matrixWorldInverse
,
j
.
matrixWorld
,
j
.
_modelViewMatrixArray
),
j
.
z
=-
j
.
_modelViewMatrix
.
n34
);
b
.
__webglSprites
.
sort
(
u
);
c
=
0
;
for
(
f
=
b
.
__webglSprites
.
length
;
c
<
f
;
c
++
)
j
=
b
.
__webglSprites
[
c
],
j
.
material
===
void
0
&&
j
.
map
&&
j
.
map
.
image
&&
j
.
map
.
image
.
width
&&
(
j
.
useScreenCoordinates
?(
n
.
uniform1i
(
h
.
useScreenCoordinates
,
1
),
n
.
uniform3f
(
h
.
screenPosition
,(
j
.
position
.
x
-
p
)
/
p
,(
v
-
j
.
position
.
y
)
/
v
,
Math
.
max
(
0
,
Math
.
min
(
1
,
j
.
position
.
z
)))):(
n
.
uniform1i
(
h
.
useScreenCoordinates
,
0
),
n
.
uniform1i
(
h
.
affectedByDistance
,
j
.
affectedByDistance
?
1
:
0
),
n
.
uniformMatrix4fv
(
h
.
modelViewMatrix
,
!
1
,
j
.
_modelViewMatrixArray
)),
m
=
j
.
map
.
image
.
width
/
(
j
.
scaleByViewport
?
ma
:
1
),
o
[
0
]
=
m
*
k
*
j
.
scale
.
x
,
o
[
1
]
=
m
*
j
.
scale
.
y
,
n
.
uniform2f
(
h
.
uvScale
,
j
.
uvScale
.
x
,
j
.
uvScale
.
y
),
n
.
uniform2f
(
h
.
uvOffset
,
j
.
uvOffset
.
x
,
j
.
uvOffset
.
y
),
n
.
uniform2f
(
h
.
alignment
,
j
.
alignment
.
x
,
j
.
alignment
.
y
),
n
.
uniform1f
(
h
.
opacity
,
j
.
opacity
),
n
.
uniform1f
(
h
.
rotation
,
j
.
rotation
),
n
.
uniform2fv
(
h
.
scale
,
o
),
j
.
mergeWith3D
&&!
t
?(
n
.
enable
(
n
.
DEPTH_TEST
),
t
=!
0
):
!
j
.
mergeWith3D
&&
t
&&
(
n
.
disable
(
n
.
DEPTH_TEST
),
t
=!
1
),
O
(
j
.
blending
),
I
(
j
.
map
,
0
),
n
.
drawElements
(
n
.
TRIANGLES
,
6
,
n
.
UNSIGNED_SHORT
,
0
));
n
.
enable
(
n
.
CULL_FACE
);
n
.
enable
(
n
.
DEPTH_TEST
);
n
.
depthMask
(
da
)}
function
B
(
b
,
e
,
c
){
b
.
_modelViewMatrix
.
multiplyToArray
(
e
.
matrixWorldInverse
,
b
.
matrixWorld
,
b
.
_modelViewMatrixArray
);
c
&&
THREE
.
Matrix4
.
makeInvert3x3
(
b
.
_modelViewMatrix
).
transposeIntoArray
(
b
.
_normalMatrixArray
)}
function
z
(
b
){
var
e
,
c
,
f
,
j
;
j
=
b
.
__materials
;
b
=
0
;
for
(
c
=
j
.
length
;
b
<
c
;
b
++
)
if
(
f
=
j
[
b
],
f
.
attributes
)
for
(
e
in
f
.
attributes
)
if
(
f
.
attributes
[
e
].
needsUpdate
)
return
!
0
;
return
!
1
}
function
D
(
b
){
var
e
,
c
,
f
,
j
;
j
=
b
.
__materials
;
b
=
0
;
for
(
c
=
j
.
length
;
b
<
c
;
b
++
)
if
(
f
=
j
[
b
],
f
.
attributes
)
for
(
e
in
f
.
attributes
)
f
.
attributes
[
e
].
needsUpdate
=!
1
}
function
C
(
b
,
e
){
var
c
;
for
(
c
=
b
.
length
-
1
;
c
>=
0
;
c
--
)
b
[
c
].
object
==
e
&&
b
.
splice
(
c
,
1
)}
function
E
(
b
){
function
e
(
b
){
var
j
=
[];
c
=
0
;
for
(
f
=
b
.
length
;
c
<
f
;
c
++
)
b
[
c
]
==
void
0
?
j
.
push
(
"
undefined
"
):
j
.
push
(
b
[
c
].
id
);
return
j
.
join
(
"
_
"
)}
var
c
,
f
,
j
,
h
,
k
,
m
,
n
,
o
,
p
=
{},
v
=
b
.
morphTargets
!==
void
0
?
b
.
morphTargets
.
length
:
0
;
b
.
geometryGroups
=
{};
j
=
0
;
for
(
h
=
b
.
faces
.
length
;
j
<
h
;
j
++
)
k
=
b
.
faces
[
j
],
m
=
k
.
materials
,
n
=
e
(
m
),
p
[
n
]
==
void
0
&&
(
p
[
n
]
=
{
hash
:
n
,
counter
:
0
}),
o
=
p
[
n
].
hash
+
"
_
"
+
p
[
n
].
counter
,
b
.
geometryGroups
[
o
]
==
void
0
&&
(
b
.
geometryGroups
[
o
]
=
{
faces
:[],
materials
:
m
,
vertices
:
0
,
numMorphTargets
:
v
}),
k
=
k
instanceof
THREE
.
Face3
?
3
:
4
,
b
.
geometryGroups
[
o
].
vertices
+
k
>
65535
&&
(
p
[
n
].
counter
+=
1
,
o
=
p
[
n
].
hash
+
"
_
"
+
p
[
n
].
counter
,
b
.
geometryGroups
[
o
]
==
void
0
&&
(
b
.
geometryGroups
[
o
]
=
{
faces
:[],
materials
:
m
,
vertices
:
0
,
numMorphTargets
:
v
})),
b
.
geometryGroups
[
o
].
faces
.
push
(
j
),
b
.
geometryGroups
[
o
].
vertices
+=
k
}
function
J
(
b
,
e
,
c
){
b
.
push
({
buffer
:
e
,
object
:
c
,
opaque
:{
list
:[],
count
:
0
},
transparent
:{
list
:[],
count
:
0
}})}
function
O
(
b
){
if
(
b
!=
U
){
switch
(
b
){
case
THREE
.
AdditiveBlending
:
n
.
blendEquation
(
n
.
FUNC_ADD
);
n
.
blendFunc
(
n
.
SRC_ALPHA
,
n
.
ONE
);
break
;
case
THREE
.
SubtractiveBlending
:
n
.
blendEquation
(
n
.
FUNC_ADD
);
n
.
blendFunc
(
n
.
ZERO
,
n
.
ONE_MINUS_SRC_COLOR
);
break
;
case
THREE
.
MultiplyBlending
:
n
.
blendEquation
(
n
.
FUNC_ADD
);
n
.
blendFunc
(
n
.
ZERO
,
n
.
SRC_COLOR
);
break
;
default
:
n
.
blendEquationSeparate
(
n
.
FUNC_ADD
,
n
.
FUNC_ADD
),
n
.
blendFuncSeparate
(
n
.
SRC_ALPHA
,
n
.
ONE_MINUS_SRC_ALPHA
,
n
.
ONE
,
n
.
ONE_MINUS_SRC_ALPHA
)}
U
=
b
}}
function
K
(
b
,
e
,
c
){(
c
.
width
&
c
.
width
-
1
)
==
0
&&
(
c
.
height
&
c
.
height
-
1
)
==
0
?(
n
.
texParameteri
(
b
,
n
.
TEXTURE_WRAP_S
,
L
(
e
.
wrapS
)),
n
.
texParameteri
(
b
,
n
.
TEXTURE_WRAP_T
,
L
(
e
.
wrapT
)),
n
.
texParameteri
(
b
,
n
.
TEXTURE_MAG_FILTER
,
L
(
e
.
magFilter
)),
n
.
texParameteri
(
b
,
n
.
TEXTURE_MIN_FILTER
,
L
(
e
.
minFilter
)),
n
.
generateMipmap
(
b
)):(
n
.
texParameteri
(
b
,
n
.
TEXTURE_WRAP_S
,
n
.
CLAMP_TO_EDGE
),
n
.
texParameteri
(
b
,
n
.
TEXTURE_WRAP_T
,
n
.
CLAMP_TO_EDGE
),
n
.
texParameteri
(
b
,
n
.
TEXTURE_MAG_FILTER
,
M
(
e
.
magFilter
)),
n
.
texParameteri
(
b
,
n
.
TEXTURE_MIN_FILTER
,
M
(
e
.
minFilter
)))}
function
I
(
b
,
e
){
if
(
b
.
needsUpdate
){
if
(
!
b
.
__webglInit
)
b
.
__webglInit
=!
0
,
b
.
__webglTexture
=
n
.
createTexture
();
n
.
activeTexture
(
n
.
TEXTURE0
+
e
);
n
.
bindTexture
(
n
.
TEXTURE_2D
,
b
.
__webglTexture
);
b
instanceof
THREE
.
DataTexture
?
n
.
texImage2D
(
n
.
TEXTURE_2D
,
0
,
L
(
b
.
format
),
b
.
image
.
width
,
b
.
image
.
height
,
0
,
L
(
b
.
format
),
n
.
UNSIGNED_BYTE
,
b
.
image
.
data
):
n
.
texImage2D
(
n
.
TEXTURE_2D
,
...
...
@@ -288,7 +288,7 @@ h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.ma
{};
w
.
attributes
=
{};
var
x
,
f
=
[
"
viewMatrix
"
,
"
modelViewMatrix
"
,
"
projectionMatrix
"
,
"
normalMatrix
"
,
"
objectMatrix
"
,
"
cameraPosition
"
,
"
cameraInverseMatrix
"
,
"
boneGlobalMatrices
"
,
"
morphTargetInfluences
"
];
for
(
x
in
m
)
f
.
push
(
x
);
x
=
f
;
f
=
0
;
for
(
m
=
x
.
length
;
f
<
m
;
f
++
)
o
=
x
[
f
],
w
.
uniforms
[
o
]
=
n
.
getUniformLocation
(
w
,
o
);
f
=
[
"
position
"
,
"
normal
"
,
"
uv
"
,
"
uv2
"
,
"
tangent
"
,
"
color
"
,
"
skinVertexA
"
,
"
skinVertexB
"
,
"
skinIndex
"
,
"
skinWeight
"
];
for
(
x
=
0
;
x
<
c
.
maxMorphTargets
;
x
++
)
f
.
push
(
"
morphTarget
"
+
x
);
for
(
u
in
e
)
f
.
push
(
u
);
u
=
f
;
x
=
0
;
for
(
e
=
u
.
length
;
x
<
e
;
x
++
)
c
=
u
[
x
],
w
.
attributes
[
c
]
=
n
.
getAttribLocation
(
w
,
c
);
V
.
push
({
program
:
w
,
code
:
k
});
u
=
w
}
b
.
program
=
u
;
u
=
b
.
program
.
attributes
;
u
.
position
>=
0
&&
n
.
enableVertexAttribArray
(
u
.
position
);
u
.
color
>=
0
&&
n
.
enableVertexAttribArray
(
u
.
color
);
u
.
normal
>=
0
&&
n
.
enableVertexAttribArray
(
u
.
normal
);
u
.
tangent
>=
0
&&
n
.
enableVertexAttribArray
(
u
.
tangent
);
b
.
skinning
&&
u
.
skinVertexA
>=
0
&&
u
.
skinVertexB
>=
0
&&
u
.
skinIndex
>=
0
&&
u
.
skinWeight
>=
0
&&
(
n
.
enableVertexAttribArray
(
u
.
skinVertexA
),
n
.
enableVertexAttribArray
(
u
.
skinVertexB
),
n
.
enableVertexAttribArray
(
u
.
skinIndex
),
n
.
enableVertexAttribArray
(
u
.
skinWeight
));
if
(
b
.
attributes
)
for
(
j
in
b
.
attributes
)
u
[
j
]
!==
void
0
&&
u
[
j
]
>=
0
&&
n
.
enableVertexAttribArray
(
u
[
j
]);
if
(
b
.
morphTargets
)
for
(
j
=
b
.
numSupportedMorphTargets
=
0
;
j
<
this
.
maxMorphTargets
;
j
++
)
x
=
"
morphTarget
"
+
j
,
u
[
x
]
>=
0
&&
(
n
.
enableVertexAttribArray
(
u
[
x
]),
b
.
numSupportedMorphTargets
++
)};
this
.
clearTarget
=
function
(
b
,
c
,
e
,
f
){
F
(
b
);
b
=
0
;
c
&&
(
b
|=
n
.
COLOR_BUFFER_BIT
);
e
&&
(
b
|=
n
.
DEPTH_BUFFER_BIT
);
f
&&
(
b
|=
n
.
STENCIL_BUFFER_BIT
);
n
.
clear
(
b
)};
this
.
render
=
function
(
b
,
c
,
n
,
t
){
var
z
,
D
,
C
,
E
,
Z
,
I
,
J
,
G
,
K
=
b
.
lights
,
M
=
b
.
fog
;
this
.
shadowMapEnabled
&&
y
(
b
,
c
);
S
.
data
.
vertices
=
0
;
S
.
data
.
faces
=
0
;
S
.
data
.
drawCalls
=
0
;
c
.
matrixAutoUpdate
&&
c
.
update
(
void
0
,
!
0
);
b
.
update
(
void
0
,
!
1
,
c
);
c
.
matrixWorldInverse
.
flattenToArray
(
la
);
c
.
projectionMatrix
.
flattenToArray
(
ra
);
N
.
multiply
(
c
.
projectionMatrix
,
c
.
matrixWorldInverse
);
p
(
N
);
this
.
initWebGLObjects
(
b
);
F
(
n
);(
this
.
autoClear
||
t
)
&&
this
.
clear
();
Z
=
b
.
__webglObjects
.
length
;
for
(
t
=
0
;
t
<
Z
;
t
++
)
if
(
z
=
b
.
__webglObjects
[
t
],
J
=
z
.
object
,
J
.
visible
)
if
(
!
(
J
instanceof
THREE
.
Mesh
)
||
o
(
J
)){
if
(
J
.
matrixWorld
.
flattenToArray
(
J
.
_objectMatrixArray
),
M
=
b
.
fog
;
this
.
shadowMapEnabled
&&
y
(
b
,
c
);
S
.
data
.
vertices
=
0
;
S
.
data
.
faces
=
0
;
S
.
data
.
drawCalls
=
0
;
c
.
matrixAutoUpdate
&&
c
.
update
(
void
0
,
!
0
);
b
.
update
(
void
0
,
!
1
,
c
);
c
.
matrixWorldInverse
.
flattenToArray
(
la
);
c
.
projectionMatrix
.
flattenToArray
(
ra
);
N
.
multiply
(
c
.
projectionMatrix
,
c
.
matrixWorldInverse
);
p
(
N
);
this
.
initWebGLObjects
(
b
);
F
(
n
);(
this
.
autoClear
||
t
)
&&
this
.
clear
();
Z
=
b
.
__webglObjects
.
length
;
for
(
t
=
0
;
t
<
Z
;
t
++
)
if
(
z
=
b
.
__webglObjects
[
t
],
J
=
z
.
object
,
J
.
visible
)
if
(
!
(
J
instanceof
THREE
.
Mesh
)
||
!
J
.
frustumCulled
||
o
(
J
)){
if
(
J
.
matrixWorld
.
flattenToArray
(
J
.
_objectMatrixArray
),
B
(
J
,
c
,
!
0
),
w
(
z
),
z
.
render
=!
0
,
this
.
sortObjects
)
z
.
object
.
renderDepth
?
z
.
z
=
z
.
object
.
renderDepth
:(
sa
.
copy
(
J
.
position
),
N
.
multiplyVector3
(
sa
),
z
.
z
=
sa
.
z
)}
else
z
.
render
=!
1
;
else
z
.
render
=!
1
;
this
.
sortObjects
&&
b
.
__webglObjects
.
sort
(
u
);
I
=
b
.
__webglObjectsImmediate
.
length
;
for
(
t
=
0
;
t
<
I
;
t
++
)
z
=
b
.
__webglObjectsImmediate
[
t
],
J
=
z
.
object
,
J
.
visible
&&
(
J
.
matrixAutoUpdate
&&
J
.
matrixWorld
.
flattenToArray
(
J
.
_objectMatrixArray
),
B
(
J
,
c
,
!
0
),
v
(
z
));
if
(
b
.
overrideMaterial
){
j
(
b
.
overrideMaterial
.
depthTest
);
O
(
b
.
overrideMaterial
.
blending
);
for
(
t
=
0
;
t
<
Z
;
t
++
)
if
(
z
=
b
.
__webglObjects
[
t
],
z
.
render
)
J
=
z
.
object
,
G
=
z
.
buffer
,
k
(
J
),
f
(
c
,
K
,
M
,
b
.
overrideMaterial
,
G
,
J
);
for
(
t
=
0
;
t
<
I
;
t
++
)
z
=
b
.
__webglObjectsImmediate
[
t
],
J
=
z
.
object
,
J
.
visible
&&
(
k
(
J
),
D
=
e
(
c
,
K
,
M
,
b
.
overrideMaterial
,
J
),
J
.
render
(
function
(
c
){
h
(
c
,
D
,
b
.
overrideMaterial
.
shading
)}))}
else
{
O
(
THREE
.
NormalBlending
);
for
(
t
=
Z
-
1
;
t
>=
0
;
t
--
)
if
(
z
=
b
.
__webglObjects
[
t
],
z
.
render
){
J
=
z
.
object
;
G
=
z
.
buffer
;
C
=
z
.
opaque
;
k
(
J
);
for
(
z
=
0
;
z
<
C
.
count
;
z
++
)
E
=
C
.
list
[
z
],
j
(
E
.
depthTest
),
m
(
E
.
polygonOffset
,
E
.
polygonOffsetFactor
,
E
.
polygonOffsetUnits
),
f
(
c
,
K
,
M
,
E
,
G
,
J
)}
for
(
t
=
0
;
t
<
I
;
t
++
)
if
(
z
=
b
.
__webglObjectsImmediate
[
t
],
J
=
z
.
object
,
J
.
visible
){
C
=
z
.
opaque
;
k
(
J
);
for
(
z
=
0
;
z
<
C
.
count
;
z
++
)
E
=
C
.
list
[
z
],
j
(
E
.
depthTest
),
m
(
E
.
polygonOffset
,
E
.
polygonOffsetFactor
,
E
.
polygonOffsetUnits
),
D
=
e
(
c
,
K
,
M
,
E
,
J
),
J
.
render
(
function
(
b
){
h
(
b
,
D
,
E
.
shading
)})}
for
(
t
=
0
;
t
<
Z
;
t
++
)
if
(
z
=
b
.
__webglObjects
[
t
],
z
.
render
){
J
=
z
.
object
;
G
=
z
.
buffer
;
C
=
z
.
transparent
;
k
(
J
);
for
(
z
=
0
;
z
<
C
.
count
;
z
++
)
E
=
C
.
list
[
z
],
O
(
E
.
blending
),
j
(
E
.
depthTest
),
m
(
E
.
polygonOffset
,
E
.
polygonOffsetFactor
,
E
.
polygonOffsetUnits
),
f
(
c
,
K
,
M
,
E
,
G
,
J
)}
for
(
t
=
...
...
build/custom/ThreeCanvas.js
浏览文件 @
75952217
...
...
@@ -47,7 +47,7 @@ THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.
THREE
.
Matrix4
.
makeFrustum
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
var
f
;
f
=
new
THREE
.
Matrix4
;
f
.
n11
=
2
*
e
/
(
b
-
a
);
f
.
n12
=
0
;
f
.
n13
=
(
b
+
a
)
/
(
b
-
a
);
f
.
n14
=
0
;
f
.
n21
=
0
;
f
.
n22
=
2
*
e
/
(
d
-
c
);
f
.
n23
=
(
d
+
c
)
/
(
d
-
c
);
f
.
n24
=
0
;
f
.
n31
=
0
;
f
.
n32
=
0
;
f
.
n33
=-
(
g
+
e
)
/
(
g
-
e
);
f
.
n34
=-
2
*
g
*
e
/
(
g
-
e
);
f
.
n41
=
0
;
f
.
n42
=
0
;
f
.
n43
=-
1
;
f
.
n44
=
0
;
return
f
};
THREE
.
Matrix4
.
makePerspective
=
function
(
a
,
b
,
c
,
d
){
var
e
,
a
=
c
*
Math
.
tan
(
a
*
Math
.
PI
/
360
);
e
=-
a
;
return
THREE
.
Matrix4
.
makeFrustum
(
e
*
b
,
a
*
b
,
e
,
a
,
c
,
d
)};
THREE
.
Matrix4
.
makeOrtho
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
var
f
,
h
,
j
,
l
;
f
=
new
THREE
.
Matrix4
;
h
=
b
-
a
;
j
=
c
-
d
;
l
=
g
-
e
;
f
.
n11
=
2
/
h
;
f
.
n12
=
0
;
f
.
n13
=
0
;
f
.
n14
=-
((
b
+
a
)
/
h
);
f
.
n21
=
0
;
f
.
n22
=
2
/
j
;
f
.
n23
=
0
;
f
.
n24
=-
((
c
+
d
)
/
j
);
f
.
n31
=
0
;
f
.
n32
=
0
;
f
.
n33
=-
2
/
l
;
f
.
n34
=-
((
g
+
e
)
/
l
);
f
.
n41
=
0
;
f
.
n42
=
0
;
f
.
n43
=
0
;
f
.
n44
=
1
;
return
f
};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__m1
=
new
THREE
.
Matrix4
;
THREE
.
Matrix4
.
__m2
=
new
THREE
.
Matrix4
;
THREE
.
Object3D
=
function
(){
this
.
id
=
THREE
.
Object3DCount
++
;
this
.
parent
=
void
0
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
eulerOrder
=
"
XYZ
"
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
flipSided
=
this
.
doubleSided
=
this
.
dynamic
=!
1
;
this
.
renderDepth
=
null
;
this
.
rotationAutoUpdate
=!
0
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixWorldNeedsUpdate
=
this
.
matrixAutoUpdate
=
!
0
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=!
1
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=!
0
;
this
.
receiveShadow
=
this
.
castShadow
=!
1
;
this
.
_vector
=
new
THREE
.
Vector3
;
this
.
name
=
""
};
!
0
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=!
1
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=!
0
;
this
.
receiveShadow
=
this
.
castShadow
=!
1
;
this
.
frustumCulled
=!
0
;
this
.
_vector
=
new
THREE
.
Vector3
;
this
.
name
=
""
};
THREE
.
Object3D
.
prototype
=
{
constructor
:
THREE
.
Object3D
,
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
0
,
1
))},
lookAt
:
function
(
a
){
this
.
matrix
.
lookAt
(
a
,
this
.
position
,
this
.
up
);
this
.
rotationAutoUpdate
&&
this
.
rotation
.
setRotationFromMatrix
(
this
.
matrix
)},
addChild
:
function
(
a
){
if
(
this
.
children
.
indexOf
(
a
)
===
-
1
){
a
.
parent
!==
void
0
&&
a
.
parent
.
removeChild
(
a
);
a
.
parent
=
this
;
this
.
children
.
push
(
a
);
for
(
var
b
=
this
;
b
.
parent
!==
void
0
;)
b
=
b
.
parent
;
b
!==
void
0
&&
b
instanceof
THREE
.
Scene
&&
b
.
addChildRecurse
(
a
)}},
removeChild
:
function
(
a
){
var
b
=
this
.
children
.
indexOf
(
a
);
if
(
b
!==-
1
)
a
.
parent
=
void
0
,
this
.
children
.
splice
(
b
,
1
)},
getChildByName
:
function
(
a
,
b
){
var
c
,
d
,
e
;
c
=
0
;
for
(
d
=
this
.
children
.
length
;
c
<
d
;
c
++
){
e
=
this
.
children
[
c
];
if
(
e
.
name
===
a
)
return
e
;
if
(
b
&&
(
e
=
e
.
getChildByName
(
a
,
b
),
e
!==
void
0
))
return
e
}},
updateMatrix
:
function
(){
this
.
matrix
.
setPosition
(
this
.
position
);
this
.
useQuaternion
?
this
.
matrix
.
setRotationFromQuaternion
(
this
.
quaternion
):
this
.
matrix
.
setRotationFromEuler
(
this
.
rotation
,
this
.
eulerOrder
);
if
(
this
.
scale
.
x
!==
1
||
this
.
scale
.
y
!==
1
||
this
.
scale
.
z
!==
1
)
this
.
matrix
.
scale
(
this
.
scale
),
this
.
boundRadiusScale
=
Math
.
max
(
this
.
scale
.
x
,
Math
.
max
(
this
.
scale
.
y
,
this
.
scale
.
z
));
this
.
matrixWorldNeedsUpdate
=!
0
},
update
:
function
(
a
,
b
,
c
){
this
.
matrixAutoUpdate
&&
this
.
updateMatrix
();
if
(
this
.
matrixWorldNeedsUpdate
||
b
)
a
?
this
.
matrixWorld
.
multiply
(
a
,
this
.
matrix
):
this
.
matrixWorld
.
copy
(
this
.
matrix
),
...
...
build/custom/ThreeDOM.js
浏览文件 @
75952217
...
...
@@ -47,7 +47,7 @@ THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.
THREE
.
Matrix4
.
makeFrustum
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
var
f
;
f
=
new
THREE
.
Matrix4
;
f
.
n11
=
2
*
e
/
(
b
-
a
);
f
.
n12
=
0
;
f
.
n13
=
(
b
+
a
)
/
(
b
-
a
);
f
.
n14
=
0
;
f
.
n21
=
0
;
f
.
n22
=
2
*
e
/
(
d
-
c
);
f
.
n23
=
(
d
+
c
)
/
(
d
-
c
);
f
.
n24
=
0
;
f
.
n31
=
0
;
f
.
n32
=
0
;
f
.
n33
=-
(
g
+
e
)
/
(
g
-
e
);
f
.
n34
=-
2
*
g
*
e
/
(
g
-
e
);
f
.
n41
=
0
;
f
.
n42
=
0
;
f
.
n43
=-
1
;
f
.
n44
=
0
;
return
f
};
THREE
.
Matrix4
.
makePerspective
=
function
(
a
,
b
,
c
,
d
){
var
e
,
a
=
c
*
Math
.
tan
(
a
*
Math
.
PI
/
360
);
e
=-
a
;
return
THREE
.
Matrix4
.
makeFrustum
(
e
*
b
,
a
*
b
,
e
,
a
,
c
,
d
)};
THREE
.
Matrix4
.
makeOrtho
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
var
f
,
h
,
j
,
i
;
f
=
new
THREE
.
Matrix4
;
h
=
b
-
a
;
j
=
c
-
d
;
i
=
g
-
e
;
f
.
n11
=
2
/
h
;
f
.
n12
=
0
;
f
.
n13
=
0
;
f
.
n14
=-
((
b
+
a
)
/
h
);
f
.
n21
=
0
;
f
.
n22
=
2
/
j
;
f
.
n23
=
0
;
f
.
n24
=-
((
c
+
d
)
/
j
);
f
.
n31
=
0
;
f
.
n32
=
0
;
f
.
n33
=-
2
/
i
;
f
.
n34
=-
((
g
+
e
)
/
i
);
f
.
n41
=
0
;
f
.
n42
=
0
;
f
.
n43
=
0
;
f
.
n44
=
1
;
return
f
};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__m1
=
new
THREE
.
Matrix4
;
THREE
.
Matrix4
.
__m2
=
new
THREE
.
Matrix4
;
THREE
.
Object3D
=
function
(){
this
.
id
=
THREE
.
Object3DCount
++
;
this
.
parent
=
void
0
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
eulerOrder
=
"
XYZ
"
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
flipSided
=
this
.
doubleSided
=
this
.
dynamic
=!
1
;
this
.
renderDepth
=
null
;
this
.
rotationAutoUpdate
=!
0
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixWorldNeedsUpdate
=
this
.
matrixAutoUpdate
=
!
0
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=!
1
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=!
0
;
this
.
receiveShadow
=
this
.
castShadow
=!
1
;
this
.
_vector
=
new
THREE
.
Vector3
;
this
.
name
=
""
};
!
0
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=!
1
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=!
0
;
this
.
receiveShadow
=
this
.
castShadow
=!
1
;
this
.
frustumCulled
=!
0
;
this
.
_vector
=
new
THREE
.
Vector3
;
this
.
name
=
""
};
THREE
.
Object3D
.
prototype
=
{
constructor
:
THREE
.
Object3D
,
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
0
,
1
))},
lookAt
:
function
(
a
){
this
.
matrix
.
lookAt
(
a
,
this
.
position
,
this
.
up
);
this
.
rotationAutoUpdate
&&
this
.
rotation
.
setRotationFromMatrix
(
this
.
matrix
)},
addChild
:
function
(
a
){
if
(
this
.
children
.
indexOf
(
a
)
===
-
1
){
a
.
parent
!==
void
0
&&
a
.
parent
.
removeChild
(
a
);
a
.
parent
=
this
;
this
.
children
.
push
(
a
);
for
(
var
b
=
this
;
b
.
parent
!==
void
0
;)
b
=
b
.
parent
;
b
!==
void
0
&&
b
instanceof
THREE
.
Scene
&&
b
.
addChildRecurse
(
a
)}},
removeChild
:
function
(
a
){
var
b
=
this
.
children
.
indexOf
(
a
);
if
(
b
!==-
1
)
a
.
parent
=
void
0
,
this
.
children
.
splice
(
b
,
1
)},
getChildByName
:
function
(
a
,
b
){
var
c
,
d
,
e
;
c
=
0
;
for
(
d
=
this
.
children
.
length
;
c
<
d
;
c
++
){
e
=
this
.
children
[
c
];
if
(
e
.
name
===
a
)
return
e
;
if
(
b
&&
(
e
=
e
.
getChildByName
(
a
,
b
),
e
!==
void
0
))
return
e
}},
updateMatrix
:
function
(){
this
.
matrix
.
setPosition
(
this
.
position
);
this
.
useQuaternion
?
this
.
matrix
.
setRotationFromQuaternion
(
this
.
quaternion
):
this
.
matrix
.
setRotationFromEuler
(
this
.
rotation
,
this
.
eulerOrder
);
if
(
this
.
scale
.
x
!==
1
||
this
.
scale
.
y
!==
1
||
this
.
scale
.
z
!==
1
)
this
.
matrix
.
scale
(
this
.
scale
),
this
.
boundRadiusScale
=
Math
.
max
(
this
.
scale
.
x
,
Math
.
max
(
this
.
scale
.
y
,
this
.
scale
.
z
));
this
.
matrixWorldNeedsUpdate
=!
0
},
update
:
function
(
a
,
b
,
c
){
this
.
matrixAutoUpdate
&&
this
.
updateMatrix
();
if
(
this
.
matrixWorldNeedsUpdate
||
b
)
a
?
this
.
matrixWorld
.
multiply
(
a
,
this
.
matrix
):
this
.
matrixWorld
.
copy
(
this
.
matrix
),
...
...
build/custom/ThreeSVG.js
浏览文件 @
75952217
...
...
@@ -47,7 +47,7 @@ THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.
THREE
.
Matrix4
.
makeFrustum
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
var
f
;
f
=
new
THREE
.
Matrix4
;
f
.
n11
=
2
*
e
/
(
b
-
a
);
f
.
n12
=
0
;
f
.
n13
=
(
b
+
a
)
/
(
b
-
a
);
f
.
n14
=
0
;
f
.
n21
=
0
;
f
.
n22
=
2
*
e
/
(
d
-
c
);
f
.
n23
=
(
d
+
c
)
/
(
d
-
c
);
f
.
n24
=
0
;
f
.
n31
=
0
;
f
.
n32
=
0
;
f
.
n33
=-
(
g
+
e
)
/
(
g
-
e
);
f
.
n34
=-
2
*
g
*
e
/
(
g
-
e
);
f
.
n41
=
0
;
f
.
n42
=
0
;
f
.
n43
=-
1
;
f
.
n44
=
0
;
return
f
};
THREE
.
Matrix4
.
makePerspective
=
function
(
a
,
b
,
c
,
d
){
var
e
,
a
=
c
*
Math
.
tan
(
a
*
Math
.
PI
/
360
);
e
=-
a
;
return
THREE
.
Matrix4
.
makeFrustum
(
e
*
b
,
a
*
b
,
e
,
a
,
c
,
d
)};
THREE
.
Matrix4
.
makeOrtho
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
var
f
,
h
,
k
,
i
;
f
=
new
THREE
.
Matrix4
;
h
=
b
-
a
;
k
=
c
-
d
;
i
=
g
-
e
;
f
.
n11
=
2
/
h
;
f
.
n12
=
0
;
f
.
n13
=
0
;
f
.
n14
=-
((
b
+
a
)
/
h
);
f
.
n21
=
0
;
f
.
n22
=
2
/
k
;
f
.
n23
=
0
;
f
.
n24
=-
((
c
+
d
)
/
k
);
f
.
n31
=
0
;
f
.
n32
=
0
;
f
.
n33
=-
2
/
i
;
f
.
n34
=-
((
g
+
e
)
/
i
);
f
.
n41
=
0
;
f
.
n42
=
0
;
f
.
n43
=
0
;
f
.
n44
=
1
;
return
f
};
THREE
.
Matrix4
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
Matrix4
.
__m1
=
new
THREE
.
Matrix4
;
THREE
.
Matrix4
.
__m2
=
new
THREE
.
Matrix4
;
THREE
.
Object3D
=
function
(){
this
.
id
=
THREE
.
Object3DCount
++
;
this
.
parent
=
void
0
;
this
.
children
=
[];
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
rotation
=
new
THREE
.
Vector3
;
this
.
eulerOrder
=
"
XYZ
"
;
this
.
scale
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
flipSided
=
this
.
doubleSided
=
this
.
dynamic
=!
1
;
this
.
renderDepth
=
null
;
this
.
rotationAutoUpdate
=!
0
;
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
matrixWorld
=
new
THREE
.
Matrix4
;
this
.
matrixRotationWorld
=
new
THREE
.
Matrix4
;
this
.
matrixWorldNeedsUpdate
=
this
.
matrixAutoUpdate
=
!
0
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=!
1
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=!
0
;
this
.
receiveShadow
=
this
.
castShadow
=!
1
;
this
.
_vector
=
new
THREE
.
Vector3
;
this
.
name
=
""
};
!
0
;
this
.
quaternion
=
new
THREE
.
Quaternion
;
this
.
useQuaternion
=!
1
;
this
.
boundRadius
=
0
;
this
.
boundRadiusScale
=
1
;
this
.
visible
=!
0
;
this
.
receiveShadow
=
this
.
castShadow
=!
1
;
this
.
frustumCulled
=!
0
;
this
.
_vector
=
new
THREE
.
Vector3
;
this
.
name
=
""
};
THREE
.
Object3D
.
prototype
=
{
constructor
:
THREE
.
Object3D
,
translate
:
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))},
translateX
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
1
,
0
,
0
))},
translateY
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
1
,
0
))},
translateZ
:
function
(
a
){
this
.
translate
(
a
,
this
.
_vector
.
set
(
0
,
0
,
1
))},
lookAt
:
function
(
a
){
this
.
matrix
.
lookAt
(
a
,
this
.
position
,
this
.
up
);
this
.
rotationAutoUpdate
&&
this
.
rotation
.
setRotationFromMatrix
(
this
.
matrix
)},
addChild
:
function
(
a
){
if
(
this
.
children
.
indexOf
(
a
)
===
-
1
){
a
.
parent
!==
void
0
&&
a
.
parent
.
removeChild
(
a
);
a
.
parent
=
this
;
this
.
children
.
push
(
a
);
for
(
var
b
=
this
;
b
.
parent
!==
void
0
;)
b
=
b
.
parent
;
b
!==
void
0
&&
b
instanceof
THREE
.
Scene
&&
b
.
addChildRecurse
(
a
)}},
removeChild
:
function
(
a
){
var
b
=
this
.
children
.
indexOf
(
a
);
if
(
b
!==-
1
)
a
.
parent
=
void
0
,
this
.
children
.
splice
(
b
,
1
)},
getChildByName
:
function
(
a
,
b
){
var
c
,
d
,
e
;
c
=
0
;
for
(
d
=
this
.
children
.
length
;
c
<
d
;
c
++
){
e
=
this
.
children
[
c
];
if
(
e
.
name
===
a
)
return
e
;
if
(
b
&&
(
e
=
e
.
getChildByName
(
a
,
b
),
e
!==
void
0
))
return
e
}},
updateMatrix
:
function
(){
this
.
matrix
.
setPosition
(
this
.
position
);
this
.
useQuaternion
?
this
.
matrix
.
setRotationFromQuaternion
(
this
.
quaternion
):
this
.
matrix
.
setRotationFromEuler
(
this
.
rotation
,
this
.
eulerOrder
);
if
(
this
.
scale
.
x
!==
1
||
this
.
scale
.
y
!==
1
||
this
.
scale
.
z
!==
1
)
this
.
matrix
.
scale
(
this
.
scale
),
this
.
boundRadiusScale
=
Math
.
max
(
this
.
scale
.
x
,
Math
.
max
(
this
.
scale
.
y
,
this
.
scale
.
z
));
this
.
matrixWorldNeedsUpdate
=!
0
},
update
:
function
(
a
,
b
,
c
){
this
.
matrixAutoUpdate
&&
this
.
updateMatrix
();
if
(
this
.
matrixWorldNeedsUpdate
||
b
)
a
?
this
.
matrixWorld
.
multiply
(
a
,
this
.
matrix
):
this
.
matrixWorld
.
copy
(
this
.
matrix
),
...
...
build/custom/ThreeWebGL.js
浏览文件 @
75952217
此差异已折叠。
点击以展开。
examples/webgl_performance.html
浏览文件 @
75952217
...
...
@@ -70,6 +70,8 @@
mesh
.
matrixAutoUpdate
=
false
;
mesh
.
updateMatrix
();
//mesh.frustumCulled = false;
scene
.
addObject
(
mesh
);
}
...
...
src/core/Object3D.js
浏览文件 @
75952217
...
...
@@ -45,6 +45,8 @@ THREE.Object3D = function() {
this
.
castShadow
=
false
;
this
.
receiveShadow
=
false
;
this
.
frustumCulled
=
true
;
this
.
_vector
=
new
THREE
.
Vector3
();
this
.
name
=
""
;
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
75952217
...
...
@@ -3464,7 +3464,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
object
.
visible
&&
object
.
castShadow
)
{
if
(
!
(
object
instanceof
THREE
.
Mesh
)
||
isInFrustum
(
object
)
)
{
if
(
!
(
object
instanceof
THREE
.
Mesh
)
||
!
(
object
.
frustumCulled
)
||
isInFrustum
(
object
)
)
{
object
.
matrixWorld
.
flattenToArray
(
object
.
_objectMatrixArray
);
...
...
@@ -3615,7 +3615,7 @@ THREE.WebGLRenderer = function ( parameters ) {
if
(
object
.
visible
)
{
if
(
!
(
object
instanceof
THREE
.
Mesh
)
||
isInFrustum
(
object
)
)
{
if
(
!
(
object
instanceof
THREE
.
Mesh
)
||
!
(
object
.
frustumCulled
)
||
isInFrustum
(
object
)
)
{
object
.
matrixWorld
.
flattenToArray
(
object
.
_objectMatrixArray
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录