Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
c687a368
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
c687a368
编写于
1月 08, 2021
作者:
M
Mr.doob
提交者:
GitHub
1月 08, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21026 from Mugen87/dev2
Decal/Edges/WireframeGeometry: Stop Geometry support.
上级
6f98352a
51c424bb
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
74 addition
and
123 deletion
+74
-123
docs/api/en/geometries/EdgesGeometry.html
docs/api/en/geometries/EdgesGeometry.html
+1
-1
docs/api/en/geometries/WireframeGeometry.html
docs/api/en/geometries/WireframeGeometry.html
+1
-1
docs/api/zh/geometries/EdgesGeometry.html
docs/api/zh/geometries/EdgesGeometry.html
+1
-1
docs/api/zh/geometries/WireframeGeometry.html
docs/api/zh/geometries/WireframeGeometry.html
+1
-1
examples/js/geometries/DecalGeometry.js
examples/js/geometries/DecalGeometry.js
+6
-7
examples/jsm/geometries/DecalGeometry.js
examples/jsm/geometries/DecalGeometry.js
+6
-7
src/geometries/EdgesGeometry.d.ts
src/geometries/EdgesGeometry.d.ts
+1
-2
src/geometries/EdgesGeometry.js
src/geometries/EdgesGeometry.js
+3
-2
src/geometries/WireframeGeometry.d.ts
src/geometries/WireframeGeometry.d.ts
+1
-2
src/geometries/WireframeGeometry.js
src/geometries/WireframeGeometry.js
+51
-94
test/unit/src/geometries/EdgesGeometry.tests.js
test/unit/src/geometries/EdgesGeometry.tests.js
+1
-4
utils/modularize.js
utils/modularize.js
+1
-1
未找到文件。
docs/api/en/geometries/EdgesGeometry.html
浏览文件 @
c687a368
...
...
@@ -29,7 +29,7 @@ scene.add( line );
<h2>
Constructor
</h2>
<h3>
[name]( [param:Geometry geometry], [param:Integer thresholdAngle] )
</h3>
<h3>
[name]( [param:
Buffer
Geometry geometry], [param:Integer thresholdAngle] )
</h3>
<p>
geometry — Any geometry object.
<br
/>
thresholdAngle — An edge is only rendered if the angle (in degrees) between the face normals of the adjoining faces exceeds this value. default = 1 degree.
...
...
docs/api/en/geometries/WireframeGeometry.html
浏览文件 @
c687a368
...
...
@@ -36,7 +36,7 @@
<h2>
Constructor
</h2>
<h3>
[name]( [param:Geometry geometry] )
</h3>
<h3>
[name]( [param:
Buffer
Geometry geometry] )
</h3>
<p>
geometry — any geometry object.
</p>
...
...
docs/api/zh/geometries/EdgesGeometry.html
浏览文件 @
c687a368
...
...
@@ -28,7 +28,7 @@
<h2>
构造器
</h2>
<h3>
[name]( [param:Geometry geometry], [param:Integer thresholdAngle] )
</h3>
<h3>
[name]( [param:
Buffer
Geometry geometry], [param:Integer thresholdAngle] )
</h3>
<p>
geometry — 任何一个几何体对象。
<br
/>
thresholdAngle — 仅当相邻面的法线之间的角度(单位为角度)超过这个值时,才会渲染边缘。默认值为1。
...
...
docs/api/zh/geometries/WireframeGeometry.html
浏览文件 @
c687a368
...
...
@@ -35,7 +35,7 @@
<h2>
构造器
</h2>
<h3>
[name]( [param:Geometry geometry] )
</h3>
<h3>
[name]( [param:
Buffer
Geometry geometry] )
</h3>
<p>
geometry — 任意几何体对象。
</p>
...
...
examples/js/geometries/DecalGeometry.js
浏览文件 @
c687a368
...
...
@@ -49,7 +49,7 @@ THREE.DecalGeometry = function ( mesh, position, orientation, size ) {
function
generate
()
{
var
i
;
var
geometry
=
new
THREE
.
BufferGeometry
();
var
decalVertices
=
[];
var
vertex
=
new
THREE
.
Vector3
();
...
...
@@ -57,16 +57,15 @@ THREE.DecalGeometry = function ( mesh, position, orientation, size ) {
// handle different geometry types
if
(
mesh
.
geometry
.
isGeometry
)
{
geometry
.
fromGeometry
(
mesh
.
geometry
);
if
(
mesh
.
geometry
.
isGeometry
===
true
)
{
}
else
{
geometry
.
copy
(
mesh
.
geometry
);
console
.
error
(
'
THREE.DecalGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.
'
);
return
;
}
var
geometry
=
mesh
.
geometry
;
var
positionAttribute
=
geometry
.
attributes
.
position
;
var
normalAttribute
=
geometry
.
attributes
.
normal
;
...
...
examples/jsm/geometries/DecalGeometry.js
浏览文件 @
c687a368
...
...
@@ -56,7 +56,7 @@ var DecalGeometry = function ( mesh, position, orientation, size ) {
function
generate
()
{
var
i
;
var
geometry
=
new
BufferGeometry
();
var
decalVertices
=
[];
var
vertex
=
new
Vector3
();
...
...
@@ -64,16 +64,15 @@ var DecalGeometry = function ( mesh, position, orientation, size ) {
// handle different geometry types
if
(
mesh
.
geometry
.
isGeometry
)
{
geometry
.
fromGeometry
(
mesh
.
geometry
);
if
(
mesh
.
geometry
.
isGeometry
===
true
)
{
}
else
{
geometry
.
copy
(
mesh
.
geometry
);
console
.
error
(
'
THREE.DecalGeometry no longer supports THREE.Geometry. Use BufferGeometry instead.
'
);
return
;
}
var
geometry
=
mesh
.
geometry
;
var
positionAttribute
=
geometry
.
attributes
.
position
;
var
normalAttribute
=
geometry
.
attributes
.
normal
;
...
...
src/geometries/EdgesGeometry.d.ts
浏览文件 @
c687a368
import
{
BufferGeometry
}
from
'
../core/BufferGeometry
'
;
import
{
Geometry
}
from
'
../core/Geometry
'
;
export
class
EdgesGeometry
extends
BufferGeometry
{
...
...
@@ -7,7 +6,7 @@ export class EdgesGeometry extends BufferGeometry {
* @param geometry
* @param [thresholdAngle=1]
*/
constructor
(
geometry
:
BufferGeometry
|
Geometry
,
thresholdAngle
?:
number
);
constructor
(
geometry
:
BufferGeometry
,
thresholdAngle
?:
number
);
/**
* @default 'EdgesGeometry'
...
...
src/geometries/EdgesGeometry.js
浏览文件 @
c687a368
...
...
@@ -23,9 +23,10 @@ class EdgesGeometry extends BufferGeometry {
thresholdAngle
=
(
thresholdAngle
!==
undefined
)
?
thresholdAngle
:
1
;
if
(
geometry
.
isGeometry
)
{
if
(
geometry
.
isGeometry
===
true
)
{
geometry
=
new
BufferGeometry
().
fromGeometry
(
geometry
);
console
.
error
(
'
THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.
'
);
return
;
}
...
...
src/geometries/WireframeGeometry.d.ts
浏览文件 @
c687a368
import
{
Geometry
}
from
'
./../core/Geometry
'
;
import
{
BufferGeometry
}
from
'
./../core/BufferGeometry
'
;
export
class
WireframeGeometry
extends
BufferGeometry
{
constructor
(
geometry
:
Geometry
|
BufferGeometry
);
constructor
(
geometry
:
BufferGeometry
);
/**
* @default 'WireframeGeometry'
...
...
src/geometries/WireframeGeometry.js
浏览文件 @
c687a368
...
...
@@ -9,6 +9,13 @@ class WireframeGeometry extends BufferGeometry {
super
();
this
.
type
=
'
WireframeGeometry
'
;
if
(
geometry
.
isGeometry
===
true
)
{
console
.
error
(
'
THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.
'
);
return
;
}
// buffer
const
vertices
=
[];
...
...
@@ -16,96 +23,46 @@ class WireframeGeometry extends BufferGeometry {
// helper variables
const
edge
=
[
0
,
0
],
edges
=
{};
const
keys
=
[
'
a
'
,
'
b
'
,
'
c
'
];
// different logic for Geometry and BufferGeometry
if
(
geometry
&&
geometry
.
isGeometry
)
{
// create a data structure that contains all edges without duplicates
const
faces
=
geometry
.
faces
;
for
(
let
i
=
0
,
l
=
faces
.
length
;
i
<
l
;
i
++
)
{
const
face
=
faces
[
i
];
for
(
let
j
=
0
;
j
<
3
;
j
++
)
{
const
edge1
=
face
[
keys
[
j
]
];
const
edge2
=
face
[
keys
[
(
j
+
1
)
%
3
]
];
edge
[
0
]
=
Math
.
min
(
edge1
,
edge2
);
// sorting prevents duplicates
edge
[
1
]
=
Math
.
max
(
edge1
,
edge2
);
const
key
=
edge
[
0
]
+
'
,
'
+
edge
[
1
]
;
const
vertex
=
new
Vector3
()
;
if
(
edges
[
key
]
===
undefined
)
{
if
(
geometry
.
index
!==
null
)
{
edges
[
key
]
=
{
index1
:
edge
[
0
],
index2
:
edge
[
1
]
};
// indexed BufferGeometry
}
}
const
position
=
geometry
.
attributes
.
position
;
const
indices
=
geometry
.
index
;
let
groups
=
geometry
.
groups
;
}
if
(
groups
.
length
===
0
)
{
// generate vertices
for
(
const
key
in
edges
)
{
const
e
=
edges
[
key
];
let
vertex
=
geometry
.
vertices
[
e
.
index1
];
vertices
.
push
(
vertex
.
x
,
vertex
.
y
,
vertex
.
z
);
vertex
=
geometry
.
vertices
[
e
.
index2
];
vertices
.
push
(
vertex
.
x
,
vertex
.
y
,
vertex
.
z
);
groups
=
[
{
start
:
0
,
count
:
indices
.
count
,
materialIndex
:
0
}
];
}
}
else
if
(
geometry
&&
geometry
.
isBufferGeometry
)
{
// create a data structure that contains all eges without duplicates
const
vertex
=
new
Vector3
();
for
(
let
o
=
0
,
ol
=
groups
.
length
;
o
<
ol
;
++
o
)
{
if
(
geometry
.
index
!==
null
)
{
const
group
=
groups
[
o
];
// indexed BufferGeometry
const
start
=
group
.
start
;
const
count
=
group
.
count
;
const
position
=
geometry
.
attributes
.
position
;
const
indices
=
geometry
.
index
;
let
groups
=
geometry
.
groups
;
for
(
let
i
=
start
,
l
=
(
start
+
count
);
i
<
l
;
i
+=
3
)
{
if
(
groups
.
length
===
0
)
{
groups
=
[
{
start
:
0
,
count
:
indices
.
count
,
materialIndex
:
0
}
];
}
// create a data structure that contains all eges without duplicates
for
(
let
o
=
0
,
ol
=
groups
.
length
;
o
<
ol
;
++
o
)
{
const
group
=
groups
[
o
];
const
start
=
group
.
start
;
const
count
=
group
.
count
;
for
(
let
i
=
start
,
l
=
(
start
+
count
);
i
<
l
;
i
+=
3
)
{
for
(
let
j
=
0
;
j
<
3
;
j
++
)
{
const
edge1
=
indices
.
getX
(
i
+
j
);
const
edge2
=
indices
.
getX
(
i
+
(
j
+
1
)
%
3
);
edge
[
0
]
=
Math
.
min
(
edge1
,
edge2
);
// sorting prevents duplicates
edge
[
1
]
=
Math
.
max
(
edge1
,
edge2
);
for
(
let
j
=
0
;
j
<
3
;
j
++
)
{
const
key
=
edge
[
0
]
+
'
,
'
+
edge
[
1
];
const
edge1
=
indices
.
getX
(
i
+
j
);
const
edge2
=
indices
.
getX
(
i
+
(
j
+
1
)
%
3
);
edge
[
0
]
=
Math
.
min
(
edge1
,
edge2
);
// sorting prevents duplicates
edge
[
1
]
=
Math
.
max
(
edge1
,
edge2
);
if
(
edges
[
key
]
===
undefined
)
{
const
key
=
edge
[
0
]
+
'
,
'
+
edge
[
1
];
edges
[
key
]
=
{
index1
:
edge
[
0
],
index2
:
edge
[
1
]
};
if
(
edges
[
key
]
===
undefined
)
{
}
edges
[
key
]
=
{
index1
:
edge
[
0
],
index2
:
edge
[
1
]
};
}
...
...
@@ -113,42 +70,42 @@ class WireframeGeometry extends BufferGeometry {
}
// generate vertices
}
for
(
const
key
in
edges
)
{
// generate vertices
const
e
=
edges
[
key
];
for
(
const
key
in
edges
)
{
vertex
.
fromBufferAttribute
(
position
,
e
.
index1
);
vertices
.
push
(
vertex
.
x
,
vertex
.
y
,
vertex
.
z
);
const
e
=
edges
[
key
];
vertex
.
fromBufferAttribute
(
position
,
e
.
index2
);
vertices
.
push
(
vertex
.
x
,
vertex
.
y
,
vertex
.
z
);
vertex
.
fromBufferAttribute
(
position
,
e
.
index1
);
vertices
.
push
(
vertex
.
x
,
vertex
.
y
,
vertex
.
z
);
}
vertex
.
fromBufferAttribute
(
position
,
e
.
index2
);
vertices
.
push
(
vertex
.
x
,
vertex
.
y
,
vertex
.
z
);
}
else
{
}
// non-indexed BufferGeometry
}
else
{
const
position
=
geometry
.
attributes
.
position
;
// non-indexed BufferGeometry
for
(
let
i
=
0
,
l
=
(
position
.
count
/
3
);
i
<
l
;
i
++
)
{
const
position
=
geometry
.
attributes
.
position
;
for
(
let
j
=
0
;
j
<
3
;
j
++
)
{
for
(
let
i
=
0
,
l
=
(
position
.
count
/
3
);
i
<
l
;
i
++
)
{
// three edges per triangle, an edge is represented as (index1, index2)
// e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)
for
(
let
j
=
0
;
j
<
3
;
j
++
)
{
const
index1
=
3
*
i
+
j
;
vertex
.
fromBufferAttribute
(
position
,
index1
);
vertices
.
push
(
vertex
.
x
,
vertex
.
y
,
vertex
.
z
);
// three edges per triangle, an edge is represented as (index1, index2)
// e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)
const
index2
=
3
*
i
+
(
(
j
+
1
)
%
3
)
;
vertex
.
fromBufferAttribute
(
position
,
index2
);
vertices
.
push
(
vertex
.
x
,
vertex
.
y
,
vertex
.
z
);
const
index1
=
3
*
i
+
j
;
vertex
.
fromBufferAttribute
(
position
,
index1
);
vertices
.
push
(
vertex
.
x
,
vertex
.
y
,
vertex
.
z
);
}
const
index2
=
3
*
i
+
(
(
j
+
1
)
%
3
);
vertex
.
fromBufferAttribute
(
position
,
index2
);
vertices
.
push
(
vertex
.
x
,
vertex
.
y
,
vertex
.
z
);
}
...
...
test/unit/src/geometries/EdgesGeometry.tests.js
浏览文件 @
c687a368
/* global QUnit */
import
{
EdgesGeometry
}
from
'
../../../../src/geometries/EdgesGeometry
'
;
import
{
Geometry
}
from
'
../../../../src/core/Geometry
'
;
import
{
BufferGeometry
}
from
'
../../../../src/core/BufferGeometry
'
;
import
{
BufferAttribute
}
from
'
../../../../src/core/BufferAttribute
'
;
import
{
Vector3
}
from
'
../../../../src/math/Vector3
'
;
...
...
@@ -41,10 +40,8 @@ function testEdges( vertList, idxList, numAfter, assert ) {
function
createGeometries
(
vertList
,
idxList
)
{
var
geomIB
=
createIndexedBufferGeometry
(
vertList
,
idxList
);
var
geom
=
new
Geometry
().
fromBufferGeometry
(
geomIB
);
var
geomB
=
new
BufferGeometry
().
fromGeometry
(
geom
);
var
geomDC
=
addDrawCalls
(
geomIB
.
clone
()
);
return
[
geom
,
geomB
,
geom
IB
,
geomDC
];
return
[
geomIB
,
geomDC
];
}
...
...
utils/modularize.js
浏览文件 @
c687a368
...
...
@@ -44,7 +44,7 @@ var files = [
{
path
:
'
geometries/BoxLineGeometry.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
geometries/ConvexGeometry.js
'
,
dependencies
:
[
{
name
:
'
ConvexHull
'
,
path
:
'
math/ConvexHull.js
'
}
],
ignoreList
:
[]
},
{
path
:
'
geometries/DecalGeometry.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
geometries/DecalGeometry.js
'
,
dependencies
:
[],
ignoreList
:
[
'
Geometry
'
]
},
{
path
:
'
geometries/LightningStrike.js
'
,
dependencies
:
[
{
name
:
'
SimplexNoise
'
,
path
:
'
math/SimplexNoise.js
'
}
],
ignoreList
:
[
'
Mesh
'
]
},
{
path
:
'
geometries/ParametricGeometries.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
{
path
:
'
geometries/TeapotBufferGeometry.js
'
,
dependencies
:
[],
ignoreList
:
[]
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录