Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
imjiangjun
pbrt-v4
提交
8f688d1c
P
pbrt-v4
项目概览
imjiangjun
/
pbrt-v4
12 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
pbrt-v4
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8f688d1c
编写于
8月 26, 2020
作者:
M
Matt Pharr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename GeneralMedium member variable
上级
f8108305
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
13 deletion
+14
-13
src/pbrt/media.h
src/pbrt/media.h
+14
-13
未找到文件。
src/pbrt/media.h
浏览文件 @
8f688d1c
...
...
@@ -157,16 +157,16 @@ class GeneralMedium {
mediumFromRender
(
Inverse
(
renderFromMedium
)),
renderFromMedium
(
renderFromMedium
),
maxDensityGrid
(
alloc
)
{
maxDensityGrid
=
provider
->
GetMaxDensityGrid
(
alloc
,
&
maxDGridRes
);
maxDensityGrid
=
provider
->
GetMaxDensityGrid
(
alloc
,
&
gridResolution
);
}
std
::
string
ToString
()
const
{
return
StringPrintf
(
"[ GeneralMedium provider: %s mediumBounds: %s "
"sigma_a_spec: %s sigma_s_spec: %s sigScale: %f phase: %s "
"mediumFromRender: %s maxDensityGrid: %s
maxDensityGridRes
: %s ]"
,
"mediumFromRender: %s maxDensityGrid: %s
gridResolution
: %s ]"
,
*
provider
,
mediumBounds
,
sigma_a_spec
,
sigma_s_spec
,
sigScale
,
phase
,
mediumFromRender
,
maxDensityGrid
,
maxDGridRes
);
mediumFromRender
,
maxDensityGrid
,
gridResolution
);
}
bool
IsEmissive
()
const
{
return
provider
->
IsEmissive
();
}
...
...
@@ -195,8 +195,8 @@ class GeneralMedium {
Point3f
gridIntersect
=
rayGrid
(
tMin
);
float
nextCrossingT
[
3
],
deltaT
[
3
];
int
step
[
3
],
voxelLimit
[
3
],
voxel
[
3
];
Vector3f
voxelWidth
(
1.
f
/
maxDGridRes
.
x
,
1.
f
/
maxDGridRes
.
y
,
1.
f
/
maxDGridRes
.
z
);
Vector3f
voxelWidth
(
1.
f
/
gridResolution
.
x
,
1.
f
/
gridResolution
.
y
,
1.
f
/
gridResolution
.
z
);
for
(
int
axis
=
0
;
axis
<
3
;
++
axis
)
{
// Initialize ray stepping parameters for axis
// Handle negative zero ray direction
...
...
@@ -204,21 +204,21 @@ class GeneralMedium {
rayGrid
.
d
[
axis
]
=
0.
f
;
// Compute current voxel for axis
voxel
[
axis
]
=
Clamp
(
gridIntersect
[
axis
]
*
maxDGridRes
[
axis
],
0
,
maxDGridRes
[
axis
]
-
1
);
voxel
[
axis
]
=
Clamp
(
gridIntersect
[
axis
]
*
gridResolution
[
axis
],
0
,
gridResolution
[
axis
]
-
1
);
if
(
rayGrid
.
d
[
axis
]
>=
0
)
{
// Handle ray with positive direction for voxel stepping
Float
nextVoxelPos
=
Float
(
voxel
[
axis
]
+
1
)
/
maxDGridRes
[
axis
];
Float
nextVoxelPos
=
Float
(
voxel
[
axis
]
+
1
)
/
gridResolution
[
axis
];
nextCrossingT
[
axis
]
=
tMin
+
(
nextVoxelPos
-
gridIntersect
[
axis
])
/
rayGrid
.
d
[
axis
];
deltaT
[
axis
]
=
voxelWidth
[
axis
]
/
rayGrid
.
d
[
axis
];
step
[
axis
]
=
1
;
voxelLimit
[
axis
]
=
maxDGridRes
[
axis
];
voxelLimit
[
axis
]
=
gridResolution
[
axis
];
}
else
{
// Handle ray with negative direction for voxel stepping
Float
nextVoxelPos
=
Float
(
voxel
[
axis
])
/
maxDGridRes
[
axis
];
Float
nextVoxelPos
=
Float
(
voxel
[
axis
])
/
gridResolution
[
axis
];
nextCrossingT
[
axis
]
=
tMin
+
(
nextVoxelPos
-
gridIntersect
[
axis
])
/
rayGrid
.
d
[
axis
];
deltaT
[
axis
]
=
-
voxelWidth
[
axis
]
/
rayGrid
.
d
[
axis
];
...
...
@@ -240,7 +240,8 @@ class GeneralMedium {
// Sample volume scattering in current voxel
// Get _maxDensity_ for current voxel and compute _sigma\_maj_
int
offset
=
voxel
[
0
]
+
maxDGridRes
.
x
*
(
voxel
[
1
]
+
maxDGridRes
.
y
*
voxel
[
2
]);
int
offset
=
voxel
[
0
]
+
gridResolution
.
x
*
(
voxel
[
1
]
+
gridResolution
.
y
*
voxel
[
2
]);
Float
maxDensity
=
maxDensityGrid
[
offset
];
SampledSpectrum
sigma_maj
(
sigma_t
*
maxDensity
);
...
...
@@ -336,7 +337,7 @@ class GeneralMedium {
HGPhaseFunction
phase
;
Transform
mediumFromRender
,
renderFromMedium
;
pstd
::
vector
<
Float
>
maxDensityGrid
;
Point3i
maxDGridRes
;
Point3i
gridResolution
;
};
// UniformGridMediumProvider Definition
...
...
@@ -378,7 +379,7 @@ class UniformGridMediumProvider {
pstd
::
vector
<
Float
>
GetMaxDensityGrid
(
Allocator
alloc
,
Point3i
*
res
)
const
{
pstd
::
vector
<
Float
>
maxGrid
(
alloc
);
// Set _
maxDGridRes
_ and allocate _maxGrid_
// Set _
gridResolution
_ and allocate _maxGrid_
*
res
=
Point3i
(
4
,
4
,
4
);
maxGrid
.
resize
(
res
->
x
*
res
->
y
*
res
->
z
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录