From 2d290040a1fea8319f33a982823bea13d1d95348 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Jun 2012 22:44:58 +0000 Subject: style cleanup --- intern/cycles/kernel/osl/emissive.cpp | 93 ++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 46 deletions(-) (limited to 'intern/cycles/kernel/osl/emissive.cpp') diff --git a/intern/cycles/kernel/osl/emissive.cpp b/intern/cycles/kernel/osl/emissive.cpp index 2d2d6e1fdde..0a582c3f558 100644 --- a/intern/cycles/kernel/osl/emissive.cpp +++ b/intern/cycles/kernel/osl/emissive.cpp @@ -49,57 +49,58 @@ using namespace OSL; /// class GenericEmissiveClosure : public EmissiveClosure { public: - GenericEmissiveClosure() { } - - void setup() { } - - size_t memsize () const { return sizeof(*this); } - - const char *name () const { return "emission"; } - - 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); - } - - 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); - } - - /// 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 cosNO = Ng.dot(omega_out); - return cosNO > 0 ? 1.0f: 0.0f; - } + GenericEmissiveClosure() { } + + void setup() {} + + size_t memsize() const { return sizeof(*this); } + + const char *name() const { return "emission"; } + + 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); + } + + 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); + } + + /// 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 cosNO = Ng.dot(omega_out); + return cosNO > 0 ? 1.0f : 0.0f; + } }; ClosureParam closure_emission_params[] = { - CLOSURE_STRING_KEYPARAM("label"), - CLOSURE_FINISH_PARAM(GenericEmissiveClosure) }; + CLOSURE_STRING_KEYPARAM("label"), + CLOSURE_FINISH_PARAM(GenericEmissiveClosure) +}; CLOSURE_PREPARE(closure_emission_prepare, GenericEmissiveClosure) -- cgit v1.2.3