Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
1b544f04
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,发现更多精彩内容 >>
提交
1b544f04
编写于
6月 10, 2019
作者:
W
WestLangley
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make Euler and Quaternion .onChange() methods private
上级
6737d0df
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
41 addition
and
96 deletion
+41
-96
docs/api/en/math/Euler.html
docs/api/en/math/Euler.html
+4
-29
docs/api/en/math/Quaternion.html
docs/api/en/math/Quaternion.html
+0
-30
examples/webgl_interactive_cubes_gpu.html
examples/webgl_interactive_cubes_gpu.html
+1
-1
examples/webgl_interactive_instances_gpu.html
examples/webgl_interactive_instances_gpu.html
+1
-1
examples/webgl_postprocessing_crossfade.html
examples/webgl_postprocessing_crossfade.html
+1
-1
src/core/Object3D.js
src/core/Object3D.js
+2
-2
src/math/Euler.d.ts
src/math/Euler.d.ts
+2
-2
src/math/Euler.js
src/math/Euler.js
+11
-11
src/math/Quaternion.d.ts
src/math/Quaternion.d.ts
+2
-2
src/math/Quaternion.js
src/math/Quaternion.js
+17
-17
未找到文件。
docs/api/en/math/Euler.html
浏览文件 @
1b544f04
...
...
@@ -58,29 +58,21 @@
to the
<em>
local
</em>
coordinate system. That is, for order 'XYZ', the rotation is first around the local-X
axis (which is the same as the world-X axis), then around local-Y (which may now be different from the
world Y-axis), then local-Z (which may be different from the world Z-axis).
<br
/><br
/>
If the order is changed, [page:.onChangeCallback onChangeCallback] will be called.
</p>
<h3>
[property:Float x]
</h3>
<p>
The current value of the x component.
<br
/><br
/>
If this is changed, [page:.onChangeCallback onChangeCallback] will be called.
</p>
<h3>
[property:Float y]
</h3>
<p>
The current value of the y component.
<br
/><br
/>
If this is changed, [page:.onChangeCallback onChangeCallback] will be called.
</p>
<h3>
[property:Float z]
</h3>
<p>
The current value of the z component.
<br
/><br
/>
If this is changed, [page:.onChangeCallback onChangeCallback] will be called.
</p>
<h2>
Methods
</h2>
...
...
@@ -104,18 +96,6 @@
Optionally assigns this euler's [page:.order order] to array[3].
</p>
<h3>
[method:Euler onChange]( [param:Function onChangeCallback] )
</h3>
<p>
[page:Function onChangeCallback] - set the value of the onChangeCallback() function.
</p>
<h3>
[method:Euler onChangeCallback]( )
</h3>
<p>
By default this is an empty function, however it can be set via [page:.onChange onChange]().
<br
/>
It gets called after changing the [page:.x x], [page:.y y], [page:.z z] or [page:.order order] properties,
and also after calling most setter functions (see those for details).
</p>
<h3>
[method:Euler reorder]( [param:String newOrder] )
</h3>
<p>
Resets the euler angle with a new order by creating a quaternion from this euler angle
...
...
@@ -131,27 +111,23 @@
[page:.z z] - the angle of the z axis in radians.
<br
/>
[page:.order order] - (optional) a string representing the order that the rotations are applied.
<br
/><br
/>
Sets the angles of this euler transform and optionally the [page:.order order]
and then call [page:.onChangeCallback onChangeCallback]()
.
Sets the angles of this euler transform and optionally the [page:.order order].
</p>
<h3>
[method:Euler setFromRotationMatrix]( [param:Matrix4 m], [param:String order]
, [param:Boolean update]
)
</h3>
<h3>
[method:Euler setFromRotationMatrix]( [param:Matrix4 m], [param:String order] )
</h3>
<p>
[page:Matrix4 m] - a [page:Matrix4] of which the upper 3x3 of matrix is a pure
[link:https://en.wikipedia.org/wiki/Rotation_matrix rotation matrix] (i.e. unscaled).
<br
/>
[page:.order order] - (optional) a string representing the order that the rotations are applied.
<br
/>
[page:Boolean update] - (optional) whether to call [page:.onChangeCallback onChangeCallback]() after applying
the matrix.
<br
/><br
/>
Sets the angles of this euler transform from a pure rotation matrix based on the orientation
specified by order.
</p>
<h3>
[method:Euler setFromQuaternion]( [param:Quaternion q], [param:String order]
, [param:Boolean update]
)
</h3>
<h3>
[method:Euler setFromQuaternion]( [param:Quaternion q], [param:String order] )
</h3>
<p>
[page:Quaternion q] - a normalized quaternion.
<br
/>
[page:.order order] - (optional) a string representing the order that the rotations are applied.
<br
/>
[page:Boolean update] - (optional) whether to call [page:.onChangeCallback onChangeCallback]() after applying
the matrix.
<br
/><br
/>
Sets the angles of this euler transform from a normalized quaternion based on the orientation
specified by [page:.order order].
...
...
@@ -163,8 +139,7 @@
[page:Vector3 vector] - [page:Vector3].
<br
/>
[page:.order order] - (optional) a string representing the order that the rotations are applied.
<br
/><br
/>
Set the [page:.x x], [page:.y y] and [page:.z z], and optionally update the [page:.order order]. [page:.onChangeCallback onChangeCallback]()
is called after these changes are made.
Set the [page:.x x], [page:.y y] and [page:.z z], and optionally update the [page:.order order].
</p>
...
...
docs/api/en/math/Quaternion.html
浏览文件 @
1b544f04
...
...
@@ -52,16 +52,12 @@
</p>
<h3>
[property:Float x]
</h3>
<p>
Changing this property will result in [page:.onChangeCallback onChangeCallback] being called.
</p>
<h3>
[property:Float y]
</h3>
<p>
Changing this property will result in [page:.onChangeCallback onChangeCallback] being called.
</p>
<h3>
[property:Float z]
</h3>
<p>
Changing this property will result in [page:.onChangeCallback onChangeCallback] being called.
</p>
<h3>
[property:Float w]
</h3>
<p>
Changing this property will result in [page:.onChangeCallback onChangeCallback] being called.
</p>
<h2>
Methods
</h2>
...
...
@@ -146,32 +142,6 @@
Adapted from the method outlined [link:http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm here].
</p>
<h3>
[method:Quaternion onChange]( [param:Function onChangeCallback] )
</h3>
<p>
Sets the [page:.onChangeCallback onChangeCallback]() method.
</p>
<h3>
[method:Quaternion onChangeCallback]( )
</h3>
<p>
This function is called whenever any of the following occurs:
<ul>
<li>
The [page:.x x], [page:.y y], [page:.z z] or
[page:.w w] properties are changed.
</li>
<li>
The [page:.set set](), [page:.copy copy](), [page:.clone clone](),
[page:.setFromAxisAngle setFromAxisAngle](), [page:.setFromRotationMatrix setFromRotationMatrix](),
[page:.conjugate conjugate](), [page:.normalize normalize](),
[page:.multiplyQuaternions multiplyQuaternions](), [page:.slerp slerp]() or [page:.fromArray fromArray]()
functions are called.
</li>
<li>
[page:.setFromEuler setFromEuler]() function is called with its *update* argument not set to false.
</li>
</ul>
By default it is the empty function, however you can change it if needed using [page:.onChange onChange]( [page:Function onChangeCallback] ).
</p>
<h3>
[method:Quaternion premultiply]( [param:Quaternion q] )
</h3>
<p>
Pre-multiplies this quaternion by [page:Quaternion q].
</p>
...
...
examples/webgl_interactive_cubes_gpu.html
浏览文件 @
1b544f04
...
...
@@ -105,7 +105,7 @@
scale
.
y
=
Math
.
random
()
*
200
+
100
;
scale
.
z
=
Math
.
random
()
*
200
+
100
;
quaternion
.
setFromEuler
(
rotation
,
false
);
quaternion
.
setFromEuler
(
rotation
);
matrix
.
compose
(
position
,
quaternion
,
scale
);
geometry
.
applyMatrix
(
matrix
);
...
...
examples/webgl_interactive_instances_gpu.html
浏览文件 @
1b544f04
...
...
@@ -451,7 +451,7 @@
rotation
.
y
=
Math
.
random
()
*
2
*
Math
.
PI
;
rotation
.
z
=
Math
.
random
()
*
2
*
Math
.
PI
;
quaternion
.
setFromEuler
(
rotation
,
false
);
quaternion
.
setFromEuler
(
rotation
);
scale
.
x
=
scale
.
y
=
scale
.
z
=
Math
.
random
()
*
1
;
...
...
examples/webgl_postprocessing_crossfade.html
浏览文件 @
1b544f04
...
...
@@ -143,7 +143,7 @@
rotation
.
x
=
Math
.
random
()
*
2
*
Math
.
PI
;
rotation
.
y
=
Math
.
random
()
*
2
*
Math
.
PI
;
rotation
.
z
=
Math
.
random
()
*
2
*
Math
.
PI
;
quaternion
.
setFromEuler
(
rotation
,
false
);
quaternion
.
setFromEuler
(
rotation
);
scale
.
x
=
Math
.
random
()
*
200
+
100
;
...
...
src/core/Object3D.js
浏览文件 @
1b544f04
...
...
@@ -49,8 +49,8 @@ function Object3D() {
}
rotation
.
onChange
(
onRotationChange
);
quaternion
.
onChange
(
onQuaternionChange
);
rotation
.
_
onChange
(
onRotationChange
);
quaternion
.
_
onChange
(
onQuaternionChange
);
Object
.
defineProperties
(
this
,
{
position
:
{
...
...
src/math/Euler.d.ts
浏览文件 @
1b544f04
...
...
@@ -160,7 +160,7 @@ export class Euler {
y
:
number
;
z
:
number
;
order
:
string
;
onChangeCallback
:
Function
;
_
onChangeCallback
:
Function
;
set
(
x
:
number
,
y
:
number
,
z
:
number
,
order
?:
string
):
Euler
;
clone
():
this
;
...
...
@@ -173,7 +173,7 @@ export class Euler {
fromArray
(
xyzo
:
any
[]
):
Euler
;
toArray
(
array
?:
number
[],
offset
?:
number
):
number
[];
toVector3
(
optionalResult
?:
Vector3
):
Vector3
;
onChange
(
callback
:
Function
):
this
;
_
onChange
(
callback
:
Function
):
this
;
static
RotationOrders
:
string
[];
static
DefaultOrder
:
string
;
...
...
src/math/Euler.js
浏览文件 @
1b544f04
...
...
@@ -35,7 +35,7 @@ Object.defineProperties( Euler.prototype, {
set
:
function
(
value
)
{
this
.
_x
=
value
;
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
}
...
...
@@ -52,7 +52,7 @@ Object.defineProperties( Euler.prototype, {
set
:
function
(
value
)
{
this
.
_y
=
value
;
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
}
...
...
@@ -69,7 +69,7 @@ Object.defineProperties( Euler.prototype, {
set
:
function
(
value
)
{
this
.
_z
=
value
;
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
}
...
...
@@ -86,7 +86,7 @@ Object.defineProperties( Euler.prototype, {
set
:
function
(
value
)
{
this
.
_order
=
value
;
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
}
...
...
@@ -105,7 +105,7 @@ Object.assign( Euler.prototype, {
this
.
_z
=
z
;
this
.
_order
=
order
||
this
.
_order
;
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
return
this
;
...
...
@@ -124,7 +124,7 @@ Object.assign( Euler.prototype, {
this
.
_z
=
euler
.
_z
;
this
.
_order
=
euler
.
_order
;
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
return
this
;
...
...
@@ -247,7 +247,7 @@ Object.assign( Euler.prototype, {
this
.
_order
=
order
;
if
(
update
!==
false
)
this
.
onChangeCallback
();
if
(
update
!==
false
)
this
.
_
onChangeCallback
();
return
this
;
...
...
@@ -302,7 +302,7 @@ Object.assign( Euler.prototype, {
this
.
_z
=
array
[
2
];
if
(
array
[
3
]
!==
undefined
)
this
.
_order
=
array
[
3
];
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
return
this
;
...
...
@@ -336,15 +336,15 @@ Object.assign( Euler.prototype, {
},
onChange
:
function
(
callback
)
{
_
onChange
:
function
(
callback
)
{
this
.
onChangeCallback
=
callback
;
this
.
_
onChangeCallback
=
callback
;
return
this
;
},
onChangeCallback
:
function
()
{}
_
onChangeCallback
:
function
()
{}
}
);
...
...
src/math/Quaternion.d.ts
浏览文件 @
1b544f04
...
...
@@ -100,8 +100,8 @@ export class Quaternion {
fromArray
(
xyzw
:
number
[],
offset
?:
number
):
Quaternion
;
toArray
(
xyzw
?:
number
[],
offset
?:
number
):
number
[];
onChange
(
callback
:
Function
):
Quaternion
;
onChangeCallback
:
Function
;
_
onChange
(
callback
:
Function
):
Quaternion
;
_
onChangeCallback
:
Function
;
/**
* Adapted from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/.
...
...
src/math/Quaternion.js
浏览文件 @
1b544f04
...
...
@@ -101,7 +101,7 @@ Object.defineProperties( Quaternion.prototype, {
set
:
function
(
value
)
{
this
.
_x
=
value
;
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
}
...
...
@@ -118,7 +118,7 @@ Object.defineProperties( Quaternion.prototype, {
set
:
function
(
value
)
{
this
.
_y
=
value
;
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
}
...
...
@@ -135,7 +135,7 @@ Object.defineProperties( Quaternion.prototype, {
set
:
function
(
value
)
{
this
.
_z
=
value
;
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
}
...
...
@@ -152,7 +152,7 @@ Object.defineProperties( Quaternion.prototype, {
set
:
function
(
value
)
{
this
.
_w
=
value
;
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
}
...
...
@@ -171,7 +171,7 @@ Object.assign( Quaternion.prototype, {
this
.
_z
=
z
;
this
.
_w
=
w
;
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
return
this
;
...
...
@@ -190,7 +190,7 @@ Object.assign( Quaternion.prototype, {
this
.
_z
=
quaternion
.
z
;
this
.
_w
=
quaternion
.
w
;
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
return
this
;
...
...
@@ -265,7 +265,7 @@ Object.assign( Quaternion.prototype, {
}
if
(
update
!==
false
)
this
.
onChangeCallback
();
if
(
update
!==
false
)
this
.
_
onChangeCallback
();
return
this
;
...
...
@@ -284,7 +284,7 @@ Object.assign( Quaternion.prototype, {
this
.
_z
=
axis
.
z
*
s
;
this
.
_w
=
Math
.
cos
(
halfAngle
);
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
return
this
;
...
...
@@ -343,7 +343,7 @@ Object.assign( Quaternion.prototype, {
}
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
return
this
;
...
...
@@ -426,7 +426,7 @@ Object.assign( Quaternion.prototype, {
this
.
_y
*=
-
1
;
this
.
_z
*=
-
1
;
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
return
this
;
...
...
@@ -472,7 +472,7 @@ Object.assign( Quaternion.prototype, {
}
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
return
this
;
...
...
@@ -509,7 +509,7 @@ Object.assign( Quaternion.prototype, {
this
.
_z
=
qaz
*
qbw
+
qaw
*
qbz
+
qax
*
qby
-
qay
*
qbx
;
this
.
_w
=
qaw
*
qbw
-
qax
*
qbx
-
qay
*
qby
-
qaz
*
qbz
;
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
return
this
;
...
...
@@ -576,7 +576,7 @@ Object.assign( Quaternion.prototype, {
this
.
_y
=
(
y
*
ratioA
+
this
.
_y
*
ratioB
);
this
.
_z
=
(
z
*
ratioA
+
this
.
_z
*
ratioB
);
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
return
this
;
...
...
@@ -597,7 +597,7 @@ Object.assign( Quaternion.prototype, {
this
.
_z
=
array
[
offset
+
2
];
this
.
_w
=
array
[
offset
+
3
];
this
.
onChangeCallback
();
this
.
_
onChangeCallback
();
return
this
;
...
...
@@ -617,15 +617,15 @@ Object.assign( Quaternion.prototype, {
},
onChange
:
function
(
callback
)
{
_
onChange
:
function
(
callback
)
{
this
.
onChangeCallback
=
callback
;
this
.
_
onChangeCallback
=
callback
;
return
this
;
},
onChangeCallback
:
function
()
{}
_
onChangeCallback
:
function
()
{}
}
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录