Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
renderproc.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_RENDERPROC_H_)
21 #define __MITSUBA_RENDER_RENDERPROC_H_
22 
23 #include <mitsuba/render/scene.h>
26 
28 
29 /**
30  * \brief Parallel process for rendering with sampling-based integrators.
31  *
32  * Splits an image into independent rectangular pixel regions, which are
33  * then rendered in parallel.
34  *
35  * \sa SamplingIntegrator
36  * \ingroup librender
37  */
39 public:
40  BlockedRenderProcess(const RenderJob *parent, RenderQueue *queue,
41  int blockSize);
42 
43  /**
44  * \brief Set the pixel format associated with the rendering process
45  *
46  * By default, this class works with image blocks that store a set
47  * of spectral samples along with an alpha value and an accumulated
48  * reconstruction filter weight for each pixel. This method can be
49  * used to change this, which is useful when additional information
50  * should be returned (e.g. normals or depth values).
51  *
52  * \param pixelFormat
53  * Desired pixel format (e.g. \ref Bitmap::EMultiChannel)
54  * \param channelCount
55  * Number of image channels. Only needs to be specified when
56  * setting <tt>pixelFormat=Bitmap::EMultiChannel</tt>
57  * \param warnInvalid
58  * By default, the rendering process issues a warning when writing
59  * negative, infinite or NaN-valued pixels. This flag can be used
60  * to turn off the warnings.
61  */
62  void setPixelFormat(Bitmap::EPixelFormat pixelFormat,
63  int channelCount = -1, bool warnInvalid = false);
64 
65  // ======================================================================
66  //! @{ \name Implementation of the ParallelProcess interface
67  // ======================================================================
68 
70  void processResult(const WorkResult *result, bool cancelled);
71  void bindResource(const std::string &name, int id);
72  EStatus generateWork(WorkUnit *unit, int worker);
73 
74  //! @}
75  // ======================================================================
76 
78 protected:
79  /// Virtual destructor
80  virtual ~BlockedRenderProcess();
81 protected:
82  ref<RenderQueue> m_queue;
83  ref<Scene> m_scene;
84  ref<Film> m_film;
85  const RenderJob *m_parent;
86  int m_resultCount;
87  ref<Mutex> m_resultMutex;
88  ProgressReporter *m_progress;
89  int m_borderSize;
90  Bitmap::EPixelFormat m_pixelFormat;
91  int m_channelCount;
92  bool m_warnInvalid;
93 };
94 
96 
97 #endif /* __MITSUBA_RENDER_RENDERPROC_H_ */
virtual EStatus generateWork(WorkUnit *unit, int worker)
Generate a piece of work.
General-purpose bitmap class with read and write support for several common file formats.
Definition: bitmap.h:50
virtual void processResult(const WorkResult *result, bool cancelled)=0
Called whenever a work unit has been completed.
Definition: imageproc.h:35
EStatus
Return codes used by generateWork() and getReturnStatus()
Definition: sched.h:204
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
EPixelFormat
Definition: bitmap.h:61
#define MTS_NAMESPACE_BEGIN
Definition: platform.h:137
Parallel process for rendering with sampling-based integrators.
Definition: renderproc.h:38
Abstract work result – represents the result of a processed WorkUnit instance.
Definition: sched.h:80
Abstract work unit – represents a small amount of information that encodes part of a larger processin...
Definition: sched.h:47
#define MTS_DECLARE_CLASS()
This macro must be used in the initial definition in classes that derive from Object.
Definition: class.h:158
Abstract film base class - used to store samples generated by Integrator implementations.
Definition: film.h:37
Reference counting helper.
Definition: ref.h:40
General-purpose progress reporter.
Definition: statistics.h:287
virtual ref< WorkProcessor > createWorkProcessor() const =0
Create an instance of the algorithm responsible for executing the work units of this parallel process...
Coordinates the process of rendering a single image.
Definition: renderjob.h:37
#define MTS_EXPORT_RENDER
Definition: platform.h:109
virtual void bindResource(const std::string &name, int id)
Bind a resource to this parallel process.
#define MTS_NAMESPACE_END
Definition: platform.h:138
Thin wrapper around the recursive boost thread lock.
Definition: lock.h:34