Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
03f04000
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,发现更多精彩内容 >>
未验证
提交
03f04000
编写于
12月 06, 2018
作者:
M
Mr.doob
提交者:
GitHub
12月 06, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15372 from Mugen87/dev19
Examples: Moved RaytracingWorker to BufferGeometry.
上级
7025521d
3e07c28f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
16 deletion
+21
-16
examples/js/renderers/RaytracingWorker.js
examples/js/renderers/RaytracingWorker.js
+18
-13
examples/raytracing_sandbox.html
examples/raytracing_sandbox.html
+3
-3
未找到文件。
examples/js/renderers/RaytracingWorker.js
浏览文件 @
03f04000
...
...
@@ -168,7 +168,7 @@ THREE.RaytracingRendererWorker = function () {
var
material
=
object
.
material
;
var
face
=
intersection
.
face
;
var
vertices
=
object
.
geometry
.
vertices
;
var
geometry
=
object
.
geometry
;
//
...
...
@@ -250,7 +250,7 @@ THREE.RaytracingRendererWorker = function () {
// (should be possible to cache even more)
localPoint
.
copy
(
point
).
applyMatrix4
(
_object
.
inverseMatrix
);
computePixelNormal
(
normalVector
,
localPoint
,
material
.
flatShading
,
face
,
vertices
);
computePixelNormal
(
normalVector
,
localPoint
,
material
.
flatShading
,
face
,
geometry
);
normalVector
.
applyMatrix3
(
_object
.
normalMatrix
).
normalize
();
normalComputed
=
true
;
...
...
@@ -378,14 +378,17 @@ THREE.RaytracingRendererWorker = function () {
var
computePixelNormal
=
(
function
()
{
var
vA
=
new
THREE
.
Vector3
();
var
vB
=
new
THREE
.
Vector3
();
var
vC
=
new
THREE
.
Vector3
();
var
tmpVec1
=
new
THREE
.
Vector3
();
var
tmpVec2
=
new
THREE
.
Vector3
();
var
tmpVec3
=
new
THREE
.
Vector3
();
return
function
computePixelNormal
(
outputVector
,
point
,
flatShading
,
face
,
vertices
)
{
return
function
computePixelNormal
(
outputVector
,
point
,
flatShading
,
face
,
geometry
)
{
var
faceNormal
=
face
.
normal
;
var
vertexNormals
=
face
.
vertexNormals
;
if
(
flatShading
===
true
)
{
...
...
@@ -393,11 +396,14 @@ THREE.RaytracingRendererWorker = function () {
}
else
{
// compute barycentric coordinates
var
positions
=
geometry
.
attributes
.
position
;
var
normals
=
geometry
.
attributes
.
normal
;
var
vA
=
vertices
[
face
.
a
];
var
vB
=
vertices
[
face
.
b
];
var
vC
=
vertices
[
face
.
c
];
vA
.
fromBufferAttribute
(
positions
,
face
.
a
);
vB
.
fromBufferAttribute
(
positions
,
face
.
b
);
vC
.
fromBufferAttribute
(
positions
,
face
.
c
);
// compute barycentric coordinates
tmpVec3
.
crossVectors
(
tmpVec1
.
subVectors
(
vB
,
vA
),
tmpVec2
.
subVectors
(
vC
,
vA
)
);
var
areaABC
=
faceNormal
.
dot
(
tmpVec3
);
...
...
@@ -414,13 +420,12 @@ THREE.RaytracingRendererWorker = function () {
// compute interpolated vertex normal
tmpVec1
.
copy
(
vertexNormals
[
0
]
);
tmpVec1
.
multiplyScalar
(
a
);
tmpVec1
.
fromBufferAttribute
(
normals
,
face
.
a
);
tmpVec2
.
fromBufferAttribute
(
normals
,
face
.
b
);
tmpVec3
.
fromBufferAttribute
(
normals
,
face
.
c
);
tmpVec
2
.
copy
(
vertexNormals
[
1
]
);
tmpVec
1
.
multiplyScalar
(
a
);
tmpVec2
.
multiplyScalar
(
b
);
tmpVec3
.
copy
(
vertexNormals
[
2
]
);
tmpVec3
.
multiplyScalar
(
c
);
outputVector
.
addVectors
(
tmpVec1
,
tmpVec2
);
...
...
examples/raytracing_sandbox.html
浏览文件 @
03f04000
...
...
@@ -139,9 +139,9 @@
// geometries
var
sphereGeometry
=
new
THREE
.
SphereGeometry
(
100
,
16
,
8
);
var
planeGeometry
=
new
THREE
.
BoxGeometry
(
600
,
5
,
600
);
var
boxGeometry
=
new
THREE
.
BoxGeometry
(
100
,
100
,
100
);
var
sphereGeometry
=
new
THREE
.
Sphere
Buffer
Geometry
(
100
,
16
,
8
);
var
planeGeometry
=
new
THREE
.
Box
Buffer
Geometry
(
600
,
5
,
600
);
var
boxGeometry
=
new
THREE
.
Box
Buffer
Geometry
(
100
,
100
,
100
);
// Sphere
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录