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:
Diffstat (limited to 'intern/cycles/kernel/osl/background.cpp')
-rw-r--r--intern/cycles/kernel/osl/background.cpp44
1 files changed, 29 insertions, 15 deletions
diff --git a/intern/cycles/kernel/osl/background.cpp b/intern/cycles/kernel/osl/background.cpp
index 6290eed0af8..eed4446cddc 100644
--- a/intern/cycles/kernel/osl/background.cpp
+++ b/intern/cycles/kernel/osl/background.cpp
@@ -46,23 +46,16 @@ using namespace OSL;
/// to return a color in background shaders. No methods,
/// only the weight is taking into account
///
-class GenericBackgroundClosure : public BackgroundClosure {
+class GenericBackgroundClosure : public OSL::BackgroundClosure {
public:
GenericBackgroundClosure() {}
void setup() {};
-
size_t memsize() const { return sizeof(*this); }
-
const char *name() const { return "background"; }
-
- void print_on(std::ostream &out) const {
- out << name() << " ()";
- }
-
+ void print_on(std::ostream &out) const { out << name() << " ()"; }
};
-
/// Holdout closure
///
/// This will be used by the shader to mark the
@@ -75,16 +68,26 @@ public:
HoldoutClosure () : ClosurePrimitive(Holdout) {}
void setup() {};
-
size_t memsize() const { return sizeof(*this); }
-
const char *name() const { return "holdout"; }
-
- void print_on(std::ostream &out) const {
- out << name() << " ()";
- }
+ void print_on(std::ostream &out) const { out << name() << " ()"; }
};
+/// ambient occlusion closure
+///
+/// We only have a ambient occlusion closure for the shaders
+/// to return a color in ambient occlusion shaders. No methods,
+/// only the weight is taking into account
+///
+class AmbientOcclusionClosure : public ClosurePrimitive {
+public:
+ AmbientOcclusionClosure () : ClosurePrimitive((ClosurePrimitive::Category)AmbientOcclusion) {}
+
+ void setup() {};
+ size_t memsize() const { return sizeof(*this); }
+ const char *name() const { return "ambient_occlusion"; }
+ void print_on(std::ostream &out) const { out << name() << " ()"; }
+};
ClosureParam *closure_background_params()
{
@@ -107,5 +110,16 @@ ClosureParam *closure_holdout_params()
CLOSURE_PREPARE(closure_holdout_prepare, HoldoutClosure)
+ClosureParam *closure_ambient_occlusion_params()
+{
+ static ClosureParam params[] = {
+ CLOSURE_STRING_KEYPARAM("label"),
+ CLOSURE_FINISH_PARAM(AmbientOcclusionClosure)
+ };
+ return params;
+}
+
+CLOSURE_PREPARE(closure_ambient_occlusion_prepare, AmbientOcclusionClosure)
+
CCL_NAMESPACE_END