Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
45fa8fff
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,发现更多精彩内容 >>
提交
45fa8fff
编写于
8月 29, 2011
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ray.js: Now ignores objects behind origin and also faces behind origin (using the centroid).
上级
6e5d0490
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
372 addition
and
361 deletion
+372
-361
build/Three.js
build/Three.js
+123
-123
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+59
-59
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+26
-26
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+41
-41
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+100
-100
examples/webgl_interactive_cubes.html
examples/webgl_interactive_cubes.html
+1
-1
src/core/Ray.js
src/core/Ray.js
+22
-11
未找到文件。
build/Three.js
浏览文件 @
45fa8fff
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
build/custom/ThreeCanvas.js
浏览文件 @
45fa8fff
此差异已折叠。
点击以展开。
build/custom/ThreeDOM.js
浏览文件 @
45fa8fff
此差异已折叠。
点击以展开。
build/custom/ThreeSVG.js
浏览文件 @
45fa8fff
此差异已折叠。
点击以展开。
build/custom/ThreeWebGL.js
浏览文件 @
45fa8fff
此差异已折叠。
点击以展开。
examples/webgl_interactive_cubes.html
浏览文件 @
45fa8fff
...
...
@@ -117,7 +117,7 @@
}
var
radius
=
6
00
;
var
radius
=
1
00
;
var
theta
=
0
;
function
render
()
{
...
...
src/core/Ray.js
浏览文件 @
45fa8fff
...
...
@@ -40,9 +40,9 @@ THREE.Ray.prototype = {
if
(
object
instanceof
THREE
.
Particle
)
{
var
distance
=
distanceFromIntersection
(
this
.
origin
,
this
.
direction
,
object
);
var
distance
=
distanceFromIntersection
(
this
.
origin
,
this
.
direction
,
object
.
matrixWorld
.
getPosition
()
);
if
(
distance
>
object
.
scale
.
x
)
{
if
(
distance
==
null
||
distance
>
object
.
scale
.
x
)
{
return
[];
...
...
@@ -61,9 +61,9 @@ THREE.Ray.prototype = {
// Checking boundingSphere
var
distance
=
distanceFromIntersection
(
this
.
origin
,
this
.
direction
,
object
);
var
distance
=
distanceFromIntersection
(
this
.
origin
,
this
.
direction
,
object
.
matrixWorld
.
getPosition
()
);
if
(
distance
>
object
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
object
.
scale
.
x
,
Math
.
max
(
object
.
scale
.
y
,
object
.
scale
.
z
)
)
)
{
if
(
distance
==
null
||
distance
>
object
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
object
.
scale
.
x
,
Math
.
max
(
object
.
scale
.
y
,
object
.
scale
.
z
)
)
)
{
return
[];
...
...
@@ -71,8 +71,9 @@ THREE.Ray.prototype = {
// Checking faces
var
f
,
fl
,
face
,
a
,
b
,
c
,
d
,
normal
,
dot
,
scalar
,
var
f
,
fl
,
face
,
a
,
b
,
c
,
d
,
normal
,
vector
,
dot
,
scalar
,
origin
,
direction
,
geometry
=
object
.
geometry
,
vertices
=
geometry
.
vertices
,
...
...
@@ -89,6 +90,15 @@ THREE.Ray.prototype = {
objMatrix
=
object
.
matrixWorld
;
// check if face.centroid is behind the origin
vector
=
objMatrix
.
multiplyVector3
(
face
.
centroid
.
clone
()
).
subSelf
(
origin
);
dot
=
vector
.
dot
(
direction
);
if
(
dot
<
0
)
continue
;
//
a
=
objMatrix
.
multiplyVector3
(
vertices
[
face
.
a
].
position
.
clone
()
);
b
=
objMatrix
.
multiplyVector3
(
vertices
[
face
.
b
].
position
.
clone
()
);
c
=
objMatrix
.
multiplyVector3
(
vertices
[
face
.
c
].
position
.
clone
()
);
...
...
@@ -142,6 +152,8 @@ THREE.Ray.prototype = {
}
intersects
.
sort
(
function
(
a
,
b
)
{
return
a
.
distance
-
b
.
distance
;
}
);
return
intersects
;
}
else
{
...
...
@@ -150,19 +162,18 @@ THREE.Ray.prototype = {
}
function
distanceFromIntersection
(
origin
,
direction
,
object
)
{
function
distanceFromIntersection
(
origin
,
direction
,
position
)
{
var
vector
,
dot
,
intersect
,
distance
,
position
=
object
.
matrixWorld
.
getPosition
();
var
vector
,
dot
,
intersect
,
distance
;
vector
=
position
.
clone
().
subSelf
(
origin
);
dot
=
vector
.
dot
(
direction
);
if
(
dot
<
0
)
return
null
;
// check if position behind origin.
intersect
=
origin
.
clone
().
addSelf
(
direction
.
clone
().
multiplyScalar
(
dot
)
);
distance
=
position
.
distanceTo
(
intersect
);
// TODO: Check if distance is negative (object behind camera).
return
distance
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录