Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-10-20 16:18:00 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-10-20 16:18:00 +0400
commit9a1c1f132de971a840816614a0f4657ef1c12c89 (patch)
treeba7a0e493733275cb2df1855b69b36452322bf28 /intern/cycles/kernel/osl/emissive.cpp
parent3abef3a2e6b77949f2e992baefd660422e3e19fe (diff)
Cycles OSL: most closure code is now shared between OSL and SVM. Also fix
transmission pass and filter glossy option. The BSDF closure class is now more similar to the SVM closures, and includes some flags and labels that are needed to properly categorize the BSDF's for render passes. Phong closure is gone for the moment, needs to be adapated to the new structure still.
Diffstat (limited to 'intern/cycles/kernel/osl/emissive.cpp')
-rw-r--r--intern/cycles/kernel/osl/emissive.cpp38
1 files changed, 12 insertions, 26 deletions
diff --git a/intern/cycles/kernel/osl/emissive.cpp b/intern/cycles/kernel/osl/emissive.cpp
index 3ee57cbe6b6..37e3e37c00a 100644
--- a/intern/cycles/kernel/osl/emissive.cpp
+++ b/intern/cycles/kernel/osl/emissive.cpp
@@ -36,6 +36,9 @@
#include "osl_closures.h"
+#include "kernel_types.h"
+#include "closure/emissive.h"
+
CCL_NAMESPACE_BEGIN
using namespace OSL;
@@ -52,51 +55,34 @@ public:
GenericEmissiveClosure() { }
void setup() {}
-
size_t memsize() const { return sizeof(*this); }
-
const char *name() const { return "emission"; }
- void print_on(std::ostream &out) const {
+ void print_on(std::ostream &out) const
+ {
out << name() << "()";
}
Color3 eval(const Vec3 &Ng, const Vec3 &omega_out) const
{
- float cosNO = fabsf(Ng.dot(omega_out));
- float res = cosNO > 0 ? 1.0f : 0.0f;
- return Color3(res, res, res);
+ float3 result = emissive_eval(TO_FLOAT3(Ng), TO_FLOAT3(omega_out));
+ return TO_COLOR3(result);
}
void sample(const Vec3 &Ng, float randu, float randv,
Vec3 &omega_out, float &pdf) const
{
- // We don't do anything sophisticated here for the step
- // We just sample the whole cone uniformly to the cosine
- Vec3 T, B;
- make_orthonormals(Ng, T, B);
- float phi = 2 * (float) M_PI * randu;
- float cosTheta = sqrtf(1.0f - 1.0f * randv);
- float sinTheta = sqrtf(1.0f - cosTheta * cosTheta);
- omega_out = (cosf(phi) * sinTheta) * T +
- (sinf(phi) * sinTheta) * B +
- cosTheta * Ng;
- pdf = 1.0f / float(M_PI);
+ float3 omega_out_;
+ emissive_sample(TO_FLOAT3(Ng), randu, randv, &omega_out_, &pdf);
+ omega_out = TO_VEC3(omega_out_);
}
- /// Return the probability distribution function in the direction omega_out,
- /// given the parameters and the light's surface normal. This MUST match
- /// the PDF computed by sample().
- float pdf(const Vec3 &Ng,
- const Vec3 &omega_out) const
+ float pdf(const Vec3 &Ng, const Vec3 &omega_out) const
{
- float cosNO = Ng.dot(omega_out);
- return cosNO > 0 ? 1.0f : 0.0f;
+ return emissive_pdf(TO_FLOAT3(Ng), TO_FLOAT3(omega_out));
}
};
-
-
ClosureParam *closure_emission_params()
{
static ClosureParam params[] = {