1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
// Copyright 2009 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "BSDF.ih"
OSPRAY_BEGIN_ISPC_NAMESPACE
inline BSDF_EvalRes Reflection_eval(const varying BSDF *uniform,
const vec3f &,
const vec3f &,
const uniform FeatureFlagsHandler &)
{
return make_BSDF_EvalRes_zero();
}
inline BSDF_SampleRes Reflection_sample(const varying BSDF *uniform self,
const vec3f &wo,
const vec2f &,
float,
const uniform FeatureFlagsHandler &)
{
BSDF_SampleRes res;
res.wi = reflect(wo, getN(self));
res.pdf = inf;
res.type = BSDF_SPECULAR_REFLECTION;
res.weight = self->albedo;
return res;
}
inline varying BSDF *uniform Reflection_create(
uniform ShadingContext *uniform ctx,
const varying linear3f *uniform frame,
vec3f reflectance)
{
varying BSDF *uniform self =
(varying BSDF * uniform) ShadingContext_alloc(ctx, sizeof(BSDF));
BSDF_Constructor(self,
reflectance,
BSDF_SPECULAR_REFLECTION,
BSDF_TYPE_REFLECTION,
#ifdef OSPRAY_TARGET_SYCL
NULL,
NULL,
#else
Reflection_eval,
Reflection_sample,
#endif
frame);
return self;
}
OSPRAY_END_ISPC_NAMESPACE
|