Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
e314cb05
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,发现更多精彩内容 >>
提交
e314cb05
编写于
1月 23, 2013
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Changed some of the matrix.getPosition() to vector.getPositionFromMatrix( matrix ). See #2967.
上级
0a9132d8
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
48 addition
and
42 deletion
+48
-42
examples/js/AudioObject.js
examples/js/AudioObject.js
+2
-2
examples/js/renderers/SVGRenderer.js
examples/js/renderers/SVGRenderer.js
+7
-9
src/core/Projector.js
src/core/Projector.js
+3
-3
src/core/Raycaster.js
src/core/Raycaster.js
+6
-6
src/extras/renderers/plugins/ShadowMapPlugin.js
src/extras/renderers/plugins/ShadowMapPlugin.js
+1
-1
src/math/Frustum.js
src/math/Frustum.js
+24
-16
src/math/Vector3.js
src/math/Vector3.js
+3
-3
src/renderers/CanvasRenderer.js
src/renderers/CanvasRenderer.js
+2
-2
未找到文件。
examples/js/AudioObject.js
浏览文件 @
e314cb05
...
...
@@ -110,8 +110,8 @@ THREE.AudioObject = function ( url, volume, playbackRate, loop ) {
oldSoundPosition
.
copy
(
soundPosition
);
oldCameraPosition
.
copy
(
cameraPosition
);
soundPosition
.
copy
(
this
.
matrixWorld
.
getPosition
()
);
cameraPosition
.
copy
(
camera
.
matrixWorld
.
getPosition
()
);
soundPosition
.
getPositionFromMatrix
(
this
.
matrixWorld
);
cameraPosition
.
getPositionFromMatrix
(
camera
.
matrixWorld
);
soundDelta
.
subVectors
(
soundPosition
,
oldSoundPosition
);
cameraDelta
.
subVectors
(
cameraPosition
,
oldCameraPosition
);
...
...
examples/js/renderers/SVGRenderer.js
浏览文件 @
e314cb05
...
...
@@ -230,18 +230,16 @@ THREE.SVGRenderer = function () {
function
calculateLight
(
lights
,
position
,
normal
,
color
)
{
var
l
,
ll
,
light
,
lightColor
,
lightPosition
,
amount
;
for
(
var
l
=
0
,
ll
=
lights
.
length
;
l
<
ll
;
l
++
)
{
for
(
l
=
0
,
ll
=
lights
.
length
;
l
<
ll
;
l
++
)
{
light
=
lights
[
l
];
lightColor
=
light
.
color
;
var
light
=
lights
[
l
];
var
lightColor
=
light
.
color
;
if
(
light
instanceof
THREE
.
DirectionalLight
)
{
lightPosition
=
light
.
matrixWorld
.
getPosition
(
).
normalize
();
var
lightPosition
=
_vector3
.
getPositionFromMatrix
(
light
.
matrixWorld
).
normalize
();
amount
=
normal
.
dot
(
lightPosition
);
var
amount
=
normal
.
dot
(
lightPosition
);
if
(
amount
<=
0
)
continue
;
...
...
@@ -253,9 +251,9 @@ THREE.SVGRenderer = function () {
}
else
if
(
light
instanceof
THREE
.
PointLight
)
{
lightPosition
=
light
.
matrixWorld
.
getPosition
(
);
var
lightPosition
=
_vector3
.
getPositionFromMatrix
(
light
.
matrixWorld
);
amount
=
normal
.
dot
(
_vector3
.
subVectors
(
lightPosition
,
position
).
normalize
()
);
var
amount
=
normal
.
dot
(
_vector3
.
subVectors
(
lightPosition
,
position
).
normalize
()
);
if
(
amount
<=
0
)
continue
;
...
...
src/core/Projector.js
浏览文件 @
e314cb05
...
...
@@ -110,7 +110,7 @@ THREE.Projector = function () {
}
else
{
_vector3
.
copy
(
object
.
matrixWorld
.
getPosition
()
);
_vector3
.
getPositionFromMatrix
(
object
.
matrixWorld
);
_vector3
.
applyProjection
(
_viewProjectionMatrix
);
_object
.
z
=
_vector3
.
z
;
...
...
@@ -133,7 +133,7 @@ THREE.Projector = function () {
}
else
{
_vector3
.
copy
(
object
.
matrixWorld
.
getPosition
()
);
_vector3
.
getPositionFromMatrix
.
copy
(
object
.
matrixWorld
);
_vector3
.
applyProjection
(
_viewProjectionMatrix
);
_object
.
z
=
_vector3
.
z
;
...
...
@@ -152,7 +152,7 @@ THREE.Projector = function () {
}
else
{
_vector3
.
copy
(
object
.
matrixWorld
.
getPosition
()
);
_vector3
.
getPositionFromMatrix
(
object
.
matrixWorld
);
_vector3
.
applyProjection
(
_viewProjectionMatrix
);
_object
.
z
=
_vector3
.
z
;
...
...
src/core/Raycaster.js
浏览文件 @
e314cb05
...
...
@@ -60,7 +60,7 @@
// Checking boundingSphere distance to ray
sphere
.
set
(
object
.
matrixWorld
.
getPosition
(),
object
.
geometry
.
boundingSphere
.
radius
*
object
.
matrixWorld
.
getMaxScaleOnAxis
()
);
object
.
geometry
.
boundingSphere
.
radius
*
object
.
matrixWorld
.
getMaxScaleOnAxis
()
);
if
(
!
raycaster
.
ray
.
isIntersectionSphere
(
sphere
)
)
{
...
...
@@ -86,7 +86,7 @@
inverseMatrix
.
getInverse
(
object
.
matrixWorld
);
localRay
.
copy
(
raycaster
.
ray
).
transform
(
inverseMatrix
);
for
(
var
f
=
0
,
fl
=
geometry
.
faces
.
length
;
f
<
fl
;
f
++
)
{
var
face
=
geometry
.
faces
[
f
];
...
...
@@ -94,14 +94,14 @@
var
material
=
isFaceMaterial
===
true
?
objectMaterials
[
face
.
materialIndex
]
:
object
.
material
;
if
(
material
===
undefined
)
continue
;
facePlane
.
setFromNormalAndCoplanarPoint
(
face
.
normal
,
vertices
[
face
.
a
]
);
var
planeDistance
=
localRay
.
distanceToPlane
(
facePlane
);
// bail if raycaster and plane are parallel
if
(
Math
.
abs
(
planeDistance
)
<
precision
)
continue
;
// if negative distance, then plane is behind raycaster
if
(
planeDistance
<
0
)
continue
;
...
...
@@ -117,7 +117,7 @@
// this can be done using the planeDistance from localRay because localRay wasn't normalized, but ray was
if
(
planeDistance
<
raycaster
.
near
||
planeDistance
>
raycaster
.
far
)
continue
;
intersectPoint
=
localRay
.
at
(
planeDistance
,
intersectPoint
);
// passing in intersectPoint avoids a copy
if
(
face
instanceof
THREE
.
Face3
)
{
...
...
src/extras/renderers/plugins/ShadowMapPlugin.js
浏览文件 @
e314cb05
...
...
@@ -196,7 +196,7 @@ THREE.ShadowMapPlugin = function () {
shadowMatrix
=
light
.
shadowMatrix
;
shadowCamera
=
light
.
shadowCamera
;
shadowCamera
.
position
.
copy
(
light
.
matrixWorld
.
getPosition
()
);
shadowCamera
.
position
.
getPositionFromMatrix
(
light
.
matrixWorld
);
shadowCamera
.
lookAt
(
light
.
target
.
matrixWorld
.
getPosition
()
);
shadowCamera
.
updateMatrixWorld
();
...
...
src/math/Frustum.js
浏览文件 @
e314cb05
...
...
@@ -70,29 +70,37 @@ THREE.extend( THREE.Frustum.prototype, {
},
intersectsObject
:
function
(
object
)
{
intersectsObject
:
function
()
{
// this method is expanded inlined for performance reasons.
var
matrix
=
object
.
matrixWorld
;
var
planes
=
this
.
planes
;
var
center
=
matrix
.
getPosition
();
var
negRadius
=
-
object
.
geometry
.
boundingSphere
.
radius
*
matrix
.
getMaxScaleOnAxis
();
var
center
=
new
THREE
.
Vector3
();
for
(
var
i
=
0
;
i
<
6
;
i
++
)
{
return
function
(
object
)
{
var
distance
=
planes
[
i
].
distanceToPoint
(
center
);
// this method is expanded inlined for performance reasons.
if
(
distance
<
negRadius
)
{
var
matrix
=
object
.
matrixWorld
;
var
planes
=
this
.
planes
;
var
negRadius
=
-
object
.
geometry
.
boundingSphere
.
radius
*
matrix
.
getMaxScaleOnAxis
();
return
false
;
center
.
getPositionFromMatrix
(
matrix
);
for
(
var
i
=
0
;
i
<
6
;
i
++
)
{
var
distance
=
planes
[
i
].
distanceToPoint
(
center
);
if
(
distance
<
negRadius
)
{
return
false
;
}
}
}
return
true
;
return
true
;
}
;
},
}
()
,
intersectsSphere
:
function
(
sphere
)
{
...
...
@@ -104,7 +112,7 @@ THREE.extend( THREE.Frustum.prototype, {
var
distance
=
planes
[
i
].
distanceToPoint
(
center
);
if
(
distance
<
negRadius
)
{
if
(
distance
<
negRadius
)
{
return
false
;
...
...
@@ -122,7 +130,7 @@ THREE.extend( THREE.Frustum.prototype, {
for
(
var
i
=
0
;
i
<
6
;
i
++
)
{
if
(
planes
[
i
].
distanceToPoint
(
point
)
<
0
)
{
if
(
planes
[
i
].
distanceToPoint
(
point
)
<
0
)
{
return
false
;
...
...
@@ -140,4 +148,4 @@ THREE.extend( THREE.Frustum.prototype, {
}
}
);
\ No newline at end of file
}
);
src/math/Vector3.js
浏览文件 @
e314cb05
...
...
@@ -265,7 +265,7 @@ THREE.extend( THREE.Vector3.prototype, {
},
applyEuler
:
function
()
{
applyEuler
:
function
()
{
var
q1
=
new
THREE
.
Quaternion
();
...
...
@@ -281,7 +281,7 @@ THREE.extend( THREE.Vector3.prototype, {
}(),
applyAxisAngle
:
function
()
{
applyAxisAngle
:
function
()
{
var
q1
=
new
THREE
.
Quaternion
();
...
...
@@ -432,7 +432,7 @@ THREE.extend( THREE.Vector3.prototype, {
},
negate
:
function
()
{
negate
:
function
()
{
return
this
.
multiplyScalar
(
-
1
);
...
...
src/renderers/CanvasRenderer.js
浏览文件 @
e314cb05
...
...
@@ -436,7 +436,7 @@ THREE.CanvasRenderer = function ( parameters ) {
if
(
light
instanceof
THREE
.
DirectionalLight
)
{
var
lightPosition
=
light
.
matrixWorld
.
getPosition
(
).
normalize
();
var
lightPosition
=
_vector3
.
getPositionFromMatrix
(
light
.
matrixWorld
).
normalize
();
var
amount
=
normal
.
dot
(
lightPosition
);
...
...
@@ -448,7 +448,7 @@ THREE.CanvasRenderer = function ( parameters ) {
}
else
if
(
light
instanceof
THREE
.
PointLight
)
{
var
lightPosition
=
light
.
matrixWorld
.
getPosition
(
);
var
lightPosition
=
_vector3
.
getPositionFromMatrix
(
light
.
matrixWorld
);
var
amount
=
normal
.
dot
(
_vector3
.
subVectors
(
lightPosition
,
position
).
normalize
()
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录