Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
5c3aab83
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,发现更多精彩内容 >>
提交
5c3aab83
编写于
8月 09, 2015
作者:
A
ALEXANDER PLETZER
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix for vertices that are integer numbers
上级
d6384d20
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
42 addition
and
18 deletion
+42
-18
examples/js/loaders/VTKLoader.js
examples/js/loaders/VTKLoader.js
+42
-18
未找到文件。
examples/js/loaders/VTKLoader.js
浏览文件 @
5c3aab83
...
...
@@ -31,43 +31,67 @@ THREE.VTKLoader.prototype = {
var
indices
=
[];
var
positions
=
[];
var
pattern
,
result
;
var
result
;
// float float float
pattern
=
/
([\+
|
\-]?[\d]
+
[\.][\d
|
\-
|e
]
+
)[
]
+
([\+
|
\-]?[\d]
+
[\.][\d
|
\-
|e
]
+
)[
]
+
([\+
|
\-]?[\d]
+
[\.][\d
|
\-
|e
]
+
)
/g
;
var
pat3Floats
=
/
([\-]?[\d]
+
[\.]?[\d
|
\-
|e
]
*
)[
]
+
([\-]?[\d]
+
[\.]?[\d
|
\-
|e
]
*
)[
]
+
([\-]?[\d]
+
[\.]?[\d
|
\-
|e
]
*
)
/g
;
var
patTriangle
=
/^3
[
]
+
([\d]
+
)[
]
+
([\d]
+
)[
]
+
([\d]
+
)
/
;
var
patQuad
=
/^4
[
]
+
([\d]
+
)[
]
+
([\d]
+
)[
]
+
([\d]
+
)[
]
+
([\d]
+
)
/
;
var
patPOINTS
=
/^POINTS /
;
var
patPOLYGONS
=
/^POLYGONS /
;
var
inPointsSection
=
false
;
var
inPolygonsSection
=
false
;
while
(
(
result
=
pattern
.
exec
(
data
)
)
!==
null
)
{
var
lines
=
data
.
split
(
'
\n
'
);
for
(
var
i
=
0
;
i
<
lines
.
length
;
++
i
)
{
// ["1.0 2.0 3.0", "1.0", "2.0", "3.0"]
line
=
lines
[
i
];
positions
.
push
(
parseFloat
(
result
[
1
]
),
parseFloat
(
result
[
2
]
),
parseFloat
(
result
[
3
]
)
);
if
(
inPointsSection
)
{
}
// get the vertices
// 3 int int int
while
(
(
result
=
pat3Floats
.
exec
(
line
)
)
!==
null
)
{
positions
.
push
(
parseFloat
(
result
[
1
]
),
parseFloat
(
result
[
2
]
),
parseFloat
(
result
[
3
]
)
);
}
}
else
if
(
inPolygonsSection
)
{
pattern
=
/3
[
]
+
([\d]
+
)[
]
+
([\d]
+
)[
]
+
([\d]
+
)
/g
;
result
=
patTriangle
.
exec
(
line
)
;
while
(
(
result
=
pattern
.
exec
(
data
)
)
!==
null
)
{
if
(
result
!==
null
)
{
// ["3 1 2 3", "1", "2", "3"]
// 3 int int int
// triangle
indices
.
push
(
parseInt
(
result
[
1
]
),
parseInt
(
result
[
2
]
),
parseInt
(
result
[
3
]
)
);
indices
.
push
(
parseInt
(
result
[
1
]
),
parseInt
(
result
[
2
]
),
parseInt
(
result
[
3
]
)
);
}
else
{
}
result
=
patQuad
.
exec
(
line
);
// 4 int int int int
if
(
result
!==
null
)
{
pattern
=
/4
[
]
+
([\d]
+
)[
]
+
([\d]
+
)[
]
+
([\d]
+
)[
]
+
([\d]
+
)
/g
;
// 4 int int int int
// break quad into two triangles
while
(
(
result
=
pattern
.
exec
(
data
)
)
!==
null
)
{
indices
.
push
(
parseInt
(
result
[
1
]
),
parseInt
(
result
[
2
]
),
parseInt
(
result
[
4
]
)
);
indices
.
push
(
parseInt
(
result
[
2
]
),
parseInt
(
result
[
3
]
),
parseInt
(
result
[
4
]
)
);
}
// ["4 1 2 3 4", "1", "2", "3", "4"]
}
indices
.
push
(
parseInt
(
result
[
1
]
),
parseInt
(
result
[
2
]
),
parseInt
(
result
[
4
]
)
);
indices
.
push
(
parseInt
(
result
[
2
]
),
parseInt
(
result
[
3
]
),
parseInt
(
result
[
4
]
)
);
}
if
(
patPOLYGONS
.
exec
(
line
)
!==
null
)
{
inPointsSection
=
false
;
inPolygonsSection
=
true
;
}
if
(
patPOINTS
.
exec
(
line
)
!==
null
)
{
inPolygonsSection
=
false
;
inPointsSection
=
true
;
}
}
var
geometry
=
new
THREE
.
BufferGeometry
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录