Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
subsurface.h
Go to the documentation of this file.
1 /*
2  This file is part of Mitsuba, a physically based rendering system.
3 
4  Copyright (c) 2007-2014 by Wenzel Jakob and others.
5 
6  Mitsuba is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License Version 3
8  as published by the Free Software Foundation.
9 
10  Mitsuba is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #pragma once
20 #if !defined(__MITSUBA_RENDER_SUBSURFACE_H_)
21 #define __MITSUBA_RENDER_SUBSURFACE_H_
22 
23 #include <mitsuba/core/netobject.h>
24 
26 
27 /**
28  * \brief Abstract subsurface scattering models
29  *
30  * Can be attached to an arbitrary shape to compute exitant
31  * radiance due to internal scattering. How that is done is
32  * completely up to the implementation. It might for instance
33  * recursively trace rays or perform lookups into a precomputed
34  * point cloud radiance representation.
35  *
36  * \ingroup librender
37  */
39 public:
40  /**
41  * \brief Possibly perform a pre-process task.
42  *
43  * The last three parameters are resource IDs of the associated scene,
44  * camera and sample generator, which have been made available to all
45  * local and remote workers.
46  */
47  virtual bool preprocess(const Scene *scene, RenderQueue *queue, const RenderJob *job,
48  int sceneResID, int cameraResID, int samplerResID) = 0;
49 
50  /// Selectively activate/deactivate the subsurface integrator
51  inline void setActive(bool active) { m_active = active; }
52 
53  /// Return whether or not the subsurface integrator is currently active
54  inline bool isActive() const { return m_active; }
55 
56  /// Cancel any running pre-process tasks
57  virtual void cancel();
58 
59  /// Return the list of shapes associated with this subsurface integrator
60  inline const std::vector<Shape *> getShapes() const { return m_shapes; }
61 
62  /// Get the exitant radiance for a point on the surface
63  virtual Spectrum Lo(const Scene *scene, Sampler *sampler,
64  const Intersection &its, const Vector &d, int depth = 0) const = 0;
65 
66  /// Serialize this subsurface integrator to a binary data stream
67  void serialize(Stream *stream, InstanceManager *manager) const;
68 
69  /// Set the parent node of the subsurface integrator
70  void setParent(ConfigurableObject *parent);
71 
73 protected:
74  /// Create a new subsurface scattering class
75  Subsurface(const Properties &props);
76 
77  /// Unserialize a subsurface integrator from a binary data stream
78  Subsurface(Stream *stream, InstanceManager *manager);
79 
80  /// Virtual destructor
81  virtual ~Subsurface();
82 protected:
83  std::vector<Shape *> m_shapes;
84  bool m_active;
85 };
86 
88 
89 #endif /* __MITSUBA_RENDER_SUBSURFACE_H_ */
void setActive(bool active)
Selectively activate/deactivate the subsurface integrator.
Definition: subsurface.h:51
const std::vector< Shape * > getShapes() const
Return the list of shapes associated with this subsurface integrator.
Definition: subsurface.h:60
Generic serializable object, which supports construction from a Properties instance.
Definition: cobject.h:40
bool isActive() const
Return whether or not the subsurface integrator is currently active.
Definition: subsurface.h:54
Principal scene data structure.
Definition: scene.h:49
Render queue - used to keep track of a number of scenes that are simultaneously being rendered...
Definition: renderqueue.h:65
Base class of all sample generators.
Definition: sampler.h:66
#define MTS_NAMESPACE_BEGIN
Definition: platform.h:137
Abstract base class of all shapes.
Definition: shape.h:178
Abstract seekable stream class.
Definition: stream.h:58
#define MTS_DECLARE_CLASS()
This macro must be used in the initial definition in classes that derive from Object.
Definition: class.h:158
virtual void setParent(ConfigurableObject *parent)
Notify the ConfigurableObject instance about its parent object.
virtual void serialize(Stream *stream, InstanceManager *manager) const
Serialize this object to a stream.
Definition: fwd.h:96
Abstract interface for objects that reference shared network resources.
Definition: netobject.h:40
Coordinates the process of rendering a single image.
Definition: renderjob.h:37
Associative parameter map for constructing subclasses of ConfigurableObject.
Definition: properties.h:46
Container for all information related to a surface intersection.
Definition: shape.h:36
Coordinates the serialization and unserialization of object graphs.
Definition: serialization.h:65
#define MTS_EXPORT_RENDER
Definition: platform.h:109
Discrete spectral power distribution based on a number of wavelength bins over the 360-830 nm range...
Definition: spectrum.h:663
Abstract subsurface scattering models.
Definition: subsurface.h:38
#define MTS_NAMESPACE_END
Definition: platform.h:138