Fix old applications with new framework.
This commit is contained in:
parent
fe92493afd
commit
262c9f3635
4 changed files with 54 additions and 56 deletions
|
|
@ -73,7 +73,7 @@ void Application1::veachScene() {
|
|||
}
|
||||
|
||||
// Function that selects implementation at runtime
|
||||
Vec3fa Application1::renderPixel(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler) {
|
||||
Vec3fa Application1::renderPixel(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSamplerWrapper& sampler) {
|
||||
if (selected == 0) {
|
||||
return renderPixelOrig(x, y, camera, stats, sampler);
|
||||
} else if (selected == 1) {
|
||||
|
|
@ -87,7 +87,7 @@ Vec3fa Application1::renderPixel(float x, float y, const ISPCCamera& camera, Ray
|
|||
}
|
||||
}
|
||||
|
||||
Vec3fa Application1::renderPixelMIS(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler) {
|
||||
Vec3fa Application1::renderPixelMIS(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSamplerWrapper& sampler) {
|
||||
/* radiance accumulator and weight */
|
||||
Vec3fa L = Vec3fa(0.0f);
|
||||
Vec3fa Lw = Vec3fa(1.0f);
|
||||
|
|
@ -166,12 +166,12 @@ Vec3fa Application1::renderPixelMIS(float x, float y, const ISPCCamera& camera,
|
|||
Material__preprocess(material_array, matId, brdf, wo, sample);
|
||||
|
||||
/* Light ray */
|
||||
int id = (int)(RandomSampler_get1D(sampler) * data.scene->lights.size());
|
||||
int id = (int)(sampler.get1D() * data.scene->lights.size());
|
||||
if (id == data.scene->lights.size())
|
||||
id = data.scene->lights.size() - 1;
|
||||
const Light* l = data.scene->lights[id];
|
||||
|
||||
Light_SampleRes ls = Lights_sample(l, sample, RandomSampler_get2D(sampler));
|
||||
Light_SampleRes ls = Lights_sample(l, sample, sampler.get2D());
|
||||
|
||||
Vec3fa light_diffuse = Material__eval(material_array, matId, brdf, wo, sample, ls.dir);
|
||||
|
||||
|
|
@ -207,7 +207,7 @@ Vec3fa Application1::renderPixelMIS(float x, float y, const ISPCCamera& camera,
|
|||
}
|
||||
|
||||
// Use cosine sampling
|
||||
Vec2f uv = RandomSampler_get2D(sampler);
|
||||
Vec2f uv = sampler.get2D();
|
||||
Sample3f wi = cosineSampleHemisphere(uv.x, uv.y, sample.Ng);
|
||||
|
||||
Vec3fa diffuse = Material__eval(material_array, matId, brdf, wo, sample, wi.v);
|
||||
|
|
@ -222,7 +222,7 @@ Vec3fa Application1::renderPixelMIS(float x, float y, const ISPCCamera& camera,
|
|||
return L;
|
||||
}
|
||||
|
||||
Vec3fa Application1::renderPixelNextEventEstimation(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler) {
|
||||
Vec3fa Application1::renderPixelNextEventEstimation(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSamplerWrapper& sampler) {
|
||||
/* radiance accumulator and weight */
|
||||
Vec3fa L = Vec3fa(0.0f);
|
||||
Vec3fa Lw = Vec3fa(1.0f);
|
||||
|
|
@ -274,12 +274,12 @@ Vec3fa Application1::renderPixelNextEventEstimation(float x, float y, const ISPC
|
|||
Material__preprocess(material_array, matId, brdf, wo, sample);
|
||||
|
||||
/* Light ray */
|
||||
int id = (int)(RandomSampler_get1D(sampler) * data.scene->lights.size());
|
||||
int id = (int)(sampler.get1D() * data.scene->lights.size());
|
||||
if (id == data.scene->lights.size())
|
||||
id = data.scene->lights.size() - 1;
|
||||
const Light* l = data.scene->lights[id];
|
||||
|
||||
Light_SampleRes ls = Lights_sample(l, sample, RandomSampler_get2D(sampler));
|
||||
Light_SampleRes ls = Lights_sample(l, sample, sampler.get2D());
|
||||
|
||||
Vec3fa light_diffuse = Material__eval(material_array, matId, brdf, wo, sample, ls.dir);
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ Vec3fa Application1::renderPixelNextEventEstimation(float x, float y, const ISPC
|
|||
|
||||
|
||||
// Use cosine sampling
|
||||
Vec2f uv = RandomSampler_get2D(sampler);
|
||||
Vec2f uv = sampler.get2D();
|
||||
Sample3f wi = cosineSampleHemisphere(uv.x, uv.y, sample.Ng);
|
||||
|
||||
Vec3fa diffuse = Material__eval(material_array, matId, brdf, wo, sample, wi.v);
|
||||
|
|
@ -317,7 +317,7 @@ Vec3fa Application1::renderPixelNextEventEstimation(float x, float y, const ISPC
|
|||
}
|
||||
|
||||
|
||||
Vec3fa Application1::renderPixelPathTracer(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler) {
|
||||
Vec3fa Application1::renderPixelPathTracer(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSamplerWrapper& sampler) {
|
||||
/* radiance accumulator and weight */
|
||||
Vec3fa L = Vec3fa(0.0f);
|
||||
Vec3fa Lw = Vec3fa(1.0f);
|
||||
|
|
@ -368,7 +368,7 @@ Vec3fa Application1::renderPixelPathTracer(float x, float y, const ISPCCamera& c
|
|||
|
||||
|
||||
// Use cosine sampling
|
||||
Vec2f uv = RandomSampler_get2D(sampler);
|
||||
Vec2f uv = sampler.get2D();
|
||||
Sample3f wi = cosineSampleHemisphere(uv.x, uv.y, sample.Ng);
|
||||
|
||||
Vec3fa diffuse = Material__eval(material_array, matId, brdf, wo, sample, wi.v);
|
||||
|
|
@ -383,7 +383,7 @@ Vec3fa Application1::renderPixelPathTracer(float x, float y, const ISPCCamera& c
|
|||
}
|
||||
|
||||
/* task that renders a single screen tile (original implementation) */
|
||||
Vec3fa Application1::renderPixelOrig(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSampler& sampler) {
|
||||
Vec3fa Application1::renderPixelOrig(float x, float y, const ISPCCamera& camera, RayStats& stats, RandomSamplerWrapper& sampler) {
|
||||
/* radiance accumulator and weight */
|
||||
Vec3fa L = Vec3fa(0.0f);
|
||||
Vec3fa Lw = Vec3fa(1.0f);
|
||||
|
|
@ -427,14 +427,14 @@ Vec3fa Application1::renderPixelOrig(float x, float y, const ISPCCamera& camera,
|
|||
|
||||
/* sample BRDF at hit point */
|
||||
// Sample3f wi1;
|
||||
// Material__sample(material_array, matId, brdf, Lw, wo, sample, wi1, RandomSampler_get2D(sampler));
|
||||
// Material__sample(material_array, matId, brdf, Lw, wo, sample, wi1, RandomSamplerWrapper_get2D(sampler));
|
||||
|
||||
int id = (int)(RandomSampler_get1D(sampler) * data.scene->lights.size());
|
||||
int id = (int)(sampler.get1D() * data.scene->lights.size());
|
||||
if (id == data.scene->lights.size())
|
||||
id = data.scene->lights.size() - 1;
|
||||
const Light* l = data.scene->lights[id];
|
||||
|
||||
Light_SampleRes ls = Lights_sample(l, sample, RandomSampler_get2D(sampler));
|
||||
Light_SampleRes ls = Lights_sample(l, sample, sampler.get2D());
|
||||
|
||||
Vec3fa diffuse = Material__eval(material_array, matId, brdf, wo, sample, ls.dir);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue