Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fktz008
three.js
提交
04bb63d2
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,发现更多精彩内容 >>
提交
04bb63d2
编写于
4月 10, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added LinePieces support in Projector.
上级
4b5aa679
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
10 addition
and
5 deletion
+10
-5
build/Three.js
build/Three.js
+3
-3
src/core/Projector.js
src/core/Projector.js
+7
-2
未找到文件。
build/Three.js
浏览文件 @
04bb63d2
...
...
@@ -73,8 +73,8 @@ h.positionScreen.copy(h.positionWorld),C.multiplyVector4(h.positionScreen),h.pos
R
.
doubleSided
||
i
!=
R
.
flipSided
)
ia
=
m
[
p
]
=
m
[
p
]
||
new
THREE
.
RenderableFace3
,
p
++
,
k
=
ia
,
k
.
v1
.
copy
(
E
),
k
.
v2
.
copy
(
aa
),
k
.
v3
.
copy
(
ea
);
else
continue
;
else
continue
;
else
if
(
A
instanceof
THREE
.
Face4
)
if
(
E
=
j
[
A
.
a
],
aa
=
j
[
A
.
b
],
ea
=
j
[
A
.
c
],
ia
=
j
[
A
.
d
],
E
.
visible
&&
aa
.
visible
&&
ea
.
visible
&&
ia
.
visible
)
if
(
i
=
0
>
(
ia
.
positionScreen
.
x
-
E
.
positionScreen
.
x
)
*
(
aa
.
positionScreen
.
y
-
E
.
positionScreen
.
y
)
-
(
ia
.
positionScreen
.
y
-
E
.
positionScreen
.
y
)
*
(
aa
.
positionScreen
.
x
-
E
.
positionScreen
.
x
)
||
0
>
(
aa
.
positionScreen
.
x
-
ea
.
positionScreen
.
x
)
*
(
ia
.
positionScreen
.
y
-
ea
.
positionScreen
.
y
)
-
(
aa
.
positionScreen
.
y
-
ea
.
positionScreen
.
y
)
*
(
ia
.
positionScreen
.
x
-
ea
.
positionScreen
.
x
),
R
.
doubleSided
||
i
!=
R
.
flipSided
)
oa
=
r
[
o
]
=
r
[
o
]
||
new
THREE
.
RenderableFace4
,
o
++
,
k
=
oa
,
k
.
v1
.
copy
(
E
),
k
.
v2
.
copy
(
aa
),
k
.
v3
.
copy
(
ea
),
k
.
v4
.
copy
(
ia
);
else
continue
;
else
continue
;
k
.
normalWorld
.
copy
(
A
.
normal
);
!
i
&&
(
R
.
flipSided
||
R
.
doubleSided
)
&&
k
.
normalWorld
.
negate
();
ba
.
multiplyVector3
(
k
.
normalWorld
);
k
.
centroidWorld
.
copy
(
A
.
centroid
);
$
.
multiplyVector3
(
k
.
centroidWorld
);
k
.
centroidScreen
.
copy
(
k
.
centroidWorld
);
C
.
multiplyVector3
(
k
.
centroidScreen
);
ea
=
A
.
vertexNormals
;
for
(
E
=
0
,
aa
=
ea
.
length
;
E
<
aa
;
E
++
)
ia
=
k
.
vertexNormalsWorld
[
E
],
ia
.
copy
(
ea
[
E
]),
!
i
&&
(
R
.
flipSided
||
R
.
doubleSided
)
&&
ia
.
negate
(),
ba
.
multiplyVector3
(
ia
);
for
(
E
=
0
,
aa
=
Ga
.
length
;
E
<
aa
;
E
++
)
if
(
oa
=
Ga
[
E
][
V
])
for
(
ea
=
0
,
ia
=
oa
.
length
;
ea
<
ia
;
ea
++
)
k
.
uvs
[
E
][
ea
]
=
oa
[
ea
];
k
.
material
=
R
.
material
;
k
.
faceMaterial
=
null
!==
A
.
materialIndex
?
Z
[
A
.
materialIndex
]:
null
;
k
.
z
=
k
.
centroidScreen
.
z
;
w
.
elements
.
push
(
k
)}}
else
if
(
R
instanceof
THREE
.
Line
){
G
.
multiply
(
C
,
$
);
V
=
R
.
geometry
.
vertices
;
E
=
b
();
E
.
positionScreen
.
copy
(
V
[
0
].
position
);
G
.
multiplyVector4
(
E
.
positionScreen
);
for
(
B
=
1
,
A
=
V
.
length
;
B
<
A
;
B
++
)
if
(
E
=
b
(),
E
.
positionScreen
.
copy
(
V
[
B
].
position
),
G
.
multiplyVector4
(
E
.
positionScreen
),
aa
=
j
[
l
-
2
],
N
.
copy
(
E
.
positionScreen
),
P
.
copy
(
aa
.
positionScreen
),
d
(
N
,
P
))
N
.
multiplyScalar
(
1
/
N
.
w
),
P
.
multiplyScalar
(
1
/
P
.
w
),
$
=
s
[
q
]
=
s
[
q
]
||
new
THREE
.
RenderableLine
,
q
++
,
n
=
$
,
n
.
v1
.
positionScreen
.
copy
(
N
),
n
.
v2
.
positionScreen
.
copy
(
P
),
n
.
z
=
Math
.
max
(
N
.
z
,
P
.
z
),
n
.
material
=
R
.
material
,
w
.
elements
.
push
(
n
)}
for
(
a
=
0
,
z
=
w
.
sprites
.
length
;
a
<
z
;
a
++
)
if
(
R
=
w
.
sprites
[
a
].
object
,
$
=
R
.
matrixWorld
,
R
instanceof
THREE
.
Particle
&&
(
F
.
set
(
$
.
n14
,
$
.
n24
,
$
.
n34
,
1
),
C
.
multiplyVector4
(
F
),
F
.
z
/=
F
.
w
,
0
<
F
.
z
&&
1
>
F
.
z
))
g
=
t
[
v
]
=
t
[
v
]
||
new
THREE
.
RenderableParticle
,
v
++
,
u
=
g
,
u
.
x
=
F
.
x
/
F
.
w
,
u
.
y
=
F
.
y
/
F
.
w
,
u
.
z
=
F
.
z
,
u
.
rotation
=
R
.
rotation
.
z
,
u
.
scale
.
x
=
R
.
scale
.
x
*
Math
.
abs
(
u
.
x
-
(
F
.
x
+
e
.
projectionMatrix
.
n11
)
/
(
F
.
w
+
e
.
projectionMatrix
.
n14
)),
u
.
scale
.
y
=
R
.
scale
.
y
*
Math
.
abs
(
u
.
y
-
(
F
.
y
+
e
.
projectionMatrix
.
n22
)
/
(
F
.
w
+
e
.
projectionMatrix
.
n24
)),
u
.
material
=
R
.
material
,
w
.
elements
.
push
(
u
);
f
&&
w
.
elements
.
sort
(
c
);
return
w
}};
$
=
R
.
type
===
THREE
.
LinePieces
?
2
:
1
;
for
(
B
=
1
,
A
=
V
.
length
;
B
<
A
;
B
++
)
if
(
E
=
b
(),
E
.
positionScreen
.
copy
(
V
[
B
].
position
),
G
.
multiplyVector4
(
E
.
positionScreen
),
0
===
B
%
$
&&
(
aa
=
j
[
l
-
2
],
N
.
copy
(
E
.
positionScreen
),
P
.
copy
(
aa
.
positionScreen
),
d
(
N
,
P
)))
N
.
multiplyScalar
(
1
/
N
.
w
),
P
.
multiplyScalar
(
1
/
P
.
w
),
Z
=
s
[
q
]
=
s
[
q
]
||
new
THREE
.
RenderableLine
,
q
++
,
n
=
Z
,
n
.
v1
.
positionScreen
.
copy
(
N
),
n
.
v2
.
positionScreen
.
copy
(
P
),
n
.
z
=
Math
.
max
(
N
.
z
,
P
.
z
),
n
.
material
=
R
.
material
,
w
.
elements
.
push
(
n
)}
for
(
a
=
0
,
z
=
w
.
sprites
.
length
;
a
<
z
;
a
++
)
if
(
R
=
w
.
sprites
[
a
].
object
,
$
=
R
.
matrixWorld
,
R
instanceof
THREE
.
Particle
&&
(
F
.
set
(
$
.
n14
,
$
.
n24
,
$
.
n34
,
1
),
C
.
multiplyVector4
(
F
),
F
.
z
/=
F
.
w
,
0
<
F
.
z
&&
1
>
F
.
z
))
g
=
t
[
v
]
=
t
[
v
]
||
new
THREE
.
RenderableParticle
,
v
++
,
u
=
g
,
u
.
x
=
F
.
x
/
F
.
w
,
u
.
y
=
F
.
y
/
F
.
w
,
u
.
z
=
F
.
z
,
u
.
rotation
=
R
.
rotation
.
z
,
u
.
scale
.
x
=
R
.
scale
.
x
*
Math
.
abs
(
u
.
x
-
(
F
.
x
+
e
.
projectionMatrix
.
n11
)
/
(
F
.
w
+
e
.
projectionMatrix
.
n14
)),
u
.
scale
.
y
=
R
.
scale
.
y
*
Math
.
abs
(
u
.
y
-
(
F
.
y
+
e
.
projectionMatrix
.
n22
)
/
(
F
.
w
+
e
.
projectionMatrix
.
n24
)),
u
.
material
=
R
.
material
,
w
.
elements
.
push
(
u
);
f
&&
w
.
elements
.
sort
(
c
);
return
w
}};
THREE
.
Quaternion
=
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
;
this
.
z
=
c
||
0
;
this
.
w
=
void
0
!==
d
?
d
:
1
};
THREE
.
Quaternion
.
prototype
=
{
constructor
:
THREE
.
Quaternion
,
set
:
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
d
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
this
.
w
=
a
.
w
;
return
this
},
setFromEuler
:
function
(
a
){
var
b
=
Math
.
PI
/
360
,
c
=
a
.
x
*
b
,
d
=
a
.
y
*
b
,
e
=
a
.
z
*
b
,
a
=
Math
.
cos
(
d
),
d
=
Math
.
sin
(
d
),
b
=
Math
.
cos
(
-
e
),
e
=
Math
.
sin
(
-
e
),
f
=
Math
.
cos
(
c
),
c
=
Math
.
sin
(
c
),
g
=
a
*
b
,
h
=
d
*
e
;
this
.
w
=
g
*
f
-
h
*
c
;
this
.
x
=
g
*
c
+
h
*
f
;
this
.
y
=
d
*
b
*
f
+
a
*
e
*
c
;
this
.
z
=
a
*
e
*
f
-
d
*
b
*
c
;
return
this
},
setFromAxisAngle
:
function
(
a
,
b
){
var
c
=
b
/
2
,
d
=
Math
.
sin
(
c
);
this
.
x
=
a
.
x
*
d
;
this
.
y
=
a
.
y
*
d
;
this
.
z
=
a
.
z
*
d
;
this
.
w
=
Math
.
cos
(
c
);
return
this
},
setFromRotationMatrix
:
function
(
a
){
var
b
=
Math
.
pow
(
a
.
determinant
(),
1
/
3
);
this
.
w
=
Math
.
sqrt
(
Math
.
max
(
0
,
b
+
a
.
n11
+
a
.
n22
+
a
.
n33
))
/
2
;
this
.
x
=
Math
.
sqrt
(
Math
.
max
(
0
,
b
+
a
.
n11
-
a
.
n22
-
a
.
n33
))
/
2
;
this
.
y
=
Math
.
sqrt
(
Math
.
max
(
0
,
b
-
a
.
n11
+
a
.
n22
-
a
.
n33
))
/
2
;
this
.
z
=
Math
.
sqrt
(
Math
.
max
(
0
,
b
-
a
.
n11
-
a
.
n22
+
a
.
n33
))
/
2
;
this
.
x
=
0
>
a
.
n32
-
a
.
n23
?
-
Math
.
abs
(
this
.
x
):
Math
.
abs
(
this
.
x
);
this
.
y
=
0
>
a
.
n13
-
a
.
n31
?
-
Math
.
abs
(
this
.
y
):
Math
.
abs
(
this
.
y
);
this
.
z
=
0
>
a
.
n21
-
a
.
n12
?
-
Math
.
abs
(
this
.
z
):
Math
.
abs
(
this
.
z
);
...
...
@@ -308,7 +308,7 @@ g._normalMatrixArray=new Float32Array(9),g._modelViewMatrixArray=new Float32Arra
-
1
,
void
0
===
B
[
E
]
&&
(
B
[
E
]
=
{
hash
:
E
,
counter
:
0
}),
w
=
B
[
E
].
hash
+
"
_
"
+
B
[
E
].
counter
,
void
0
===
q
.
geometryGroups
[
w
]
&&
(
q
.
geometryGroups
[
w
]
=
{
faces3
:[],
faces4
:[],
materialIndex
:
u
,
vertices
:
0
,
numMorphTargets
:
C
,
numMorphNormals
:
G
}),
v
=
A
instanceof
THREE
.
Face3
?
3
:
4
,
65535
<
q
.
geometryGroups
[
w
].
vertices
+
v
&&
(
B
[
E
].
counter
+=
1
,
w
=
B
[
E
].
hash
+
"
_
"
+
B
[
E
].
counter
,
void
0
===
q
.
geometryGroups
[
w
]
&&
(
q
.
geometryGroups
[
w
]
=
{
faces3
:[],
faces4
:[],
materialIndex
:
u
,
vertices
:
0
,
numMorphTargets
:
C
,
numMorphNormals
:
G
})),
A
instanceof
THREE
.
Face3
?
q
.
geometryGroups
[
w
].
faces3
.
push
(
s
):
q
.
geometryGroups
[
w
].
faces4
.
push
(
s
),
q
.
geometryGroups
[
w
].
vertices
+=
v
;
q
.
geometryGroupsList
=
[];
var
V
=
void
0
;
for
(
V
in
q
.
geometryGroups
)
q
.
geometryGroups
[
V
].
id
=
ea
++
,
q
.
geometryGroupsList
.
push
(
q
.
geometryGroups
[
V
])}
for
(
j
in
l
.
geometryGroups
)
if
(
n
=
l
.
geometryGroups
[
j
],
!
n
.
__webglVertexBuffer
){
var
z
=
n
;
z
.
__webglVertexBuffer
=
i
.
createBuffer
();
z
.
__webglNormalBuffer
=
i
.
createBuffer
();
z
.
__webglTangentBuffer
=
i
.
createBuffer
();
z
.
__webglColorBuffer
=
i
.
createBuffer
();
z
.
__webglUVBuffer
=
i
.
createBuffer
();
z
.
__webglUV2Buffer
=
i
.
createBuffer
();
z
.
__webglSkinVertexABuffer
=
i
.
createBuffer
();
z
.
__webglSkinVertexBBuffer
=
i
.
createBuffer
();
z
.
__webglSkinIndicesBuffer
=
i
.
createBuffer
();
z
.
__webglSkinWeightsBuffer
=
i
.
createBuffer
();
z
.
__webglFaceBuffer
=
i
.
createBuffer
();
z
.
__webglLineBuffer
=
i
.
createBuffer
();
var
F
=
void
0
,
J
=
void
0
;
if
(
z
.
numMorphTargets
){
z
.
__webglMorphTargetsBuffers
=
[];
for
(
F
=
0
,
J
=
z
.
numMorphTargets
;
F
<
J
;
F
++
)
z
.
__webglMorphTargetsBuffers
.
push
(
i
.
createBuffer
())}
if
(
z
.
numMorphNormals
){
z
.
__webglMorphNormalsBuffers
=
[];
for
(
F
=
0
,
J
=
z
.
numMorphNormals
;
F
<
J
;
F
++
)
z
.
__webglMorphNormalsBuffers
.
push
(
i
.
createBuffer
())}
D
.
info
.
memory
.
geometries
++
;
var
I
=
n
,
$
=
g
,
K
=
$
.
geometry
,
O
=
I
.
faces3
,
R
=
I
.
faces4
,
aa
=
3
*
O
.
length
+
4
*
R
.
length
,
N
=
1
*
O
.
length
+
2
*
R
.
length
,
Z
=
3
*
O
.
length
+
4
*
R
.
length
,
P
=
c
(
$
,
I
),
ba
=
e
(
P
),
S
=
d
(
P
),
ja
=
P
.
vertexColors
?
P
.
vertexColors
:
!
1
;
I
.
__vertexArray
=
new
Float32Array
(
3
*
aa
);
if
(
S
)
I
.
__normalArray
=
new
Float32Array
(
3
*
aa
);
if
(
K
.
hasTangents
)
I
.
__tangentArray
=
new
Float32Array
(
4
*
aa
);
if
(
ja
)
I
.
__colorArray
=
new
Float32Array
(
3
*
aa
);
if
(
ba
){
if
(
0
<
K
.
faceUvs
.
length
||
0
<
K
.
faceVertexUvs
.
length
)
I
.
__uvArray
=
new
Float32Array
(
2
*
aa
);
if
(
1
<
K
.
faceUvs
.
length
||
1
<
K
.
faceVertexUvs
.
length
)
I
.
__uv2Array
=
var
I
=
n
,
$
=
g
,
K
=
$
.
geometry
,
R
=
I
.
faces3
,
O
=
I
.
faces4
,
aa
=
3
*
R
.
length
+
4
*
O
.
length
,
N
=
1
*
R
.
length
+
2
*
O
.
length
,
Z
=
3
*
R
.
length
+
4
*
O
.
length
,
P
=
c
(
$
,
I
),
ba
=
e
(
P
),
S
=
d
(
P
),
ja
=
P
.
vertexColors
?
P
.
vertexColors
:
!
1
;
I
.
__vertexArray
=
new
Float32Array
(
3
*
aa
);
if
(
S
)
I
.
__normalArray
=
new
Float32Array
(
3
*
aa
);
if
(
K
.
hasTangents
)
I
.
__tangentArray
=
new
Float32Array
(
4
*
aa
);
if
(
ja
)
I
.
__colorArray
=
new
Float32Array
(
3
*
aa
);
if
(
ba
){
if
(
0
<
K
.
faceUvs
.
length
||
0
<
K
.
faceVertexUvs
.
length
)
I
.
__uvArray
=
new
Float32Array
(
2
*
aa
);
if
(
1
<
K
.
faceUvs
.
length
||
1
<
K
.
faceVertexUvs
.
length
)
I
.
__uv2Array
=
new
Float32Array
(
2
*
aa
)}
if
(
$
.
geometry
.
skinWeights
.
length
&&
$
.
geometry
.
skinIndices
.
length
)
I
.
__skinVertexAArray
=
new
Float32Array
(
4
*
aa
),
I
.
__skinVertexBArray
=
new
Float32Array
(
4
*
aa
),
I
.
__skinIndexArray
=
new
Float32Array
(
4
*
aa
),
I
.
__skinWeightArray
=
new
Float32Array
(
4
*
aa
);
I
.
__faceArray
=
new
Uint16Array
(
3
*
N
);
I
.
__lineArray
=
new
Uint16Array
(
2
*
Z
);
var
T
=
void
0
,
ia
=
void
0
;
if
(
I
.
numMorphTargets
){
I
.
__morphTargetsArrays
=
[];
for
(
T
=
0
,
ia
=
I
.
numMorphTargets
;
T
<
ia
;
T
++
)
I
.
__morphTargetsArrays
.
push
(
new
Float32Array
(
3
*
aa
))}
if
(
I
.
numMorphNormals
){
I
.
__morphNormalsArrays
=
[];
for
(
T
=
0
,
ia
=
I
.
numMorphNormals
;
T
<
ia
;
T
++
)
I
.
__morphNormalsArrays
.
push
(
new
Float32Array
(
3
*
aa
))}
I
.
__webglFaceCount
=
3
*
N
;
I
.
__webglLineCount
=
2
*
Z
;
if
(
P
.
attributes
){
if
(
void
0
===
I
.
__webglCustomAttributesList
)
I
.
__webglCustomAttributesList
=
[];
var
Ga
=
void
0
;
for
(
Ga
in
P
.
attributes
){
var
Ka
=
P
.
attributes
[
Ga
],
oa
=
{},
ga
;
for
(
ga
in
Ka
)
oa
[
ga
]
=
Ka
[
ga
];
if
(
!
oa
.
__webglInitialized
||
oa
.
createUniqueBuffers
){
oa
.
__webglInitialized
=!
0
;
var
Da
=
1
;
"
v2
"
===
oa
.
type
?
Da
=
2
:
"
v3
"
===
oa
.
type
?
Da
=
3
:
"
v4
"
===
oa
.
type
?
Da
=
4
:
"
c
"
===
oa
.
type
&&
(
Da
=
3
);
oa
.
size
=
Da
;
oa
.
array
=
new
Float32Array
(
aa
*
Da
);
oa
.
buffer
=
i
.
createBuffer
();
oa
.
buffer
.
belongsToAttribute
=
Ga
;
Ka
.
needsUpdate
=!
0
;
oa
.
__original
=
Ka
}
I
.
__webglCustomAttributesList
.
push
(
oa
)}}
I
.
__inittedArrays
=!
0
;
l
.
__dirtyVertices
=!
0
;
l
.
__dirtyMorphTargets
=!
0
;
l
.
__dirtyElements
=!
0
;
l
.
__dirtyUvs
=!
0
;
l
.
__dirtyNormals
=!
0
;
l
.
__dirtyTangents
=!
0
;
l
.
__dirtyColors
=!
0
}}}
else
if
(
g
instanceof
THREE
.
Ribbon
){
if
(
l
=
g
.
geometry
,
!
l
.
__webglVertexBuffer
){
var
Ua
=
l
;
Ua
.
__webglVertexBuffer
=
i
.
createBuffer
();
Ua
.
__webglColorBuffer
=
i
.
createBuffer
();
D
.
info
.
memory
.
geometries
++
;
...
...
src/core/Projector.js
浏览文件 @
04bb63d2
...
...
@@ -319,12 +319,17 @@ THREE.Projector = function() {
v1
.
positionScreen
.
copy
(
vertices
[
0
].
position
);
_projScreenobjectMatrixWorld
.
multiplyVector4
(
v1
.
positionScreen
);
for
(
v
=
1
,
vl
=
vertices
.
length
;
v
<
vl
;
v
++
)
{
// Handle LineStrip and LinePieces
var
step
=
object
.
type
===
THREE
.
LinePieces
?
2
:
1
;
for
(
v
=
1
,
vl
=
vertices
.
length
;
v
<
vl
;
v
++
)
{
v1
=
getNextVertexInPool
();
v1
.
positionScreen
.
copy
(
vertices
[
v
].
position
);
_projScreenobjectMatrixWorld
.
multiplyVector4
(
v1
.
positionScreen
);
if
(
v
%
step
!==
0
)
continue
;
v2
=
_vertexPool
[
_vertexCount
-
2
];
_clippedVertex1PositionScreen
.
copy
(
v1
.
positionScreen
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录