Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
073439a5
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 搜索 >>
提交
073439a5
编写于
3月 22, 2020
作者:
D
Don McCurdy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add quaternion.fromBufferAttribute
上级
f298e828
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
60 addition
and
2 deletion
+60
-2
docs/api/en/math/Quaternion.html
docs/api/en/math/Quaternion.html
+8
-0
docs/api/zh/math/Quaternion.html
docs/api/zh/math/Quaternion.html
+8
-0
src/math/Quaternion.js
src/math/Quaternion.js
+11
-0
test/unit/src/math/Quaternion.tests.js
test/unit/src/math/Quaternion.tests.js
+33
-2
未找到文件。
docs/api/en/math/Quaternion.html
浏览文件 @
073439a5
...
@@ -195,6 +195,14 @@
...
@@ -195,6 +195,14 @@
Returns the numerical elements of this quaternion in an array of format [x, y, z, w].
Returns the numerical elements of this quaternion in an array of format [x, y, z, w].
</p>
</p>
<h3>
[method:this fromBufferAttribute]( [param:BufferAttribute attribute], [param:Integer index] )
</h3>
<p>
[page:BufferAttribute attribute] - the source attribute.
<br
/>
[page:Integer index] - index in the attribute.
<br
/><br
/>
Sets [page:.x x], [page:.y y], [page:.z z], [page:.w w] properties of this quaternion from the [page:BufferAttribute attribute].
</p>
<h2>
Static Methods
</h2>
<h2>
Static Methods
</h2>
<p>
<p>
...
...
docs/api/zh/math/Quaternion.html
浏览文件 @
073439a5
...
@@ -195,6 +195,14 @@
...
@@ -195,6 +195,14 @@
Returns the numerical elements of this quaternion in an array of format [x, y, z, w].
Returns the numerical elements of this quaternion in an array of format [x, y, z, w].
</p>
</p>
<h3>
[method:this fromBufferAttribute]( [param:BufferAttribute attribute], [param:Integer index] )
</h3>
<p>
[page:BufferAttribute attribute] - the source attribute.
<br
/>
[page:Integer index] - index in the attribute.
<br
/><br
/>
Sets [page:.x x], [page:.y y], [page:.z z], [page:.w w] properties of this quaternion from the [page:BufferAttribute attribute].
</p>
<h2>
Static Methods
</h2>
<h2>
Static Methods
</h2>
<p>
<p>
...
...
src/math/Quaternion.js
浏览文件 @
073439a5
...
@@ -620,6 +620,17 @@ Object.assign( Quaternion.prototype, {
...
@@ -620,6 +620,17 @@ Object.assign( Quaternion.prototype, {
},
},
fromBufferAttribute
:
function
(
attribute
,
index
)
{
this
.
_x
=
attribute
.
getX
(
index
);
this
.
_y
=
attribute
.
getY
(
index
);
this
.
_z
=
attribute
.
getZ
(
index
);
this
.
_w
=
attribute
.
getW
(
index
);
return
this
;
},
_onChange
:
function
(
callback
)
{
_onChange
:
function
(
callback
)
{
this
.
_onChangeCallback
=
callback
;
this
.
_onChangeCallback
=
callback
;
...
...
test/unit/src/math/Quaternion.tests.js
浏览文件 @
073439a5
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
*/
*/
/* global QUnit */
/* global QUnit */
import
{
BufferAttribute
}
from
'
../../../../src/core/BufferAttribute
'
;
import
{
Quaternion
}
from
'
../../../../src/math/Quaternion
'
;
import
{
Quaternion
}
from
'
../../../../src/math/Quaternion
'
;
import
{
Vector3
}
from
'
../../../../src/math/Vector3
'
;
import
{
Vector3
}
from
'
../../../../src/math/Vector3
'
;
import
{
Vector4
}
from
'
../../../../src/math/Vector4
'
;
import
{
Vector4
}
from
'
../../../../src/math/Vector4
'
;
...
@@ -711,6 +712,38 @@ export default QUnit.module( 'Maths', () => {
...
@@ -711,6 +712,38 @@ export default QUnit.module( 'Maths', () => {
}
);
}
);
QUnit
.
test
(
"
fromBufferAttribute
"
,
(
assert
)
=>
{
var
a
=
new
Quaternion
();
var
attribute
=
new
BufferAttribute
(
new
Float32Array
(
[
0
,
0
,
0
,
1
,
.
7
,
0
,
0
,
.
7
,
0
,
.
7
,
0
,
.
7
,
]
),
4
);
a
.
fromBufferAttribute
(
attribute
,
0
);
assert
.
numEqual
(
a
.
x
,
0
,
'
index 0, component x
'
);
assert
.
numEqual
(
a
.
y
,
0
,
'
index 0, component y
'
);
assert
.
numEqual
(
a
.
z
,
0
,
'
index 0, component z
'
);
assert
.
numEqual
(
a
.
w
,
1
,
'
index 0, component w
'
);
a
.
fromBufferAttribute
(
attribute
,
1
);
assert
.
numEqual
(
a
.
x
,
.
7
,
'
index 1, component x
'
);
assert
.
numEqual
(
a
.
y
,
0
,
'
index 1, component y
'
);
assert
.
numEqual
(
a
.
z
,
0
,
'
index 1, component z
'
);
assert
.
numEqual
(
a
.
w
,
.
7
,
'
index 1, component w
'
);
a
.
fromBufferAttribute
(
attribute
,
2
);
assert
.
numEqual
(
a
.
x
,
0
,
'
index 2, component x
'
);
assert
.
numEqual
(
a
.
y
,
.
7
,
'
index 2, component y
'
);
assert
.
numEqual
(
a
.
z
,
0
,
'
index 2, component z
'
);
assert
.
numEqual
(
a
.
w
,
.
7
,
'
index 2, component w
'
);
}
);
QUnit
.
test
(
"
_onChange
"
,
(
assert
)
=>
{
QUnit
.
test
(
"
_onChange
"
,
(
assert
)
=>
{
var
b
=
false
;
var
b
=
false
;
...
@@ -778,5 +811,3 @@ export default QUnit.module( 'Maths', () => {
...
@@ -778,5 +811,3 @@ export default QUnit.module( 'Maths', () => {
}
);
}
);
}
);
}
);
QUnit
.
module
(
"
Quaternion
"
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录