Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
76953dcc
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,发现更多精彩内容 >>
未验证
提交
76953dcc
编写于
8月 15, 2019
作者:
M
Michael Herzog
提交者:
GitHub
8月 15, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17249 from Mugen87/dev33
Core: Eagerly instantiate module scope variables.
上级
5d68fa63
1cb8aced
变更
36
隐藏空白更改
内联
并排
Showing
36 changed file
with
227 addition
and
579 deletion
+227
-579
src/animation/PropertyBinding.js
src/animation/PropertyBinding.js
+32
-44
src/audio/AudioListener.js
src/audio/AudioListener.js
+4
-11
src/audio/PositionalAudio.js
src/audio/PositionalAudio.js
+4
-11
src/cameras/StereoCamera.js
src/cameras/StereoCamera.js
+2
-8
src/core/BufferGeometry.js
src/core/BufferGeometry.js
+7
-33
src/core/Geometry.js
src/core/Geometry.js
+3
-15
src/core/Object3D.js
src/core/Object3D.js
+18
-52
src/helpers/ArrowHelper.js
src/helpers/ArrowHelper.js
+1
-3
src/helpers/BoxHelper.js
src/helpers/BoxHelper.js
+1
-3
src/helpers/CameraHelper.js
src/helpers/CameraHelper.js
+2
-5
src/helpers/DirectionalLightHelper.js
src/helpers/DirectionalLightHelper.js
+3
-9
src/helpers/FaceNormalsHelper.js
src/helpers/FaceNormalsHelper.js
+3
-9
src/helpers/HemisphereLightHelper.js
src/helpers/HemisphereLightHelper.js
+3
-9
src/helpers/SkeletonHelper.js
src/helpers/SkeletonHelper.js
+3
-9
src/helpers/SpotLightHelper.js
src/helpers/SpotLightHelper.js
+1
-3
src/helpers/VertexNormalsHelper.js
src/helpers/VertexNormalsHelper.js
+4
-10
src/loaders/Loader.js
src/loaders/Loader.js
+12
-18
src/math/Box2.js
src/math/Box2.js
+1
-5
src/math/Box3.js
src/math/Box3.js
+29
-58
src/math/Euler.js
src/math/Euler.js
+2
-5
src/math/Frustum.js
src/math/Frustum.js
+2
-8
src/math/Line3.js
src/math/Line3.js
+2
-8
src/math/Matrix3.js
src/math/Matrix3.js
+1
-3
src/math/Matrix4.js
src/math/Matrix4.js
+8
-30
src/math/Plane.js
src/math/Plane.js
+3
-17
src/math/Ray.js
src/math/Ray.js
+9
-29
src/math/Sphere.js
src/math/Sphere.js
+2
-4
src/math/Triangle.js
src/math/Triangle.js
+11
-41
src/math/Vector3.js
src/math/Vector3.js
+2
-9
src/objects/LOD.js
src/objects/LOD.js
+2
-10
src/objects/Line.js
src/objects/Line.js
+5
-17
src/objects/LineSegments.js
src/objects/LineSegments.js
+2
-8
src/objects/Mesh.js
src/objects/Mesh.js
+22
-33
src/objects/Points.js
src/objects/Points.js
+4
-10
src/objects/Skeleton.js
src/objects/Skeleton.js
+2
-8
src/objects/Sprite.js
src/objects/Sprite.js
+15
-24
未找到文件。
src/animation/PropertyBinding.js
浏览文件 @
76953dcc
...
@@ -10,9 +10,39 @@
...
@@ -10,9 +10,39 @@
// Characters [].:/ are reserved for track binding syntax.
// Characters [].:/ are reserved for track binding syntax.
var
_RESERVED_CHARS_RE
=
'
\\
[
\\
]
\\
.:
\\
/
'
;
var
_RESERVED_CHARS_RE
=
'
\\
[
\\
]
\\
.:
\\
/
'
;
var
_reservedRe
=
new
RegExp
(
'
[
'
+
_RESERVED_CHARS_RE
+
'
]
'
,
'
g
'
);
var
_reservedRe
;
// Attempts to allow node names from any language. ES5's `\w` regexp matches
var
_trackRe
,
_supportedObjectNames
;
// only latin characters, and the unicode \p{L} is not yet supported. So
// instead, we exclude reserved characters and match everything else.
var
_wordChar
=
'
[^
'
+
_RESERVED_CHARS_RE
+
'
]
'
;
var
_wordCharOrDot
=
'
[^
'
+
_RESERVED_CHARS_RE
.
replace
(
'
\\
.
'
,
''
)
+
'
]
'
;
// Parent directories, delimited by '/' or ':'. Currently unused, but must
// be matched to parse the rest of the track name.
var
_directoryRe
=
/
((?:
WC+
[\/
:
])
*
)
/
.
source
.
replace
(
'
WC
'
,
_wordChar
);
// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.
var
_nodeRe
=
/
(
WCOD+
)?
/
.
source
.
replace
(
'
WCOD
'
,
_wordCharOrDot
);
// Object on target node, and accessor. May not contain reserved
// characters. Accessor may contain any character except closing bracket.
var
_objectRe
=
/
(?:\.(
WC+
)(?:\[(
.+
)\])?)?
/
.
source
.
replace
(
'
WC
'
,
_wordChar
);
// Property and accessor. May not contain reserved characters. Accessor may
// contain any non-bracket characters.
var
_propertyRe
=
/
\.(
WC+
)(?:\[(
.+
)\])?
/
.
source
.
replace
(
'
WC
'
,
_wordChar
);
var
_trackRe
=
new
RegExp
(
''
+
'
^
'
+
_directoryRe
+
_nodeRe
+
_objectRe
+
_propertyRe
+
'
$
'
);
var
_supportedObjectNames
=
[
'
material
'
,
'
materials
'
,
'
bones
'
];
function
Composite
(
targetGroup
,
path
,
optionalParsedPath
)
{
function
Composite
(
targetGroup
,
path
,
optionalParsedPath
)
{
...
@@ -114,54 +144,12 @@ Object.assign( PropertyBinding, {
...
@@ -114,54 +144,12 @@ Object.assign( PropertyBinding, {
*/
*/
sanitizeNodeName
:
function
(
name
)
{
sanitizeNodeName
:
function
(
name
)
{
if
(
_reservedRe
===
undefined
)
{
_reservedRe
=
new
RegExp
(
'
[
'
+
_RESERVED_CHARS_RE
+
'
]
'
,
'
g
'
);
}
return
name
.
replace
(
/
\s
/g
,
'
_
'
).
replace
(
_reservedRe
,
''
);
return
name
.
replace
(
/
\s
/g
,
'
_
'
).
replace
(
_reservedRe
,
''
);
},
},
parseTrackName
:
function
(
trackName
)
{
parseTrackName
:
function
(
trackName
)
{
if
(
_supportedObjectNames
===
undefined
)
{
// Attempts to allow node names from any language. ES5's `\w` regexp matches
// only latin characters, and the unicode \p{L} is not yet supported. So
// instead, we exclude reserved characters and match everything else.
var
wordChar
=
'
[^
'
+
_RESERVED_CHARS_RE
+
'
]
'
;
var
wordCharOrDot
=
'
[^
'
+
_RESERVED_CHARS_RE
.
replace
(
'
\\
.
'
,
''
)
+
'
]
'
;
// Parent directories, delimited by '/' or ':'. Currently unused, but must
// be matched to parse the rest of the track name.
var
directoryRe
=
/
((?:
WC+
[\/
:
])
*
)
/
.
source
.
replace
(
'
WC
'
,
wordChar
);
// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.
var
nodeRe
=
/
(
WCOD+
)?
/
.
source
.
replace
(
'
WCOD
'
,
wordCharOrDot
);
// Object on target node, and accessor. May not contain reserved
// characters. Accessor may contain any character except closing bracket.
var
objectRe
=
/
(?:\.(
WC+
)(?:\[(
.+
)\])?)?
/
.
source
.
replace
(
'
WC
'
,
wordChar
);
// Property and accessor. May not contain reserved characters. Accessor may
// contain any non-bracket characters.
var
propertyRe
=
/
\.(
WC+
)(?:\[(
.+
)\])?
/
.
source
.
replace
(
'
WC
'
,
wordChar
);
_trackRe
=
new
RegExp
(
''
+
'
^
'
+
directoryRe
+
nodeRe
+
objectRe
+
propertyRe
+
'
$
'
);
_supportedObjectNames
=
[
'
material
'
,
'
materials
'
,
'
bones
'
];
}
var
matches
=
_trackRe
.
exec
(
trackName
);
var
matches
=
_trackRe
.
exec
(
trackName
);
if
(
!
matches
)
{
if
(
!
matches
)
{
...
...
src/audio/AudioListener.js
浏览文件 @
76953dcc
...
@@ -8,8 +8,10 @@ import { Clock } from '../core/Clock.js';
...
@@ -8,8 +8,10 @@ import { Clock } from '../core/Clock.js';
import
{
Object3D
}
from
'
../core/Object3D.js
'
;
import
{
Object3D
}
from
'
../core/Object3D.js
'
;
import
{
AudioContext
}
from
'
./AudioContext.js
'
;
import
{
AudioContext
}
from
'
./AudioContext.js
'
;
var
_position
,
_quaternion
,
_scale
;
var
_position
=
new
Vector3
();
var
_orientation
;
var
_quaternion
=
new
Quaternion
();
var
_scale
=
new
Vector3
();
var
_orientation
=
new
Vector3
();
function
AudioListener
()
{
function
AudioListener
()
{
...
@@ -102,15 +104,6 @@ AudioListener.prototype = Object.assign( Object.create( Object3D.prototype ), {
...
@@ -102,15 +104,6 @@ AudioListener.prototype = Object.assign( Object.create( Object3D.prototype ), {
Object3D
.
prototype
.
updateMatrixWorld
.
call
(
this
,
force
);
Object3D
.
prototype
.
updateMatrixWorld
.
call
(
this
,
force
);
if
(
_position
===
undefined
)
{
_position
=
new
Vector3
();
_quaternion
=
new
Quaternion
();
_scale
=
new
Vector3
();
_orientation
=
new
Vector3
();
}
var
listener
=
this
.
context
.
listener
;
var
listener
=
this
.
context
.
listener
;
var
up
=
this
.
up
;
var
up
=
this
.
up
;
...
...
src/audio/PositionalAudio.js
浏览文件 @
76953dcc
...
@@ -7,8 +7,10 @@ import { Quaternion } from '../math/Quaternion.js';
...
@@ -7,8 +7,10 @@ import { Quaternion } from '../math/Quaternion.js';
import
{
Audio
}
from
'
./Audio.js
'
;
import
{
Audio
}
from
'
./Audio.js
'
;
import
{
Object3D
}
from
'
../core/Object3D.js
'
;
import
{
Object3D
}
from
'
../core/Object3D.js
'
;
var
_position
,
_quaternion
,
_scale
;
var
_position
=
new
Vector3
();
var
_orientation
;
var
_quaternion
=
new
Quaternion
();
var
_scale
=
new
Vector3
();
var
_orientation
=
new
Vector3
();
function
PositionalAudio
(
listener
)
{
function
PositionalAudio
(
listener
)
{
...
@@ -100,15 +102,6 @@ PositionalAudio.prototype = Object.assign( Object.create( Audio.prototype ), {
...
@@ -100,15 +102,6 @@ PositionalAudio.prototype = Object.assign( Object.create( Audio.prototype ), {
Object3D
.
prototype
.
updateMatrixWorld
.
call
(
this
,
force
);
Object3D
.
prototype
.
updateMatrixWorld
.
call
(
this
,
force
);
if
(
_position
===
undefined
)
{
_position
=
new
Vector3
();
_quaternion
=
new
Quaternion
();
_scale
=
new
Vector3
();
_orientation
=
new
Vector3
();
}
if
(
this
.
hasPlaybackControl
===
true
&&
this
.
isPlaying
===
false
)
return
;
if
(
this
.
hasPlaybackControl
===
true
&&
this
.
isPlaying
===
false
)
return
;
this
.
matrixWorld
.
decompose
(
_position
,
_quaternion
,
_scale
);
this
.
matrixWorld
.
decompose
(
_position
,
_quaternion
,
_scale
);
...
...
src/cameras/StereoCamera.js
浏览文件 @
76953dcc
...
@@ -2,7 +2,8 @@ import { Matrix4 } from '../math/Matrix4.js';
...
@@ -2,7 +2,8 @@ import { Matrix4 } from '../math/Matrix4.js';
import
{
_Math
}
from
'
../math/Math.js
'
;
import
{
_Math
}
from
'
../math/Math.js
'
;
import
{
PerspectiveCamera
}
from
'
./PerspectiveCamera.js
'
;
import
{
PerspectiveCamera
}
from
'
./PerspectiveCamera.js
'
;
var
_eyeRight
,
_eyeLeft
;
var
_eyeRight
=
new
Matrix4
();
var
_eyeLeft
=
new
Matrix4
();
/**
/**
* @author mrdoob / http://mrdoob.com/
* @author mrdoob / http://mrdoob.com/
...
@@ -40,13 +41,6 @@ Object.assign( StereoCamera.prototype, {
...
@@ -40,13 +41,6 @@ Object.assign( StereoCamera.prototype, {
update
:
function
(
camera
)
{
update
:
function
(
camera
)
{
if
(
_eyeRight
===
undefined
)
{
_eyeRight
=
new
Matrix4
();
_eyeLeft
=
new
Matrix4
();
}
var
cache
=
this
.
_cache
;
var
cache
=
this
.
_cache
;
var
needsUpdate
=
cache
.
focus
!==
camera
.
focus
||
cache
.
fov
!==
camera
.
fov
||
var
needsUpdate
=
cache
.
focus
!==
camera
.
focus
||
cache
.
fov
!==
camera
.
fov
||
...
...
src/core/BufferGeometry.js
浏览文件 @
76953dcc
...
@@ -16,9 +16,13 @@ import { arrayMax } from '../utils.js';
...
@@ -16,9 +16,13 @@ import { arrayMax } from '../utils.js';
*/
*/
var
_bufferGeometryId
=
1
;
// BufferGeometry uses odd numbers as Id
var
_bufferGeometryId
=
1
;
// BufferGeometry uses odd numbers as Id
var
_m1
,
_obj
,
_offset
;
var
_box
,
_boxMorphTargets
;
var
_m1
=
new
Matrix4
();
var
_vector
;
var
_obj
=
new
Object3D
();
var
_offset
=
new
Vector3
();
var
_box
=
new
Box3
();
var
_boxMorphTargets
=
new
Box3
();
var
_vector
=
new
Vector3
();
function
BufferGeometry
()
{
function
BufferGeometry
()
{
...
@@ -189,8 +193,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
...
@@ -189,8 +193,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
// rotate geometry around world x-axis
// rotate geometry around world x-axis
if
(
_m1
===
undefined
)
_m1
=
new
Matrix4
();
_m1
.
makeRotationX
(
angle
);
_m1
.
makeRotationX
(
angle
);
this
.
applyMatrix
(
_m1
);
this
.
applyMatrix
(
_m1
);
...
@@ -203,8 +205,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
...
@@ -203,8 +205,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
// rotate geometry around world y-axis
// rotate geometry around world y-axis
if
(
_m1
===
undefined
)
_m1
=
new
Matrix4
();
_m1
.
makeRotationY
(
angle
);
_m1
.
makeRotationY
(
angle
);
this
.
applyMatrix
(
_m1
);
this
.
applyMatrix
(
_m1
);
...
@@ -217,8 +217,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
...
@@ -217,8 +217,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
// rotate geometry around world z-axis
// rotate geometry around world z-axis
if
(
_m1
===
undefined
)
_m1
=
new
Matrix4
();
_m1
.
makeRotationZ
(
angle
);
_m1
.
makeRotationZ
(
angle
);
this
.
applyMatrix
(
_m1
);
this
.
applyMatrix
(
_m1
);
...
@@ -231,8 +229,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
...
@@ -231,8 +229,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
// translate geometry
// translate geometry
if
(
_m1
===
undefined
)
_m1
=
new
Matrix4
();
_m1
.
makeTranslation
(
x
,
y
,
z
);
_m1
.
makeTranslation
(
x
,
y
,
z
);
this
.
applyMatrix
(
_m1
);
this
.
applyMatrix
(
_m1
);
...
@@ -245,8 +241,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
...
@@ -245,8 +241,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
// scale geometry
// scale geometry
if
(
_m1
===
undefined
)
_m1
=
new
Matrix4
();
_m1
.
makeScale
(
x
,
y
,
z
);
_m1
.
makeScale
(
x
,
y
,
z
);
this
.
applyMatrix
(
_m1
);
this
.
applyMatrix
(
_m1
);
...
@@ -257,8 +251,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
...
@@ -257,8 +251,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
lookAt
:
function
(
vector
)
{
lookAt
:
function
(
vector
)
{
if
(
_obj
===
undefined
)
_obj
=
new
Object3D
();
_obj
.
lookAt
(
vector
);
_obj
.
lookAt
(
vector
);
_obj
.
updateMatrix
();
_obj
.
updateMatrix
();
...
@@ -271,8 +263,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
...
@@ -271,8 +263,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
center
:
function
()
{
center
:
function
()
{
if
(
_offset
===
undefined
)
_offset
=
new
Vector3
();
this
.
computeBoundingBox
();
this
.
computeBoundingBox
();
this
.
boundingBox
.
getCenter
(
_offset
).
negate
();
this
.
boundingBox
.
getCenter
(
_offset
).
negate
();
...
@@ -578,12 +568,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
...
@@ -578,12 +568,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
computeBoundingBox
:
function
()
{
computeBoundingBox
:
function
()
{
if
(
_box
===
undefined
)
{
_box
=
new
Box3
();
}
if
(
this
.
boundingBox
===
null
)
{
if
(
this
.
boundingBox
===
null
)
{
this
.
boundingBox
=
new
Box3
();
this
.
boundingBox
=
new
Box3
();
...
@@ -629,14 +613,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
...
@@ -629,14 +613,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
computeBoundingSphere
:
function
()
{
computeBoundingSphere
:
function
()
{
if
(
_boxMorphTargets
===
undefined
)
{
_box
=
new
Box3
();
_vector
=
new
Vector3
();
_boxMorphTargets
=
new
Box3
();
}
if
(
this
.
boundingSphere
===
null
)
{
if
(
this
.
boundingSphere
===
null
)
{
this
.
boundingSphere
=
new
Sphere
();
this
.
boundingSphere
=
new
Sphere
();
...
@@ -877,8 +853,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
...
@@ -877,8 +853,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
normalizeNormals
:
function
()
{
normalizeNormals
:
function
()
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector3
();
var
normals
=
this
.
attributes
.
normal
;
var
normals
=
this
.
attributes
.
normal
;
for
(
var
i
=
0
,
il
=
normals
.
count
;
i
<
il
;
i
++
)
{
for
(
var
i
=
0
,
il
=
normals
.
count
;
i
<
il
;
i
++
)
{
...
...
src/core/Geometry.js
浏览文件 @
76953dcc
...
@@ -20,7 +20,9 @@ import { _Math } from '../math/Math.js';
...
@@ -20,7 +20,9 @@ import { _Math } from '../math/Math.js';
*/
*/
var
_geometryId
=
0
;
// Geometry uses even numbers as Id
var
_geometryId
=
0
;
// Geometry uses even numbers as Id
var
_m1
,
_obj
,
_offset
;
var
_m1
=
new
Matrix4
();
var
_obj
=
new
Object3D
();
var
_offset
=
new
Vector3
();
function
Geometry
()
{
function
Geometry
()
{
...
@@ -112,8 +114,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -112,8 +114,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
// rotate geometry around world x-axis
// rotate geometry around world x-axis
if
(
_m1
===
undefined
)
_m1
=
new
Matrix4
();
_m1
.
makeRotationX
(
angle
);
_m1
.
makeRotationX
(
angle
);
this
.
applyMatrix
(
_m1
);
this
.
applyMatrix
(
_m1
);
...
@@ -126,8 +126,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -126,8 +126,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
// rotate geometry around world y-axis
// rotate geometry around world y-axis
if
(
_m1
===
undefined
)
_m1
=
new
Matrix4
();
_m1
.
makeRotationY
(
angle
);
_m1
.
makeRotationY
(
angle
);
this
.
applyMatrix
(
_m1
);
this
.
applyMatrix
(
_m1
);
...
@@ -140,8 +138,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -140,8 +138,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
// rotate geometry around world z-axis
// rotate geometry around world z-axis
if
(
_m1
===
undefined
)
_m1
=
new
Matrix4
();
_m1
.
makeRotationZ
(
angle
);
_m1
.
makeRotationZ
(
angle
);
this
.
applyMatrix
(
_m1
);
this
.
applyMatrix
(
_m1
);
...
@@ -154,8 +150,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -154,8 +150,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
// translate geometry
// translate geometry
if
(
_m1
===
undefined
)
_m1
=
new
Matrix4
();
_m1
.
makeTranslation
(
x
,
y
,
z
);
_m1
.
makeTranslation
(
x
,
y
,
z
);
this
.
applyMatrix
(
_m1
);
this
.
applyMatrix
(
_m1
);
...
@@ -168,8 +162,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -168,8 +162,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
// scale geometry
// scale geometry
if
(
_m1
===
undefined
)
_m1
=
new
Matrix4
();
_m1
.
makeScale
(
x
,
y
,
z
);
_m1
.
makeScale
(
x
,
y
,
z
);
this
.
applyMatrix
(
_m1
);
this
.
applyMatrix
(
_m1
);
...
@@ -180,8 +172,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -180,8 +172,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
lookAt
:
function
(
vector
)
{
lookAt
:
function
(
vector
)
{
if
(
_obj
===
undefined
)
_obj
=
new
Object3D
();
_obj
.
lookAt
(
vector
);
_obj
.
lookAt
(
vector
);
_obj
.
updateMatrix
();
_obj
.
updateMatrix
();
...
@@ -327,8 +317,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -327,8 +317,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
center
:
function
()
{
center
:
function
()
{
if
(
_offset
===
undefined
)
_offset
=
new
Vector3
();
this
.
computeBoundingBox
();
this
.
computeBoundingBox
();
this
.
boundingBox
.
getCenter
(
_offset
).
negate
();
this
.
boundingBox
.
getCenter
(
_offset
).
negate
();
...
...
src/core/Object3D.js
浏览文件 @
76953dcc
...
@@ -8,6 +8,24 @@ import { Matrix3 } from '../math/Matrix3.js';
...
@@ -8,6 +8,24 @@ import { Matrix3 } from '../math/Matrix3.js';
import
{
_Math
}
from
'
../math/Math.js
'
;
import
{
_Math
}
from
'
../math/Math.js
'
;
import
{
TrianglesDrawMode
}
from
'
../constants.js
'
;
import
{
TrianglesDrawMode
}
from
'
../constants.js
'
;
var
_object3DId
=
0
;
var
_v1
=
new
Vector3
();
var
_q1
=
new
Quaternion
();
var
_m1
=
new
Matrix4
();
var
_target
=
new
Vector3
();
var
_position
=
new
Vector3
();
var
_scale
=
new
Vector3
();
var
_quaternion
=
new
Quaternion
();
var
_xAxis
=
new
Vector3
(
1
,
0
,
0
);
var
_yAxis
=
new
Vector3
(
0
,
1
,
0
);
var
_zAxis
=
new
Vector3
(
0
,
0
,
1
);
var
_addedEvent
=
{
type
:
'
added
'
};
var
_removedEvent
=
{
type
:
'
removed
'
};
/**
/**
* @author mrdoob / http://mrdoob.com/
* @author mrdoob / http://mrdoob.com/
* @author mikael emtinger / http://gomo.se/
* @author mikael emtinger / http://gomo.se/
...
@@ -16,13 +34,6 @@ import { TrianglesDrawMode } from '../constants.js';
...
@@ -16,13 +34,6 @@ import { TrianglesDrawMode } from '../constants.js';
* @author elephantatwork / www.elephantatwork.ch
* @author elephantatwork / www.elephantatwork.ch
*/
*/
var
_object3DId
=
0
;
var
_m1
,
_q1
,
_v1
;
var
_xAxis
,
_yAxis
,
_zAxis
;
var
_target
,
_position
,
_scale
,
_quaternion
;
var
_addedEvent
=
{
type
:
'
added
'
};
var
_removedEvent
=
{
type
:
'
removed
'
};
function
Object3D
()
{
function
Object3D
()
{
Object
.
defineProperty
(
this
,
'
id
'
,
{
value
:
_object3DId
++
}
);
Object
.
defineProperty
(
this
,
'
id
'
,
{
value
:
_object3DId
++
}
);
...
@@ -170,8 +181,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -170,8 +181,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
// rotate object on axis in object space
// rotate object on axis in object space
// axis is assumed to be normalized
// axis is assumed to be normalized
if
(
_q1
===
undefined
)
_q1
=
new
Quaternion
();
_q1
.
setFromAxisAngle
(
axis
,
angle
);
_q1
.
setFromAxisAngle
(
axis
,
angle
);
this
.
quaternion
.
multiply
(
_q1
);
this
.
quaternion
.
multiply
(
_q1
);
...
@@ -186,8 +195,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -186,8 +195,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
// axis is assumed to be normalized
// axis is assumed to be normalized
// method assumes no rotated parent
// method assumes no rotated parent
if
(
_q1
===
undefined
)
_q1
=
new
Quaternion
();
_q1
.
setFromAxisAngle
(
axis
,
angle
);
_q1
.
setFromAxisAngle
(
axis
,
angle
);
this
.
quaternion
.
premultiply
(
_q1
);
this
.
quaternion
.
premultiply
(
_q1
);
...
@@ -198,24 +205,18 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -198,24 +205,18 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
rotateX
:
function
(
angle
)
{
rotateX
:
function
(
angle
)
{
if
(
_xAxis
===
undefined
)
_xAxis
=
new
Vector3
(
1
,
0
,
0
);
return
this
.
rotateOnAxis
(
_xAxis
,
angle
);
return
this
.
rotateOnAxis
(
_xAxis
,
angle
);
},
},
rotateY
:
function
(
angle
)
{
rotateY
:
function
(
angle
)
{
if
(
_yAxis
===
undefined
)
_yAxis
=
new
Vector3
(
0
,
1
,
0
);
return
this
.
rotateOnAxis
(
_yAxis
,
angle
);
return
this
.
rotateOnAxis
(
_yAxis
,
angle
);
},
},
rotateZ
:
function
(
angle
)
{
rotateZ
:
function
(
angle
)
{
if
(
_zAxis
===
undefined
)
_zAxis
=
new
Vector3
(
0
,
0
,
1
);
return
this
.
rotateOnAxis
(
_zAxis
,
angle
);
return
this
.
rotateOnAxis
(
_zAxis
,
angle
);
},
},
...
@@ -225,8 +226,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -225,8 +226,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
// translate object by distance along axis in object space
// translate object by distance along axis in object space
// axis is assumed to be normalized
// axis is assumed to be normalized
if
(
_v1
===
undefined
)
_v1
=
new
Vector3
();
_v1
.
copy
(
axis
).
applyQuaternion
(
this
.
quaternion
);
_v1
.
copy
(
axis
).
applyQuaternion
(
this
.
quaternion
);
this
.
position
.
add
(
_v1
.
multiplyScalar
(
distance
)
);
this
.
position
.
add
(
_v1
.
multiplyScalar
(
distance
)
);
...
@@ -237,24 +236,18 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -237,24 +236,18 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
translateX
:
function
(
distance
)
{
translateX
:
function
(
distance
)
{
if
(
_xAxis
===
undefined
)
_xAxis
=
new
Vector3
(
1
,
0
,
0
);
return
this
.
translateOnAxis
(
_xAxis
,
distance
);
return
this
.
translateOnAxis
(
_xAxis
,
distance
);
},
},
translateY
:
function
(
distance
)
{
translateY
:
function
(
distance
)
{
if
(
_yAxis
===
undefined
)
_yAxis
=
new
Vector3
(
0
,
1
,
0
);
return
this
.
translateOnAxis
(
_yAxis
,
distance
);
return
this
.
translateOnAxis
(
_yAxis
,
distance
);
},
},
translateZ
:
function
(
distance
)
{
translateZ
:
function
(
distance
)
{
if
(
_zAxis
===
undefined
)
_zAxis
=
new
Vector3
(
0
,
0
,
1
);
return
this
.
translateOnAxis
(
_zAxis
,
distance
);
return
this
.
translateOnAxis
(
_zAxis
,
distance
);
},
},
...
@@ -267,8 +260,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -267,8 +260,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
worldToLocal
:
function
(
vector
)
{
worldToLocal
:
function
(
vector
)
{
if
(
_m1
===
undefined
)
_m1
=
new
Matrix4
();
return
vector
.
applyMatrix4
(
_m1
.
getInverse
(
this
.
matrixWorld
)
);
return
vector
.
applyMatrix4
(
_m1
.
getInverse
(
this
.
matrixWorld
)
);
},
},
...
@@ -277,15 +268,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -277,15 +268,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
// This method does not support objects having non-uniformly-scaled parent(s)
// This method does not support objects having non-uniformly-scaled parent(s)
if
(
_target
===
undefined
)
{
_q1
=
new
Quaternion
();
_m1
=
new
Matrix4
();
_target
=
new
Vector3
();
_position
=
new
Vector3
();
}
if
(
x
.
isVector3
)
{
if
(
x
.
isVector3
)
{
_target
.
copy
(
x
);
_target
.
copy
(
x
);
...
@@ -401,8 +383,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -401,8 +383,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
// adds object as a child of this, while maintaining the object's world transform
// adds object as a child of this, while maintaining the object's world transform
if
(
_m1
===
undefined
)
_m1
=
new
Matrix4
();
this
.
updateWorldMatrix
(
true
,
false
);
this
.
updateWorldMatrix
(
true
,
false
);
_m1
.
getInverse
(
this
.
matrixWorld
);
_m1
.
getInverse
(
this
.
matrixWorld
);
...
@@ -475,13 +455,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -475,13 +455,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
getWorldQuaternion
:
function
(
target
)
{
getWorldQuaternion
:
function
(
target
)
{
if
(
_scale
===
undefined
)
{
_position
=
new
Vector3
();
_scale
=
new
Vector3
();
}
if
(
target
===
undefined
)
{
if
(
target
===
undefined
)
{
console
.
warn
(
'
THREE.Object3D: .getWorldQuaternion() target is now required
'
);
console
.
warn
(
'
THREE.Object3D: .getWorldQuaternion() target is now required
'
);
...
@@ -499,13 +472,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
...
@@ -499,13 +472,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
getWorldScale
:
function
(
target
)
{
getWorldScale
:
function
(
target
)
{
if
(
_quaternion
===
undefined
)
{
_position
=
new
Vector3
();
_quaternion
=
new
Quaternion
();
}
if
(
target
===
undefined
)
{
if
(
target
===
undefined
)
{
console
.
warn
(
'
THREE.Object3D: .getWorldScale() target is now required
'
);
console
.
warn
(
'
THREE.Object3D: .getWorldScale() target is now required
'
);
...
...
src/helpers/ArrowHelper.js
浏览文件 @
76953dcc
...
@@ -24,7 +24,7 @@ import { Mesh } from '../objects/Mesh.js';
...
@@ -24,7 +24,7 @@ import { Mesh } from '../objects/Mesh.js';
import
{
Line
}
from
'
../objects/Line.js
'
;
import
{
Line
}
from
'
../objects/Line.js
'
;
import
{
Vector3
}
from
'
../math/Vector3.js
'
;
import
{
Vector3
}
from
'
../math/Vector3.js
'
;
var
_axis
;
var
_axis
=
new
Vector3
()
;
var
_lineGeometry
,
_coneGeometry
;
var
_lineGeometry
,
_coneGeometry
;
function
ArrowHelper
(
dir
,
origin
,
length
,
color
,
headLength
,
headWidth
)
{
function
ArrowHelper
(
dir
,
origin
,
length
,
color
,
headLength
,
headWidth
)
{
...
@@ -70,8 +70,6 @@ ArrowHelper.prototype.constructor = ArrowHelper;
...
@@ -70,8 +70,6 @@ ArrowHelper.prototype.constructor = ArrowHelper;
ArrowHelper
.
prototype
.
setDirection
=
function
(
dir
)
{
ArrowHelper
.
prototype
.
setDirection
=
function
(
dir
)
{
if
(
_axis
===
undefined
)
_axis
=
new
Vector3
();
// dir is assumed to be normalized
// dir is assumed to be normalized
if
(
dir
.
y
>
0.99999
)
{
if
(
dir
.
y
>
0.99999
)
{
...
...
src/helpers/BoxHelper.js
浏览文件 @
76953dcc
...
@@ -9,7 +9,7 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
...
@@ -9,7 +9,7 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
import
{
BufferAttribute
}
from
'
../core/BufferAttribute.js
'
;
import
{
BufferAttribute
}
from
'
../core/BufferAttribute.js
'
;
import
{
BufferGeometry
}
from
'
../core/BufferGeometry.js
'
;
import
{
BufferGeometry
}
from
'
../core/BufferGeometry.js
'
;
var
_box
;
var
_box
=
new
Box3
()
;
function
BoxHelper
(
object
,
color
)
{
function
BoxHelper
(
object
,
color
)
{
...
@@ -37,8 +37,6 @@ BoxHelper.prototype.constructor = BoxHelper;
...
@@ -37,8 +37,6 @@ BoxHelper.prototype.constructor = BoxHelper;
BoxHelper
.
prototype
.
update
=
function
(
object
)
{
BoxHelper
.
prototype
.
update
=
function
(
object
)
{
if
(
_box
===
undefined
)
_box
=
new
Box3
();
if
(
object
!==
undefined
)
{
if
(
object
!==
undefined
)
{
console
.
warn
(
'
THREE.BoxHelper: .update() has no longer arguments.
'
);
console
.
warn
(
'
THREE.BoxHelper: .update() has no longer arguments.
'
);
...
...
src/helpers/CameraHelper.js
浏览文件 @
76953dcc
...
@@ -17,7 +17,8 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
...
@@ -17,7 +17,8 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
import
{
BufferGeometry
}
from
'
../core/BufferGeometry.js
'
;
import
{
BufferGeometry
}
from
'
../core/BufferGeometry.js
'
;
import
{
Float32BufferAttribute
}
from
'
../core/BufferAttribute.js
'
;
import
{
Float32BufferAttribute
}
from
'
../core/BufferAttribute.js
'
;
var
_vector
,
_camera
;
var
_vector
=
new
Vector3
();
var
_camera
=
new
Camera
();
function
CameraHelper
(
camera
)
{
function
CameraHelper
(
camera
)
{
...
@@ -128,8 +129,6 @@ CameraHelper.prototype.constructor = CameraHelper;
...
@@ -128,8 +129,6 @@ CameraHelper.prototype.constructor = CameraHelper;
CameraHelper
.
prototype
.
update
=
function
()
{
CameraHelper
.
prototype
.
update
=
function
()
{
if
(
_camera
===
undefined
)
_camera
=
new
Camera
();
var
geometry
=
this
.
geometry
;
var
geometry
=
this
.
geometry
;
var
pointMap
=
this
.
pointMap
;
var
pointMap
=
this
.
pointMap
;
...
@@ -183,8 +182,6 @@ CameraHelper.prototype.update = function () {
...
@@ -183,8 +182,6 @@ CameraHelper.prototype.update = function () {
function
setPoint
(
point
,
pointMap
,
geometry
,
camera
,
x
,
y
,
z
)
{
function
setPoint
(
point
,
pointMap
,
geometry
,
camera
,
x
,
y
,
z
)
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector3
();
_vector
.
set
(
x
,
y
,
z
).
unproject
(
camera
);
_vector
.
set
(
x
,
y
,
z
).
unproject
(
camera
);
var
points
=
pointMap
[
point
];
var
points
=
pointMap
[
point
];
...
...
src/helpers/DirectionalLightHelper.js
浏览文件 @
76953dcc
...
@@ -11,7 +11,9 @@ import { Float32BufferAttribute } from '../core/BufferAttribute.js';
...
@@ -11,7 +11,9 @@ import { Float32BufferAttribute } from '../core/BufferAttribute.js';
import
{
BufferGeometry
}
from
'
../core/BufferGeometry.js
'
;
import
{
BufferGeometry
}
from
'
../core/BufferGeometry.js
'
;
import
{
LineBasicMaterial
}
from
'
../materials/LineBasicMaterial.js
'
;
import
{
LineBasicMaterial
}
from
'
../materials/LineBasicMaterial.js
'
;
var
_v1
,
_v2
,
_v3
;
var
_v1
=
new
Vector3
();
var
_v2
=
new
Vector3
();
var
_v3
=
new
Vector3
();
function
DirectionalLightHelper
(
light
,
size
,
color
)
{
function
DirectionalLightHelper
(
light
,
size
,
color
)
{
...
@@ -65,14 +67,6 @@ DirectionalLightHelper.prototype.dispose = function () {
...
@@ -65,14 +67,6 @@ DirectionalLightHelper.prototype.dispose = function () {
DirectionalLightHelper
.
prototype
.
update
=
function
()
{
DirectionalLightHelper
.
prototype
.
update
=
function
()
{
if
(
_v3
===
undefined
)
{
_v1
=
new
Vector3
();
_v2
=
new
Vector3
();
_v3
=
new
Vector3
();
}
_v1
.
setFromMatrixPosition
(
this
.
light
.
matrixWorld
);
_v1
.
setFromMatrixPosition
(
this
.
light
.
matrixWorld
);
_v2
.
setFromMatrixPosition
(
this
.
light
.
target
.
matrixWorld
);
_v2
.
setFromMatrixPosition
(
this
.
light
.
target
.
matrixWorld
);
_v3
.
subVectors
(
_v2
,
_v1
);
_v3
.
subVectors
(
_v2
,
_v1
);
...
...
src/helpers/FaceNormalsHelper.js
浏览文件 @
76953dcc
...
@@ -10,7 +10,9 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
...
@@ -10,7 +10,9 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
import
{
Float32BufferAttribute
}
from
'
../core/BufferAttribute.js
'
;
import
{
Float32BufferAttribute
}
from
'
../core/BufferAttribute.js
'
;
import
{
BufferGeometry
}
from
'
../core/BufferGeometry.js
'
;
import
{
BufferGeometry
}
from
'
../core/BufferGeometry.js
'
;
var
_v1
,
_v2
,
_normalMatrix
;
var
_v1
=
new
Vector3
();
var
_v2
=
new
Vector3
();
var
_normalMatrix
=
new
Matrix3
();
function
FaceNormalsHelper
(
object
,
size
,
hex
,
linewidth
)
{
function
FaceNormalsHelper
(
object
,
size
,
hex
,
linewidth
)
{
...
@@ -62,14 +64,6 @@ FaceNormalsHelper.prototype.constructor = FaceNormalsHelper;
...
@@ -62,14 +64,6 @@ FaceNormalsHelper.prototype.constructor = FaceNormalsHelper;
FaceNormalsHelper
.
prototype
.
update
=
function
()
{
FaceNormalsHelper
.
prototype
.
update
=
function
()
{
if
(
_normalMatrix
===
undefined
)
{
_v1
=
new
Vector3
();
_v2
=
new
Vector3
();
_normalMatrix
=
new
Matrix3
();
}
this
.
object
.
updateMatrixWorld
(
true
);
this
.
object
.
updateMatrixWorld
(
true
);
_normalMatrix
.
getNormalMatrix
(
this
.
object
.
matrixWorld
);
_normalMatrix
.
getNormalMatrix
(
this
.
object
.
matrixWorld
);
...
...
src/helpers/HemisphereLightHelper.js
浏览文件 @
76953dcc
...
@@ -13,7 +13,9 @@ import { MeshBasicMaterial } from '../materials/MeshBasicMaterial.js';
...
@@ -13,7 +13,9 @@ import { MeshBasicMaterial } from '../materials/MeshBasicMaterial.js';
import
{
OctahedronBufferGeometry
}
from
'
../geometries/OctahedronGeometry.js
'
;
import
{
OctahedronBufferGeometry
}
from
'
../geometries/OctahedronGeometry.js
'
;
import
{
BufferAttribute
}
from
'
../core/BufferAttribute.js
'
;
import
{
BufferAttribute
}
from
'
../core/BufferAttribute.js
'
;
var
_vector
,
_color1
,
_color2
;
var
_vector
=
new
Vector3
();
var
_color1
=
new
Color
();
var
_color2
=
new
Color
();
function
HemisphereLightHelper
(
light
,
size
,
color
)
{
function
HemisphereLightHelper
(
light
,
size
,
color
)
{
...
@@ -56,14 +58,6 @@ HemisphereLightHelper.prototype.dispose = function () {
...
@@ -56,14 +58,6 @@ HemisphereLightHelper.prototype.dispose = function () {
HemisphereLightHelper
.
prototype
.
update
=
function
()
{
HemisphereLightHelper
.
prototype
.
update
=
function
()
{
if
(
_color2
===
undefined
)
{
_vector
=
new
Vector3
();
_color1
=
new
Color
();
_color2
=
new
Color
();
}
var
mesh
=
this
.
children
[
0
];
var
mesh
=
this
.
children
[
0
];
if
(
this
.
color
!==
undefined
)
{
if
(
this
.
color
!==
undefined
)
{
...
...
src/helpers/SkeletonHelper.js
浏览文件 @
76953dcc
...
@@ -16,7 +16,9 @@ import { BufferGeometry } from '../core/BufferGeometry.js';
...
@@ -16,7 +16,9 @@ import { BufferGeometry } from '../core/BufferGeometry.js';
import
{
Float32BufferAttribute
}
from
'
../core/BufferAttribute.js
'
;
import
{
Float32BufferAttribute
}
from
'
../core/BufferAttribute.js
'
;
import
{
Object3D
}
from
'
../core/Object3D.js
'
;
import
{
Object3D
}
from
'
../core/Object3D.js
'
;
var
_vector
,
_boneMatrix
,
_matrixWorldInv
;
var
_vector
=
new
Vector3
();
var
_boneMatrix
=
new
Matrix4
();
var
_matrixWorldInv
=
new
Matrix4
();
function
getBoneList
(
object
)
{
function
getBoneList
(
object
)
{
...
@@ -85,14 +87,6 @@ SkeletonHelper.prototype.constructor = SkeletonHelper;
...
@@ -85,14 +87,6 @@ SkeletonHelper.prototype.constructor = SkeletonHelper;
SkeletonHelper
.
prototype
.
updateMatrixWorld
=
function
(
force
)
{
SkeletonHelper
.
prototype
.
updateMatrixWorld
=
function
(
force
)
{
if
(
_matrixWorldInv
===
undefined
)
{
_vector
=
new
Vector3
();
_boneMatrix
=
new
Matrix4
();
_matrixWorldInv
=
new
Matrix4
();
}
var
bones
=
this
.
bones
;
var
bones
=
this
.
bones
;
var
geometry
=
this
.
geometry
;
var
geometry
=
this
.
geometry
;
...
...
src/helpers/SpotLightHelper.js
浏览文件 @
76953dcc
...
@@ -11,7 +11,7 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
...
@@ -11,7 +11,7 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
import
{
Float32BufferAttribute
}
from
'
../core/BufferAttribute.js
'
;
import
{
Float32BufferAttribute
}
from
'
../core/BufferAttribute.js
'
;
import
{
BufferGeometry
}
from
'
../core/BufferGeometry.js
'
;
import
{
BufferGeometry
}
from
'
../core/BufferGeometry.js
'
;
var
_vector
;
var
_vector
=
new
Vector3
()
;
function
SpotLightHelper
(
light
,
color
)
{
function
SpotLightHelper
(
light
,
color
)
{
...
@@ -70,8 +70,6 @@ SpotLightHelper.prototype.dispose = function () {
...
@@ -70,8 +70,6 @@ SpotLightHelper.prototype.dispose = function () {
SpotLightHelper
.
prototype
.
update
=
function
()
{
SpotLightHelper
.
prototype
.
update
=
function
()
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector3
();
this
.
light
.
updateMatrixWorld
();
this
.
light
.
updateMatrixWorld
();
var
coneLength
=
this
.
light
.
distance
?
this
.
light
.
distance
:
1000
;
var
coneLength
=
this
.
light
.
distance
?
this
.
light
.
distance
:
1000
;
...
...
src/helpers/VertexNormalsHelper.js
浏览文件 @
76953dcc
...
@@ -10,7 +10,10 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
...
@@ -10,7 +10,10 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial.js';
import
{
Float32BufferAttribute
}
from
'
../core/BufferAttribute.js
'
;
import
{
Float32BufferAttribute
}
from
'
../core/BufferAttribute.js
'
;
import
{
BufferGeometry
}
from
'
../core/BufferGeometry.js
'
;
import
{
BufferGeometry
}
from
'
../core/BufferGeometry.js
'
;
var
_v1
,
_v2
,
_normalMatrix
,
_keys
;
var
_v1
=
new
Vector3
();
var
_v2
=
new
Vector3
();
var
_normalMatrix
=
new
Matrix3
();
var
_keys
=
[
'
a
'
,
'
b
'
,
'
c
'
];
function
VertexNormalsHelper
(
object
,
size
,
hex
,
linewidth
)
{
function
VertexNormalsHelper
(
object
,
size
,
hex
,
linewidth
)
{
...
@@ -61,15 +64,6 @@ VertexNormalsHelper.prototype.constructor = VertexNormalsHelper;
...
@@ -61,15 +64,6 @@ VertexNormalsHelper.prototype.constructor = VertexNormalsHelper;
VertexNormalsHelper
.
prototype
.
update
=
function
()
{
VertexNormalsHelper
.
prototype
.
update
=
function
()
{
if
(
_normalMatrix
===
undefined
)
{
_v1
=
new
Vector3
();
_v2
=
new
Vector3
();
_normalMatrix
=
new
Matrix3
();
_keys
=
[
'
a
'
,
'
b
'
,
'
c
'
];
}
this
.
object
.
updateMatrixWorld
(
true
);
this
.
object
.
updateMatrixWorld
(
true
);
_normalMatrix
.
getNormalMatrix
(
this
.
object
.
matrixWorld
);
_normalMatrix
.
getNormalMatrix
(
this
.
object
.
matrixWorld
);
...
...
src/loaders/Loader.js
浏览文件 @
76953dcc
...
@@ -24,7 +24,18 @@ import { Color } from '../math/Color.js';
...
@@ -24,7 +24,18 @@ import { Color } from '../math/Color.js';
* @author alteredq / http://alteredqualia.com/
* @author alteredq / http://alteredqualia.com/
*/
*/
var
_BlendingMode
,
_color
,
_textureLoader
,
_materialLoader
;
var
_BlendingMode
=
{
NoBlending
:
NoBlending
,
NormalBlending
:
NormalBlending
,
AdditiveBlending
:
AdditiveBlending
,
SubtractiveBlending
:
SubtractiveBlending
,
MultiplyBlending
:
MultiplyBlending
,
CustomBlending
:
CustomBlending
};
var
_color
=
new
Color
();
var
_textureLoader
=
new
TextureLoader
();
var
_materialLoader
=
new
MaterialLoader
();
function
Loader
()
{}
function
Loader
()
{}
...
@@ -87,23 +98,6 @@ Object.assign( Loader.prototype, {
...
@@ -87,23 +98,6 @@ Object.assign( Loader.prototype, {
createMaterial
:
function
(
m
,
texturePath
,
crossOrigin
)
{
createMaterial
:
function
(
m
,
texturePath
,
crossOrigin
)
{
if
(
_materialLoader
===
undefined
)
{
_BlendingMode
=
{
NoBlending
:
NoBlending
,
NormalBlending
:
NormalBlending
,
AdditiveBlending
:
AdditiveBlending
,
SubtractiveBlending
:
SubtractiveBlending
,
MultiplyBlending
:
MultiplyBlending
,
CustomBlending
:
CustomBlending
};
_color
=
new
Color
();
_textureLoader
=
new
TextureLoader
();
_materialLoader
=
new
MaterialLoader
();
}
// convert from old material format
// convert from old material format
var
textures
=
{};
var
textures
=
{};
...
...
src/math/Box2.js
浏览文件 @
76953dcc
...
@@ -4,7 +4,7 @@ import { Vector2 } from './Vector2.js';
...
@@ -4,7 +4,7 @@ import { Vector2 } from './Vector2.js';
* @author bhouston / http://clara.io
* @author bhouston / http://clara.io
*/
*/
var
_vector
;
var
_vector
=
new
Vector2
()
;
function
Box2
(
min
,
max
)
{
function
Box2
(
min
,
max
)
{
...
@@ -40,8 +40,6 @@ Object.assign( Box2.prototype, {
...
@@ -40,8 +40,6 @@ Object.assign( Box2.prototype, {
setFromCenterAndSize
:
function
(
center
,
size
)
{
setFromCenterAndSize
:
function
(
center
,
size
)
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector2
();
var
halfSize
=
_vector
.
copy
(
size
).
multiplyScalar
(
0.5
);
var
halfSize
=
_vector
.
copy
(
size
).
multiplyScalar
(
0.5
);
this
.
min
.
copy
(
center
).
sub
(
halfSize
);
this
.
min
.
copy
(
center
).
sub
(
halfSize
);
this
.
max
.
copy
(
center
).
add
(
halfSize
);
this
.
max
.
copy
(
center
).
add
(
halfSize
);
...
@@ -192,8 +190,6 @@ Object.assign( Box2.prototype, {
...
@@ -192,8 +190,6 @@ Object.assign( Box2.prototype, {
distanceToPoint
:
function
(
point
)
{
distanceToPoint
:
function
(
point
)
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector2
();
var
clampedPoint
=
_vector
.
copy
(
point
).
clamp
(
this
.
min
,
this
.
max
);
var
clampedPoint
=
_vector
.
copy
(
point
).
clamp
(
this
.
min
,
this
.
max
);
return
clampedPoint
.
sub
(
point
).
length
();
return
clampedPoint
.
sub
(
point
).
length
();
...
...
src/math/Box3.js
浏览文件 @
76953dcc
import
{
Vector3
}
from
'
./Vector3.js
'
;
import
{
Vector3
}
from
'
./Vector3.js
'
;
var
_points
=
[
new
Vector3
(),
new
Vector3
(),
new
Vector3
(),
new
Vector3
(),
new
Vector3
(),
new
Vector3
(),
new
Vector3
(),
new
Vector3
()
];
var
_vector
=
new
Vector3
();
// triangle centered vertices
var
_v0
=
new
Vector3
();
var
_v1
=
new
Vector3
();
var
_v2
=
new
Vector3
();
// triangle edge vectors
var
_f0
=
new
Vector3
();
var
_f1
=
new
Vector3
();
var
_f2
=
new
Vector3
();
var
_center
=
new
Vector3
();
var
_extents
=
new
Vector3
();
var
_triangleNormal
=
new
Vector3
();
var
_testAxis
=
new
Vector3
();
/**
/**
* @author bhouston / http://clara.io
* @author bhouston / http://clara.io
* @author WestLangley / http://github.com/WestLangley
* @author WestLangley / http://github.com/WestLangley
*/
*/
var
_points
;
var
_vector
;
var
_v0
,
_v1
,
_v2
;
var
_f0
,
_f1
,
_f2
;
var
_center
;
var
_extents
;
var
_triangleNormal
;
function
Box3
(
min
,
max
)
{
function
Box3
(
min
,
max
)
{
this
.
min
=
(
min
!==
undefined
)
?
min
:
new
Vector3
(
+
Infinity
,
+
Infinity
,
+
Infinity
);
this
.
min
=
(
min
!==
undefined
)
?
min
:
new
Vector3
(
+
Infinity
,
+
Infinity
,
+
Infinity
);
...
@@ -116,8 +136,6 @@ Object.assign( Box3.prototype, {
...
@@ -116,8 +136,6 @@ Object.assign( Box3.prototype, {
setFromCenterAndSize
:
function
(
center
,
size
)
{
setFromCenterAndSize
:
function
(
center
,
size
)
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector3
();
var
halfSize
=
_vector
.
copy
(
size
).
multiplyScalar
(
0.5
);
var
halfSize
=
_vector
.
copy
(
size
).
multiplyScalar
(
0.5
);
this
.
min
.
copy
(
center
).
sub
(
halfSize
);
this
.
min
.
copy
(
center
).
sub
(
halfSize
);
...
@@ -222,8 +240,6 @@ Object.assign( Box3.prototype, {
...
@@ -222,8 +240,6 @@ Object.assign( Box3.prototype, {
expandByObject
:
function
(
object
)
{
expandByObject
:
function
(
object
)
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector3
();
var
i
,
l
;
var
i
,
l
;
// Computes the world-axis-aligned bounding box of an object (including its children),
// Computes the world-axis-aligned bounding box of an object (including its children),
...
@@ -329,8 +345,6 @@ Object.assign( Box3.prototype, {
...
@@ -329,8 +345,6 @@ Object.assign( Box3.prototype, {
intersectsSphere
:
function
(
sphere
)
{
intersectsSphere
:
function
(
sphere
)
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector3
();
// Find the point on the AABB closest to the sphere center.
// Find the point on the AABB closest to the sphere center.
this
.
clampPoint
(
sphere
.
center
,
_vector
);
this
.
clampPoint
(
sphere
.
center
,
_vector
);
...
@@ -388,26 +402,6 @@ Object.assign( Box3.prototype, {
...
@@ -388,26 +402,6 @@ Object.assign( Box3.prototype, {
intersectsTriangle
:
function
(
triangle
)
{
intersectsTriangle
:
function
(
triangle
)
{
if
(
_v0
===
undefined
)
{
// triangle centered vertices
_v0
=
new
Vector3
();
_v1
=
new
Vector3
();
_v2
=
new
Vector3
();
// triangle edge vectors
_f0
=
new
Vector3
();
_f1
=
new
Vector3
();
_f2
=
new
Vector3
();
_center
=
new
Vector3
();
_extents
=
new
Vector3
();
_triangleNormal
=
new
Vector3
();
}
if
(
this
.
isEmpty
()
)
{
if
(
this
.
isEmpty
()
)
{
return
false
;
return
false
;
...
@@ -474,8 +468,6 @@ Object.assign( Box3.prototype, {
...
@@ -474,8 +468,6 @@ Object.assign( Box3.prototype, {
distanceToPoint
:
function
(
point
)
{
distanceToPoint
:
function
(
point
)
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector3
();
var
clampedPoint
=
_vector
.
copy
(
point
).
clamp
(
this
.
min
,
this
.
max
);
var
clampedPoint
=
_vector
.
copy
(
point
).
clamp
(
this
.
min
,
this
.
max
);
return
clampedPoint
.
sub
(
point
).
length
();
return
clampedPoint
.
sub
(
point
).
length
();
...
@@ -484,8 +476,6 @@ Object.assign( Box3.prototype, {
...
@@ -484,8 +476,6 @@ Object.assign( Box3.prototype, {
getBoundingSphere
:
function
(
target
)
{
getBoundingSphere
:
function
(
target
)
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector3
();
if
(
target
===
undefined
)
{
if
(
target
===
undefined
)
{
console
.
error
(
'
THREE.Box3: .getBoundingSphere() target is now required
'
);
console
.
error
(
'
THREE.Box3: .getBoundingSphere() target is now required
'
);
...
@@ -524,21 +514,6 @@ Object.assign( Box3.prototype, {
...
@@ -524,21 +514,6 @@ Object.assign( Box3.prototype, {
applyMatrix4
:
function
(
matrix
)
{
applyMatrix4
:
function
(
matrix
)
{
if
(
_points
===
undefined
)
{
_points
=
[
new
Vector3
(),
new
Vector3
(),
new
Vector3
(),
new
Vector3
(),
new
Vector3
(),
new
Vector3
(),
new
Vector3
(),
new
Vector3
()
];
}
// transform of empty box is an empty box.
// transform of empty box is an empty box.
if
(
this
.
isEmpty
()
)
return
this
;
if
(
this
.
isEmpty
()
)
return
this
;
...
@@ -575,12 +550,8 @@ Object.assign( Box3.prototype, {
...
@@ -575,12 +550,8 @@ Object.assign( Box3.prototype, {
}
);
}
);
var
_testAxis
;
function
satForAxes
(
axes
,
v0
,
v1
,
v2
,
extents
)
{
function
satForAxes
(
axes
,
v0
,
v1
,
v2
,
extents
)
{
if
(
_testAxis
===
undefined
)
_testAxis
=
new
Vector3
();
var
i
,
j
;
var
i
,
j
;
for
(
i
=
0
,
j
=
axes
.
length
-
3
;
i
<=
j
;
i
+=
3
)
{
for
(
i
=
0
,
j
=
axes
.
length
-
3
;
i
<=
j
;
i
+=
3
)
{
...
...
src/math/Euler.js
浏览文件 @
76953dcc
...
@@ -9,7 +9,8 @@ import { _Math } from './Math.js';
...
@@ -9,7 +9,8 @@ import { _Math } from './Math.js';
* @author bhouston / http://clara.io
* @author bhouston / http://clara.io
*/
*/
var
_matrix
,
_quaternion
;
var
_matrix
=
new
Matrix4
();
var
_quaternion
=
new
Quaternion
();
function
Euler
(
x
,
y
,
z
,
order
)
{
function
Euler
(
x
,
y
,
z
,
order
)
{
...
@@ -257,8 +258,6 @@ Object.assign( Euler.prototype, {
...
@@ -257,8 +258,6 @@ Object.assign( Euler.prototype, {
setFromQuaternion
:
function
(
q
,
order
,
update
)
{
setFromQuaternion
:
function
(
q
,
order
,
update
)
{
if
(
_matrix
===
undefined
)
_matrix
=
new
Matrix4
();
_matrix
.
makeRotationFromQuaternion
(
q
);
_matrix
.
makeRotationFromQuaternion
(
q
);
return
this
.
setFromRotationMatrix
(
_matrix
,
order
,
update
);
return
this
.
setFromRotationMatrix
(
_matrix
,
order
,
update
);
...
@@ -275,8 +274,6 @@ Object.assign( Euler.prototype, {
...
@@ -275,8 +274,6 @@ Object.assign( Euler.prototype, {
// WARNING: this discards revolution information -bhouston
// WARNING: this discards revolution information -bhouston
if
(
_quaternion
===
undefined
)
_quaternion
=
new
Quaternion
();
_quaternion
.
setFromEuler
(
this
);
_quaternion
.
setFromEuler
(
this
);
return
this
.
setFromQuaternion
(
_quaternion
,
newOrder
);
return
this
.
setFromQuaternion
(
_quaternion
,
newOrder
);
...
...
src/math/Frustum.js
浏览文件 @
76953dcc
...
@@ -8,8 +8,8 @@ import { Plane } from './Plane.js';
...
@@ -8,8 +8,8 @@ import { Plane } from './Plane.js';
* @author bhouston / http://clara.io
* @author bhouston / http://clara.io
*/
*/
var
_sphere
;
var
_sphere
=
new
Sphere
()
;
var
_vector
;
var
_vector
=
new
Vector3
()
;
function
Frustum
(
p0
,
p1
,
p2
,
p3
,
p4
,
p5
)
{
function
Frustum
(
p0
,
p1
,
p2
,
p3
,
p4
,
p5
)
{
...
@@ -85,8 +85,6 @@ Object.assign( Frustum.prototype, {
...
@@ -85,8 +85,6 @@ Object.assign( Frustum.prototype, {
intersectsObject
:
function
(
object
)
{
intersectsObject
:
function
(
object
)
{
if
(
_sphere
===
undefined
)
_sphere
=
new
Sphere
();
var
geometry
=
object
.
geometry
;
var
geometry
=
object
.
geometry
;
if
(
geometry
.
boundingSphere
===
null
)
geometry
.
computeBoundingSphere
();
if
(
geometry
.
boundingSphere
===
null
)
geometry
.
computeBoundingSphere
();
...
@@ -99,8 +97,6 @@ Object.assign( Frustum.prototype, {
...
@@ -99,8 +97,6 @@ Object.assign( Frustum.prototype, {
intersectsSprite
:
function
(
sprite
)
{
intersectsSprite
:
function
(
sprite
)
{
if
(
_sphere
===
undefined
)
_sphere
=
new
Sphere
();
_sphere
.
center
.
set
(
0
,
0
,
0
);
_sphere
.
center
.
set
(
0
,
0
,
0
);
_sphere
.
radius
=
0.7071067811865476
;
_sphere
.
radius
=
0.7071067811865476
;
_sphere
.
applyMatrix4
(
sprite
.
matrixWorld
);
_sphere
.
applyMatrix4
(
sprite
.
matrixWorld
);
...
@@ -133,8 +129,6 @@ Object.assign( Frustum.prototype, {
...
@@ -133,8 +129,6 @@ Object.assign( Frustum.prototype, {
intersectsBox
:
function
(
box
)
{
intersectsBox
:
function
(
box
)
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector3
();
var
planes
=
this
.
planes
;
var
planes
=
this
.
planes
;
for
(
var
i
=
0
;
i
<
6
;
i
++
)
{
for
(
var
i
=
0
;
i
<
6
;
i
++
)
{
...
...
src/math/Line3.js
浏览文件 @
76953dcc
...
@@ -5,7 +5,8 @@ import { _Math } from './Math.js';
...
@@ -5,7 +5,8 @@ import { _Math } from './Math.js';
* @author bhouston / http://clara.io
* @author bhouston / http://clara.io
*/
*/
var
_startP
,
_startEnd
;
var
_startP
=
new
Vector3
();
var
_startEnd
=
new
Vector3
();
function
Line3
(
start
,
end
)
{
function
Line3
(
start
,
end
)
{
...
@@ -93,13 +94,6 @@ Object.assign( Line3.prototype, {
...
@@ -93,13 +94,6 @@ Object.assign( Line3.prototype, {
closestPointToPointParameter
:
function
(
point
,
clampToLine
)
{
closestPointToPointParameter
:
function
(
point
,
clampToLine
)
{
if
(
_startP
===
undefined
)
{
_startP
=
new
Vector3
();
_startEnd
=
new
Vector3
();
}
_startP
.
subVectors
(
point
,
this
.
start
);
_startP
.
subVectors
(
point
,
this
.
start
);
_startEnd
.
subVectors
(
this
.
end
,
this
.
start
);
_startEnd
.
subVectors
(
this
.
end
,
this
.
start
);
...
...
src/math/Matrix3.js
浏览文件 @
76953dcc
...
@@ -7,7 +7,7 @@ import { Vector3 } from './Vector3.js';
...
@@ -7,7 +7,7 @@ import { Vector3 } from './Vector3.js';
* @author tschw
* @author tschw
*/
*/
var
_vector
;
var
_vector
=
new
Vector3
()
;
function
Matrix3
()
{
function
Matrix3
()
{
...
@@ -94,8 +94,6 @@ Object.assign( Matrix3.prototype, {
...
@@ -94,8 +94,6 @@ Object.assign( Matrix3.prototype, {
applyToBufferAttribute
:
function
(
attribute
)
{
applyToBufferAttribute
:
function
(
attribute
)
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector3
();
for
(
var
i
=
0
,
l
=
attribute
.
count
;
i
<
l
;
i
++
)
{
for
(
var
i
=
0
,
l
=
attribute
.
count
;
i
<
l
;
i
++
)
{
_vector
.
x
=
attribute
.
getX
(
i
);
_vector
.
x
=
attribute
.
getX
(
i
);
...
...
src/math/Matrix4.js
浏览文件 @
76953dcc
import
{
Vector3
}
from
'
./Vector3.js
'
;
import
{
Vector3
}
from
'
./Vector3.js
'
;
var
_v1
=
new
Vector3
();
var
_m1
=
new
Matrix4
();
var
_zero
=
new
Vector3
(
0
,
0
,
0
);
var
_one
=
new
Vector3
(
1
,
1
,
1
);
var
_x
=
new
Vector3
();
var
_y
=
new
Vector3
();
var
_z
=
new
Vector3
();
/**
/**
* @author mrdoob / http://mrdoob.com/
* @author mrdoob / http://mrdoob.com/
* @author supereggbert / http://www.paulbrunt.co.uk/
* @author supereggbert / http://www.paulbrunt.co.uk/
...
@@ -13,10 +21,6 @@ import { Vector3 } from './Vector3.js';
...
@@ -13,10 +21,6 @@ import { Vector3 } from './Vector3.js';
* @author WestLangley / http://github.com/WestLangley
* @author WestLangley / http://github.com/WestLangley
*/
*/
var
_v1
,
_m1
;
var
_zero
,
_one
;
var
_x
,
_y
,
_z
;
function
Matrix4
()
{
function
Matrix4
()
{
this
.
elements
=
[
this
.
elements
=
[
...
@@ -125,8 +129,6 @@ Object.assign( Matrix4.prototype, {
...
@@ -125,8 +129,6 @@ Object.assign( Matrix4.prototype, {
extractRotation
:
function
(
m
)
{
extractRotation
:
function
(
m
)
{
if
(
_v1
===
undefined
)
_v1
=
new
Vector3
();
// this method does not support reflection matrices
// this method does not support reflection matrices
var
te
=
this
.
elements
;
var
te
=
this
.
elements
;
...
@@ -290,27 +292,12 @@ Object.assign( Matrix4.prototype, {
...
@@ -290,27 +292,12 @@ Object.assign( Matrix4.prototype, {
makeRotationFromQuaternion
:
function
(
q
)
{
makeRotationFromQuaternion
:
function
(
q
)
{
if
(
_zero
===
undefined
)
{
_zero
=
new
Vector3
(
0
,
0
,
0
);
_one
=
new
Vector3
(
1
,
1
,
1
);
}
return
this
.
compose
(
_zero
,
q
,
_one
);
return
this
.
compose
(
_zero
,
q
,
_one
);
},
},
lookAt
:
function
(
eye
,
target
,
up
)
{
lookAt
:
function
(
eye
,
target
,
up
)
{
if
(
_x
===
undefined
)
{
_x
=
new
Vector3
();
_y
=
new
Vector3
();
_z
=
new
Vector3
();
}
var
te
=
this
.
elements
;
var
te
=
this
.
elements
;
_z
.
subVectors
(
eye
,
target
);
_z
.
subVectors
(
eye
,
target
);
...
@@ -430,8 +417,6 @@ Object.assign( Matrix4.prototype, {
...
@@ -430,8 +417,6 @@ Object.assign( Matrix4.prototype, {
applyToBufferAttribute
:
function
(
attribute
)
{
applyToBufferAttribute
:
function
(
attribute
)
{
if
(
_v1
===
undefined
)
_v1
=
new
Vector3
();
for
(
var
i
=
0
,
l
=
attribute
.
count
;
i
<
l
;
i
++
)
{
for
(
var
i
=
0
,
l
=
attribute
.
count
;
i
<
l
;
i
++
)
{
_v1
.
x
=
attribute
.
getX
(
i
);
_v1
.
x
=
attribute
.
getX
(
i
);
...
@@ -782,13 +767,6 @@ Object.assign( Matrix4.prototype, {
...
@@ -782,13 +767,6 @@ Object.assign( Matrix4.prototype, {
decompose
:
function
(
position
,
quaternion
,
scale
)
{
decompose
:
function
(
position
,
quaternion
,
scale
)
{
if
(
_m1
===
undefined
)
{
_m1
=
new
Matrix4
();
_v1
=
new
Vector3
();
}
var
te
=
this
.
elements
;
var
te
=
this
.
elements
;
var
sx
=
_v1
.
set
(
te
[
0
],
te
[
1
],
te
[
2
]
).
length
();
var
sx
=
_v1
.
set
(
te
[
0
],
te
[
1
],
te
[
2
]
).
length
();
...
...
src/math/Plane.js
浏览文件 @
76953dcc
...
@@ -5,7 +5,9 @@ import { Vector3 } from './Vector3.js';
...
@@ -5,7 +5,9 @@ import { Vector3 } from './Vector3.js';
* @author bhouston / http://clara.io
* @author bhouston / http://clara.io
*/
*/
var
_vector1
,
_vector2
,
_normalMatrix
;
var
_vector1
=
new
Vector3
();
var
_vector2
=
new
Vector3
();
var
_normalMatrix
=
new
Matrix3
();
function
Plane
(
normal
,
constant
)
{
function
Plane
(
normal
,
constant
)
{
...
@@ -49,13 +51,6 @@ Object.assign( Plane.prototype, {
...
@@ -49,13 +51,6 @@ Object.assign( Plane.prototype, {
setFromCoplanarPoints
:
function
(
a
,
b
,
c
)
{
setFromCoplanarPoints
:
function
(
a
,
b
,
c
)
{
if
(
_vector1
===
undefined
)
{
_vector1
=
new
Vector3
();
_vector2
=
new
Vector3
();
}
var
normal
=
_vector1
.
subVectors
(
c
,
b
).
cross
(
_vector2
.
subVectors
(
a
,
b
)
).
normalize
();
var
normal
=
_vector1
.
subVectors
(
c
,
b
).
cross
(
_vector2
.
subVectors
(
a
,
b
)
).
normalize
();
// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?
// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?
...
@@ -129,8 +124,6 @@ Object.assign( Plane.prototype, {
...
@@ -129,8 +124,6 @@ Object.assign( Plane.prototype, {
intersectLine
:
function
(
line
,
target
)
{
intersectLine
:
function
(
line
,
target
)
{
if
(
_vector1
===
undefined
)
_vector1
=
new
Vector3
();
if
(
target
===
undefined
)
{
if
(
target
===
undefined
)
{
console
.
warn
(
'
THREE.Plane: .intersectLine() target is now required
'
);
console
.
warn
(
'
THREE.Plane: .intersectLine() target is now required
'
);
...
@@ -206,13 +199,6 @@ Object.assign( Plane.prototype, {
...
@@ -206,13 +199,6 @@ Object.assign( Plane.prototype, {
applyMatrix4
:
function
(
matrix
,
optionalNormalMatrix
)
{
applyMatrix4
:
function
(
matrix
,
optionalNormalMatrix
)
{
if
(
_normalMatrix
===
undefined
)
{
_normalMatrix
=
new
Matrix3
();
_vector1
=
new
Vector3
();
}
var
normalMatrix
=
optionalNormalMatrix
||
_normalMatrix
.
getNormalMatrix
(
matrix
);
var
normalMatrix
=
optionalNormalMatrix
||
_normalMatrix
.
getNormalMatrix
(
matrix
);
var
referencePoint
=
this
.
coplanarPoint
(
_vector1
).
applyMatrix4
(
matrix
);
var
referencePoint
=
this
.
coplanarPoint
(
_vector1
).
applyMatrix4
(
matrix
);
...
...
src/math/Ray.js
浏览文件 @
76953dcc
import
{
Vector3
}
from
'
./Vector3.js
'
;
import
{
Vector3
}
from
'
./Vector3.js
'
;
var
_vector
=
new
Vector3
();
var
_segCenter
=
new
Vector3
();
var
_segDir
=
new
Vector3
();
var
_diff
=
new
Vector3
();
var
_edge1
=
new
Vector3
();
var
_edge2
=
new
Vector3
();
var
_normal
=
new
Vector3
();
/**
/**
* @author bhouston / http://clara.io
* @author bhouston / http://clara.io
*/
*/
var
_vector
;
var
_segCenter
,
_segDir
,
_diff
;
var
_diff
,
_edge1
,
_edge2
,
_normal
;
function
Ray
(
origin
,
direction
)
{
function
Ray
(
origin
,
direction
)
{
this
.
origin
=
(
origin
!==
undefined
)
?
origin
:
new
Vector3
();
this
.
origin
=
(
origin
!==
undefined
)
?
origin
:
new
Vector3
();
...
@@ -64,8 +69,6 @@ Object.assign( Ray.prototype, {
...
@@ -64,8 +69,6 @@ Object.assign( Ray.prototype, {
recast
:
function
(
t
)
{
recast
:
function
(
t
)
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector3
();
this
.
origin
.
copy
(
this
.
at
(
t
,
_vector
)
);
this
.
origin
.
copy
(
this
.
at
(
t
,
_vector
)
);
return
this
;
return
this
;
...
@@ -103,8 +106,6 @@ Object.assign( Ray.prototype, {
...
@@ -103,8 +106,6 @@ Object.assign( Ray.prototype, {
distanceSqToPoint
:
function
(
point
)
{
distanceSqToPoint
:
function
(
point
)
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector3
();
var
directionDistance
=
_vector
.
subVectors
(
point
,
this
.
origin
).
dot
(
this
.
direction
);
var
directionDistance
=
_vector
.
subVectors
(
point
,
this
.
origin
).
dot
(
this
.
direction
);
// point behind the ray
// point behind the ray
...
@@ -123,14 +124,6 @@ Object.assign( Ray.prototype, {
...
@@ -123,14 +124,6 @@ Object.assign( Ray.prototype, {
distanceSqToSegment
:
function
(
v0
,
v1
,
optionalPointOnRay
,
optionalPointOnSegment
)
{
distanceSqToSegment
:
function
(
v0
,
v1
,
optionalPointOnRay
,
optionalPointOnSegment
)
{
if
(
_segCenter
===
undefined
)
{
_segCenter
=
new
Vector3
();
_segDir
=
new
Vector3
();
_diff
=
new
Vector3
();
}
// from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteDistRaySegment.h
// from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteDistRaySegment.h
// It returns the min distance between the ray and the segment
// It returns the min distance between the ray and the segment
// defined by v0 and v1
// defined by v0 and v1
...
@@ -250,8 +243,6 @@ Object.assign( Ray.prototype, {
...
@@ -250,8 +243,6 @@ Object.assign( Ray.prototype, {
intersectSphere
:
function
(
sphere
,
target
)
{
intersectSphere
:
function
(
sphere
,
target
)
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector3
();
_vector
.
subVectors
(
sphere
.
center
,
this
.
origin
);
_vector
.
subVectors
(
sphere
.
center
,
this
.
origin
);
var
tca
=
_vector
.
dot
(
this
.
direction
);
var
tca
=
_vector
.
dot
(
this
.
direction
);
var
d2
=
_vector
.
dot
(
_vector
)
-
tca
*
tca
;
var
d2
=
_vector
.
dot
(
_vector
)
-
tca
*
tca
;
...
@@ -424,8 +415,6 @@ Object.assign( Ray.prototype, {
...
@@ -424,8 +415,6 @@ Object.assign( Ray.prototype, {
intersectsBox
:
function
(
box
)
{
intersectsBox
:
function
(
box
)
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector3
();
return
this
.
intersectBox
(
box
,
_vector
)
!==
null
;
return
this
.
intersectBox
(
box
,
_vector
)
!==
null
;
},
},
...
@@ -434,15 +423,6 @@ Object.assign( Ray.prototype, {
...
@@ -434,15 +423,6 @@ Object.assign( Ray.prototype, {
// Compute the offset origin, edges, and normal.
// Compute the offset origin, edges, and normal.
if
(
_diff
===
undefined
)
{
_diff
=
new
Vector3
();
_edge1
=
new
Vector3
();
_edge2
=
new
Vector3
();
_normal
=
new
Vector3
();
}
// from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h
// from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h
_edge1
.
subVectors
(
b
,
a
);
_edge1
.
subVectors
(
b
,
a
);
...
...
src/math/Sphere.js
浏览文件 @
76953dcc
import
{
Box3
}
from
'
./Box3.js
'
;
import
{
Box3
}
from
'
./Box3.js
'
;
import
{
Vector3
}
from
'
./Vector3.js
'
;
import
{
Vector3
}
from
'
./Vector3.js
'
;
var
_box
=
new
Box3
();
/**
/**
* @author bhouston / http://clara.io
* @author bhouston / http://clara.io
* @author mrdoob / http://mrdoob.com/
* @author mrdoob / http://mrdoob.com/
*/
*/
var
_box
;
function
Sphere
(
center
,
radius
)
{
function
Sphere
(
center
,
radius
)
{
this
.
center
=
(
center
!==
undefined
)
?
center
:
new
Vector3
();
this
.
center
=
(
center
!==
undefined
)
?
center
:
new
Vector3
();
...
@@ -28,8 +28,6 @@ Object.assign( Sphere.prototype, {
...
@@ -28,8 +28,6 @@ Object.assign( Sphere.prototype, {
setFromPoints
:
function
(
points
,
optionalCenter
)
{
setFromPoints
:
function
(
points
,
optionalCenter
)
{
if
(
_box
===
undefined
)
_box
=
new
Box3
();
var
center
=
this
.
center
;
var
center
=
this
.
center
;
if
(
optionalCenter
!==
undefined
)
{
if
(
optionalCenter
!==
undefined
)
{
...
...
src/math/Triangle.js
浏览文件 @
76953dcc
...
@@ -5,8 +5,17 @@ import { Vector3 } from './Vector3.js';
...
@@ -5,8 +5,17 @@ import { Vector3 } from './Vector3.js';
* @author mrdoob / http://mrdoob.com/
* @author mrdoob / http://mrdoob.com/
*/
*/
var
_v0
,
_v1
,
_v2
,
_v3
;
var
_v0
=
new
Vector3
();
var
_vab
,
_vac
,
_vbc
,
_vap
,
_vbp
,
_vcp
;
var
_v1
=
new
Vector3
();
var
_v2
=
new
Vector3
();
var
_v3
=
new
Vector3
();
var
_vab
=
new
Vector3
();
var
_vac
=
new
Vector3
();
var
_vbc
=
new
Vector3
();
var
_vap
=
new
Vector3
();
var
_vbp
=
new
Vector3
();
var
_vcp
=
new
Vector3
();
function
Triangle
(
a
,
b
,
c
)
{
function
Triangle
(
a
,
b
,
c
)
{
...
@@ -20,8 +29,6 @@ Object.assign( Triangle, {
...
@@ -20,8 +29,6 @@ Object.assign( Triangle, {
getNormal
:
function
(
a
,
b
,
c
,
target
)
{
getNormal
:
function
(
a
,
b
,
c
,
target
)
{
if
(
_v0
===
undefined
)
_v0
=
new
Vector3
();
if
(
target
===
undefined
)
{
if
(
target
===
undefined
)
{
console
.
warn
(
'
THREE.Triangle: .getNormal() target is now required
'
);
console
.
warn
(
'
THREE.Triangle: .getNormal() target is now required
'
);
...
@@ -48,14 +55,6 @@ Object.assign( Triangle, {
...
@@ -48,14 +55,6 @@ Object.assign( Triangle, {
// based on: http://www.blackpawn.com/texts/pointinpoly/default.html
// based on: http://www.blackpawn.com/texts/pointinpoly/default.html
getBarycoord
:
function
(
point
,
a
,
b
,
c
,
target
)
{
getBarycoord
:
function
(
point
,
a
,
b
,
c
,
target
)
{
if
(
_v2
===
undefined
)
{
_v0
=
new
Vector3
();
_v1
=
new
Vector3
();
_v2
=
new
Vector3
();
}
_v0
.
subVectors
(
c
,
a
);
_v0
.
subVectors
(
c
,
a
);
_v1
.
subVectors
(
b
,
a
);
_v1
.
subVectors
(
b
,
a
);
_v2
.
subVectors
(
point
,
a
);
_v2
.
subVectors
(
point
,
a
);
...
@@ -95,8 +94,6 @@ Object.assign( Triangle, {
...
@@ -95,8 +94,6 @@ Object.assign( Triangle, {
containsPoint
:
function
(
point
,
a
,
b
,
c
)
{
containsPoint
:
function
(
point
,
a
,
b
,
c
)
{
if
(
_v3
===
undefined
)
_v3
=
new
Vector3
();
Triangle
.
getBarycoord
(
point
,
a
,
b
,
c
,
_v3
);
Triangle
.
getBarycoord
(
point
,
a
,
b
,
c
,
_v3
);
return
(
_v3
.
x
>=
0
)
&&
(
_v3
.
y
>=
0
)
&&
(
(
_v3
.
x
+
_v3
.
y
)
<=
1
);
return
(
_v3
.
x
>=
0
)
&&
(
_v3
.
y
>=
0
)
&&
(
(
_v3
.
x
+
_v3
.
y
)
<=
1
);
...
@@ -105,8 +102,6 @@ Object.assign( Triangle, {
...
@@ -105,8 +102,6 @@ Object.assign( Triangle, {
getUV
:
function
(
point
,
p1
,
p2
,
p3
,
uv1
,
uv2
,
uv3
,
target
)
{
getUV
:
function
(
point
,
p1
,
p2
,
p3
,
uv1
,
uv2
,
uv3
,
target
)
{
if
(
_v3
===
undefined
)
_v3
=
new
Vector3
();
this
.
getBarycoord
(
point
,
p1
,
p2
,
p3
,
_v3
);
this
.
getBarycoord
(
point
,
p1
,
p2
,
p3
,
_v3
);
target
.
set
(
0
,
0
);
target
.
set
(
0
,
0
);
...
@@ -120,13 +115,6 @@ Object.assign( Triangle, {
...
@@ -120,13 +115,6 @@ Object.assign( Triangle, {
isFrontFacing
:
function
(
a
,
b
,
c
,
direction
)
{
isFrontFacing
:
function
(
a
,
b
,
c
,
direction
)
{
if
(
_v1
===
undefined
)
{
_v0
=
new
Vector3
();
_v1
=
new
Vector3
();
}
_v0
.
subVectors
(
c
,
b
);
_v0
.
subVectors
(
c
,
b
);
_v1
.
subVectors
(
a
,
b
);
_v1
.
subVectors
(
a
,
b
);
...
@@ -177,13 +165,6 @@ Object.assign( Triangle.prototype, {
...
@@ -177,13 +165,6 @@ Object.assign( Triangle.prototype, {
getArea
:
function
()
{
getArea
:
function
()
{
if
(
_v1
===
undefined
)
{
_v0
=
new
Vector3
();
_v1
=
new
Vector3
();
}
_v0
.
subVectors
(
this
.
c
,
this
.
b
);
_v0
.
subVectors
(
this
.
c
,
this
.
b
);
_v1
.
subVectors
(
this
.
a
,
this
.
b
);
_v1
.
subVectors
(
this
.
a
,
this
.
b
);
...
@@ -255,17 +236,6 @@ Object.assign( Triangle.prototype, {
...
@@ -255,17 +236,6 @@ Object.assign( Triangle.prototype, {
closestPointToPoint
:
function
(
p
,
target
)
{
closestPointToPoint
:
function
(
p
,
target
)
{
if
(
_vab
===
undefined
)
{
_vab
=
new
Vector3
();
_vac
=
new
Vector3
();
_vbc
=
new
Vector3
();
_vap
=
new
Vector3
();
_vbp
=
new
Vector3
();
_vcp
=
new
Vector3
();
}
if
(
target
===
undefined
)
{
if
(
target
===
undefined
)
{
console
.
warn
(
'
THREE.Triangle: .closestPointToPoint() target is now required
'
);
console
.
warn
(
'
THREE.Triangle: .closestPointToPoint() target is now required
'
);
...
...
src/math/Vector3.js
浏览文件 @
76953dcc
...
@@ -10,7 +10,8 @@ import { Quaternion } from './Quaternion.js';
...
@@ -10,7 +10,8 @@ import { Quaternion } from './Quaternion.js';
* @author WestLangley / http://github.com/WestLangley
* @author WestLangley / http://github.com/WestLangley
*/
*/
var
_vector
,
_quaternion
;
var
_vector
=
new
Vector3
();
var
_quaternion
=
new
Quaternion
();
function
Vector3
(
x
,
y
,
z
)
{
function
Vector3
(
x
,
y
,
z
)
{
...
@@ -235,8 +236,6 @@ Object.assign( Vector3.prototype, {
...
@@ -235,8 +236,6 @@ Object.assign( Vector3.prototype, {
applyEuler
:
function
(
euler
)
{
applyEuler
:
function
(
euler
)
{
if
(
_quaternion
===
undefined
)
_quaternion
=
new
Quaternion
();
if
(
!
(
euler
&&
euler
.
isEuler
)
)
{
if
(
!
(
euler
&&
euler
.
isEuler
)
)
{
console
.
error
(
'
THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.
'
);
console
.
error
(
'
THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.
'
);
...
@@ -249,8 +248,6 @@ Object.assign( Vector3.prototype, {
...
@@ -249,8 +248,6 @@ Object.assign( Vector3.prototype, {
applyAxisAngle
:
function
(
axis
,
angle
)
{
applyAxisAngle
:
function
(
axis
,
angle
)
{
if
(
_quaternion
===
undefined
)
_quaternion
=
new
Quaternion
();
return
this
.
applyQuaternion
(
_quaternion
.
setFromAxisAngle
(
axis
,
angle
)
);
return
this
.
applyQuaternion
(
_quaternion
.
setFromAxisAngle
(
axis
,
angle
)
);
},
},
...
@@ -539,8 +536,6 @@ Object.assign( Vector3.prototype, {
...
@@ -539,8 +536,6 @@ Object.assign( Vector3.prototype, {
projectOnPlane
:
function
(
planeNormal
)
{
projectOnPlane
:
function
(
planeNormal
)
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector3
();
_vector
.
copy
(
this
).
projectOnVector
(
planeNormal
);
_vector
.
copy
(
this
).
projectOnVector
(
planeNormal
);
return
this
.
sub
(
_vector
);
return
this
.
sub
(
_vector
);
...
@@ -549,8 +544,6 @@ Object.assign( Vector3.prototype, {
...
@@ -549,8 +544,6 @@ Object.assign( Vector3.prototype, {
reflect
:
function
(
normal
)
{
reflect
:
function
(
normal
)
{
if
(
_vector
===
undefined
)
_vector
=
new
Vector3
();
// reflect incident vector off plane orthogonal to normal
// reflect incident vector off plane orthogonal to normal
// normal is assumed to have unit length
// normal is assumed to have unit length
...
...
src/objects/LOD.js
浏览文件 @
76953dcc
...
@@ -7,7 +7,8 @@ import { Object3D } from '../core/Object3D.js';
...
@@ -7,7 +7,8 @@ import { Object3D } from '../core/Object3D.js';
* @author mrdoob / http://mrdoob.com/
* @author mrdoob / http://mrdoob.com/
*/
*/
var
_v1
,
_v2
;
var
_v1
=
new
Vector3
();
var
_v2
=
new
Vector3
();
function
LOD
()
{
function
LOD
()
{
...
@@ -96,8 +97,6 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
...
@@ -96,8 +97,6 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
raycast
:
function
(
raycaster
,
intersects
)
{
raycast
:
function
(
raycaster
,
intersects
)
{
if
(
_v1
===
undefined
)
_v1
=
new
Vector3
();
_v1
.
setFromMatrixPosition
(
this
.
matrixWorld
);
_v1
.
setFromMatrixPosition
(
this
.
matrixWorld
);
var
distance
=
raycaster
.
ray
.
origin
.
distanceTo
(
_v1
);
var
distance
=
raycaster
.
ray
.
origin
.
distanceTo
(
_v1
);
...
@@ -108,13 +107,6 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
...
@@ -108,13 +107,6 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
update
:
function
(
camera
)
{
update
:
function
(
camera
)
{
if
(
_v2
===
undefined
)
{
_v1
=
new
Vector3
();
_v2
=
new
Vector3
();
}
var
levels
=
this
.
levels
;
var
levels
=
this
.
levels
;
if
(
levels
.
length
>
1
)
{
if
(
levels
.
length
>
1
)
{
...
...
src/objects/Line.js
浏览文件 @
76953dcc
...
@@ -11,8 +11,11 @@ import { Float32BufferAttribute } from '../core/BufferAttribute.js';
...
@@ -11,8 +11,11 @@ import { Float32BufferAttribute } from '../core/BufferAttribute.js';
* @author mrdoob / http://mrdoob.com/
* @author mrdoob / http://mrdoob.com/
*/
*/
var
_start
,
_end
;
var
_start
=
new
Vector3
();
var
_inverseMatrix
,
_ray
,
_sphere
;
var
_end
=
new
Vector3
();
var
_inverseMatrix
=
new
Matrix4
();
var
_ray
=
new
Ray
();
var
_sphere
=
new
Sphere
();
function
Line
(
geometry
,
material
,
mode
)
{
function
Line
(
geometry
,
material
,
mode
)
{
...
@@ -39,13 +42,6 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), {
...
@@ -39,13 +42,6 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), {
computeLineDistances
:
function
()
{
computeLineDistances
:
function
()
{
if
(
_end
===
undefined
)
{
_start
=
new
Vector3
();
_end
=
new
Vector3
();
}
var
geometry
=
this
.
geometry
;
var
geometry
=
this
.
geometry
;
if
(
geometry
.
isBufferGeometry
)
{
if
(
geometry
.
isBufferGeometry
)
{
...
@@ -97,14 +93,6 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), {
...
@@ -97,14 +93,6 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), {
raycast
:
function
(
raycaster
,
intersects
)
{
raycast
:
function
(
raycaster
,
intersects
)
{
if
(
_sphere
===
undefined
)
{
_inverseMatrix
=
new
Matrix4
();
_ray
=
new
Ray
();
_sphere
=
new
Sphere
();
}
var
precision
=
raycaster
.
linePrecision
;
var
precision
=
raycaster
.
linePrecision
;
var
geometry
=
this
.
geometry
;
var
geometry
=
this
.
geometry
;
...
...
src/objects/LineSegments.js
浏览文件 @
76953dcc
...
@@ -6,7 +6,8 @@ import { Float32BufferAttribute } from '../core/BufferAttribute.js';
...
@@ -6,7 +6,8 @@ import { Float32BufferAttribute } from '../core/BufferAttribute.js';
* @author mrdoob / http://mrdoob.com/
* @author mrdoob / http://mrdoob.com/
*/
*/
var
_start
,
_end
;
var
_start
=
new
Vector3
();
var
_end
=
new
Vector3
();
function
LineSegments
(
geometry
,
material
)
{
function
LineSegments
(
geometry
,
material
)
{
...
@@ -24,13 +25,6 @@ LineSegments.prototype = Object.assign( Object.create( Line.prototype ), {
...
@@ -24,13 +25,6 @@ LineSegments.prototype = Object.assign( Object.create( Line.prototype ), {
computeLineDistances
:
function
()
{
computeLineDistances
:
function
()
{
if
(
_end
===
undefined
)
{
_start
=
new
Vector3
();
_end
=
new
Vector3
();
}
var
geometry
=
this
.
geometry
;
var
geometry
=
this
.
geometry
;
if
(
geometry
.
isBufferGeometry
)
{
if
(
geometry
.
isBufferGeometry
)
{
...
...
src/objects/Mesh.js
浏览文件 @
76953dcc
...
@@ -17,12 +17,28 @@ import { BufferGeometry } from '../core/BufferGeometry.js';
...
@@ -17,12 +17,28 @@ import { BufferGeometry } from '../core/BufferGeometry.js';
* @author jonobr1 / http://jonobr1.com/
* @author jonobr1 / http://jonobr1.com/
*/
*/
var
_inverseMatrix
,
_ray
,
_sphere
;
var
_inverseMatrix
=
new
Matrix4
();
var
_vA
,
_vB
,
_vC
;
var
_ray
=
new
Ray
();
var
_tempA
,
_tempB
,
_tempC
;
var
_sphere
=
new
Sphere
();
var
_morphA
,
_morphB
,
_morphC
;
var
_uvA
,
_uvB
,
_uvC
;
var
_vA
=
new
Vector3
();
var
_intersectionPoint
,
_intersectionPointWorld
;
var
_vB
=
new
Vector3
();
var
_vC
=
new
Vector3
();
var
_tempA
=
new
Vector3
();
var
_tempB
=
new
Vector3
();
var
_tempC
=
new
Vector3
();
var
_morphA
=
new
Vector3
();
var
_morphB
=
new
Vector3
();
var
_morphC
=
new
Vector3
();
var
_uvA
=
new
Vector2
();
var
_uvB
=
new
Vector2
();
var
_uvC
=
new
Vector2
();
var
_intersectionPoint
=
new
Vector3
();
var
_intersectionPointWorld
=
new
Vector3
();
function
Mesh
(
geometry
,
material
)
{
function
Mesh
(
geometry
,
material
)
{
...
@@ -121,33 +137,6 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
...
@@ -121,33 +137,6 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), {
raycast
:
function
(
raycaster
,
intersects
)
{
raycast
:
function
(
raycaster
,
intersects
)
{
if
(
_intersectionPointWorld
===
undefined
)
{
_inverseMatrix
=
new
Matrix4
();
_ray
=
new
Ray
();
_sphere
=
new
Sphere
();
_vA
=
new
Vector3
();
_vB
=
new
Vector3
();
_vC
=
new
Vector3
();
_tempA
=
new
Vector3
();
_tempB
=
new
Vector3
();
_tempC
=
new
Vector3
();
_morphA
=
new
Vector3
();
_morphB
=
new
Vector3
();
_morphC
=
new
Vector3
();
_uvA
=
new
Vector2
();
_uvB
=
new
Vector2
();
_uvC
=
new
Vector2
();
_intersectionPoint
=
new
Vector3
();
_intersectionPointWorld
=
new
Vector3
();
}
var
geometry
=
this
.
geometry
;
var
geometry
=
this
.
geometry
;
var
material
=
this
.
material
;
var
material
=
this
.
material
;
var
matrixWorld
=
this
.
matrixWorld
;
var
matrixWorld
=
this
.
matrixWorld
;
...
...
src/objects/Points.js
浏览文件 @
76953dcc
...
@@ -10,7 +10,10 @@ import { BufferGeometry } from '../core/BufferGeometry.js';
...
@@ -10,7 +10,10 @@ import { BufferGeometry } from '../core/BufferGeometry.js';
* @author alteredq / http://alteredqualia.com/
* @author alteredq / http://alteredqualia.com/
*/
*/
var
_inverseMatrix
,
_ray
,
_sphere
,
_position
;
var
_inverseMatrix
=
new
Matrix4
();
var
_ray
=
new
Ray
();
var
_sphere
=
new
Sphere
();
var
_position
=
new
Vector3
();
function
Points
(
geometry
,
material
)
{
function
Points
(
geometry
,
material
)
{
...
@@ -33,15 +36,6 @@ Points.prototype = Object.assign( Object.create( Object3D.prototype ), {
...
@@ -33,15 +36,6 @@ Points.prototype = Object.assign( Object.create( Object3D.prototype ), {
raycast
:
function
(
raycaster
,
intersects
)
{
raycast
:
function
(
raycaster
,
intersects
)
{
if
(
_sphere
===
undefined
)
{
_inverseMatrix
=
new
Matrix4
();
_ray
=
new
Ray
();
_sphere
=
new
Sphere
();
_position
=
new
Vector3
();
}
var
geometry
=
this
.
geometry
;
var
geometry
=
this
.
geometry
;
var
matrixWorld
=
this
.
matrixWorld
;
var
matrixWorld
=
this
.
matrixWorld
;
var
threshold
=
raycaster
.
params
.
Points
.
threshold
;
var
threshold
=
raycaster
.
params
.
Points
.
threshold
;
...
...
src/objects/Skeleton.js
浏览文件 @
76953dcc
...
@@ -7,7 +7,8 @@ import { Matrix4 } from '../math/Matrix4.js';
...
@@ -7,7 +7,8 @@ import { Matrix4 } from '../math/Matrix4.js';
* @author ikerr / http://verold.com
* @author ikerr / http://verold.com
*/
*/
var
_offsetMatrix
,
_identityMatrix
;
var
_offsetMatrix
=
new
Matrix4
();
var
_identityMatrix
=
new
Matrix4
();
function
Skeleton
(
bones
,
boneInverses
)
{
function
Skeleton
(
bones
,
boneInverses
)
{
...
@@ -117,13 +118,6 @@ Object.assign( Skeleton.prototype, {
...
@@ -117,13 +118,6 @@ Object.assign( Skeleton.prototype, {
update
:
function
()
{
update
:
function
()
{
if
(
_identityMatrix
===
undefined
)
{
_offsetMatrix
=
new
Matrix4
();
_identityMatrix
=
new
Matrix4
();
}
var
bones
=
this
.
bones
;
var
bones
=
this
.
bones
;
var
boneInverses
=
this
.
boneInverses
;
var
boneInverses
=
this
.
boneInverses
;
var
boneMatrices
=
this
.
boneMatrices
;
var
boneMatrices
=
this
.
boneMatrices
;
...
...
src/objects/Sprite.js
浏览文件 @
76953dcc
...
@@ -15,10 +15,21 @@ import { SpriteMaterial } from '../materials/SpriteMaterial.js';
...
@@ -15,10 +15,21 @@ import { SpriteMaterial } from '../materials/SpriteMaterial.js';
var
_geometry
;
var
_geometry
;
var
_intersectPoint
,
_worldScale
,
_mvPosition
;
var
_intersectPoint
=
new
Vector3
();
var
_alignedPosition
,
_rotatedPosition
,
_viewWorldMatrix
;
var
_worldScale
=
new
Vector3
();
var
_vA
,
_vB
,
_vC
;
var
_mvPosition
=
new
Vector3
();
var
_uvA
,
_uvB
,
_uvC
;
var
_alignedPosition
=
new
Vector2
();
var
_rotatedPosition
=
new
Vector2
();
var
_viewWorldMatrix
=
new
Matrix4
();
var
_vA
=
new
Vector3
();
var
_vB
=
new
Vector3
();
var
_vC
=
new
Vector3
();
var
_uvA
=
new
Vector2
();
var
_uvB
=
new
Vector2
();
var
_uvC
=
new
Vector2
();
function
Sprite
(
material
)
{
function
Sprite
(
material
)
{
...
@@ -66,26 +77,6 @@ Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
...
@@ -66,26 +77,6 @@ Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
}
}
if
(
_uvC
===
undefined
)
{
_intersectPoint
=
new
Vector3
();
_worldScale
=
new
Vector3
();
_mvPosition
=
new
Vector3
();
_alignedPosition
=
new
Vector2
();
_rotatedPosition
=
new
Vector2
();
_viewWorldMatrix
=
new
Matrix4
();
_vA
=
new
Vector3
();
_vB
=
new
Vector3
();
_vC
=
new
Vector3
();
_uvA
=
new
Vector2
();
_uvB
=
new
Vector2
();
_uvC
=
new
Vector2
();
}
_worldScale
.
setFromMatrixScale
(
this
.
matrixWorld
);
_worldScale
.
setFromMatrixScale
(
this
.
matrixWorld
);
_viewWorldMatrix
.
copy
(
raycaster
.
camera
.
matrixWorld
);
_viewWorldMatrix
.
copy
(
raycaster
.
camera
.
matrixWorld
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录