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:
authorCampbell Barton <ideasman42@gmail.com>2012-06-05 02:44:58 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-05 02:44:58 +0400
commit2d290040a1fea8319f33a982823bea13d1d95348 (patch)
tree5bdaf2aceb9b854e31ca70665dbfaa8af9634522 /intern/cycles/kernel/osl/emissive.cpp
parentf94123a5c651b8a65e5e6e11cd2aed8fcc766498 (diff)
style cleanup
Diffstat (limited to 'intern/cycles/kernel/osl/emissive.cpp')
-rw-r--r--intern/cycles/kernel/osl/emissive.cpp93
1 files changed, 47 insertions, 46 deletions
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)