Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rectwu.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_RECTWU_H_)
21 #define __MITSUBA_RENDER_RECTWU_H_
22 
23 #include <mitsuba/core/sched.h>
24 
26 
27 /**
28  * \brief Work unit that specifies a rectangular region in an image.
29  *
30  * Used for instance in \ref BlockedImageProcess
31  * \ingroup librender
32  */
34 public:
35  inline RectangularWorkUnit() { }
36 
37  /* WorkUnit implementation */
38  void set(const WorkUnit *wu);
39  void load(Stream *stream);
40  void save(Stream *stream) const;
41 
42  inline const Point2i &getOffset() const { return m_offset; }
43  inline const Vector2i &getSize() const { return m_size; }
44 
45  inline void setOffset(const Point2i &offset) { m_offset = offset; }
46  inline void setSize(const Vector2i &size) { m_size = size; }
47 
48  std::string toString() const;
49 
51 protected:
52  /// Virtual destructor
53  virtual ~RectangularWorkUnit() { }
54 private:
55  Point2i m_offset;
56  Vector2i m_size;
57 };
58 
60 
61 #endif /* __MITSUBA_RENDER_RECTWU_H_ */
virtual void save(Stream *stream) const =0
Serialize a work unit to a binary data stream.
const Point2i & getOffset() const
Definition: rectwu.h:42
virtual void set(const WorkUnit *workUnit)=0
Copy the content of another work unit of the same type.
virtual std::string toString() const =0
Return a string representation.
void setSize(const Vector2i &size)
Definition: rectwu.h:46
#define MTS_NAMESPACE_BEGIN
Definition: platform.h:137
RectangularWorkUnit()
Definition: rectwu.h:35
Abstract work unit – represents a small amount of information that encodes part of a larger processin...
Definition: sched.h:47
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
Definition: fwd.h:99
virtual void load(Stream *stream)=0
Fill the work unit with content acquired from a binary data stream.
Work unit that specifies a rectangular region in an image.
Definition: rectwu.h:33
const Vector2i & getSize() const
Definition: rectwu.h:43
#define MTS_EXPORT_RENDER
Definition: platform.h:109
Definition: fwd.h:95
#define MTS_NAMESPACE_END
Definition: platform.h:138
void setOffset(const Point2i &offset)
Definition: rectwu.h:45