Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
a1ac92db
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,发现更多精彩内容 >>
提交
a1ac92db
编写于
12月 21, 2012
作者:
B
Ben Houston
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'vector-index-accessors' into dev
上级
2613df20
d23fc1b8
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
96 addition
and
0 deletion
+96
-0
src/math/Vector2.js
src/math/Vector2.js
+17
-0
src/math/Vector3.js
src/math/Vector3.js
+18
-0
src/math/Vector4.js
src/math/Vector4.js
+19
-0
test/unit/math/Vector2.js
test/unit/math/Vector2.js
+11
-0
test/unit/math/Vector3.js
test/unit/math/Vector3.js
+14
-0
test/unit/math/Vector4.js
test/unit/math/Vector4.js
+17
-0
未找到文件。
src/math/Vector2.js
浏览文件 @
a1ac92db
...
...
@@ -41,6 +41,18 @@ THREE.Vector2.prototype = {
},
setComponent
:
function
(
index
,
value
)
{
this
[
THREE
.
Vector2
.
__indexToName
[
index
]
]
=
value
;
},
getComponent
:
function
(
index
)
{
return
this
[
THREE
.
Vector2
.
__indexToName
[
index
]
];
},
copy
:
function
(
v
)
{
this
.
x
=
v
.
x
;
...
...
@@ -263,3 +275,8 @@ THREE.Vector2.prototype = {
}
};
THREE
.
Vector2
.
__indexToName
=
{
0
:
'
x
'
,
1
:
'
y
'
};
src/math/Vector3.js
浏览文件 @
a1ac92db
...
...
@@ -54,6 +54,18 @@ THREE.Vector3.prototype = {
},
setComponent
:
function
(
index
,
value
)
{
this
[
THREE
.
Vector3
.
__indexToName
[
index
]
]
=
value
;
},
getComponent
:
function
(
index
)
{
return
this
[
THREE
.
Vector3
.
__indexToName
[
index
]
];
},
copy
:
function
(
v
)
{
this
.
x
=
v
.
x
;
...
...
@@ -579,3 +591,9 @@ THREE.Vector3.prototype = {
}
};
THREE
.
Vector3
.
__indexToName
=
{
0
:
'
x
'
,
1
:
'
y
'
,
2
:
'
z
'
};
src/math/Vector4.js
浏览文件 @
a1ac92db
...
...
@@ -62,6 +62,18 @@ THREE.Vector4.prototype = {
},
setComponent
:
function
(
index
,
value
)
{
this
[
THREE
.
Vector4
.
__indexToName
[
index
]
]
=
value
;
},
getComponent
:
function
(
index
)
{
return
this
[
THREE
.
Vector4
.
__indexToName
[
index
]
];
},
copy
:
function
(
v
)
{
this
.
x
=
v
.
x
;
...
...
@@ -494,3 +506,10 @@ THREE.Vector4.prototype = {
}
};
THREE
.
Vector4
.
__indexToName
=
{
0
:
'
x
'
,
1
:
'
y
'
,
2
:
'
z
'
,
3
:
'
w
'
};
test/unit/math/Vector2.js
浏览文件 @
a1ac92db
...
...
@@ -48,6 +48,17 @@ test( "setX,setY", function() {
ok
(
a
.
y
==
y
,
"
Passed!
"
);
});
test
(
"
setComponent,getComponent
"
,
function
()
{
var
a
=
new
THREE
.
Vector2
();
ok
(
a
.
x
==
0
,
"
Passed!
"
);
ok
(
a
.
y
==
0
,
"
Passed!
"
);
a
.
setComponent
(
0
,
1
);
a
.
setComponent
(
1
,
2
);
ok
(
a
.
getComponent
(
0
)
==
1
,
"
Passed!
"
);
ok
(
a
.
getComponent
(
1
)
==
2
,
"
Passed!
"
);
});
test
(
"
add
"
,
function
()
{
var
a
=
new
THREE
.
Vector2
(
x
,
y
);
var
b
=
new
THREE
.
Vector2
(
-
x
,
-
y
);
...
...
test/unit/math/Vector3.js
浏览文件 @
a1ac92db
...
...
@@ -59,6 +59,20 @@ test( "setX,setY,setZ", function() {
ok
(
a
.
z
==
z
,
"
Passed!
"
);
});
test
(
"
setComponent,getComponent
"
,
function
()
{
var
a
=
new
THREE
.
Vector3
();
ok
(
a
.
x
==
0
,
"
Passed!
"
);
ok
(
a
.
y
==
0
,
"
Passed!
"
);
ok
(
a
.
z
==
0
,
"
Passed!
"
);
a
.
setComponent
(
0
,
1
);
a
.
setComponent
(
1
,
2
);
a
.
setComponent
(
2
,
3
);
ok
(
a
.
getComponent
(
0
)
==
1
,
"
Passed!
"
);
ok
(
a
.
getComponent
(
1
)
==
2
,
"
Passed!
"
);
ok
(
a
.
getComponent
(
2
)
==
3
,
"
Passed!
"
);
});
test
(
"
add
"
,
function
()
{
var
a
=
new
THREE
.
Vector3
(
x
,
y
,
z
);
var
b
=
new
THREE
.
Vector3
(
-
x
,
-
y
,
-
z
);
...
...
test/unit/math/Vector4.js
浏览文件 @
a1ac92db
...
...
@@ -69,6 +69,23 @@ test( "setX,setY,setZ,setW", function() {
ok
(
a
.
w
==
w
,
"
Passed!
"
);
});
test
(
"
setComponent,getComponent
"
,
function
()
{
var
a
=
new
THREE
.
Vector4
();
ok
(
a
.
x
==
0
,
"
Passed!
"
);
ok
(
a
.
y
==
0
,
"
Passed!
"
);
ok
(
a
.
z
==
0
,
"
Passed!
"
);
ok
(
a
.
w
==
1
,
"
Passed!
"
);
a
.
setComponent
(
0
,
1
);
a
.
setComponent
(
1
,
2
);
a
.
setComponent
(
2
,
3
);
a
.
setComponent
(
3
,
4
);
ok
(
a
.
getComponent
(
0
)
==
1
,
"
Passed!
"
);
ok
(
a
.
getComponent
(
1
)
==
2
,
"
Passed!
"
);
ok
(
a
.
getComponent
(
2
)
==
3
,
"
Passed!
"
);
ok
(
a
.
getComponent
(
3
)
==
4
,
"
Passed!
"
);
});
test
(
"
add
"
,
function
()
{
var
a
=
new
THREE
.
Vector4
(
x
,
y
,
z
,
w
);
var
b
=
new
THREE
.
Vector4
(
-
x
,
-
y
,
-
z
,
-
w
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录