Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
072a035a
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,发现更多精彩内容 >>
提交
072a035a
编写于
8月 18, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ArrowHelper: Removed no longer needed closure.
上级
11aac1d8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
28 deletion
+22
-28
src/extras/helpers/ArrowHelper.js
src/extras/helpers/ArrowHelper.js
+22
-28
未找到文件。
src/extras/helpers/ArrowHelper.js
浏览文件 @
072a035a
...
@@ -8,8 +8,6 @@ import { Mesh } from '../../objects/Mesh';
...
@@ -8,8 +8,6 @@ import { Mesh } from '../../objects/Mesh';
import
{
LineBasicMaterial
}
from
'
../../materials/LineBasicMaterial
'
;
import
{
LineBasicMaterial
}
from
'
../../materials/LineBasicMaterial
'
;
import
{
Line
}
from
'
../../objects/Line
'
;
import
{
Line
}
from
'
../../objects/Line
'
;
var
ArrowHelper
;
/**
/**
* @author WestLangley / http://github.com/WestLangley
* @author WestLangley / http://github.com/WestLangley
* @author zz85 / http://github.com/zz85
* @author zz85 / http://github.com/zz85
...
@@ -26,41 +24,37 @@ var ArrowHelper;
...
@@ -26,41 +24,37 @@ var ArrowHelper;
* headWidth - Number
* headWidth - Number
*/
*/
ArrowHelper
=
(
function
()
{
var
lineGeometry
=
new
BufferGeometry
();
lineGeometry
.
addAttribute
(
'
position
'
,
new
Float32Attribute
(
[
0
,
0
,
0
,
0
,
1
,
0
],
3
)
);
var
lineGeometry
=
new
BufferGeometry
();
lineGeometry
.
addAttribute
(
'
position
'
,
new
Float32Attribute
(
[
0
,
0
,
0
,
0
,
1
,
0
],
3
)
);
var
coneGeometry
=
new
CylinderBufferGeometry
(
0
,
0.5
,
1
,
5
,
1
);
var
coneGeometry
=
new
CylinderBufferGeometry
(
0
,
0.5
,
1
,
5
,
1
);
coneGeometry
.
translate
(
0
,
-
0.5
,
0
);
coneGeometry
.
translate
(
0
,
-
0.5
,
0
);
return
function
ArrowHelper
(
dir
,
origin
,
length
,
color
,
headLength
,
headWidth
)
{
function
ArrowHelper
(
dir
,
origin
,
length
,
color
,
headLength
,
headWidth
)
{
// dir is assumed to be normalized
Object3D
.
call
(
this
);
// dir is assumed to be normalized
if
(
color
===
undefined
)
color
=
0xffff00
;
Object3D
.
call
(
this
);
if
(
length
===
undefined
)
length
=
1
;
if
(
headLength
===
undefined
)
headLength
=
0.2
*
length
;
if
(
headWidth
===
undefined
)
headWidth
=
0.2
*
headLength
;
this
.
position
.
copy
(
origin
);
if
(
color
===
undefined
)
color
=
0xffff00
;
if
(
length
===
undefined
)
length
=
1
;
if
(
headLength
===
undefined
)
headLength
=
0.2
*
length
;
if
(
headWidth
===
undefined
)
headWidth
=
0.2
*
headLength
;
this
.
line
=
new
Line
(
lineGeometry
,
new
LineBasicMaterial
(
{
color
:
color
}
)
);
this
.
position
.
copy
(
origin
);
this
.
line
.
matrixAutoUpdate
=
false
;
this
.
add
(
this
.
line
);
this
.
cone
=
new
Mesh
(
coneGeometry
,
new
Mesh
BasicMaterial
(
{
color
:
color
}
)
);
this
.
line
=
new
Line
(
lineGeometry
,
new
Line
BasicMaterial
(
{
color
:
color
}
)
);
this
.
co
ne
.
matrixAutoUpdate
=
false
;
this
.
li
ne
.
matrixAutoUpdate
=
false
;
this
.
add
(
this
.
co
ne
);
this
.
add
(
this
.
li
ne
);
this
.
setDirection
(
dir
);
this
.
cone
=
new
Mesh
(
coneGeometry
,
new
MeshBasicMaterial
(
{
color
:
color
}
)
);
this
.
setLength
(
length
,
headLength
,
headWidth
);
this
.
cone
.
matrixAutoUpdate
=
false
;
this
.
add
(
this
.
cone
);
};
this
.
setDirection
(
dir
);
this
.
setLength
(
length
,
headLength
,
headWidth
);
}
()
);
}
ArrowHelper
.
prototype
=
Object
.
create
(
Object3D
.
prototype
);
ArrowHelper
.
prototype
=
Object
.
create
(
Object3D
.
prototype
);
ArrowHelper
.
prototype
.
constructor
=
ArrowHelper
;
ArrowHelper
.
prototype
.
constructor
=
ArrowHelper
;
...
@@ -118,4 +112,4 @@ ArrowHelper.prototype.setColor = function ( color ) {
...
@@ -118,4 +112,4 @@ ArrowHelper.prototype.setColor = function ( color ) {
};
};
export
{
ArrowHelper
};
export
{
ArrowHelper
};
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录